Created a new example to test the compilation and concepts of samplers#252
Created a new example to test the compilation and concepts of samplers#252karimsayedre wants to merge 2 commits intomasterfrom
Conversation
| // Compile test: instantiate sampling types to verify DXC compilation | ||
| #include <nbl/builtin/hlsl/sampling/concentric_mapping.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/linear.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/bilinear.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/uniform_spheres.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/cos_weighted_spheres.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/box_muller_transform.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/spherical_triangle.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/projected_spherical_triangle.hlsl> | ||
| #include <nbl/builtin/hlsl/sampling/spherical_rectangle.hlsl> | ||
| using namespace nbl::hlsl; | ||
|
|
||
| [[vk::binding(0, 0)]] RWStructuredBuffer<float32_t4> output; | ||
|
|
||
| [numthreads(1, 1, 1)] void main() | ||
| { | ||
| float32_t2 u2 = float32_t2(0.5, 0.5); | ||
| float32_t3 u3 = float32_t3(0.5, 0.5, 0.5); | ||
| float32_t4 acc = float32_t4(0, 0, 0, 0); | ||
|
|
||
| // concentric mapping (free function) | ||
| float32_t2 concentric = sampling::concentricMapping<float32_t>(u2); | ||
| acc.xy += concentric; | ||
|
|
||
| // Linear | ||
| sampling::Linear<float32_t> lin = sampling::Linear<float32_t>::create(u2); | ||
| acc.x += lin.generate(0.5f); | ||
|
|
||
| // Bilinear | ||
| sampling::Bilinear<float32_t> bilinear = sampling::Bilinear<float32_t>::create(float32_t4(1, 2, 3, 4)); | ||
| float32_t rcpPdf; | ||
| float32_t2 bilSample = bilinear.generate(rcpPdf, u2); | ||
| acc.xy += bilSample; | ||
| acc.z += rcpPdf; | ||
|
|
There was a problem hiding this comment.
could you use the Testing harness introduced by @Przemog1 to actually run this with some random number seed and compare results between CPU and GPU
There was a problem hiding this comment.
Actually lets turn it up to 11, and make a benchmark of samplers, requires one entry point & pipelineper sampler though to have meaningful tests for spilling, register usage etc.
There was a problem hiding this comment.
and you also need a unit test which does Jacobian testing on all Bijective Samplers
CMakeLists.txt
Outdated
| endif() | ||
|
|
||
| add_subdirectory(74_QuantizedSequenceTests) | ||
| add_subdirectory(75_HLSLSamplingTests) |
There was a problem hiding this comment.
the example should have a low number like the BxDF unit tests, since its so foundational (actually bXdfs depend somewhat on the samplers - at least the basic projected hemisphere and sphere ones)
There was a problem hiding this comment.
Don't want to collide with other examples, 37 is good?
No description provided.