summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-08-04 19:34:33 -0400
committerGitHub <noreply@github.com>2020-08-04 16:34:33 -0700
commit092337a67e7ef8ec108cab9cb6679e59bb2ff791 (patch)
tree9effc33e878c022f8b63bf883f68bb32aff26edc /tests
parentde309d939199ec3fef1dacf23b502b7f209e37a1 (diff)
Sampler Feedback improvements (#1475)
* Add the Feedback texture types. Depreciate SLANG_RESOURCE_EXT_SHAPE_MASK. * Starting point to test sampler feedback. * WIP on FeedbackSampler. * Use __target_intrinsic to override the output of sampler feedback types. * Use newer generic syntax for FeedbackTexture. * Reflects Feedback type. * SLANG_TYPE_KIND_TEXTURE_FEEDBACK -> SLANG_TYPE_KIND_FEEDBACK * Added reflection test. * Reneable issue with generics in sampler-feedback-basic.slang * Add methods to FeedbackTexture2D/Array. Make test cover test cases. * Sampler feedback produces DXC code. * Disabled Sampler feedback test - as requires newer version of DXC. * Fix bug in reflection tool output. * Fix problem with direct-spirv-emit.slang.expected due to update to glslang. * Fix direct-spirv-emit.slang * Use SLANG_RESOURCE_EXT_SHAPE_MASK again * Make Feedback be emitted as a textue type prefix. * Add support for GetDimensions to FeedbackTexture2D * WIP on CPU sampler feedback. Update of target compatibility. * Fix some bugs in C++ feedback sampler. Fix GetDimensions for FeedbackTextures. Run 'Compile' test for CPU compute feedback texture test. Update target-compatability.md * Fix GetDimensions call on feedback sampler. * Small documentation improvements. Co-authored-by: Tim Foley <tfoleyNV@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl-intrinsic/sampler-feedback/compute-sampler-feedback.slang43
-rw-r--r--tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang5
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/hlsl-intrinsic/sampler-feedback/compute-sampler-feedback.slang b/tests/hlsl-intrinsic/sampler-feedback/compute-sampler-feedback.slang
new file mode 100644
index 000000000..c5fd93ca4
--- /dev/null
+++ b/tests/hlsl-intrinsic/sampler-feedback/compute-sampler-feedback.slang
@@ -0,0 +1,43 @@
+//TEST:COMPILE: -entry computeMain -stage compute -target dll tests/hlsl-intrinsic/sampler-feedback/compute-sampler-feedback.slang
+
+// Not available on non PS shader
+// dx.op.writeSamplerFeedback WriteSamplerFeedback
+// dx.op.writeSamplerFeedbackBias WriteSamplerFeedbackBias
+
+FeedbackTexture2D<SAMPLER_FEEDBACK_MIN_MIP> feedbackMinMip;
+FeedbackTexture2D<SAMPLER_FEEDBACK_MIP_REGION_USED> feedbackMipRegionUsed;
+FeedbackTexture2DArray<SAMPLER_FEEDBACK_MIN_MIP> feedbackMinMipArray;
+FeedbackTexture2DArray<SAMPLER_FEEDBACK_MIP_REGION_USED> feebackMipRegionUsedArray;
+
+Texture2D<float> tex2D;
+Texture2DArray<float> tex2DArray;
+SamplerState samp;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ float2 coords2D = float2(1, 2) * dispatchThreadID.x;
+ float3 coords2DArray = float3(1, 2, 3) * dispatchThreadID.x;
+
+ float clamp = 4;
+ float bias = 0.5F;
+ float lod = 6;
+ float2 ddx = float2(1.0F / 32, 2.0F / 32);
+ float2 ddy = float2(3.0F / 32, 4.0F / 32);
+
+ uint width, height, elements, mipLevels;
+ feedbackMinMip.GetDimensions(width, height);
+ feedbackMinMipArray.GetDimensions(width, height, elements);
+
+ feedbackMinMip.GetDimensions(0, width, height, mipLevels);
+ feedbackMinMipArray.GetDimensions(0, width, height, elements, mipLevels);
+
+
+ feedbackMinMip.WriteSamplerFeedbackGrad(tex2D, samp, coords2D, ddx, ddy, clamp);
+
+ // Level
+ feedbackMinMip.WriteSamplerFeedbackLevel(tex2D, samp, coords2D, lod);
+
+ // No Clamp
+ feedbackMinMip.WriteSamplerFeedbackGrad(tex2D, samp, coords2D, ddx, ddy);
+}
diff --git a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang
index 9e707b229..3b9497e5e 100644
--- a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang
+++ b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang
@@ -20,6 +20,11 @@ float4 main() : SV_Target
float lod = 6;
float2 ddx = float2(1.0F / 32, 2.0F / 32);
float2 ddy = float2(3.0F / 32, 4.0F / 32);
+
+ uint width, height, elements;
+ feedbackMinMip.GetDimensions(width, height);
+
+ feedbackMinMipArray.GetDimensions(width, height, elements);
// Clamped
feedbackMinMip.WriteSamplerFeedback(tex2D, samp, coords2D, clamp);