From 82120582c0afda96f813f2f22533c772bb1df270 Mon Sep 17 00:00:00 2001 From: Julius Ikkala Date: Tue, 11 Oct 2022 19:10:38 +0300 Subject: [PATCH] Fix broken first-bounce random seed --- external/fuchsia_radix_sort | 2 +- shader/random_sampler.glsl | 2 +- shader/sampling_sobol_owen.glsl | 2 +- src/aabb_scene.cc | 8 +++----- src/context.hh | 1 + src/mesh.cc | 8 +++----- src/scene.cc | 8 +++----- 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/external/fuchsia_radix_sort b/external/fuchsia_radix_sort index 4165014..828b329 160000 --- a/external/fuchsia_radix_sort +++ b/external/fuchsia_radix_sort @@ -1 +1 @@ -Subproject commit 4165014fb8dd77effeb046a874236e15113dd4de +Subproject commit 828b329ec6f49fbb64bff3bc118bea46f18e5e4a diff --git a/shader/random_sampler.glsl b/shader/random_sampler.glsl index 4dd66f4..3aa10a8 100644 --- a/shader/random_sampler.glsl +++ b/shader/random_sampler.glsl @@ -29,7 +29,7 @@ random_sampler init_random_sampler( uvec4 coord, uvec3 size ){ random_sampler rsampler; - rsampler.seed = coord; + rsampler.seed = pcg4d(coord); return rsampler; } diff --git a/shader/sampling_sobol_owen.glsl b/shader/sampling_sobol_owen.glsl index 028fd0a..33490df 100644 --- a/shader/sampling_sobol_owen.glsl +++ b/shader/sampling_sobol_owen.glsl @@ -90,7 +90,7 @@ vec4 get_shuffled_scrambled_sobol_pt(sobol_sampler ssampler, uint bounce) sobol_sampler init_sobol_sampler(uvec4 seed) { sobol_sampler ssampler; - ssampler.seed = seed; + ssampler.seed = pcg4d(seed); return ssampler; } #endif diff --git a/src/aabb_scene.cc b/src/aabb_scene.cc index dde8553..6eca0d6 100644 --- a/src/aabb_scene.cc +++ b/src/aabb_scene.cc @@ -183,12 +183,10 @@ void aabb_scene::init_acceleration_structures(const char* timer_name) vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace| vk::BuildAccelerationStructureFlagBitsKHR::eAllowUpdate, vk::BuildAccelerationStructureModeKHR::eBuild, - {}, - {}, + VK_NULL_HANDLE, + VK_NULL_HANDLE, 1, - &geom, - {}, - {} + &geom ); vk::AccelerationStructureBuildSizesInfoKHR size_info = diff --git a/src/context.hh b/src/context.hh index c7f96b0..c90f1d2 100644 --- a/src/context.hh +++ b/src/context.hh @@ -7,6 +7,7 @@ #include "render_target.hh" #include #include +#include #include #include diff --git a/src/mesh.cc b/src/mesh.cc index 58e5221..188a455 100644 --- a/src/mesh.cc +++ b/src/mesh.cc @@ -40,12 +40,10 @@ void build_acceleration_structure( vk::AccelerationStructureTypeKHR::eBottomLevel, {}, vk::BuildAccelerationStructureModeKHR::eBuild, - {}, - {}, + VK_NULL_HANDLE, + VK_NULL_HANDLE, 1, - &geom, - {}, - {} + &geom ); if(static_as) diff --git a/src/scene.cc b/src/scene.cc index 4f3dffe..a2fd833 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -346,12 +346,10 @@ void scene::init_tlas(size_t i) vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace| vk::BuildAccelerationStructureFlagBitsKHR::eAllowUpdate, vk::BuildAccelerationStructureModeKHR::eBuild, - {}, - {}, + VK_NULL_HANDLE, + VK_NULL_HANDLE, 1, - &geom, - {}, - {} + &geom ); vk::AccelerationStructureBuildSizesInfoKHR size_info =