Created a new example to test the compilation and concepts of samplers#252
Open
karimsayedre wants to merge 2 commits intomasterfrom
Open
Created a new example to test the compilation and concepts of samplers#252karimsayedre wants to merge 2 commits intomasterfrom
karimsayedre wants to merge 2 commits intomasterfrom
Conversation
Comment on lines
1
to
35
| // 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.