Skip to content

Commit 9f5d027

Browse files
My bad @Crisspl , global variable bit me in the ass.... although we need it, cause GLSL!
1 parent 1ec971e commit 9f5d027

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples_tests/22.RaytracedAO/raygen.comp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ void main()
117117

118118
nbl_glsl_xoroshiro64star_state_t scramble_start_state; // this should get advanced for secondary rays by 3 or 4 iterations
119119

120-
nbl_glsl_MC_precomputed_t precomputed;
121120
nbl_glsl_MC_instr_stream_t gcs;
122121
nbl_glsl_MC_instr_stream_t rnps;
122+
nbl_glsl_MC_precomputed_t precomputed;
123123

124124
const bool nonBackgroudPixel = revdepth>0.0;
125125
if (nonBackgroudPixel)
@@ -163,7 +163,6 @@ void main()
163163
nbl_glsl_MC_oriented_material_t material = nbl_glsl_MC_material_data_t_getOriented(InstData.data[objectID].material,frontfacing);
164164

165165
// use loaded data
166-
precomputed = nbl_glsl_MC_precomputeData(frontfacing);
167166
emissive = nbl_glsl_MC_oriented_material_t_getEmissive(material);
168167
gcs = nbl_glsl_MC_oriented_material_t_getGenChoiceStream(material);
169168
rnps = nbl_glsl_MC_oriented_material_t_getRemAndPdfStream(material);
@@ -173,6 +172,9 @@ void main()
173172
normalizedN.x = dot(InstData.data[objectID].normalMatrixRow0,normal);
174173
normalizedN.y = dot(InstData.data[objectID].normalMatrixRow1,normal);
175174
normalizedN.z = dot(InstData.data[objectID].normalMatrixRow2,normal);
175+
176+
// need to do this after we have world, V and N ready
177+
precomputed = nbl_glsl_MC_precomputeData(frontfacing);
176178

177179
// prefetch textures and normals
178180
#ifdef TEX_PREFETCH_STREAM

0 commit comments

Comments
 (0)