summaryrefslogtreecommitdiffstats
path: root/tests/compute/half-structured-buffer.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-03-18 18:19:26 -0400
committerGitHub <noreply@github.com>2019-03-18 18:19:26 -0400
commit71885de27c973a73b7d020f5ebbe86e16b86d7e4 (patch)
tree1d4ab43ac820fdb88611ce587f7613e13a58c6d2 /tests/compute/half-structured-buffer.slang
parent70048715cec251a23871747e342e5cf938c97255 (diff)
First pass support for half on vk (#912)
* Look at getting half to work on vk. * Alter half test so can always produce consistent test results. * First pass working half on vk. * Improve comments for vulkan extensions around half. * Upgraded vulkan headers to v1.1.103 https://github.com/KhronosGroup/Vulkan-Headers * * Add getFeatures on Render interface * Vulkan renderer determines at startup if it can support half * Parse render-features on render-test * Small changes to half-calc.slang test. * Structured buffer half access works as expected for Vk, but isn't for dx12, so disable for now. * Require the half feature for renderers for the half-structured-buffer.slang test. * * Added ToolReturnCode to be more rigerous about how a return code is passed back from a tool * Added support for a tool being able to pass back an 'ignored' result. * Used enum codes to indicate meanings * Made spawnAndWait return a ToolReturnCode * Ignore tests that don't have required render-feature * Fix macro line continuation usage. * Check dx12 has half support. * Checking for half on dx12 - if CheckFeatureSupport fails, don't fail renderer initialization. * Fix typo.
Diffstat (limited to 'tests/compute/half-structured-buffer.slang')
-rw-r--r--tests/compute/half-structured-buffer.slang30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/compute/half-structured-buffer.slang b/tests/compute/half-structured-buffer.slang
new file mode 100644
index 000000000..e67aba55e
--- /dev/null
+++ b/tests/compute/half-structured-buffer.slang
@@ -0,0 +1,30 @@
+//TEST(compute):COMPARE_COMPUTE:-vk -compute -profile cs_6_2 -render-features half
+//Disable on Dx12 for now - because writing to structured buffer produces unexpected results
+//DISABLE_TEST(compute):COMPARE_COMPUTE:-dx12 -compute -use-dxil -profile cs_6_2 -render-features half
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=16):dxbinding(0),glbinding(0),out
+
+struct Thing
+{
+ uint pos;
+ float radius;
+ half4 color;
+};
+
+RWStructuredBuffer<Thing> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float v = float(tid);
+
+ float base = v* 4.0f;
+
+ Thing thing;
+ thing.pos = tid;
+ thing.color = half4(base, base + 1.0f, base + 2.0f, base + 3.0f);
+ thing.radius = v;
+
+ outputBuffer[tid] = thing;
+} \ No newline at end of file