@@ -298,6 +298,10 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_SPHERE, PPM>
298298 using sample_type = LightSample;
299299 using ray_dir_info_type = typename sample_type::ray_dir_info_type;
300300
301+ // affected by https://github.com/microsoft/DirectXShaderCompiler/issues/7007
302+ // NBL_CONSTEXPR_STATIC_INLINE PTPolygonMethod PolygonMethod = PPM;
303+ enum : uint16_t { PolygonMethod = PPM };
304+
301305 static spectral_type deferredEvalAndPdf (NBL_REF_ARG (scalar_type) pdf, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (ray_type) ray)
302306 {
303307 pdf = 1.0 / scene.lightCount;
@@ -311,19 +315,17 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_SPHERE, PPM>
311315
312316 static sample_type generate_and_quotient_and_pdf (NBL_REF_ARG (quotient_pdf_type) quotient_pdf, NBL_REF_ARG (scalar_type) newRayMaxT, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (vector3_type) origin, NBL_CONST_REF_ARG (interaction_type) interaction, bool isBSDF, NBL_CONST_REF_ARG (vector3_type) xi, uint32_t depth)
313317 {
314- sample_type L;
315- scalar_type pdf;
316-
317318 const light_type light = scene.lights[lightID];
318319 const Shape<PST_SPHERE> sphere = scene.spheres[light.objectID.id];
319320 const ShapeSampling<PST_SPHERE, PPM> sampling = ShapeSampling<PST_SPHERE, PPM>::create (sphere);
320321
322+ scalar_type pdf;
321323 const vector3_type sampleL = sampling.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
322324 const vector3_type V = interaction.isotropic.V.getDirection ();
323325 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
324326 ray_dir_info_type rayL;
325327 rayL.direction = sampleL;
326- L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
328+ sample_type L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
327329
328330 newRayMaxT *= Tolerance<scalar_type>::getEnd (depth);
329331 pdf *= 1.0 / scalar_type (scene.lightCount);
@@ -348,6 +350,9 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_TRIANGLE, PP
348350 using sample_type = LightSample;
349351 using ray_dir_info_type = typename sample_type::ray_dir_info_type;
350352
353+ // NBL_CONSTEXPR_STATIC_INLINE PTPolygonMethod PolygonMethod = PPM;
354+ enum : uint16_t { PolygonMethod = PPM };
355+
351356 static spectral_type deferredEvalAndPdf (NBL_REF_ARG (scalar_type) pdf, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (ray_type) ray)
352357 {
353358 pdf = 1.0 / scene.lightCount;
@@ -361,19 +366,17 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_TRIANGLE, PP
361366
362367 static sample_type generate_and_quotient_and_pdf (NBL_REF_ARG (quotient_pdf_type) quotient_pdf, NBL_REF_ARG (scalar_type) newRayMaxT, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (vector3_type) origin, NBL_CONST_REF_ARG (interaction_type) interaction, bool isBSDF, NBL_CONST_REF_ARG (vector3_type) xi, uint32_t depth)
363368 {
364- sample_type L;
365- scalar_type pdf;
366-
367369 const light_type light = scene.lights[lightID];
368370 const Shape<PST_TRIANGLE> tri = scene.triangles[light.objectID.id];
369371 const ShapeSampling<PST_TRIANGLE, PPM> sampling = ShapeSampling<PST_TRIANGLE, PPM>::create (tri);
370372
373+ scalar_type pdf;
371374 const vector3_type sampleL = sampling.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
372375 const vector3_type V = interaction.isotropic.V.getDirection ();
373376 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
374377 ray_dir_info_type rayL;
375378 rayL.direction = sampleL;
376- L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
379+ sample_type L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
377380
378381 newRayMaxT *= Tolerance<scalar_type>::getEnd (depth);
379382 pdf *= 1.0 / scalar_type (scene.lightCount);
@@ -398,6 +401,9 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_RECTANGLE, P
398401 using sample_type = LightSample;
399402 using ray_dir_info_type = typename sample_type::ray_dir_info_type;
400403
404+ // NBL_CONSTEXPR_STATIC_INLINE PTPolygonMethod PolygonMethod = PPM;
405+ enum : uint16_t { PolygonMethod = PPM };
406+
401407 static spectral_type deferredEvalAndPdf (NBL_REF_ARG (scalar_type) pdf, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (ray_type) ray)
402408 {
403409 pdf = 1.0 / scene.lightCount;
@@ -411,19 +417,17 @@ struct Estimator<Scene, Ray, LightSample, Aniso, IM_PROCEDURAL, PST_RECTANGLE, P
411417
412418 static sample_type generate_and_quotient_and_pdf (NBL_REF_ARG (quotient_pdf_type) quotient_pdf, NBL_REF_ARG (scalar_type) newRayMaxT, NBL_CONST_REF_ARG (scene_type) scene, uint32_t lightID, NBL_CONST_REF_ARG (vector3_type) origin, NBL_CONST_REF_ARG (interaction_type) interaction, bool isBSDF, NBL_CONST_REF_ARG (vector3_type) xi, uint32_t depth)
413419 {
414- sample_type L;
415- scalar_type pdf;
416-
417420 const light_type light = scene.lights[lightID];
418421 const Shape<PST_RECTANGLE> rect = scene.rectangles[light.objectID.id];
419422 const ShapeSampling<PST_RECTANGLE, PPM> sampling = ShapeSampling<PST_RECTANGLE, PPM>::create (rect);
420423
424+ scalar_type pdf;
421425 const vector3_type sampleL = sampling.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
422426 const vector3_type V = interaction.isotropic.V.getDirection ();
423427 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
424428 ray_dir_info_type rayL;
425429 rayL.direction = sampleL;
426- L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
430+ sample_type L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
427431
428432 newRayMaxT *= Tolerance<scalar_type>::getEnd (depth);
429433 pdf *= 1.0 / scalar_type (scene.lightCount);
0 commit comments