Anatomy of Nvidia's Voxel Cone Tracing Code (VXGI)

Here is diffuse cone tracing code.

  1 //
  2  Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
  3  Buffer Definitions: 
  4  cbuffer AbstractTracingCB
  5  {
  6    struct VxgiAbstractTracingConstants
  7    {
  8 
  9        float4 rOpacityTextureSize;    // Offset:    0
 10        float4 rEmittanceTextureSize;  // Offset:   16
 11        float4 ClipmapAnchor;          // Offset:   32
 12        float4 SceneBoundaryLower;     // Offset:   48
 13        float4 SceneBoundaryUpper;     // Offset:   64
 14        float4 ClipmapCenter;          // Offset:   80
 15        float4 TracingToroidalOffset;  // Offset:   96
 16        float EmittancePackingStride;  // Offset:  112
 17        float FinestVoxelSize;         // Offset:  116
 18        float StackTextureSize;        // Offset:  120
 19        float rNearestLevel0Boundary;  // Offset:  124
 20        float MaxMipmapLevel;          // Offset:  128
 21        float rEmittanceStorageScale;  // Offset:  132
 22        float rClipmapSizeWorld;       // Offset:  136
 23        uint Use6DOpacity;             // Offset:  140
 24    } g_VxgiAbstractTracingCB;         // Offset:    0 Size:   144
 25  }
 26  cbuffer TranslationCB
 27  {
 28    float4 g_VxgiTranslationParameters[13];// Offset:    0 Size:   208
 29    float4 g_VxgiTranslationParameters2[13];// Offset:  208 Size:   208
 30  }
 31  cbuffer cBuiltinTracingParameters
 32  {
 33    struct GBufferParameters
 34    {
 35 
 36        row_major float4x4 viewProjMatrix;// Offset:    0
 37        row_major float4x4 viewProjMatrixInv;// Offset:   64
 38        row_major float4x4 viewMatrix; // Offset:  128
 39        float4 cameraPosition;         // Offset:  192
 40        float4 uvToView;               // Offset:  208
 41        float2 gbufferSize;            // Offset:  224
 42        float2 gbufferSizeInv;         // Offset:  232
 43        float2 viewportOrigin;         // Offset:  240
 44        float2 viewportSize;           // Offset:  248
 45        float2 viewportSizeInv;        // Offset:  256
 46        float2 firstSamplePosition;    // Offset:  264
 47        float projectionA;             // Offset:  272
 48        float projectionB;             // Offset:  276
 49        float depthScale;              // Offset:  280
 50        float depthBias;               // Offset:  284
 51        float normalScale;             // Offset:  288
 52        float normalBias;              // Offset:  292
 53        float radiusToScreen;          // Offset:  296
 54    } g_GBuffer;                       // Offset:    0 Size:   300
 55 
 56    struct GBufferParameters
 57    {
 58 
 59        row_major float4x4 viewProjMatrix;// Offset:  304
 60        row_major float4x4 viewProjMatrixInv;// Offset:  368
 61        row_major float4x4 viewMatrix; // Offset:  432
 62        float4 cameraPosition;         // Offset:  496
 63        float4 uvToView;               // Offset:  512
 64        float2 gbufferSize;            // Offset:  528
 65        float2 gbufferSizeInv;         // Offset:  536
 66        float2 viewportOrigin;         // Offset:  544
 67        float2 viewportSize;           // Offset:  552
 68        float2 viewportSizeInv;        // Offset:  560
 69        float2 firstSamplePosition;    // Offset:  568
 70        float projectionA;             // Offset:  576
 71        float projectionB;             // Offset:  580
 72        float depthScale;              // Offset:  584
 73        float depthBias;               // Offset:  588
 74        float normalScale;             // Offset:  592
 75        float normalBias;              // Offset:  596
 76        float radiusToScreen;          // Offset:  600
 77    } g_PreviousGBuffer;               // Offset:  304 Size:   300 [unused]
 78    row_major float4x4 g_ReprojectionMatrix;// Offset:  608 Size:    64 [unused]
 79    float4 g_AmbientColor;             // Offset:  672 Size:    16
 80    float4 g_DownsampleScale;          // Offset:  688 Size:    16
 81    float4 g_DebugParams;              // Offset:  704 Size:    16 [unused]
 82    float4 g_EnvironmentMapTint;       // Offset:  720 Size:    16
 83    float4 g_RefinementGridResolution; // Offset:  736 Size:    16 [unused]
 84    float4 g_BackgroundColor;          // Offset:  752 Size:    16 [unused]
 85    int2 g_PixelToSave;                // Offset:  768 Size:     8 [unused]
 86    int2 g_RandomOffset;               // Offset:  776 Size:     8
 87    float2 g_GridOrigin;               // Offset:  784 Size:     8 [unused]
 88    float g_ConeFactor;                // Offset:  792 Size:     4
 89    float g_TracingStep;               // Offset:  796 Size:     4
 90    float g_OpacityCorrectionFactor;   // Offset:  800 Size:     4
 91    int g_MaxSamples;                  // Offset:  804 Size:     4
 92    int g_NumCones;                    // Offset:  808 Size:     4 [unused]
 93    float g_rNumCones;                 // Offset:  812 Size:     4
 94    float g_EmittanceScale;            // Offset:  816 Size:     4
 95    float g_EnvironmentMapResolution;  // Offset:  820 Size:     4
 96    float g_MaxEnvironmentMapMipLevel; // Offset:  824 Size:     4
 97    float g_NormalOffsetFactor;        // Offset:  828 Size:     4
 98    float g_AmbientAttenuationFactor;  // Offset:  832 Size:     4
 99    uint g_FlipOpacityDirections;      // Offset:  836 Size:     4
100    float g_InitialOffsetBias;         // Offset:  840 Size:     4
101    float g_InitialOffsetDistanceFactor;// Offset:  844 Size:     4
102    uint g_EnableSpecularRandomOffsets;// Offset:  848 Size:     4 [unused]
103    uint g_NumDiscontinuityLevels;     // Offset:  852 Size:     4 [unused]
104    float g_TemporalReprojectionWeight;// Offset:  856 Size:     4 [unused]
105    float g_TangentJitterScale;        // Offset:  860 Size:     4 [unused]
106    float g_DepthDeltaSign;            // Offset:  864 Size:     4 [unused]
107    float g_ReprojectionDepthWeightScale;// Offset:  868 Size:     4 [unused]
108    float g_ReprojectionNormalWeightExponent;// Offset:  872 Size:     4 [unused]
109    float g_InterpolationWeightThreshold;// Offset:  876 Size:     4 [unused]
110    uint g_EnableRefinement;           // Offset:  880 Size:     4 [unused]
111    float g_AmbientScale;              // Offset:  884 Size:     4
112    float g_AmbientBias;               // Offset:  888 Size:     4
113    float g_AmbientPower;              // Offset:  892 Size:     4
114    float g_AmbientDistanceDarkening;  // Offset:  896 Size:     4
115    int g_AltSettingsStencilMask;      // Offset:  900 Size:     4
116    int g_AltSettingsStencilRefValue;  // Offset:  904 Size:     4
117    float g_AltInitialOffsetBias;      // Offset:  908 Size:     4
118    float g_AltInitialOffsetDistanceFactor;// Offset:  912 Size:     4
119    float g_AltNormalOffsetFactor;     // Offset:  916 Size:     4
120    float g_AltTracingStep;            // Offset:  920 Size:     4
121    float g_SSAO_SurfaceBias;          // Offset:  924 Size:     4 [unused]
122    float g_SSAO_RadiusWorld;          // Offset:  928 Size:     4 [unused]
123    float g_SSAO_rBackgroundViewDepth; // Offset:  932 Size:     4 [unused]
124    float g_SSAO_CoarseAO;             // Offset:  936 Size:     4 [unused]
125    float g_SSAO_PowerExponent;        // Offset:  940 Size:     4 [unused]
126  }
127  Resource Bindings:
128  Name                                 Type  Format         Dim Slot Elements
129  ------------------------------ ---------- ------- ----------- ---- --------
130  s_VoxelTextureSampler             sampler      NA          NA    0        1
131  s_EnvironmentMapSampler           sampler      NA          NA   11        1
132  g_DepthBuffer                     texture  float4          2d    0        1
133  g_TargetFlatNormal                texture  float4          2d    3        1
134  g_TargetStencil                   texture   uint2          2d    4        1
135  t_OpacityMap_Pos                  texture  float4          3d    6        1
136  t_OpacityMap_Neg                  texture  float4          3d    7        1
137  t_ConeDirectionMap                texture  float4     2darray   10        1
138  t_EnvironmentMap                  texture  float4        cube   11        1
139  t_EmittanceEven                   texture  float4          3d   12        1
140  t_EmittanceOdd                    texture  float4          3d   15        1
141  AbstractTracingCB                 cbuffer      NA          NA    0        1
142  TranslationCB                     cbuffer      NA          NA    1        1
143  cBuiltinTracingParameters         cbuffer      NA          NA    2        1
144  Input signature:
145  Name                 Index   Mask Register SysValue  Format   Used
146  -------------------- ----- ------ -------- -------- ------- ------
147  TEXCOORD                 0   xy          0     NONE   float       
148  INSTANCEID               0     z         0     NONE   float     z 
149  RAY                      0   xyzw        1     NONE   float       
150  SV_Position              0   xyzw        2      POS   float   xy  
151  Output signature:
152  Name                 Index   Mask Register SysValue  Format   Used
153  -------------------- ----- ------ -------- -------- ------- ------
154  SV_Target                0   xyzw        0   TARGET   float   xyzw
155  SV_Target                1   xyzw        1   TARGET   float   xyzw
156  SV_Target                2   xyzw        2   TARGET   float   xyzw
157 
158 0x00000000: ps_5_0
159 0x00000008: dcl_globalFlags refactoringAllowed
160 0x0000000C: dcl_constantbuffer cb0[9], immediateIndexed
161 0x0000001C: dcl_constantbuffer cb1[26], dynamicIndexed
162 0x0000002C: dcl_constantbuffer cb2[58], immediateIndexed
163 0x0000003C: dcl_sampler s_VoxelTextureSampler, mode_default
164 0x00000048: dcl_sampler s_EnvironmentMapSampler, mode_default
165 0x00000054: dcl_resource_texture2d (float,float,float,float) g_DepthBuffer
166 0x00000064: dcl_resource_texture2d (float,float,float,float) g_TargetFlatNormal
167 0x00000074: dcl_resource_texture2d (uint,uint,uint,uint) g_TargetStencil
168 0x00000084: dcl_resource_texture3d (float,float,float,float) t_OpacityMap_Pos
169 0x00000094: dcl_resource_texture3d (float,float,float,float) t_OpacityMap_Neg
170 0x000000A4: dcl_resource_texture2darray (float,float,float,float) t_ConeDirectionMap
171 0x000000B4: dcl_resource_texturecube (float,float,float,float) t_EnvironmentMap
172 0x000000C4: dcl_resource_texture3d (float,float,float,float) t_EmittanceEven
173 0x000000D4: dcl_resource_texture3d (float,float,float,float) t_EmittanceOdd
174 0x000000E4: dcl_input_ps linear v0.z
175 0x000000F0: dcl_input_ps_siv linear noperspective v2.xy, position
176 0x00000100: dcl_output o0.xyzw
177 0x0000010C: dcl_output o1.xyzw
178 0x00000118: dcl_output o2.xyzw
179 0x00000124: dcl_temps 19
180 
181 0x0000012C: lt r0.xy, l(1.000000, 1.000000, 0.000000, 0.000000), g_DownsampleScale.xyxx
182 0x00000158: and r0.x, r0.y, r0.x
183 0x00000174: round_ni r0.yz, v2.xxyx
184 0x00000188: itof r1.xy, g_RandomOffset.zwzz
185 0x000001A0: add r1.xy, r0.yzyy, r1.xyxx
186 0x000001BC: mul r1.xy, r1.xyxx, g_DownsampleScale.zwzz
187 0x000001DC: frc r1.xy, r1.xyxx
188 0x000001F0: mul r1.xy, r1.xyxx, g_DownsampleScale.xyxx
189 0x00000210: round_ni r1.xy, r1.xyxx
190 0x00000224: add r0.w, -r1.x, g_DownsampleScale.x
191 0x00000248: mad r0.w, r0.z, g_DownsampleScale.y, r0.w
192 0x00000270: mad r1.x, r0.y, g_DownsampleScale.x, r1.y
193 0x00000298: add r0.w, r0.w, firstSamplePosition.w
194 0x000002B8: add r1.x, r1.x, firstSamplePosition.z
195 0x000002D8: add r1.y, r0.w, l(-1.000000)
196 0x000002F4: movc r0.xw, r0.xxxx, r1.xxxy, v2.xxxy
197 0x00000318: ftoi r1.xy, r0.xwxx
198 0x0000032C: mov r1.zw, l(0,0,0,0)
199 
200 // load depth and normal
201 // r2 = {depth, normal.x, normal.y, normal.z}
202 0x0000034C: ld_indexable(texture2d)(float,float,float,float) r2.x, r1.xyww, g_DepthBuffer.xyzw
203 0x00000370: ld_indexable(texture2d)(float,float,float,float) r2.yzw, r1.xyww, g_TargetFlatNormal.wxyz
204 0x00000394: mad r2.x, r2.x, depthScale, depthBias
205 0x000003C0: mad r2.yzw, r2.yyzw, normalScale.xxxx, normalBias.yyyy
206 0x000003EC: dp3 r3.x, r2.yzwy, r2.yzwy
207 0x00000408: sqrt r3.x, r3.x
208 0x0000041C: div r2.yzw, r2.yyzw, r3.xxxx                             // normalize
209 0x00000438: ge r3.x, l(0.000000), r3.x
210 0x00000454: movc r2.yzw, r3.xxxx, l(0,0,0,0), r2.yyzw
211 
212 // convert screen position to world space
213 // r3.xyz = world space position
214 // r0.xw  = {screenX, screenY} [-1,1]
215 0x00000484: add r0.xw, r0.xxxw, -viewportOrigin.xxxy
216 0x000004A8: mul r0.xw, r0.xxxw, viewportSizeInv.xxxy
217 0x000004C8: mad r0.x, r0.x, l(2.000000), l(-1.000000)
218 0x000004EC: mad r0.w, -r0.w, l(2.000000), l(1.000000)
219 0x00000514: mul r3.xyzw, r0.wwww, viewProjMatrixInv.xyzw
220 0x00000534: mad r3.xyzw, r0.xxxx, viewProjMatrixInv.xyzw, r3.xyzw
221 0x0000055C: mad r3.xyzw, r2.xxxx, viewProjMatrixInv.xyzw, r3.xyzw
222 0x00000584: add r3.xyzw, r3.xyzw, viewProjMatrixInv.xyzw
223 0x000005A4: div r3.xyz, r3.xyzx, r3.wwww
224 
225 // calculate distance from clipmap center
226 0x000005C0: add r4.xyz, r3.xyzx, -ClipmapAnchor.xyzx
227 0x000005E4: max r0.x, |r4.z|, |r4.y|
228 0x00000608: max r0.x, r0.x, |r4.x|                 // r0.x = max distance from clipmap center
229 0x00000628: add r0.w, -r0.x, ClipmapAnchor.w
230 0x0000064C: mul r0.w, r0.w, rClipmapSizeWorld.z    // r0.w = (ClipmapAnchor.w - r0.x) * rClipmapSizeWorld
231 0x0000066C: mul_sat r0.w, r0.w, l(4.000000)        // r0.w = saturate(4 * (ClipmapAnchor.w - r0.x) * rClipmapSizeWorld)
232 // r0.x = max distance
233 // r0.w = saturate(4 * (ClipmapAnchor.w - r0.x) * rClipmapSizeWorld)
234 // r4 = offset from clipmap center
235 
236 // check if normal and depth is valid
237 // r2.x = is valid
238 0x00000688: and r4.xyz, r2.yzwy, l(0x7f800000, 0x7f800000, 0x7f800000, 0)   // fetch exponent part
239 0x000006B0: ieq r5.xyz, r4.xyzx, l(0, 0, 0, 0)
240 0x000006D8: and r2.x, r5.y, r5.x
241 0x000006F4: and r2.x, r5.z, r2.x                                            // check if all exponent part is 0
242 0x00000710: ieq r4.xyz, r4.xyzx, l(0x7f800000, 0x7f800000, 0x7f800000, 0)
243 0x00000738: or r3.w, r4.y, r4.x
244 0x00000754: or r3.w, r4.z, r3.w
245 0x00000770: or r2.x, r2.x, r3.w
246 0x0000078C: not r2.x, r2.x
247 0x000007A0: ne r3.w, r0.w, l(0.000000)
248 0x000007BC: and r2.x, r2.x, r3.w
249 
250 // calculate indirect diffuse light
251 0x000007D8: if_nz r2.x
252 // normalize normal
253 0x000007E4:   ftou r4.z, v0.z                     // r4.z = instance id
254 0x000007F8:   dp3 r2.x, r2.yzwy, r2.yzwy          // r2.x = dot(normal, normal)
255 0x00000814:   rsq r2.x, r2.x                      // r2.x = 1 / length(normal)
256 0x00000828:   mul r5.xyz, r2.xxxx, r2.yzwy        // r5.xyz = normalize(normal)
257 
258 // calculate local coordinate system
259 // r5 = normal
260 // r6 = tangent
261 // r7 = bitangent
262 0x00000844:   mov r6.xyz, |r5.xyzx|                          // r6.xyz = |normalize(normal)|
263 0x0000085C:   max r3.w, r6.z, r6.y
264 0x00000878:   max r3.w, r3.w, r6.x                           // r3.w = max3(normalize(normal))
265 0x00000894:   mad r7.xyz, -r2.zyyz, r2.xxxx, -r5.zzyz        // r7.xyz = -r2.zyy / |normal| - r5.zzy
266 0x000008C0:   lt r8.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r5.xyzx
267 0x000008E8:   lt r9.xyz, r5.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
268 0x00000910:   iadd r8.xyz, -r8.xyzx, r9.xyzx
269 0x00000930:   itof r8.xyz, r8.xyzx
270 0x00000944:   eq r9.xy, r6.xyxx, r3.wwww
271 0x00000960:   mul r7.xyz, r7.xyzx, r8.xyzx
272 0x0000097C:   mov r6.w, r7.y
273 0x00000990:   mov r7.w, r6.z
274 0x000009A4:   movc r6.yzw, r9.yyyy, r6.yywy, r7.wwwz
275 0x000009C8:   mov r7.yz, r6.xxxx
276 0x000009DC:   movc r6.xyz, r9.xxxx, r7.xyzx, r6.yzwy
277 0x00000A00:   dp3 r3.w, r6.xyzx, r6.xyzx
278 0x00000A1C:   rsq r3.w, r3.w
279 0x00000A30:   mul r6.xyz, r3.wwww, r6.xyzx                       // r6.xyz = normalize(r6.xyz)
280 0x00000A4C:   mul r7.xyz, r5.yzxy, r6.zxyz
281 0x00000A68:   mad r7.xyz, r6.yzxy, r5.zxyz, -r7.xyzx             // r7.xyz = cross(r6.xyz, r5.xyz)
282 0x00000A90:   ftoi r0.yz, r0.yyzy
283 0x00000AA4:   iadd r0.yz, r0.yyzy, g_RandomOffset.zzwz
284 0x00000AC4:   and r4.xy, r0.yzyy, l(3, 3, 0, 0)                  // r4.xy is useless because color is the same
285 0x00000AEC:   mov r4.w, l(0)                                     // r4.w = 0
286 
287 // get cone direction from texture (what a stupid way!)
288 // r4.xyz = normalized cone direction in world space
289 0x00000B00:   ld_indexable(texture2darray)(float,float,float,float) r4.xyzw, r4.xyzw, t_ConeDirectionMap.xyzw // r4.z = instance id = cone index, r4.xy is useless 
290 0x00000B24:   mul r5.xyz, r5.xyzx, r4.yyyy                       // r5.xyz = r5.xyz * r4.y
291 0x00000B40:   mad r5.xyz, r4.xxxx, r6.xyzx, r5.xyzx              // r5.xyz = r4.x * r6.xyz + r5.xyz * r4.y
292 0x00000B64:   mad r4.xyz, r4.zzzz, r7.xyzx, r5.xyzx              // r4.xyz = r4.x * r6.xyz + r4.y * r5.xyz + r4.z * r7.xyz
293 0x00000B88:   dp3 r0.y, r4.xyzx, r4.xyzx
294 0x00000BA4:   rsq r0.y, r0.y
295 0x00000BB8:   mul r4.xyz, r0.yyyy, r4.xyzx                       // r4.xyz = normalized cone direction
296 0x00000BD4:   dp2 r0.x, rNearestLevel0Boundary.wwww, r0.xxxx     // r0.x = 0, rNearestLevel0Boundary = 0
297 0x00000BF4:   max r0.x, r0.x, l(1.000000)                        // r0.x = 1
298 0x00000C10:   mul r0.y, r4.w, r0.x                               // r0.y = 0
299 
300 // set cone tracing parameter
301 // r1 = {g_InitialOffsetBias, g_InitialOffsetDistanceFactor, g_NormalOffsetFactor, g_TracingStep}
302 //    = {2, 1, 0.5, 0.5}
303 0x00000C2C:   if_nz g_AltSettingsStencilMask
304 0x00000C3C:     ld_indexable(texture2d)(uint,uint,uint,uint) r0.z, r1.xyzw, g_TargetStencil.xzyw
305 0x00000C60:     and r0.z, r0.z, g_AltSettingsStencilMask
306 0x00000C80:     ieq r0.z, r0.z, g_AltSettingsStencilRefValue
307 0x00000CA0:     mov r1.xy, (g_InitialOffsetBias,g_InitialOffsetDistanceFactor,g_InitialOffsetBias,g_InitialOffsetBias)
308 0x00000CB8:     mov r1.z, g_NormalOffsetFactor
309 0x00000CD0:     mov r1.w, g_TracingStep
310 0x00000CE8:     movc r1.x, r0.z, g_AltInitialOffsetBias, r1.x
311 0x00000D10:     movc r1.yzw, r0.zzzz, (g_AltInitialOffsetDistanceFactor,g_AltInitialOffsetDistanceFactor,g_AltNormalOffsetFactor,g_AltTracingStep), r1.yyzw
312 0x00000D38:   else 
313 0x00000D3C:     mov r1.xy, (g_InitialOffsetBias,g_InitialOffsetDistanceFactor,g_InitialOffsetBias,g_InitialOffsetBias)
314 0x00000D54:     mov r1.z, g_NormalOffsetFactor
315 0x00000D6C:     mov r1.w, g_TracingStep
316 0x00000D84:   endif 
317 
318 // compute initial offset
319 // g_AmbientAttenuationFactor = 0.04
320 // g_InitialOffsetBias = 2
321 // g_InitialOffsetDistanceFactor = 1
322 // g_TracingStep = 0.5
323 // g_NormalOffsetFactor = 0.5
324 // r0.xy = {3,0}
325 0x00000D88:   log r0.z, r0.x                                // r0.x = 1
326 0x00000D9C:   mul r0.z, r0.z, g_AmbientDistanceDarkening
327 0x00000DBC:   exp r0.z, r0.z
328 0x00000DD0:   mul r0.z, r0.z, g_AmbientAttenuationFactor    // r0.z = g_AmbientAttenuationFactor * r0.x ^ g_AmbientDistanceDarkening = 0.04 * r0.x ^ -0.25 = 0.04
329 0x00000DF0:   itof r3.w, g_MaxSamples                       // g_MaxSamples = 128
330 0x00000E08:   mad r0.x, r0.x, r1.y, r1.x                    // r0.x = r0.x * g_InitialOffsetDistanceFactor + g_InitialOffsetBias = 3
331 0x00000E2C:   mad r0.x, r0.y, g_TracingStep, r0.x           // r0.x = r0.y * g_TracingStep + r0.x = 3
332 // r0.z = AO scale
333 
334 // offset 3*FinestVoxelSize from surface point
335 0x00000E54:   mad r2.xyz, r2.yzwy, r2.xxxx, -r4.xyzx        // r2.xyz = normalize(normal) - r4.xyz
336 0x00000E7C:   mad r1.xyz, r1.zzzz, r2.xyzx, r4.xyzx         // r1.xyz = g_NormalOffsetFactor * r2.xyz + r4.xyz = 0.5 * (normal + direction)
337 0x00000EA0:   dp3 r0.y, r1.xyzx, r1.xyzx
338 0x00000EBC:   rsq r0.y, r0.y
339 0x00000ED0:   mul r1.xyz, r0.yyyy, r1.xyzx                  // r1.xyz = normalize(r1.xyz)
340 0x00000EEC:   mul r0.y, r0.x, FinestVoxelSize.y             // r0.y = r0.x * FinestVoxelSize = 3 * 8 = 24
341 0x00000F0C:   mad r1.xyz, r1.xyzx, r0.yyyy, r3.xyzx         // r1.xyz = r1.xyz * 24 + world position
342 0x00000F30:   mul r0.y, rEmittanceStorageScale.y, g_EmittanceScale // r0.y = 1.0 * 0.52
343 // r1.xyz = start trace position = position + 3 * FinestVoxelSize * 0.5 * (normal + direction)
344 
345 // set cone tracing step
346 // g_ConeFactor = 2 * sin a
347 // d' = d * (2 + 2*sin a) / (2 - 2*sin a) = d * (2 + g_ConeFactor) / (2 - g_ConeFactor)
348 0x00000F54:   add r2.x, -g_ConeFactor, l(2.000000)           // r2.x = 2 - g_ConeFactor = 2 - 0.87 = 1.13
349 0x00000F78:   add r2.y, g_ConeFactor, l(2.000000)            // r2.y = 2 + g_ConeFactor = 2.87
350 0x00000F98:   div r2.y, r2.y, r2.x
351 0x00000FB4:   add r2.y, r2.y, l(-1.000000)                   // r2.y = (2 + g_ConeFactor) / (2 - g_ConeFactor) -1 = 1.53
352 0x00000FD0:   add r2.z, MaxMipmapLevel.x, l(1.000000)        // r2.z = MaxMipmapLevel + 1 = 10
353 0x00000FF0:   mul r2.w, FinestVoxelSize.y, FinestVoxelSize.y // r2.w = FinestVoxelSize * FinestVoxelSize = 64
354 // r2 = {2 - g_ConeFactor, step factor, MaxMipmapLevel + 1, FinestVoxelSize * FinestVoxelSize}
355 //    = {1.13, 1.53, 10, 64}
356 
357 // initialize indirect color data
358 0x00001014:   movc r3.xyz, g_FlipOpacityDirections.yyyy, -r4.xyzx, r4.xyzx    // r3.xyz = cone tracing direction
359 0x00001040:   lt r5.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r4.xyzx
360 0x00001068:   and r4.w, r5.x, l(0x40400000)
361 0x00001084:   movc r5.xy, r5.yzyy, l(4.000000,5.000000,0,0), l(1.000000,2.000000,0,0)
362 0x000010C0:   mul r6.x, r4.w, EmittancePackingStride.x
363 0x000010E0:   mul r5.xy, r5.xyxx, EmittancePackingStride.xxxx
364 0x00001100:   mov r6.yz, l(0,0,0,0)
365 0x00001120:   mov r5.zw, l(0,0,0,0)
366 0x00001140:   mov r8.xyz, r1.xyzx                                    // r8.xyz = start trace position in world space
367 0x00001154:   mov r4.w, Use6DOpacity.w
368 0x0000116C:   mov r6.w, l(1.000000)
369 0x00001180:   mov r7.xyzw, l(0,0,0,1.000000)
370 0x000011A0:   mov r8.w, l(1.000000)
371 0x000011B4:   mov r9.z, r0.x                                         // r9.z = 3, distance in voxel count
372 0x000011C8:   mov r9.xyw, l(0,1.000000,0,0)
373 // r6.w = 1       = latest transparency
374 // r7 = {0,0,0,1} = {indirect color.rgb, last step transparency}
375 // r8.w = 1       = last two step transparency
376 // r9 = {0,1,3,0}
377 
378 // cone trace loop
379 // r8.xyz = sample position in world space
380 0x000011E8:   loop 
381 0x000011EC:     ge r10.x, r9.w, r3.w                                 // if(iteration >= 128) break;
382 0x00001208:     breakc_nz r10.x
383 
384 0x00001214:     add r10.xyz, r8.xyzx, -ClipmapAnchor.xyzx            // r10.xyz = offset from clipmap center
385 0x00001238:     max r10.y, |r10.z|, |r10.y|
386 0x0000125C:     max r10.x, r10.y, |r10.x|                            // r10.x = distance from clipmap center = max(r10.xyz)
387 0x0000127C:     dp2 r10.y, rNearestLevel0Boundary.wwww, r10.xxxx     // rNearestLevel0Boundary = 0
388 0x0000129C:     max r10.y, r10.y, l(1.000000)                        // r10.y = 1
389 // r10.y = 1
390 
391 // calculate sample level
392 // r9.z  = distance measured by voxel count
393 // r10.y = 1
394 // r11.x = level
395 0x000012B8:     mul r10.z, r9.z, g_ConeFactor                        // r10.z = r9.z * g_ConeFactor = r9.z * 0.87
396 0x000012D8:     lt r10.w, r10.z, r10.y                               // if (r10.z < 1)
397 0x000012F4:     movc r10.z, r10.w, r10.y, r10.z                      //    r10.z = 1
398 0x00001318:     log r11.x, r10.z                                     // r11.x = level
399 0x0000132C:     ge r11.y, r11.x, r2.z                                // if(level > MaxMipmapLevel + 1)
400 0x00001348:     if_nz r11.y                                          //      break
401 0x00001354:       break 
402 0x00001358:     endif
403 // r10.z = diameter measured by voxel count
404 // r10.w = is diameter less that 1 voxel
405 
406 // r10.x = max axis distance from clipmap center - distance from ray origin
407 0x0000135C:     add r10.x, -r10.x, ClipmapAnchor.w                   // r10.x = 8128 - manhattan distance
408 0x00001380:     mul r11.y, r10.z, FinestVoxelSize.y                  // r11.y = diameter in world coordinate
409 0x000013A0:     mad r10.x, -r10.z, FinestVoxelSize.y, r10.x          // r10.x = max axis distance from clipmap center - diameter
410 0x000013CC:     lt r11.z, r10.x, l(0.000000)                         // if (max axis distance < diameter)
411 0x000013E8:     if_nz r11.z                                          //      break
412 0x000013F4:       break 
413 0x000013F8:     endif 
414 
415 // check if sample position is out of scene bounding box
416 0x000013FC:     mad r12.xyz, r10.zzzz, FinestVoxelSize.yyyy, r8.xyzx // r12.xyz = sample position + diameter
417 0x00001424:     lt r12.xyz, r12.xyzx, SceneBoundaryLower.xyzx
418 0x00001444:     or r11.z, r12.y, r12.x
419 0x00001460:     or r11.z, r12.z, r11.z
420 0x0000147C:     mad r12.xyz, -r10.zzzz, FinestVoxelSize.yyyy, r8.xyzx
421 0x000014A8:     lt r12.xyz, SceneBoundaryUpper.xyzx, r12.xyzx
422 0x000014C8:     or r11.w, r12.y, r12.x
423 0x000014E4:     or r11.w, r12.z, r11.w
424 0x00001500:     or r11.z, r11.w, r11.z
425 0x0000151C:     if_nz r11.z                                          // if out of box, break
426 0x00001528:       break 
427 0x0000152C:     endif 
428 
429 // calculate weight for lower and higher levels
430 // r6.w  = transparency for environment map
431 // r9.z  = distance measured by voxel count
432 // r10.x = manhattan distance from clipmap center - distance from ray origin
433 // r11.x = level
434 // r9.x  = old AO
435 // r10.w = is diameter less that one voxel
436 0x00001530:     mad r11.z, r9.z, l(2.000000), r10.y                  // r11.z = distance in voxels * 2 + 1
437 0x00001554:     div r11.z, r11.z, r2.x                               // r11.z /= 2 - g_ConeFactor
438 0x00001570:     add r10.y, r9.z, r10.y                               // r10.y = r9.z + 1
439 0x0000158C:     max r10.y, r10.y, r11.z                              // r10.y = max(distance + 1, (distance * 2 + 1)/(2 - g_ConeFactor))
440 0x000015A8:     add r10.y, -r9.z, r10.y                              // r10.y = max(distance + 1, (distance * 2 + 1)/(2 - g_ConeFactor)) - distance
441 0x000015C8:     mul r11.z, r2.y, r9.z                                // r11.z = step in voxels = distance * step factor
442 0x000015E4:     movc r10.y, r10.w, r10.y, r11.z                      // r10.y = is diameter less that one voxel ? r10.y : original step in voxels
443 0x00001608:     mul r10.w, r1.w, r10.y                               // r10.w = g_TracingStep * original step in voxels = step in voxels
444 0x00001624:     mul r11.z, r0.z, -r9.z                               // r11.z = 0.04 * -distance measured by voxel count
445 0x00001644:     mul r11.z, r11.z, l(1.442695)                        // r11.z = 0.04 * -distance measured by voxel count * 1.442695
446 0x00001660:     exp r11.z, r11.z                                     // r11.z = new weight = 2 ^ (0.04 * -distance measured by voxel count * 1.442695)
447 0x00001674:     add r11.w, r9.y, -r11.z                              // r11.w = delta weight = old weight - new weight = r9.y - 2 ^ (0.04 * -distance measured by voxel count * 1.442695)
448 0x00001694:     mad r11.w, r11.w, r6.w, r9.x                         // r11.w = AO = delta weight * transparency for env map + old AO
449 0x000016B8:     div_sat r10.x, r10.x, r11.y                          // r11.y = distance in world coordinate
450 0x000016D4:     round_ni r12.x, r11.x                                // r12.x = floor(level)
451 0x000016E8:     add r12.y, r11.x, -r12.x                             // r12.y = level - floor(level) = weight for upper level
452 0x00001708:     add r12.z, -r12.y, l(1.000000)                       // r12.z = 1 - r12.y = weight for lower level
453 0x00001728:     mul r12.z, r10.x, r12.z                              // r12.z = weight for lower level * r10.x
454 0x00001744:     lt r11.x, MaxMipmapLevel.x, r11.x                    // r11.x = MaxMipmapLevel < level
455 0x00001764:     mul r10.x, r10.x, r12.y                              // r10.x = weight for upper level
456 0x00001780:     movc r10.x, r11.x, l(0), r10.x                       // r10.x = (level > MaxMipmapLevel) ? 0 : r10.x
457 0x000017A4:     ftoi r11.x, r12.x                                    // r11.x = int(floor(level))
458 // r10.y = original step in voxels
459 // r10.w = step in voxels
460 //       = g_TracingStep * (max(distance + 1, (distance * 2 + 1)/(2 - g_ConeFactor)) - distance), if diameter less that one voxel
461 //       = g_TracingStep * ((2 + g_ConeFactor) / (2 - g_ConeFactor)-1) * distance
462 // r11.z = new weight = 2 ^ (0.04 * -distance measured by voxel count * 1.442695)
463 // r11.w = AO
464 //       = old AO + (old weight - new weight) * transparency for env map
465 //       = old AO + (old weight - new weight) * transparency for env map
466 
467 // calculate clipmap address
468 // r11.x = lower level
469 // r8.xyz = sample position
470 0x000017B8:     add r13.xyz, r8.xyzx, -ClipmapCenter.xyzx            // r13.xyz = sample position - clipmap center
471 0x000017DC:     mad r14.xyz, r13.xyzx, g_VxgiTranslationParameters[r11.x].xxxx, l(0.500000, 0.500000, 0.500000, 0.000000) // r14.xyz = 0.5
472 0x00001814:     add r14.xyz, r14.xyzx, g_VxgiTranslationParameters2[r11.x].xyzx                                           // r14.xyz = r14.xyz + g_VxgiTranslationParameters2[level]
473 0x0000183C:     frc r14.xyz, r14.xyzx
474 0x00001850:     mul r15.xy, r14.xyxx, g_VxgiTranslationParameters[r11.x].yyyy                                             // r15.xy = r14.xy * clip map resolution
475 0x00001874:     mad r15.z, r14.z, g_VxgiTranslationParameters[r11.x].y, g_VxgiTranslationParameters[r11.x].z              // r15.z = r14.z * clip map resolution + clip map offset
476 0x000018A8:     mul r15.xyz, r15.xyzx, rOpacityTextureSize.xyzx                                                           // r15.xyz = texture coordinate
477 0x000018C8:     mad r16.xy, r14.xyxx, g_VxgiTranslationParameters[r11.x].yyyy, l(1.000000, 0.000000, 0.000000, 0.000000)
478 0x00001900:     mad r16.z, r14.z, g_VxgiTranslationParameters[r11.x].y, g_VxgiTranslationParameters[r11.x].w
479 0x00001934:     mul r14.xyz, r16.xyzx, rEmittanceTextureSize.xyzx
480 0x00001954:     add r12.y, r12.x, l(1.000000)
481 0x00001970:     ftoi r12.y, r12.y
482 
483 0x00001984:     mad r13.xyz, r13.xyzx, g_VxgiTranslationParameters[r12.y].xxxx, l(0.500000, 0.500000, 0.500000, 0.000000)
484 0x000019BC:     add r13.xyz, r13.xyzx, g_VxgiTranslationParameters2[r12.y].xyzx
485 0x000019E4:     frc r13.xyz, r13.xyzx
486 0x000019F8:     mul r16.xy, r13.xyxx, g_VxgiTranslationParameters[r12.y].yyyy
487 0x00001A1C:     mad r16.z, r13.z, g_VxgiTranslationParameters[r12.y].y, g_VxgiTranslationParameters[r12.y].z
488 0x00001A50:     mul r16.xyz, r16.xyzx, rOpacityTextureSize.xyzx
489 0x00001A70:     mad r17.xy, r13.xyxx, g_VxgiTranslationParameters[r12.y].yyyy, l(1.000000, 0.000000, 0.000000, 0.000000)
490 0x00001AA8:     mad r17.z, r13.z, g_VxgiTranslationParameters[r12.y].y, g_VxgiTranslationParameters[r12.y].w
491 0x00001ADC:     mul r13.xyz, r17.xyzx, rEmittanceTextureSize.xyzx
492 
493 // sample lower opacity clipmap
494 // r3.xyz = cone tracing direction
495 // r12.y = low opacity
496 // r15.y = is occupied
497 0x00001AFC:     sample_l_indexable(texture3d)(float,float,float,float) r17.xyzw, r15.xyzx, t_OpacityMap_Pos.xyzw, s_VoxelTextureSampler, l(0.000000)
498 0x00001B30:     if_nz r4.w         // if(Use6DOpacity)
499 0x00001B3C:       sample_l_indexable(texture3d)(float,float,float,float) r15.xyz, r15.xyzx, t_OpacityMap_Neg.xyzw, s_VoxelTextureSampler, l(0.000000)
500 0x00001B70:       mul_sat r18.xyz, -r3.xyzx, r17.xyzx                                  // r18.xyz = -1 * cone direction.xyz * opacity_pos.xyz
501 0x00001B90:       add r12.y, r18.y, r18.x
502 0x00001BAC:       add r12.y, r18.z, r12.y                                              // r12.y = r18.x + r18.y + r18.z
503 0x00001BC8:       mul_sat r15.xyz, r3.xyzx, r15.xyzx                                   // r15.xyz = cone direction.xyz * opacity_neg.xyz
504 0x00001BE4:       add r12.w, r15.y, r15.x
505 0x00001C00:       add r12.w, r15.z, r12.w                                              // r12.w = r15.x + r15.y + r15.z
506 0x00001C1C:       min r12.yw, r12.yyyw, l(0.000000, 1.000000, 0.000000, 1.000000)      // r12.yw = min(r12.yw, 1)
507 0x00001C44:       add r12.y, r12.w, r12.y
508 0x00001C60:     else 
509 0x00001C64:       mul_sat r15.xyz, |r4.xyzx|, r17.xyzx
510 0x00001C84:       add r12.w, r15.y, r15.x
511 0x00001CA0:       add r12.w, r15.z, r12.w                                              // r12.w = dot(|direction.xyz|, opacity.xyz)
512 0x00001CBC:       min r12.y, r12.w, l(1.000000)                                        // r12.y = lower opacity
513 0x00001CD8:     endif 
514 0x00001CDC:     ne r15.y, r17.w, l(0.000000)                                           // r15.y = if lower voxel is occupied
515 
516 // sample higher opacity clipmap
517 // r12.w = high opacity
518 // r15.x = is occupied
519 0x00001CF8:     sample_l_indexable(texture3d)(float,float,float,float) r17.xyzw, r16.xyzx, t_OpacityMap_Pos.xyzw, s_VoxelTextureSampler, l(0.000000)
520 0x00001D2C:     if_nz r4.w         // if(Use6DOpacity)
521 0x00001D38:       sample_l_indexable(texture3d)(float,float,float,float) r16.xyz, r16.xyzx, t_OpacityMap_Neg.xyzw, s_VoxelTextureSampler, l(0.000000)
522 0x00001D6C:       mul_sat r18.xyz, -r3.xyzx, r17.xyzx
523 0x00001D8C:       add r12.w, r18.y, r18.x
524 0x00001DA8:       add r12.w, r18.z, r12.w
525 0x00001DC4:       min r12.w, r12.w, l(1.000000)
526 0x00001DE0:       mul_sat r16.xyz, r3.xyzx, r16.xyzx
527 0x00001DFC:       add r13.w, r16.y, r16.x
528 0x00001E18:       add r13.w, r16.z, r13.w
529 0x00001E34:       min r13.w, r13.w, l(1.000000)
530 0x00001E50:       add r12.w, r12.w, r13.w
531 0x00001E6C:     else 
532 0x00001E70:       mul_sat r16.xyz, |r4.xyzx|, r17.xyzx
533 0x00001E90:       add r13.w, r16.y, r16.x
534 0x00001EAC:       add r13.w, r16.z, r13.w
535 0x00001EC8:       min r12.w, r13.w, l(1.000000)                                        // r12.w = higher opacity
536 0x00001EE4:     endif 
537 0x00001EE8:     ne r15.x, r17.w, l(0.000000)                                           // r15.x = if higher voxel is occupied
538 
539 // interpolate opacity
540 // r12.x = floor(level)
541 // r12.y = low opacity
542 // r12.z = low weight
543 // r12.w = high opacity
544 // r10.x = high weight
545 0x00001F04:     mul r12.w, r10.x, r12.w                                                // r12.w = higher opacity * weight
546 0x00001F20:     mad_sat r12.y, r12.y, r12.z, r12.w                                     // r12.y = interpolated opacity
547 0x00001F44:     add r12.x, r12.x, r12.x                                                // r12.x = floor(level) * 2
548 0x00001F60:     exp r12.x, r12.x                                                       // r12.x = 2 ^ (floor(level) * 2)
549 0x00001F74:     mul r12.x, r2.w, r12.x                                                 // r12.x = r12.x * FinestVoxelSize * FinestVoxelSize = r12.x * 64
550 0x00001F90:     mul r10.x, r10.x, r12.x                                                // r10.x = 2 ^ (floor(level) * 2) * 64 * high weight
551 0x00001FAC:     mul r15.w, r12.z, r12.x                                                // r15.w = 2 ^ (floor(level) * 2) * 64 * low weight
552 0x00001FC8:     mul r15.z, r10.x, l(4.000000)                                          // r15.z = 2 ^ (floor(level) * 2) * 64 * high weight * 4
553 0x00001FE4:     and r10.x, r11.x, l(1)                                                 // r10.x = is lower level odd ?
554 0x00002000:     movc r15.xyzw, r10.xxxx, r15.xyzw, r15.yxwz                            // r15.xyzw = is odd ? r15.xyzw : r15.yxwz
555 // r15 = {is even occupied, is odd occupied, even weight, odd weight}
556 
557 // sample even color clipmap
558 0x00002024:     if_nz r15.x
559 0x00002030:       movc r12.xzw, r10.xxxx, r13.xxyz, r14.xxyz
560 0x00002054:       add r16.xyz, r6.xyyx, r12.xzwx
561 0x00002070:       add r17.xyz, r5.xzzx, r12.xzwx
562 0x0000208C:       add r12.xzw, r5.yyzz, r12.xxzw
563 0x000020A8:       sample_l_indexable(texture3d)(float,float,float,float) r16.xyz, r16.xyzx, t_EmittanceEven.xyzw, s_VoxelTextureSampler, l(0.000000)
564 0x000020DC:       sample_l_indexable(texture3d)(float,float,float,float) r17.xyz, r17.xyzx, t_EmittanceEven.xyzw, s_VoxelTextureSampler, l(0.000000)
565 0x00002110:       sample_l_indexable(texture3d)(float,float,float,float) r12.xzw, r12.xzwx, t_EmittanceEven.xwyz, s_VoxelTextureSampler, l(0.000000)
566 0x00002144:       mul r17.xyz, |r4.yyyy|, r17.xyzx
567 0x00002164:       mad r16.xyz, |r4.xxxx|, r16.xyzx, r17.xyzx
568 0x0000218C:       mad r12.xzw, |r4.zzzz|, r12.xxzw, r16.xxyz                            // r12.xzw = interpolated color in even texture
569 0x000021B4:       mul r12.xzw, r15.zzzz, r12.xxzw                                       // r12.xzw = even color
570 0x000021D0:     else 
571 0x000021D4:       mov r12.xzw, l(0,0,0,0)
572 0x000021F4:     endif
573 
574 // sample odd color clipmap
575 0x000021F8:     lt r11.x, l(0.000000), r15.w
576 0x00002214:     and r11.x, r11.x, r15.y
577 0x00002230:     if_nz r11.x                                                             // if (is odd occupied && odd weight > 0)
578 0x0000223C:       movc r13.xyz, r10.xxxx, r14.xyzx, r13.xyzx
579 0x00002260:       add r14.xyz, r6.xzzx, r13.xyzx
580 0x0000227C:       add r16.xyz, r5.xwwx, r13.xyzx
581 0x00002298:       add r13.xyz, r5.ywwy, r13.xyzx
582 0x000022B4:       sample_l_indexable(texture3d)(float,float,float,float) r14.xyz, r14.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
583 0x000022E8:       sample_l_indexable(texture3d)(float,float,float,float) r16.xyz, r16.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
584 0x0000231C:       sample_l_indexable(texture3d)(float,float,float,float) r13.xyz, r13.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
585 0x00002350:       mul r16.xyz, |r4.yyyy|, r16.xyzx
586 0x00002370:       mad r14.xyz, |r4.xxxx|, r14.xyzx, r16.xyzx
587 0x00002398:       mad r13.xyz, |r4.zzzz|, r13.xyzx, r14.xyzx
588 0x000023C0:       mad r12.xzw, r13.xxyz, r15.wwww, r12.xxzw                             // r12.xzw = final interpolated color
589 0x000023E4:       mov r15.x, l(-1)
590 0x000023F8:     endif
591 // r12.xzw = final interpolated color
592 
593 // Add color contribution and update transparency for environment map
594 // r12.y = intepolated opacity
595 // r10.w = step in voxels
596 // r10.z = diameter
597 // r11.y = distance in world coordinate
598 // r6.w = old transparency
599 0x000023FC:     mul r13.xyz, r0.yyyy, r12.xzwx                                          // r13.xyz = scaled color = rEmittanceStorageScale.y * g_EmittanceScale * color = 0.52 * color
600 0x00002418:     div r10.x, g_ConeFactor, r11.y                                          // r10.x = g_ConeFactor / distance
601 0x00002438:     mul r10.x, r10.x, r10.x                                                 // r10.x = (g_ConeFactor / distance) ^ 2
602 0x00002454:     mul r13.xyz, r10.xxxx, r13.xyzx                                         // color.xyz = (g_ConeFactor / distance) ^ 2 * color.xyz
603 0x00002470:     movc r12.xzw, r15.xxxx, r13.xxyz, r12.xxzw                              // r12.xzw = color.xyz * -1 + final color
604 0x00002494:     lt r10.x, l(0.000000), r12.y                                            // r10.x = opacity > 0
605 0x000024B0:     add r11.x, -r12.y, l(1.000000)                                          // r11.x = 1 - opacity
606 0x000024D0:     mul r11.y, r10.w, g_OpacityCorrectionFactor                             // r11.y = step in voxels * g_OpacityCorrectionFactor
607 0x000024F0:     div r10.z, r11.y, r10.z                                                 // r10.z = factor = step in voxels * g_OpacityCorrectionFactor / diameter
608 0x0000250C:     log r11.x, r11.x                                                        // r11.x = log2(1 - opacity)
609 0x00002520:     mul r10.z, r10.z, r11.x                                                 // r10.z = r10.z * log2(1 - opacity)
610 0x0000253C:     exp r10.z, r10.z                                                        // r10.z = 2 ^ (r10.z) = 2 ^ (factor * log2(1 - opacity)) = (1 - opacity) ^ factor
611 0x00002550:     add r10.z, -r10.z, l(1.000000)                                          // r10.z = 1 - (1 - opacity) ^ factor
612 0x00002570:     and r10.x, r10.z, r10.x                                                 // r10.x = opacity > 0 ? 1 - (1 - opacity) ^ factor : 0
613 0x0000258C:     mad r12.xyz, r8.wwww, r12.xzwx, r7.xyzx                                 // r12.xyz = new indirect color = 1 * (color.xyz * -1 + final color) + indirect color
614 0x000025B0:     add r10.x, -r10.x, l(1.000000)                                          // r10.x = step transparency = (1 - opacity) ^ factor
615 0x000025D0:     mul r10.x, r6.w, r10.x                                                  // r10.x = r6.w * r10.x = transparency for environment map * step transparency
616 // r10.x = new transparency for environment map
617 //       = old transparency * (1 - ((1- intepolated opacity) ^ (step in voxels * g_OpacityCorrectionFactor / diameter in voxels))), if intepolated opacity < 1
618 //       = old transparency, otherwise
619 // r12.xyz = new indirect color
620 //         = old indirect color + intepolated color * the second last transparency
621 
622 // terminate cone tracing
623 0x000025EC:     lt r10.z, r7.w, l(0.000100)                                             // r10.z = r7.w < 0.001
624 0x00002608:     if_nz r10.z                                                             // if(r7.w < 0.001)
625 0x00002614:       mov r7.xyz, r12.xyzx                                                  //     r7.xyz = indirect color
626 0x00002628:       mov r9.x, r11.w                                                       //     r9.x = AO = r11.w
627 0x0000263C:       mov r6.w, r10.x                                                       //     r6.w = r10.x = transparency for environment map
628 0x00002650:       break 
629 0x00002654:     endif
630 
631 // proceed to next iteration
632 // r11.z = new AO weight = 2 ^ (0.04 * distance measured by voxel count * 1.442695)
633 // r11.w = AO
634 // r10.x = transparency for environment map
635 0x00002658:     mad r9.z, r10.y, r1.w, r9.z                                             // r9.z = new distance = g_TracingStep * step in voxels + distance in voxels
636 0x0000267C:     mul r10.y, r10.w, FinestVoxelSize.y                                     // r10.y = step length
637 0x0000269C:     mad r8.xyz, r10.yyyy, r4.xyzx, r8.xyzx                                  // r8.xyz = new sampling position = old sampling position + step size * direction
638 0x000026C0:     add r9.w, r9.w, l(1.000000)                                             // r9.w = iteration++
639 0x000026DC:     mov r7.xyz, r12.xyzx                                                    // r7.xyz = indirect color
640 0x000026F0:     mov r10.y, r6.w                                                         // r10.y = tranparency
641 0x00002704:     mov r8.w, r7.w                                                          // r8.w = tranparency
642 0x00002718:     mov r9.xy, r11.wzww                                                     // r9.xy = r11.wz = {AO, 2 ^ (0.04 * distance measured by voxel count * 1.442695)}
643 0x0000272C:     mov r6.w, r10.x                                                         // r6.w = new transparency for env map = r10.x
644 0x00002740:     mov r7.w, r10.y                                                         // r7.w = transparency
645 // r7.xyz = indirect light
646 // r6.w = latest transparency for environment map
647 // r7.w = last transparency for environment map
648 // r8.w = the second last transparency for environment map
649 // r9.x = AO
650 // r9.y = new AO weight
651 
652 0x00002754:   endloop 
653 
654 // sample environment map
655 0x00002758:   mov_sat r9.x, r9.x
656 0x0000276C:   add_sat r0.x, -r6.w, l(1.000000)                                          // r0.x = saturate(1 - transparency)
657 0x0000278C:   add r0.x, -r0.x, l(1.000000)                                              // r0.x = 1 - saturate(1 - transparency) = transparency
658 0x000027AC:   mul r0.xyz, r0.xxxx, g_EnvironmentMapTint.xyzx                            // r0.xyz = g_EnvironmentMapTint * transparency
659 0x000027CC:   lt r1.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r0.xyzx
660 0x000027F4:   or r1.x, r1.y, r1.x
661 0x00002810:   or r1.x, r1.z, r1.x
662 0x0000282C:   if_nz r1.x                                                                // if (any(g_EnvironmentMapTint * transparency > 0))
663 0x00002838:     mul r1.x, g_ConeFactor, g_EnvironmentMapResolution                      //      r1.x = g_ConeFactor * g_EnvironmentMapResolution
664 0x0000285C:     log r1.x, r1.x                                                          //      r1.x = log2(g_ConeFactor * g_EnvironmentMapResolution)
665 0x00002870:     add r1.x, r1.x, l(-1.000000)
666 0x0000288C:     max r1.x, r1.x, l(0.000000)                                             //      r1.x = max(log2(g_ConeFactor * g_EnvironmentMapResolution)-1,0)
667 0x000028A8:     min r1.x, r1.x, g_MaxEnvironmentMapMipLevel                             //      r1.x = min(g_MaxEnvironmentMapMipLevel, max(log2(g_ConeFactor * g_EnvironmentMapResolution)-1,0))
668 0x000028C8:     sample_l_indexable(texturecube)(float,float,float,float) r1.xyz, r4.xyzx, t_EnvironmentMap.xyzw, s_EnvironmentMapSampler, r1.x
669 0x000028FC:     mul r0.xyz, r0.xyzx, r1.xyzx                                            //      r0.xyz = environment color = g_EnvironmentMapTint * transparency * environment map color
670 0x00002918:     mad r7.xyz, r0.xyzx, g_rNumCones.wwww, r7.xyzx                          //      r7.xyz = indirect color = r7.xyz + environment color / number of cones
671 0x00002940:   endif 
672 // r7.xyz = indirect light
673 
674 // add ambient color
675 // r9.x = AO?
676 0x00002944:   mad_sat r0.x, r9.x, g_AmbientScale, g_AmbientBias                         // r0.x = saturate(r9.x * g_AmbientScale + g_AmbientBias)
677 0x00002970:   log r0.x, r0.x
678 0x00002984:   mul r0.x, r0.x, g_AmbientPower
679 0x000029A4:   exp r0.x, r0.x                                                            // r0.x = ambient strength = pow(saturate(r9.x * g_AmbientScale + g_AmbientBias), g_AmbientPower)
680 0x000029B8:   mul r0.xyz, r0.xxxx, g_AmbientColor.xyzx
681 0x000029D8:   mul r0.xyz, r0.xyzx, g_rNumCones.wwww                                     // r0.xyz = ambient term = ambient strength * g_AmbientColor.xyzx / number of cones
682 0x000029F8:   mad r0.xyz, r7.xyzx, l(0.318310, 0.318310, 0.318310, 0.000000), r0.xyzx   // r0.xyz = all indirect light = ambient term + indirect light * 0.318310
683 0x00002A28:   mul r1.xyz, r4.xxxx, r0.xyzx                                              // r1.xyz = all indirect light * direction.x
684 0x00002A44:   mul r2.xyz, r4.yyyy, r0.xyzx                                              // r2.xyz = all indirect light * direction.y = all indirect light * cos(theta)
685 0x00002A60:   mul r0.xyz, r4.zzzz, r0.xyzx                                              // r0.xyz = all indirect light * direction.z
686 0x00002A7C: else 
687 0x00002A80:   mov r1.xyz, l(0,0,0,0)
688 0x00002AA0:   mov r2.xyz, l(0,0,0,0)
689 0x00002AC0:   mov r0.xyz, l(0,0,0,0)
690 0x00002AE0: endif 
691 
692 // write x axis indirect illumination
693 0x00002AE4: mul r0.w, r0.w, g_rNumCones.w
694 0x00002B04: and r1.w, r1.x, l(0x7f800000)
695 0x00002B20: ieq r1.w, r1.w, l(0x7f800000)
696 0x00002B3C: movc o0.x, r1.w, l(0), r1.x
697 0x00002B60: and r1.x, r1.y, l(0x7f800000)
698 0x00002B7C: ieq r1.x, r1.x, l(0x7f800000)
699 0x00002B98: movc o0.y, r1.x, l(0), r1.y
700 0x00002BBC: and r1.x, r1.z, l(0x7f800000)
701 0x00002BD8: ieq r1.x, r1.x, l(0x7f800000)
702 0x00002BF4: movc o0.z, r1.x, l(0), r1.z
703 0x00002C18: and r1.x, r0.w, l(0x7f800000)
704 0x00002C34: ieq r1.x, r1.x, l(0x7f800000)
705 0x00002C50: movc o0.w, r1.x, l(0), r0.w
706 
707 // write y axis indirect illumination
708 0x00002C74: and r0.w, r2.x, l(0x7f800000)
709 0x00002C90: ieq r0.w, r0.w, l(0x7f800000)
710 0x00002CAC: movc o1.x, r0.w, l(0), r2.x
711 0x00002CD0: and r0.w, r2.y, l(0x7f800000)
712 0x00002CEC: ieq r0.w, r0.w, l(0x7f800000)
713 0x00002D08: movc o1.y, r0.w, l(0), r2.y
714 0x00002D2C: and r0.w, r2.z, l(0x7f800000)
715 0x00002D48: ieq r0.w, r0.w, l(0x7f800000)
716 0x00002D64: movc o1.z, r0.w, l(0), r2.z
717 
718 // write z axis indirect illumination
719 0x00002D88: and r0.w, r0.x, l(0x7f800000)
720 0x00002DA4: ieq r0.w, r0.w, l(0x7f800000)
721 0x00002DC0: movc o2.x, r0.w, l(0), r0.x
722 0x00002DE4: and r0.x, r0.y, l(0x7f800000)
723 0x00002E00: ieq r0.x, r0.x, l(0x7f800000)
724 0x00002E1C: movc o2.y, r0.x, l(0), r0.y
725 0x00002E40: and r0.x, r0.z, l(0x7f800000)
726 0x00002E5C: ieq r0.x, r0.x, l(0x7f800000)
727 0x00002E78: movc o2.z, r0.x, l(0), r0.z
728 0x00002E9C: mov o1.w, l(0)
729 0x00002EB0: mov o2.w, l(0)
730 0x00002EC4: ret 
731 // Approximately 399 instruction slots used

 

Here is specular cone tracing code

  1 //
  2 // Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
  3 //
  4 //
  5 // Buffer Definitions: 
  6 //
  7 // cbuffer AbstractTracingCB
  8 // {
  9 //
 10 //   struct VxgiAbstractTracingConstants
 11 //   {
 12 //       
 13 //       float4 rOpacityTextureSize;    // Offset:    0
 14 //       float4 rEmittanceTextureSize;  // Offset:   16
 15 //       float4 ClipmapAnchor;          // Offset:   32
 16 //       float4 SceneBoundaryLower;     // Offset:   48
 17 //       float4 SceneBoundaryUpper;     // Offset:   64
 18 //       float4 ClipmapCenter;          // Offset:   80
 19 //       float4 TracingToroidalOffset;  // Offset:   96
 20 //       float EmittancePackingStride;  // Offset:  112
 21 //       float FinestVoxelSize;         // Offset:  116
 22 //       float StackTextureSize;        // Offset:  120
 23 //       float rNearestLevel0Boundary;  // Offset:  124
 24 //       float MaxMipmapLevel;          // Offset:  128
 25 //       float rEmittanceStorageScale;  // Offset:  132
 26 //       float rClipmapSizeWorld;       // Offset:  136
 27 //       uint Use6DOpacity;             // Offset:  140
 28 //
 29 //   } g_VxgiAbstractTracingCB;         // Offset:    0 Size:   144
 30 //
 31 // }
 32 //
 33 // cbuffer TranslationCB
 34 // {
 35 //
 36 //   float4 g_VxgiTranslationParameters[13];// Offset:    0 Size:   208
 37 //   float4 g_VxgiTranslationParameters2[13];// Offset:  208 Size:   208
 38 //
 39 // }
 40 //
 41 // cbuffer cBuiltinTracingParameters
 42 // {
 43 //
 44 //   struct GBufferParameters
 45 //   {
 46 //       
 47 //       row_major float4x4 viewProjMatrix;// Offset:    0
 48 //       row_major float4x4 viewProjMatrixInv;// Offset:   64
 49 //       row_major float4x4 viewMatrix; // Offset:  128
 50 //       float4 cameraPosition;         // Offset:  192
 51 //       float4 uvToView;               // Offset:  208
 52 //       float2 gbufferSize;            // Offset:  224
 53 //       float2 gbufferSizeInv;         // Offset:  232
 54 //       float2 viewportOrigin;         // Offset:  240
 55 //       float2 viewportSize;           // Offset:  248
 56 //       float2 viewportSizeInv;        // Offset:  256
 57 //       float2 firstSamplePosition;    // Offset:  264
 58 //       float projectionA;             // Offset:  272
 59 //       float projectionB;             // Offset:  276
 60 //       float depthScale;              // Offset:  280
 61 //       float depthBias;               // Offset:  284
 62 //       float normalScale;             // Offset:  288
 63 //       float normalBias;              // Offset:  292
 64 //       float radiusToScreen;          // Offset:  296
 65 //
 66 //   } g_GBuffer;                       // Offset:    0 Size:   300
 67 //   
 68 //   struct GBufferParameters
 69 //   {
 70 //       
 71 //       row_major float4x4 viewProjMatrix;// Offset:  304
 72 //       row_major float4x4 viewProjMatrixInv;// Offset:  368
 73 //       row_major float4x4 viewMatrix; // Offset:  432
 74 //       float4 cameraPosition;         // Offset:  496
 75 //       float4 uvToView;               // Offset:  512
 76 //       float2 gbufferSize;            // Offset:  528
 77 //       float2 gbufferSizeInv;         // Offset:  536
 78 //       float2 viewportOrigin;         // Offset:  544
 79 //       float2 viewportSize;           // Offset:  552
 80 //       float2 viewportSizeInv;        // Offset:  560
 81 //       float2 firstSamplePosition;    // Offset:  568
 82 //       float projectionA;             // Offset:  576
 83 //       float projectionB;             // Offset:  580
 84 //       float depthScale;              // Offset:  584
 85 //       float depthBias;               // Offset:  588
 86 //       float normalScale;             // Offset:  592
 87 //       float normalBias;              // Offset:  596
 88 //       float radiusToScreen;          // Offset:  600
 89 //
 90 //   } g_PreviousGBuffer;               // Offset:  304 Size:   300
 91 //   row_major float4x4 g_ReprojectionMatrix;// Offset:  608 Size:    64
 92 //   float4 g_AmbientColor;             // Offset:  672 Size:    16 [unused]
 93 //   float4 g_DownsampleScale;          // Offset:  688 Size:    16 [unused]
 94 //   float4 g_DebugParams;              // Offset:  704 Size:    16 [unused]
 95 //   float4 g_EnvironmentMapTint;       // Offset:  720 Size:    16
 96 //   float4 g_RefinementGridResolution; // Offset:  736 Size:    16 [unused]
 97 //   float4 g_BackgroundColor;          // Offset:  752 Size:    16 [unused]
 98 //   int2 g_PixelToSave;                // Offset:  768 Size:     8 [unused]
 99 //   int2 g_RandomOffset;               // Offset:  776 Size:     8
100 //   float2 g_GridOrigin;               // Offset:  784 Size:     8 [unused]
101 //   float g_ConeFactor;                // Offset:  792 Size:     4 [unused]
102 //   float g_TracingStep;               // Offset:  796 Size:     4
103 //   float g_OpacityCorrectionFactor;   // Offset:  800 Size:     4
104 //   int g_MaxSamples;                  // Offset:  804 Size:     4
105 //   int g_NumCones;                    // Offset:  808 Size:     4 [unused]
106 //   float g_rNumCones;                 // Offset:  812 Size:     4 [unused]
107 //   float g_EmittanceScale;            // Offset:  816 Size:     4
108 //   float g_EnvironmentMapResolution;  // Offset:  820 Size:     4
109 //   float g_MaxEnvironmentMapMipLevel; // Offset:  824 Size:     4
110 //   float g_NormalOffsetFactor;        // Offset:  828 Size:     4 [unused]
111 //   float g_AmbientAttenuationFactor;  // Offset:  832 Size:     4 [unused]
112 //   uint g_FlipOpacityDirections;      // Offset:  836 Size:     4
113 //   float g_InitialOffsetBias;         // Offset:  840 Size:     4
114 //   float g_InitialOffsetDistanceFactor;// Offset:  844 Size:     4
115 //   uint g_EnableSpecularRandomOffsets;// Offset:  848 Size:     4
116 //   uint g_NumDiscontinuityLevels;     // Offset:  852 Size:     4 [unused]
117 //   float g_TemporalReprojectionWeight;// Offset:  856 Size:     4
118 //   float g_TangentJitterScale;        // Offset:  860 Size:     4
119 //   float g_DepthDeltaSign;            // Offset:  864 Size:     4 [unused]
120 //   float g_ReprojectionDepthWeightScale;// Offset:  868 Size:     4
121 //   float g_ReprojectionNormalWeightExponent;// Offset:  872 Size:     4
122 //   float g_InterpolationWeightThreshold;// Offset:  876 Size:     4 [unused]
123 //   uint g_EnableRefinement;           // Offset:  880 Size:     4 [unused]
124 //   float g_AmbientScale;              // Offset:  884 Size:     4 [unused]
125 //   float g_AmbientBias;               // Offset:  888 Size:     4 [unused]
126 //   float g_AmbientPower;              // Offset:  892 Size:     4 [unused]
127 //   float g_AmbientDistanceDarkening;  // Offset:  896 Size:     4 [unused]
128 //   int g_AltSettingsStencilMask;      // Offset:  900 Size:     4 [unused]
129 //   int g_AltSettingsStencilRefValue;  // Offset:  904 Size:     4 [unused]
130 //   float g_AltInitialOffsetBias;      // Offset:  908 Size:     4 [unused]
131 //   float g_AltInitialOffsetDistanceFactor;// Offset:  912 Size:     4 [unused]
132 //   float g_AltNormalOffsetFactor;     // Offset:  916 Size:     4 [unused]
133 //   float g_AltTracingStep;            // Offset:  920 Size:     4 [unused]
134 //   float g_SSAO_SurfaceBias;          // Offset:  924 Size:     4 [unused]
135 //   float g_SSAO_RadiusWorld;          // Offset:  928 Size:     4 [unused]
136 //   float g_SSAO_rBackgroundViewDepth; // Offset:  932 Size:     4 [unused]
137 //   float g_SSAO_CoarseAO;             // Offset:  936 Size:     4 [unused]
138 //   float g_SSAO_PowerExponent;        // Offset:  940 Size:     4 [unused]
139 //
140 // }
141 //
142 //
143 // Resource Bindings:
144 //
145 // Name                                 Type  Format         Dim Slot Elements
146 // ------------------------------ ---------- ------- ----------- ---- --------
147 // s_VoxelTextureSampler             sampler      NA          NA    0        1
148 // s_EnvironmentMapSampler           sampler      NA          NA   11        1
149 // g_DepthBuffer                     texture  float4          2d    0        1
150 // g_TargetNormal                    texture  float4          2d    2        1
151 // t_OpacityMap_Pos                  texture  float4          3d    6        1
152 // t_OpacityMap_Neg                  texture  float4          3d    7        1
153 // t_Randoms                         texture  float4          2d    9        1
154 // t_EnvironmentMap                  texture  float4        cube   11        1
155 // t_EmittanceEven                   texture  float4          3d   12        1
156 // t_EmittanceOdd                    texture  float4          3d   15        1
157 // g_PrevDepthBuffer                 texture  float4          2d   18        1
158 // g_PrevTargetNormal                texture  float4          2d   19        1
159 // g_PrevSpecular                    texture  float4          2d   20        1
160 // AbstractTracingCB                 cbuffer      NA          NA    0        1
161 // TranslationCB                     cbuffer      NA          NA    1        1
162 // cBuiltinTracingParameters         cbuffer      NA          NA    2        1
163 //
164 //
165 //
166 // Input signature:
167 //
168 // Name                 Index   Mask Register SysValue  Format   Used
169 // -------------------- ----- ------ -------- -------- ------- ------
170 // TEXCOORD                 0   xy          0     NONE   float   xy  
171 // INSTANCEID               0     z         0     NONE   float       
172 // RAY                      0   xyzw        1     NONE   float       
173 // SV_Position              0   xyzw        2      POS   float   xy  
174 //
175 //
176 // Output signature:
177 //
178 // Name                 Index   Mask Register SysValue  Format   Used
179 // -------------------- ----- ------ -------- -------- ------- ------
180 // SV_Target                0   xyzw        0   TARGET   float   xyzw
181 //
182 0x00000000: ps_5_0
183 0x00000008: dcl_globalFlags refactoringAllowed
184 0x0000000C: dcl_immediateConstantBuffer { { -0.759375, 0.518795, 0, 0},
185                               { 0.532276, 0.235007, 0, 0},
186                               { 0.811488, -0.458026, 0, 0},
187                               { -0.309351, -0.749256, 0, 0},
188                               { 0.229313, 0.760701, 0, 0},
189                               { 0.082651, -0.893957, 0, 0},
190                               { 0.098134, 0.192451, 0, 0},
191                               { -0.311438, -0.301729, 0, 0},
192                               { 0.650529, 0.629737, 0, 0},
193                               { -0.302202, 0.297664, 0, 0},
194                               { -0.738689, -0.521569, 0, 0},
195                               { -0.393524, 0.753064, 0, 0},
196                               { -0.692823, 0.071195, 0, 0},
197                               { 0.858102, -0.016241, 0, 0},
198                               { 0.398883, -0.617012, 0, 0},
199                               { 0.283767, -0.179743, 0, 0} }
200 0x00000114: dcl_constantbuffer cb0[9], immediateIndexed
201 0x00000124: dcl_constantbuffer cb1[26], dynamicIndexed
202 0x00000134: dcl_constantbuffer cb2[55], immediateIndexed
203 0x00000144: dcl_sampler s_VoxelTextureSampler, mode_default
204 0x00000150: dcl_sampler s_EnvironmentMapSampler, mode_default
205 0x0000015C: dcl_resource_texture2d (float,float,float,float) g_DepthBuffer
206 0x0000016C: dcl_resource_texture2d (float,float,float,float) g_TargetNormal
207 0x0000017C: dcl_resource_texture3d (float,float,float,float) t_OpacityMap_Pos
208 0x0000018C: dcl_resource_texture3d (float,float,float,float) t_OpacityMap_Neg
209 0x0000019C: dcl_resource_texture2d (float,float,float,float) t_Randoms
210 0x000001AC: dcl_resource_texturecube (float,float,float,float) t_EnvironmentMap
211 0x000001BC: dcl_resource_texture3d (float,float,float,float) t_EmittanceEven
212 0x000001CC: dcl_resource_texture3d (float,float,float,float) t_EmittanceOdd
213 0x000001DC: dcl_resource_texture2d (float,float,float,float) g_PrevDepthBuffer
214 0x000001EC: dcl_resource_texture2d (float,float,float,float) g_PrevTargetNormal
215 0x000001FC: dcl_resource_texture2d (float,float,float,float) g_PrevSpecular
216 0x0000020C: dcl_input_ps linear v0.xy
217 0x00000218: dcl_input_ps_siv linear noperspective v2.xy, position
218 0x00000228: dcl_output o0.xyzw
219 0x00000234: dcl_temps 21
220 
221 // load normal
222 0x0000023C: ftoi r0.xy, v2.xyxx                                               // r0.xy = SV_Position.xy
223 0x00000250: mov r0.zw, l(0,0,0,0)
224 0x00000270: ld_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyww, g_TargetNormal.xyzw // r1.xyzw = g_TargetNormal.xyzw
225 0x00000294: ge r2.x, l(0.000000), r1.w                                        // if(0 >= r1.w)
226 0x000002B0: if_nz r2.x
227 0x000002BC:   mov o0.xyzw, l(0,0,0,0)                                         //      SV_Target.xyzw = (0,0,0,0)
228 0x000002DC:   ret                                                             //      return
229 0x000002E0: endif
230 // r0.xy = screen position
231 // r1.xyzw = normal
232 // r1.w = glossiness
233 
234 // load depth, normalize normal
235 0x000002E4: ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, g_DepthBuffer.xyzw   // r0.x = depth
236 0x00000308: mad r0.x, r0.x, depthScale.z, depthBias.w                         // r0.x = r0.x * depthScale.z + depthBias.w
237 0x00000334: mad r0.yzw, r1.xxyz, normalScale.xxxx, normalBias.yyyy            // r0.yzw = r1.xyz * normalScale.xxxx + normalBias.yyyy
238 0x00000360: dp3 r1.x, r0.yzwy, r0.yzwy                                        // r0.yzw = normalize(r0.yzw)
239 0x0000037C: sqrt r1.x, r1.x
240 0x00000390: div r0.yzw, r0.yyzw, r1.xxxx
241 0x000003AC: ge r1.x, l(0.000000), r1.x                                        // if(length(normal) <= 0)
242 0x000003C8: movc r0.yzw, r1.xxxx, l(0,0,0,0), r0.yyzw                         //    r0.yzw = 0
243 // r0.yzw = normalized normal
244 // r0.x   = depth
245 
246 // compute world space position
247 0x000003F8: add r1.xy, v2.xyxx, -viewportOrigin.xyxx
248 0x0000041C: mul r1.xy, r1.xyxx, viewportSizeInv.xyxx
249 0x0000043C: mad r1.x, r1.x, l(2.000000), l(-1.000000)
250 0x00000460: mad r1.y, -r1.y, l(2.000000), l(1.000000)                         // r1.xy = project space coordinate
251 0x00000488: mul r2.xyzw, r1.yyyy, viewProjMatrixInv.xyzw
252 0x000004A8: mad r2.xyzw, r1.xxxx, viewProjMatrixInv.xyzw, r2.xyzw
253 0x000004D0: mad r2.xyzw, r0.xxxx, viewProjMatrixInv.xyzw, r2.xyzw
254 0x000004F8: add r2.xyzw, r2.xyzw, viewProjMatrixInv.xyzw
255 0x00000518: div r1.xyz, r2.xyzx, r2.wwww
256 // r1.xyz = world space position
257 
258 // compute view direction
259 0x00000534: add r2.xyz, r1.xyzx, -cameraPosition.xyzx                         // r2.xyz = r1.xyz - cameraPosition
260 0x00000558: dp3 r2.w, r2.xyzx, r0.yzwy
261 0x00000574: add r2.w, r2.w, r2.w
262 0x00000590: mad r2.xyz, r0.yzwy, -r2.wwww, r2.xyzx                            // r2.xyz += normal * -dot(normal,r2.xyz)*2
263 0x000005B8: dp3 r2.w, r2.xyzx, r2.xyzx
264 0x000005D4: rsq r2.w, r2.w
265 0x000005E8: mul r3.xyz, r2.wwww, r2.xyzx                                      // r3.xyz = normalized reflection vector
266 // r2.xyz = reflection vector
267 // r3.xyz = normalized reflection vector
268 
269 // compute clipmap size factor for shading point
270 0x00000604: add r4.xyz, r1.xyzx, -ClipmapAnchor.xyzx
271 0x00000628: max r2.z, |r4.z|, |r4.y|
272 0x0000064C: max r2.z, r2.z, |r4.x|
273 0x0000066C: dp2 r2.z, rNearestLevel0Boundary.wwww, r2.zzzz                    // rNearestLevel0Boundary = 0
274 0x0000068C: max r2.z, r2.z, l(1.000000)
275 // r2.z = 0
276 
277 // calculate fresnel coefficient
278 0x000006A8: add r4.xyz, -r1.xyzx, cameraPosition.xyzx
279 0x000006CC: dp3 r3.w, r4.xyzx, r4.xyzx
280 0x000006E8: rsq r3.w, r3.w
281 0x000006FC: mul r4.xyz, r3.wwww, r4.xyzx                                      // r4.xyz = normalized view vector (from shading point to camera)
282 0x00000718: dp3 r3.w, r0.yzwy, r4.xyzx                                        // r0.yzw = normalized normal
283 0x00000734: add r3.w, -|r3.w|, l(1.000000)
284 0x00000754: max r3.w, r3.w, l(0.000000)
285 0x00000770: mul r3.w, r3.w, r3.w
286 0x0000078C: mul r3.w, r3.w, r3.w                                              // r3.w = (1-dot(viewVector, normal)) ^ 4
287 // r3.w = fresnel coef?
288 
289 // calculate random offset
290 0x000007A8: itof r4.xy, g_RandomOffset.zwzz                                   // g_RandomOffset = (0,0)
291 0x000007C0: add r4.xy, r4.xyxx, v2.xyxx                                       // r4.xy = screen position + g_RandomOffset
292 0x000007DC: ftoi r4.zw, r4.xxxy
293 0x000007F0: and r5.xy, r4.zwzz, l(3, 3, 0, 0)                                 // r5.xy = (screen position + g_RandomOffset) & (3,3)
294 0x00000818: mov r5.zw, l(0,0,0,0)
295 0x00000838: ld_indexable(texture2d)(float,float,float,float) r4.z, r5.xyzw, t_Randoms.yzxw // load random number, based on screen position
296 0x0000085C: movc r4.z, g_EnableSpecularRandomOffsets, r4.z, l(0.500000)       // r4.z = random offset
297 0x00000884: mul r4.z, r2.z, r4.z                                              // r4.z = random offset * level factor = 0
298 // r4.xy = screen position + g_RandomOffset
299 // r4.z = random offset * level factor = 0
300 
301 0x000008A0: min r1.w, r1.w, l(0.750000)
302 0x000008BC: mul r1.w, r1.w, r1.w
303 0x000008D8: mul r4.w, r1.w, l(1.772454)                                       // r4.w = min(normal texture.w, 0.75) ^ 2 * 1.772454
304 0x000008F4: itof r5.x, g_MaxSamples                                           // g_MaxSamples = 128
305 0x0000090C: dp2 r4.x, r4.xyxx, l(12.989800, 78.233002, 0.000000, 0.000000)
306 0x00000934: sincos r4.x, null, r4.x                                           // r4.x = sin(dot(screen position + g_RandomOffset, (12.989800, 78.233002)))
307 0x0000094C: mul r4.x, r4.x, l(43758.546875)
308 0x00000968: frc r4.x, r4.x
309 // r4.x = random number = frac(sin(dot(screen position + g_RandomOffset, (12.989800, 78.233002))) * 43758.546875)
310 // r4.w = min(glossiness, 0.75) ^ 2 * 1.772454
311 
312 // Calculate initial offset
313 // r2.z = 0
314 0x0000097C: mad r2.z, r2.z, g_InitialOffsetDistanceFactor, g_InitialOffsetBias// r2.z = 0 * g_InitialOffsetDistanceFactor + g_InitialOffsetBias = 2
315 0x000009A8: mul r3.w, r3.w, g_InitialOffsetBias                               // r3.w *= g_InitialOffsetBias
316 0x000009C8: mad r2.z, r3.w, l(5.000000), r2.z                                 // r2.z = fresnel coef* g_InitialOffsetBias*5+0 * g_InitialOffsetDistanceFactor + g_InitialOffsetBias
317 0x000009EC: mad r2.z, r4.z, g_TracingStep, r2.z                               // r2.z = random offset * level factor * g_TracingStep + fresnel coef* g_InitialOffsetBias*5+0 * g_InitialOffsetDistanceFactor + g_InitialOffsetBias
318                                                                               //      = 0 + fresnel coef* g_InitialOffsetBias*5 + g_InitialOffsetBias
319 0x00000A14: mul r3.w, r2.z, FinestVoxelSize.y
320 0x00000A34: mad r1.xyz, r3.xyzx, r3.wwww, r1.xyzx                             // r1.xyz = world space position + offset * reflection vector
321 // r1.xyz = initial tracing position
322 // r2.z = random offset * level factor * g_TracingStep + fresnel coef* g_InitialOffsetBias*5 + 0 * g_InitialOffsetDistanceFactor + g_InitialOffsetBias
323 //      = 0 + fresnel coef* g_InitialOffsetBias*5 + g_InitialOffsetBias
324 
325 // Construct local coordinate system
326 // r3.xyz = normalized reflection vector
327 0x00000A58: mul r3.w, rEmittanceStorageScale.y, g_EmittanceScale
328 0x00000A7C: mov r6.xyz, |r3.xyzx|
329 0x00000A94: max r4.y, r6.z, r6.y
330 0x00000AB0: max r4.y, r4.y, r6.x                                              // r4.y = max(abs(normalized reflection vector))
331 0x00000ACC: mad r2.xyw, -r2.yxyx, r2.wwww, -r3.zzzy                           // r2.xyw = -normalize(reflection vector).yxx - normalized reflection vector.zzy
332 0x00000AF8: lt r5.yzw, l(0.000000, 0.000000, 0.000000, 0.000000), r3.xxyz     // r5.yzw = 0 < r3.xyz
333 0x00000B20: lt r7.xyz, r3.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)     // r7.xyz = r3.xyz < 0
334 0x00000B48: iadd r7.xyz, -r5.yzwy, r7.xyzx                                    // r7.xyz = r7.xyz - r5.yzw = -sign(normalized reflection vector)
335 0x00000B68: itof r7.xyz, r7.xyzx
336 0x00000B7C: eq r4.yz, r6.xxyx, r4.yyyy                                        // r4.yz = r6.xy == r4.yy
337 0x00000B98: mul r7.xyz, r2.xywx, r7.xyzx
338 0x00000BB4: mov r6.w, r7.y
339 0x00000BC8: mov r7.w, r6.z
340 0x00000BDC: movc r2.xyw, r4.zzzz, r6.ywyy, r7.wwwz
341 0x00000C00: mov r7.yz, r6.xxxx
342 0x00000C14: movc r2.xyw, r4.yyyy, r7.xyxz, r2.xyxw
343 0x00000C38: dp3 r4.y, r2.xywx, r2.xywx
344 0x00000C54: rsq r4.y, r4.y
345 0x00000C68: mul r2.xyw, r2.xyxw, r4.yyyy                                      // r2.xyw = normalize(r2.xyw)
346 0x00000C84: mul r7.xyz, r3.yzxy, r2.wxyw
347 0x00000CA0: mad r7.xyz, r2.ywxy, r3.zxyz, -r7.xyzx                            // r7.xyz = r2.ywx * r3.zxy - r2.wxy * r3.yzx = cross(r2.xyw, r3.xyz)
348 // r3.xyz = normalized reflection vector, "z" axis
349 // r2.xyw = "y" axis
350 // r7 = cross(r2.xyw, normalized reflection vector) = "x" axis
351 
352 // prepare data for cone tracing
353 // r1.w = glossiness
354 0x00000CC8: frc r4.x, r4.x
355 0x00000CDC: mul r4.x, r4.x, l(16.000000)
356 0x00000CF8: ftoi r4.x, r4.x                                                   // r4.x = int(frac(random number)*16)
357 0x00000D0C: mad r4.y, -r1.w, l(1.772454), l(2.000000)                         // r4.y = -r1.w * 1.772454 + 2
358 0x00000D34: mad r4.z, r1.w, l(1.772454), l(2.000000)                          // r4.z = r1.w * 1.772454 + 2
359 0x00000D58: div r4.z, r4.z, r4.y                                              // r4.z = (2 + r1.w * 1.772454) / (2 - r1.w * 1.772454)
360 0x00000D74: add r4.z, r4.z, l(-1.000000)                                      // r4.z = (2 + r1.w * 1.772454) / (2 - r1.w * 1.772454) - 1
361 0x00000D90: add r6.w, MaxMipmapLevel.x, l(1.000000)                           // r6.w = MaxMipmapLevel + 1
362 0x00000DB0: lt r8.xy, l(0.000000, 0.000000, 0.000000, 0.000000), (g_TangentJitterScale,g_TemporalReprojectionWeight,g_TangentJitterScale,g_TangentJitterScale)
363 0x00000DDC: mul r7.w, FinestVoxelSize.y, FinestVoxelSize.y                    // r7.w = FinestVoxelSize.y * FinestVoxelSize.y
364 0x00000E00: movc r9.xyz, g_FlipOpacityDirections.yyyy, -r3.xyzx, r3.xyzx      // r9.xyz = g_FlipOpacityDirections ? reflection vector : -reflection vector
365 0x00000E2C: and r5.y, r5.y, l(0x40400000)
366 0x00000E48: movc r5.zw, r5.zzzw, l(0,0,4.000000,5.000000), l(0,0,1.000000,2.000000) // r5.yzw = face index = reflection vector.xyz > 0 ? (3,4,5) : (0,1,2)
367 0x00000E84: mul r10.x, r5.y, EmittancePackingStride.x                         // r10.x = x face texcoord offset = r5.y * EmittancePackingStride = r5.y * 0.17
368 0x00000EA4: mul r11.xy, r5.zwzz, EmittancePackingStride.xxxx                  // r11.xy = yz face texcoord offset = r5.zw * EmittancePackingStride = r5.zw * 0.17
369 // r4.y = 2 - r1.w * 1.772454
370 // r4.z = cone tracing step factor = (2 + r1.w * 1.772454) / (2 - r1.w * 1.772454) - 1
371 // r5.yzw = face index = reflection vector.xyz > 0 ? (3,4,5) : (0,1,2)
372 // r6.w = MaxMipmapLevel + 1
373 // r7.w = FinestVoxelSize.y * FinestVoxelSize.y
374 // r8.xy = (g_TangentJitterScale > 0, g_TemporalReprojectionWeight > 0)
375 // r9.xyz = g_FlipOpacityDirections ? reflection vector : -reflection vector
376 // (r10.x, r11.xy) = xyz face texcoord offset
377 
378 // initial variables for loop
379 0x00000EC4: mov r10.yz, l(0,0,0,0)
380 0x00000EE4: mov r11.zw, l(0,0,0,0)
381 0x00000F04: mov r5.yzw, l(0,0,0,0)
382 0x00000F24: mov r12.xyz, r1.xyzx
383 0x00000F38: mov r8.z, Use6DOpacity.w
384 0x00000F50: mov r8.w, l(1.000000)
385 0x00000F64: mov r9.w, l(1.000000)
386 0x00000F78: mov r10.w, l(1.000000)
387 0x00000F8C: mov r12.w, r2.z
388 0x00000FA0: mov r13.x, l(0)
389 // r12.xyz = sample position
390 
391 // begin specular cone tracing
392 0x00000FB4: loop 
393 
394 // calculate sample level
395 // r12.w = trace length in voxel count
396 // r13.x = step count
397 0x00000FB8:   ge r13.y, r13.x, r5.x                                           // if(step count >= 128)
398 0x00000FD4:   breakc_nz r13.y                                                 //    break
399 0x00000FE0:   add r13.yzw, r12.xxyz, -ClipmapAnchor.xxyz                      // r13.yzw = sample position - ClipmapAnchor
400 0x00001004:   max r13.z, |r13.w|, |r13.z|
401 0x00001028:   max r13.y, r13.z, |r13.y|                                       // r13.y = manhattan distance from clip map center 
402 0x00001048:   dp2 r13.z, rNearestLevel0Boundary.wwww, r13.yyyy
403 0x00001068:   max r13.z, r13.z, l(1.000000)                                   // r13.z = max(1, distance from center / level 0 range)
404 0x00001084:   mul r13.w, r4.w, r12.w                                          // r13.w = min(glossiness, 0.75) ^ 2 * 1.772454 * trace length
405 0x000010A0:   lt r14.x, r13.w, r13.z                                          // if(r13.w < r13.z)
406 0x000010BC:   movc r13.w, r14.x, r13.z, r13.w                                 //    r13.w = r13.z = voxel size factor
407 0x000010E0:   log r14.y, r13.w                                                // r14.y = clip map level = log2(r13.w)
408 0x000010F4:   ge r14.z, r14.y, r6.w
409 0x00001110:   if_nz r14.z                                                     // if(level >= MaxMipmapLevel + 1)
410 0x0000111C:     break                                                         //    break
411 0x00001120:   endif 
412 // r14.y = clip map level
413 
414 0x00001124:   add r13.y, -r13.y, ClipmapAnchor.w                              // r13.y = ClipmapAnchor.w - manhattan distance
415 0x00001148:   mul r14.z, r13.w, FinestVoxelSize.y                             // r14.z = sample voxel size = r13.w * FinestVoxelSize
416 0x00001168:   mad r13.y, -r13.w, FinestVoxelSize.y, r13.y                     // r13.y = -voxel size factor * FinestVoxelSize + ClipmapAnchor.w - manhattan distance
417 0x00001194:   lt r14.w, r13.y, l(0.000000)
418 0x000011B0:   if_nz r14.w                                                     // if (r13.y < 0)
419 0x000011BC:     break                                                         //    break
420 0x000011C0:   endif 
421 
422 // test if sample position is in scene bounding box
423 0x000011C4:   mad r15.xyz, r13.wwww, FinestVoxelSize.yyyy, r12.xyzx
424 0x000011EC:   lt r15.xyz, r15.xyzx, SceneBoundaryLower.xyzx
425 0x0000120C:   or r14.w, r15.y, r15.x
426 0x00001228:   or r14.w, r15.z, r14.w
427 0x00001244:   mad r15.xyz, -r13.wwww, FinestVoxelSize.yyyy, r12.xyzx
428 0x00001270:   lt r15.xyz, SceneBoundaryUpper.xyzx, r15.xyzx
429 0x00001290:   or r15.x, r15.y, r15.x
430 0x000012AC:   or r15.x, r15.z, r15.x
431 0x000012C8:   or r14.w, r14.w, r15.x
432 0x000012E4:   if_nz r14.w
433 0x000012F0:     break 
434 0x000012F4:   endif 
435 
436 // r12.w = trace length in voxel count
437 // r13.z = max(1, distance from center / level 0 range)
438 0x000012F8:   mad r14.w, r12.w, l(2.000000), r13.z                            // r14.w = length * 2 + max(1, distance from center / level 0 range)
439 0x0000131C:   div r14.w, r14.w, r4.y                                          // r14.w = (length * 2 + max(1, distance from center / level 0 range)) / (2 - glossiness * 1.772454)
440 0x00001338:   add r13.z, r12.w, r13.z                                         // r13.z = length  + max(1, distance from center / level 0 range)
441 0x00001354:   max r13.z, r13.z, r14.w                                         // r13.z = max(length  + max(1, distance from center / level 0 range), (length * 2 + max(1, distance from center / level 0 range)) / (2 - glossiness * 1.772454))
442 0x00001370:   add r13.z, -r12.w, r13.z                                        // r13.z = max(length  + max(1, distance from center / level 0 range), (length * 2 + max(1, distance from center / level 0 range)) / (2 - glossiness * 1.772454)) - length
443 0x00001390:   mul r14.w, r4.z, r12.w                                          // r14.w = step factor * trace length
444 0x000013AC:   movc r13.z, r14.x, r13.z, r14.w
445 0x000013D0:   mul r14.x, r13.z, g_TracingStep                                 // r14.x = step legnth in voxel count = r13.z * g_TracingStep
446 0x000013F0:   div_sat r13.y, r13.y, r14.z                                     // r13.y = (-voxel size factor * FinestVoxelSize + ClipmapAnchor.w - manhattan distance) / sample voxel size
447 // r13.z = original step in voxels
448 // r14.x = step in voxels
449 //       = g_TracingStep * (max(distance + 1, (distance * 2 + 1)/(2 - g_ConeFactor)) - distance), if diameter less that one voxel
450 //       = g_TracingStep * ((2 + g_ConeFactor) / (2 - g_ConeFactor)-1) * distance
451 
452 // When g_TangentJitterScale > 0, add random tangent offset to sample position
453 // r2.xyw = "y" axis for ray coordinate system
454 // r7.xyz = "x" axis for ray coordinate system
455 0x0000140C:   if_nz r8.x                                                      // if(g_TangentJitterScale > 0)
456 0x00001418:     ftoi r14.w, r13.x                                             //    r14.w = step count
457 0x0000142C:     iadd r14.w, r4.x, r14.w                                       //    r14.w = step count + int(frac(random number)*16)
458 0x00001448:     and r14.w, r14.w, l(15)                                       //    r14.w = random index
459 0x00001464:     mul r15.x, r14.z, g_TangentJitterScale                        //    r15.x = sample voxel size * g_TangentJitterScale
460 0x00001484:     mul r15.xy, r15.xxxx, dcl_immediateConstantBuffer[r14.w + 0].xyxx
461 0x000014A4:     mad r15.xzw, r2.xxyw, r15.xxxx, r12.xxyz
462 0x000014C8:     mad r15.xyz, r7.xyzx, r15.yyyy, r15.xzwx
463 0x000014EC:   else 
464 0x000014F0:     mov r15.xyz, r12.xyzx
465 0x00001504:   endif 
466 // r15.xyz = final sample position
467 
468 // calculate clipmap level weight
469 // r14.y = clip map level
470 0x00001508:   round_ni r14.w, r14.y                                           // r14.w = round(clip map level)
471 0x0000151C:   add r15.w, -r14.w, r14.y                                        // r15.w = frac(clip map level)
472 0x0000153C:   add r16.x, -r15.w, l(1.000000)                                  // r16.x = weight for lower level = 1 - frac(clip map level)
473 0x0000155C:   mul r16.x, r13.y, r16.x
474 0x00001578:   lt r14.y, MaxMipmapLevel.x, r14.y
475 0x00001598:   mul r13.y, r13.y, r15.w
476 0x000015B4:   movc r13.y, r14.y, l(0), r13.y
477 0x000015D8:   ftoi r14.y, r14.w                                               // r14.y = int(floor(level))
478 
479 // calculate clip map address
480 0x000015EC:   add r15.xyz, r15.xyzx, -ClipmapCenter.xyzx
481 0x00001610:   mad r16.yzw, r15.xxyz, g_VxgiTranslationParameters[r14.y + 0].xxxx, l(0.000000, 0.500000, 0.500000, 0.500000)
482 0x00001648:   add r16.yzw, r16.yyzw, g_VxgiTranslationParameters2[r14.y + 13].xxyz
483 0x00001670:   frc r16.yzw, r16.yyzw
484 0x00001684:   mul r17.xy, r16.yzyy, g_VxgiTranslationParameters[r14.y + 0].yyyy
485 0x000016A8:   mad r17.z, r16.w, g_VxgiTranslationParameters[r14.y + 0].y, g_VxgiTranslationParameters[r14.y + 0].z
486 0x000016DC:   mul r17.xyz, r17.xyzx, rOpacityTextureSize.xyzx
487 0x000016FC:   mad r18.xy, r16.yzyy, g_VxgiTranslationParameters[r14.y + 0].yyyy, l(1.000000, 0.000000, 0.000000, 0.000000)
488 0x00001734:   mad r18.z, r16.w, g_VxgiTranslationParameters[r14.y + 0].y, g_VxgiTranslationParameters[r14.y + 0].w
489 0x00001768:   mul r16.yzw, r18.xxyz, rEmittanceTextureSize.xxyz
490 0x00001788:   add r15.w, r14.w, l(1.000000)
491 0x000017A4:   ftoi r15.w, r15.w
492 
493 0x000017B8:   mad r15.xyz, r15.xyzx, g_VxgiTranslationParameters[r15.w + 0].xxxx, l(0.500000, 0.500000, 0.500000, 0.000000)
494 0x000017F0:   add r15.xyz, r15.xyzx, g_VxgiTranslationParameters2[r15.w + 13].xyzx
495 0x00001818:   frc r15.xyz, r15.xyzx
496 0x0000182C:   mul r18.xy, r15.xyxx, g_VxgiTranslationParameters[r15.w + 0].yyyy
497 0x00001850:   mad r18.z, r15.z, g_VxgiTranslationParameters[r15.w + 0].y, g_VxgiTranslationParameters[r15.w + 0].z
498 0x00001884:   mul r18.xyz, r18.xyzx, rOpacityTextureSize.xyzx
499 0x000018A4:   mad r19.xy, r15.xyxx, g_VxgiTranslationParameters[r15.w + 0].yyyy, l(1.000000, 0.000000, 0.000000, 0.000000)
500 0x000018DC:   mad r19.z, r15.z, g_VxgiTranslationParameters[r15.w + 0].y, g_VxgiTranslationParameters[r15.w + 0].w
501 0x00001910:   mul r15.xyz, r19.xyzx, rEmittanceTextureSize.xyzx
502 
503 // sample lower opacity clipmap
504 0x00001930:   sample_l_indexable(texture3d)(float,float,float,float) r19.xyzw, r17.xyzx, t_OpacityMap_Pos.xyzw, s_VoxelTextureSampler, l(0.000000)
505 0x00001964:   if_nz r8.z                                                      // if(Use6DOpacity)
506 0x00001970:     sample_l_indexable(texture3d)(float,float,float,float) r17.xyz, r17.xyzx, t_OpacityMap_Neg.xyzw, s_VoxelTextureSampler, l(0.000000)
507 0x000019A4:     mul_sat r20.xyz, -r9.xyzx, r19.xyzx
508 0x000019C4:     add r15.w, r20.y, r20.x
509 0x000019E0:     add r15.w, r20.z, r15.w
510 0x000019FC:     min r15.w, r15.w, l(1.000000)
511 0x00001A18:     mul_sat r17.xyz, r9.xyzx, r17.xyzx
512 0x00001A34:     add r17.x, r17.y, r17.x
513 0x00001A50:     add r17.x, r17.z, r17.x
514 0x00001A6C:     min r17.x, r17.x, l(1.000000)
515 0x00001A88:     add r15.w, r15.w, r17.x
516 0x00001AA4:   else 
517 0x00001AA8:     mul_sat r17.xyz, r6.xyzx, r19.xyzx
518 0x00001AC4:     add r17.x, r17.y, r17.x
519 0x00001AE0:     add r17.x, r17.z, r17.x
520 0x00001AFC:     min r15.w, r17.x, l(1.000000)                                        // r15.w = lower opacity
521 0x00001B18:   endif 
522 0x00001B1C:   ne r17.y, r19.w, l(0.000000)                                           // r17.y = if lower voxel is occupied
523 
524 // sample higher opacity clipmap
525 0x00001B38:   sample_l_indexable(texture3d)(float,float,float,float) r19.xyzw, r18.xyzx, t6.xyzw, s_VoxelTextureSampler, l(0.000000)
526 0x00001B6C:   if_nz r8.z
527 0x00001B78:     sample_l_indexable(texture3d)(float,float,float,float) r18.xyz, r18.xyzx, t_OpacityMap_Neg.xyzw, s_VoxelTextureSampler, l(0.000000)
528 0x00001BAC:     mul_sat r20.xyz, -r9.xyzx, r19.xyzx
529 0x00001BCC:     add r18.w, r20.y, r20.x
530 0x00001BE8:     add r18.w, r20.z, r18.w
531 0x00001C04:     mul_sat r18.xyz, r9.xyzx, r18.xyzx
532 0x00001C20:     add r18.x, r18.y, r18.x
533 0x00001C3C:     add r18.x, r18.z, r18.x
534 0x00001C58:     min r18.xw, r18.xxxw, l(1.000000, 0.000000, 0.000000, 1.000000)
535 0x00001C80:     add r18.x, r18.x, r18.w
536 0x00001C9C:   else 
537 0x00001CA0:     mul_sat r18.yzw, r6.xxyz, r19.xxyz
538 0x00001CBC:     add r18.y, r18.z, r18.y
539 0x00001CD8:     add r18.y, r18.w, r18.y
540 0x00001CF4:     min r18.x, r18.y, l(1.000000)                                        // r18.x = higher opacity
541 0x00001D10:   endif 
542 0x00001D14:   ne r17.x, r19.w, l(0.000000)                                           // r17.x = if higher voxel is occupied
543 
544 0x00001D30:   mul r18.x, r13.y, r18.x
545 0x00001D4C:   mad_sat r15.w, r15.w, r16.x, r18.x
546 0x00001D70:   add r14.w, r14.w, r14.w
547 0x00001D8C:   exp r14.w, r14.w
548 0x00001DA0:   mul r14.w, r7.w, r14.w
549 0x00001DBC:   mul r13.y, r13.y, r14.w
550 0x00001DD8:   mul r17.w, r16.x, r14.w
551 0x00001DF4:   mul r17.z, r13.y, l(4.000000)
552 0x00001E10:   and r13.y, r14.y, l(1)
553 0x00001E2C:   movc r17.xyzw, r13.yyyy, r17.xyzw, r17.yxwz
554 
555 // sample even color clipmap
556 0x00001E50:   if_nz r17.x
557 0x00001E5C:     movc r18.xyz, r13.yyyy, r15.xyzx, r16.yzwy
558 0x00001E80:     add r19.xyz, r10.xyyx, r18.xyzx
559 0x00001E9C:     add r20.xyz, r11.xzzx, r18.xyzx
560 0x00001EB8:     add r18.xyz, r11.yzzy, r18.xyzx
561 0x00001ED4:     sample_l_indexable(texture3d)(float,float,float,float) r19.xyz, r19.xyzx, t_EmittanceEven.xyzw, s_VoxelTextureSampler, l(0.000000)
562 0x00001F08:     sample_l_indexable(texture3d)(float,float,float,float) r20.xyz, r20.xyzx, t_EmittanceEven.xyzw, s_VoxelTextureSampler, l(0.000000)
563 0x00001F3C:     sample_l_indexable(texture3d)(float,float,float,float) r18.xyz, r18.xyzx, t_EmittanceEven.xyzw, s_VoxelTextureSampler, l(0.000000)
564 0x00001F70:     mul r20.xyz, r6.yyyy, r20.xyzx
565 0x00001F8C:     mad r19.xyz, r6.xxxx, r19.xyzx, r20.xyzx
566 0x00001FB0:     mad r18.xyz, r6.zzzz, r18.xyzx, r19.xyzx
567 0x00001FD4:     mul r18.xyz, r17.zzzz, r18.xyzx
568 0x00001FF0:   else 
569 0x00001FF4:     mov r18.xyz, l(0,0,0,0)
570 0x00002014:   endif 
571 // r18.xyz = even color
572 
573 // sample odd color clipmap
574 0x00002018:   lt r14.y, l(0.000000), r17.w
575 0x00002034:   and r14.y, r14.y, r17.y
576 0x00002050:   if_nz r14.y
577 0x0000205C:     movc r15.xyz, r13.yyyy, r16.yzwy, r15.xyzx
578 0x00002080:     add r16.xyz, r10.xzzx, r15.xyzx
579 0x0000209C:     add r19.xyz, r11.xwwx, r15.xyzx
580 0x000020B8:     add r15.xyz, r11.ywwy, r15.xyzx
581 0x000020D4:     sample_l_indexable(texture3d)(float,float,float,float) r16.xyz, r16.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
582 0x00002108:     sample_l_indexable(texture3d)(float,float,float,float) r19.xyz, r19.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
583 0x0000213C:     sample_l_indexable(texture3d)(float,float,float,float) r15.xyz, r15.xyzx, t_EmittanceOdd.xyzw, s_VoxelTextureSampler, l(0.000000)
584 0x00002170:     mul r19.xyz, r6.yyyy, r19.xyzx
585 0x0000218C:     mad r16.xyz, r6.xxxx, r16.xyzx, r19.xyzx
586 0x000021B0:     mad r15.xyz, r6.zzzz, r15.xyzx, r16.xyzx
587 0x000021D4:     mad r18.xyz, r15.xyzx, r17.wwww, r18.xyzx
588 0x000021F8:     mov r17.x, l(-1)
589 0x0000220C:   endif 
590 // r18.xyz = final interpolated color
591 
592 // Add color contribution and update transparency for environment map
593 0x00002210:   mul r15.xyz, r3.wwww, r18.xyzx                                  // r15.xyz = scaled color = rEmittanceStorageScale.y * g_EmittanceScale * r18.xyz
594 0x0000222C:   div r13.y, r4.w, r14.z
595 0x00002248:   mul r13.y, r13.y, r13.y
596 0x00002264:   mul r14.yzw, r13.yyyy, r15.xxyz
597 0x00002280:   movc r14.yzw, r17.xxxx, r14.yyzw, r18.xxyz
598 0x000022A4:   lt r13.y, l(0.000000), r15.w
599 0x000022C0:   add r15.x, -r15.w, l(1.000000)
600 0x000022E0:   mul r15.y, r14.x, g_OpacityCorrectionFactor
601 0x00002300:   div r13.w, r15.y, r13.w
602 0x0000231C:   log r15.x, r15.x
603 0x00002330:   mul r13.w, r13.w, r15.x
604 0x0000234C:   exp r13.w, r13.w
605 0x00002360:   add r13.w, -r13.w, l(1.000000)
606 0x00002380:   and r13.y, r13.w, r13.y
607 0x0000239C:   mad r14.yzw, r10.wwww, r14.yyzw, r5.yyzw
608 0x000023C0:   add r13.y, -r13.y, l(1.000000)
609 0x000023E0:   mul r13.y, r8.w, r13.y
610 // r13.y = new transparency for environment map
611 //       = old transparency * (1 - ((1- intepolated opacity) ^ (step in voxels * g_OpacityCorrectionFactor / diameter in voxels))), if intepolated opacity < 1
612 //       = old transparency, otherwise
613 // r14.yzw = new indirect color
614 //         = old indirect color + intepolated color * the second last transparency
615 
616 // terminate cone tracing
617 0x000023FC:   lt r13.w, r9.w, l(0.000100)
618 0x00002418:   if_nz r13.w
619 0x00002424:     mov r5.yzw, r14.yyzw
620 0x00002438:     mov r8.w, r13.y
621 0x0000244C:     break 
622 0x00002450:   endif 
623 
624 0x00002454:   mad r12.w, r13.z, g_TracingStep, r12.w
625 0x0000247C:   mul r13.z, r14.x, FinestVoxelSize.y                             // r13.z = step length = step length in voxel count * voxel size
626 0x0000249C:   mad r12.xyz, r13.zzzz, r3.xyzx, r12.xyzx                        // r12.xyz = new sample position = step length * reflection vector + old sample position
627 0x000024C0:   add r13.x, r13.x, l(1.000000)                                   // r13.x = step count += 1
628 0x000024DC:   mov r5.yzw, r14.yyzw                                            // r5.yzw = indirect color
629 0x000024F0:   mov r13.z, r8.w                                                 // r13.z = tranparency
630 0x00002504:   mov r10.w, r9.w                                                 // r10.w = tranparency
631 0x00002518:   mov r8.w, r13.y                                                 // r8.w = new transparency for env map = r13.y
632 0x0000252C:   mov r9.w, r13.z                                                 // r9.w = transparency
633 0x00002540: endloop 
634 // r5.yzw = indirect light
635 // r8.w = latest transparency for environment map
636 // r9.w = last transparency for environment map
637 // r13.z = the second last transparency for environment map
638 
639 // sample environment map
640 0x00002544: add_sat r2.w, -r8.w, l(1.000000)
641 0x00002564: add r1.x, -r2.w, l(1.000000)
642 0x00002584: mul r1.xyz, r1.xxxx, g_EnvironmentMapTint.xyzx
643 0x000025A4: lt r4.xyz, l(0.000000, 0.000000, 0.000000, 0.000000), r1.xyzx
644 0x000025CC: or r3.w, r4.y, r4.x
645 0x000025E8: or r3.w, r4.z, r3.w
646 0x00002604: if_nz r3.w
647 0x00002610:   mul r3.w, r4.w, g_EnvironmentMapResolution
648 0x00002630:   log r3.w, r3.w
649 0x00002644:   add r3.w, r3.w, l(-1.000000)
650 0x00002660:   max r3.w, r3.w, l(0.000000)
651 0x0000267C:   min r3.w, r3.w, g_MaxEnvironmentMapMipLevel
652 0x0000269C:   sample_l_indexable(texturecube)(float,float,float,float) r3.xyz, r3.xyzx, t_EnvironmentMap.xyzw, s_EnvironmentMapSampler, r3.w
653 0x000026D0:   mul r1.xyz, r1.xyzx, r3.xyzx
654 0x000026EC:   mul r3.x, r4.w, r4.w
655 0x00002708:   mad r5.yzw, r1.xxyz, r3.xxxx, r5.yyzw
656 0x0000272C: endif 
657 // r5.yzw = indirect light
658 
659 // handle tamporal reprojection weight
660 0x00002730: mul r1.x, r1.w, r1.w
661 0x0000274C: mul r1.x, r1.x, l(3.141593)
662 0x00002768: div r2.xyz, r5.yzwy, r1.xxxx
663 0x00002784: if_nz r8.y
664 0x00002790:   mad r1.x, v0.x, l(2.000000), l(-1.000000)
665 0x000027B4:   mad r1.y, -v0.y, l(2.000000), l(1.000000)
666 0x000027DC:   mul r3.xyzw, r1.yyyy, g_ReprojectionMatrix.xyzw
667 0x000027FC:   mad r1.xyzw, r1.xxxx, g_ReprojectionMatrix.xyzw, r3.xyzw
668 0x00002824:   mad r1.xyzw, r0.xxxx, g_ReprojectionMatrix.xyzw, r1.xyzw
669 0x0000284C:   add r1.xyzw, r1.xyzw, g_ReprojectionMatrix.xyzw
670 0x0000286C:   ge r3.xyz, |r1.xyzx|, r1.wwww
671 0x0000288C:   or r0.x, r3.y, r3.x
672 0x000028A8:   or r0.x, r3.z, r0.x
673 0x000028C4:   ge r3.x, l(0.000000), r1.w
674 0x000028E0:   or r0.x, r0.x, r3.x
675 0x000028FC:   if_z r0.x
676 0x00002908:     div r1.xyz, r1.xyzx, r1.wwww
677 0x00002924:     mad r0.x, r1.x, l(0.500000), l(0.500000)
678 0x00002948:     mad r3.x, r0.x, viewportSize.z, viewportOrigin.x
679 0x00002974:     mad r0.x, -r1.y, l(0.500000), l(0.500000)
680 0x0000299C:     mad r3.y, r0.x, viewportSize.y, viewportOrigin.y
681 0x000029C8:     add r0.x, r1.z, -projectionA
682 0x000029EC:     div r0.x, projectionB, r0.x
683 0x00002A0C:     add r1.xyzw, r3.xyxy, l(-0.500000, -0.500000, -0.500000, 0.500000)
684 0x00002A34:     round_ni r1.xyzw, r1.xyzw
685 0x00002A48:     ftoi r4.xy, r1.xyxx
686 0x00002A5C:     mov r4.zw, l(0,0,0,0)
687 0x00002A7C:     ld_indexable(texture2d)(float,float,float,float) r3.z, r4.xyww, g_PrevDepthBuffer.yzxw
688 0x00002AA0:     mad r3.z, r3.z, depthScale, depthBias
689 0x00002ACC:     add r3.z, r3.z, -projectionA
690 0x00002AF0:     div r3.z, projectionB, r3.z
691 0x00002B10:     ld_indexable(texture2d)(float,float,float,float) r5.xyz, r4.xyww, g_PrevTargetNormal.xyzw
692 0x00002B34:     mad r5.xyz, r5.xyzx, normalScale.xxxx, normalBias.yyyy
693 0x00002B60:     dp3 r3.w, r5.xyzx, r5.xyzx
694 0x00002B7C:     sqrt r3.w, r3.w
695 0x00002B90:     div r5.xyz, r5.xyzx, r3.wwww
696 0x00002BAC:     ge r3.w, l(0.000000), r3.w
697 0x00002BC8:     movc r5.xyz, r3.wwww, l(0,0,0,0), r5.xyzx
698 0x00002BF8:     ld_indexable(texture2d)(float,float,float,float) r4.xyzw, r4.xyzw, g_PrevSpecular.xyzw
699 0x00002C1C:     add r3.z, r0.x, -r3.z
700 0x00002C3C:     mad_sat r3.z, -|r3.z|, g_ReprojectionDepthWeightScale, l(1.000000)
701 0x00002C68:     dp3_sat r3.w, r0.yzwy, r5.xyzx
702 0x00002C84:     log r3.w, r3.w
703 0x00002C98:     mul r3.w, r3.w, g_ReprojectionNormalWeightExponent
704 0x00002CB8:     exp r3.w, r3.w
705 0x00002CCC:     min r3.w, r3.w, l(1.000000)
706 0x00002CE8:     add r5.xyzw, -r1.xyzw, r3.xyxy
707 0x00002D08:     add r5.xyzw, r5.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
708 0x00002D30:     add r5.xyzw, -|r5.xyzw|, l(1.000000, 1.000000, 1.000000, 1.000000)
709 0x00002D5C:     mul_sat r1.xy, r5.ywyy, r5.xzxx
710 0x00002D78:     mul r3.z, r3.w, r3.z
711 0x00002D94:     mul r1.x, r1.x, r3.z
712 0x00002DB0:     and r3.z, r1.x, l(0x7f800000)
713 0x00002DCC:     ieq r3.z, r3.z, l(0x7f800000)
714 0x00002DE8:     and r5.xyzw, r4.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
715 0x00002E10:     ieq r5.xyzw, r5.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
716 0x00002E38:     or r3.w, r5.y, r5.x
717 0x00002E54:     or r3.w, r5.z, r3.w
718 0x00002E70:     or r3.w, r5.w, r3.w
719 0x00002E8C:     or r3.z, r3.w, r3.z
720 0x00002EA8:     mul r4.xyzw, r1.xxxx, r4.xyzw
721 0x00002EC4:     movc r4.xyzw, r3.zzzz, l(0,0,0,0), r4.xyzw
722 0x00002EF4:     movc r1.x, r3.z, l(0), r1.x
723 0x00002F18:     ftoi r5.xy, r1.zwzz
724 0x00002F2C:     mov r5.zw, l(0,0,0,0)
725 0x00002F4C:     ld_indexable(texture2d)(float,float,float,float) r1.z, r5.xyww, g_PrevDepthBuffer.yzxw
726 0x00002F70:     mad r1.z, r1.z, depthScale, depthBias
727 0x00002F9C:     add r1.z, r1.z, -projectionA
728 0x00002FC0:     div r1.z, projectionB, r1.z
729 0x00002FE0:     ld_indexable(texture2d)(float,float,float,float) r6.xyz, r5.xyww, g_PrevTargetNormal.xyzw
730 0x00003004:     mad r6.xyz, r6.xyzx, normalScale.xxxx, normalBias.yyyy
731 0x00003030:     dp3 r1.w, r6.xyzx, r6.xyzx
732 0x0000304C:     sqrt r1.w, r1.w
733 0x00003060:     div r6.xyz, r6.xyzx, r1.wwww
734 0x0000307C:     ge r1.w, l(0.000000), r1.w
735 0x00003098:     movc r6.xyz, r1.wwww, l(0,0,0,0), r6.xyzx
736 0x000030C8:     ld_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.xyzw, g_PrevSpecular.xyzw
737 0x000030EC:     add r1.z, r0.x, -r1.z
738 0x0000310C:     mad_sat r1.z, -|r1.z|, g_ReprojectionDepthWeightScale, l(1.000000)
739 0x00003138:     dp3_sat r1.w, r0.yzwy, r6.xyzx
740 0x00003154:     log r1.w, r1.w
741 0x00003168:     mul r1.w, r1.w, g_ReprojectionNormalWeightExponent
742 0x00003188:     exp r1.w, r1.w
743 0x0000319C:     min r1.w, r1.w, l(1.000000)
744 0x000031B8:     mul r1.z, r1.w, r1.z
745 0x000031D4:     mul r1.w, r1.y, r1.z
746 0x000031F0:     and r3.z, r1.w, l(0x7f800000)
747 0x0000320C:     ieq r3.z, r3.z, l(0x7f800000)
748 0x00003228:     and r6.xyzw, r5.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
749 0x00003250:     ieq r6.xyzw, r6.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
750 0x00003278:     or r3.w, r6.y, r6.x
751 0x00003294:     or r3.w, r6.z, r3.w
752 0x000032B0:     or r3.w, r6.w, r3.w
753 0x000032CC:     or r3.z, r3.w, r3.z
754 0x000032E8:     mad r5.xyzw, r5.xyzw, r1.wwww, r4.xyzw
755 0x0000330C:     mad r1.y, r1.z, r1.y, r1.x
756 0x00003330:     movc r4.xyzw, r3.zzzz, r4.xyzw, r5.xyzw
757 0x00003354:     movc r1.x, r3.z, r1.x, r1.y
758 0x00003378:     add r5.xyzw, r3.xyxy, l(0.500000, -0.500000, 0.500000, 0.500000)
759 0x000033A0:     round_ni r5.xyzw, r5.xyzw
760 0x000033B4:     ftoi r6.xy, r5.xyxx
761 0x000033C8:     mov r6.zw, l(0,0,0,0)
762 0x000033E8:     ld_indexable(texture2d)(float,float,float,float) r1.y, r6.xyww, g_PrevDepthBuffer.yxzw
763 0x0000340C:     mad r1.y, r1.y, depthScale, depthBias
764 0x00003438:     add r1.y, r1.y, -projectionA
765 0x0000345C:     div r1.y, projectionB, r1.y
766 0x0000347C:     ld_indexable(texture2d)(float,float,float,float) r7.xyz, r6.xyww, g_PrevTargetNormal.xyzw
767 0x000034A0:     mad r7.xyz, r7.xyzx, normalScale.xxxx, normalBias.yyyy
768 0x000034CC:     dp3 r1.z, r7.xyzx, r7.xyzx
769 0x000034E8:     sqrt r1.z, r1.z
770 0x000034FC:     div r7.xyz, r7.xyzx, r1.zzzz
771 0x00003518:     ge r1.z, l(0.000000), r1.z
772 0x00003534:     movc r7.xyz, r1.zzzz, l(0,0,0,0), r7.xyzx
773 0x00003564:     ld_indexable(texture2d)(float,float,float,float) r6.xyzw, r6.xyzw, g_PrevSpecular.xyzw
774 0x00003588:     add r1.y, r0.x, -r1.y
775 0x000035A8:     mad_sat r1.y, -|r1.y|, g_ReprojectionDepthWeightScale, l(1.000000)
776 0x000035D4:     dp3_sat r1.z, r0.yzwy, r7.xyzx
777 0x000035F0:     log r1.z, r1.z
778 0x00003604:     mul r1.z, r1.z, cg_ReprojectionNormalWeightExponent
779 0x00003624:     exp r1.z, r1.z
780 0x00003638:     min r1.z, r1.z, l(1.000000)
781 0x00003654:     add r3.xyzw, r3.xyxy, -r5.xyzw
782 0x00003674:     add r3.xyzw, r3.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000)
783 0x0000369C:     add r3.xyzw, -|r3.xyzw|, l(1.000000, 1.000000, 1.000000, 1.000000)
784 0x000036C8:     mul_sat r3.xy, r3.ywyy, r3.xzxx
785 0x000036E4:     mul r1.y, r1.z, r1.y
786 0x00003700:     mul r1.z, r3.x, r1.y
787 0x0000371C:     and r1.w, r1.z, l(0x7f800000)
788 0x00003738:     ieq r1.w, r1.w, l(0x7f800000)
789 0x00003754:     and r7.xyzw, r6.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
790 0x0000377C:     ieq r7.xyzw, r7.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
791 0x000037A4:     or r3.z, r7.y, r7.x
792 0x000037C0:     or r3.z, r7.z, r3.z
793 0x000037DC:     or r3.z, r7.w, r3.z
794 0x000037F8:     or r1.w, r1.w, r3.z
795 0x00003814:     mad r6.xyzw, r6.xyzw, r1.zzzz, r4.xyzw
796 0x00003838:     mad r1.y, r1.y, r3.x, r1.x
797 0x0000385C:     movc r4.xyzw, r1.wwww, r4.xyzw, r6.xyzw
798 0x00003880:     movc r1.x, r1.w, r1.x, r1.y
799 0x000038A4:     ftoi r5.xy, r5.zwzz
800 0x000038B8:     mov r5.zw, l(0,0,0,0)
801 0x000038D8:     ld_indexable(texture2d)(float,float,float,float) r1.y, r5.xyww, g_PrevDepthBuffer.yxzw
802 0x000038FC:     mad r1.y, r1.y, depthScale, depthBias
803 0x00003928:     add r1.y, r1.y, -projectionA
804 0x0000394C:     div r1.y, projectionB, r1.y
805 0x0000396C:     ld_indexable(texture2d)(float,float,float,float) r3.xzw, r5.xyww, g_PrevTargetNormal.xwyz
806 0x00003990:     mad r3.xzw, r3.xxzw, normalScale.xxxx, normalBias.yyyy
807 0x000039BC:     dp3 r1.z, r3.xzwx, r3.xzwx
808 0x000039D8:     sqrt r1.z, r1.z
809 0x000039EC:     div r3.xzw, r3.xxzw, r1.zzzz
810 0x00003A08:     ge r1.z, l(0.000000), r1.z
811 0x00003A24:     movc r3.xzw, r1.zzzz, l(0,0,0,0), r3.xxzw
812 0x00003A54:     ld_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.xyzw, g_PrevSpecular.xyzw
813 0x00003A78:     add r0.x, r0.x, -r1.y
814 0x00003A98:     mad_sat r0.x, -|r0.x|, g_ReprojectionDepthWeightScale, l(1.000000)
815 0x00003AC4:     dp3_sat r0.y, r0.yzwy, r3.xzwx
816 0x00003AE0:     log r0.y, r0.y
817 0x00003AF4:     mul r0.y, r0.y, g_ReprojectionNormalWeightExponent
818 0x00003B14:     exp r0.y, r0.y
819 0x00003B28:     min r0.y, r0.y, l(1.000000)
820 0x00003B44:     mul r0.x, r0.y, r0.x
821 0x00003B60:     mul r0.y, r3.y, r0.x
822 0x00003B7C:     and r0.z, r0.y, l(0x7f800000)
823 0x00003B98:     ieq r0.z, r0.z, l(0x7f800000)
824 0x00003BB4:     and r6.xyzw, r5.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
825 0x00003BDC:     ieq r6.xyzw, r6.xyzw, l(0x7f800000, 0x7f800000, 0x7f800000, 0x7f800000)
826 0x00003C04:     or r0.w, r6.y, r6.x
827 0x00003C20:     or r0.w, r6.z, r0.w
828 0x00003C3C:     or r0.w, r6.w, r0.w
829 0x00003C58:     or r0.z, r0.w, r0.z
830 0x00003C74:     mad r5.xyzw, r5.xyzw, r0.yyyy, r4.xyzw
831 0x00003C98:     mad r0.x, r0.x, r3.y, r1.x
832 0x00003CBC:     movc r3.xyzw, r0.zzzz, r4.xyzw, r5.xyzw
833 0x00003CE0:     movc r0.x, r0.z, r1.x, r0.x
834 0x00003D04:   else 
835 0x00003D08:     mov r3.xyzw, l(0,0,0,0)
836 0x00003D28:     mov r0.x, l(0)
837 0x00003D3C:   endif 
838 0x00003D40:   mad r0.x, -r0.x, g_TemporalReprojectionWeight, l(1.000000)
839 0x00003D6C:   mul r1.xyzw, r3.xyzw, g_TemporalReprojectionWeight.zzzz
840 0x00003D8C:   mad r2.xyzw, r2.xyzw, r0.xxxx, r1.xyzw
841 0x00003DB0: endif 
842 
843 0x00003DB4: and r0.x, r2.x, l(0x7f800000)
844 0x00003DD0: ieq r0.x, r0.x, l(0x7f800000)
845 0x00003DEC: movc o0.x, r0.x, l(0), r2.x
846 0x00003E10: and r0.x, r2.y, l(0x7f800000)
847 0x00003E2C: ieq r0.x, r0.x, l(0x7f800000)
848 0x00003E48: movc o0.y, r0.x, l(0), r2.y
849 0x00003E6C: and r0.x, r2.z, l(0x7f800000)
850 0x00003E88: ieq r0.x, r0.x, l(0x7f800000)
851 0x00003EA4: movc o0.z, r0.x, l(0), r2.z
852 0x00003EC8: and r0.x, r2.w, l(0x7f800000)
853 0x00003EE4: ieq r0.x, r0.x, l(0x7f800000)
854 0x00003F00: movc o0.w, r0.x, l(0), r2.w
855 0x00003F24: ret 
856 // Approximately 521 instruction slots used

 


 

posted @ 2018-08-22 14:13  dydx  阅读(543)  评论(0编辑  收藏  举报