Skip to content

Commit 0d1cd50

Browse files
Merge pull request #217 from Devsh-Graphics-Programming/ex71_hotfixes
fixes usage of PCG32 rng in ex71
2 parents a784f91 + 62ffafb commit 0d1cd50

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

71_RayTracingPipeline/app_resources/common.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ struct MaterialId
214214

215215
struct [raypayload] PrimaryPayload
216216
{
217-
using generator_t = nbl::hlsl::random::Pcg;
217+
using generator_t = nbl::hlsl::random::PCG32;
218218

219219
float32_t3 worldNormal : read(caller) : write(closesthit);
220220
float32_t rayDistance : read(caller) : write(closesthit,miss);

71_RayTracingPipeline/app_resources/raytrace.rgen.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ void main()
2929
const uint32_t3 launchSize = spirv::LaunchSizeKHR;
3030
const uint32_t2 coords = launchID.xy;
3131

32-
const uint32_t seed1 = nbl::hlsl::random::Pcg::create(pc.frameCounter)();
33-
const uint32_t seed2 = nbl::hlsl::random::Pcg::create(launchID.y * launchSize.x + launchID.x)();
32+
const uint32_t seed1 = nbl::hlsl::random::PCG32::construct(pc.frameCounter)();
33+
const uint32_t seed2 = nbl::hlsl::random::PCG32::construct(launchID.y * launchSize.x + launchID.x)();
3434
nbl::hlsl::Xoroshiro64StarStar rnd = nbl::hlsl::Xoroshiro64StarStar::construct(uint32_t2(seed1, seed2));
3535

3636
float32_t3 hitValues = float32_t3(0, 0, 0);
@@ -57,7 +57,7 @@ void main()
5757

5858
[[vk::ext_storage_class(spv::StorageClassRayPayloadKHR)]]
5959
PrimaryPayload payload;
60-
payload.pcg = PrimaryPayload::generator_t::create(rnd());
60+
payload.pcg = PrimaryPayload::generator_t::construct(rnd());
6161
spirv::traceRayKHR(topLevelAS, spv::RayFlagsMaskNone, 0xff, ERT_PRIMARY, 0, EMT_PRIMARY, rayDesc.Origin, rayDesc.TMin, rayDesc.Direction, rayDesc.TMax, payload);
6262
// TraceRay(topLevelAS, RAY_FLAG_NONE, 0xff, ERT_PRIMARY, 0, EMT_PRIMARY, rayDesc, payload);
6363

0 commit comments

Comments
 (0)