From 66bae403827a37bdc587f3356cc58fde166d04a1 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 14 Jul 2017 14:38:13 -0700 Subject: Add reflection support for GLSL thread-group-size modifier Fixes #15 These are the modifiers like: layout(local_size_x = 16) in; Unlike the HLSL case, these don't get attache to the entry point function itself, so there is a bit more work involed in looking them up. Just to make sure I didn't mess up the HLSL case, I went ahead and added two tests for this capability: one for GLSL and one for HLSL. --- tests/reflection/thread-group-size.comp | 18 ++++++++++ tests/reflection/thread-group-size.comp.expected | 42 ++++++++++++++++++++++++ tests/reflection/thread-group-size.hlsl | 11 +++++++ tests/reflection/thread-group-size.hlsl.expected | 39 ++++++++++++++++++++++ 4 files changed, 110 insertions(+) create mode 100644 tests/reflection/thread-group-size.comp create mode 100644 tests/reflection/thread-group-size.comp.expected create mode 100644 tests/reflection/thread-group-size.hlsl create mode 100644 tests/reflection/thread-group-size.hlsl.expected (limited to 'tests/reflection') diff --git a/tests/reflection/thread-group-size.comp b/tests/reflection/thread-group-size.comp new file mode 100644 index 000000000..2edf2c2df --- /dev/null +++ b/tests/reflection/thread-group-size.comp @@ -0,0 +1,18 @@ +//TEST:SIMPLE:-no-checking -target reflection-json + +// Confirm that we provide reflection data for the `local_size_*` attributes + +layout(local_size_x = 3) in; + +layout(local_size_y = 5, local_size_z = 7) in; + +buffer B +{ + float b[]; +}; + +void main() +{ + uint tid = gl_GlobalInvocationID.x; + b[tid] = b[tid + 1] + 1.0f; +} \ No newline at end of file diff --git a/tests/reflection/thread-group-size.comp.expected b/tests/reflection/thread-group-size.comp.expected new file mode 100644 index 000000000..ea7e97851 --- /dev/null +++ b/tests/reflection/thread-group-size.comp.expected @@ -0,0 +1,42 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "B", + "binding": {"kind": "descriptorTableSlot", "index": 0}, + "type": { + "kind": "shaderStorageBuffer", + "elementType": { + "kind": "struct", + "fields": [ + { + "name": "b", + "type": { + "kind": "array", + "elementCount": 0, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + }, + "bindings": [ + + ] + } + ] + } + } + } + ], + "entryPoints": [ + { + "name": "main", + "stage:": "compute", + "threadGroupSize": [3, 5, 7] + } + ] +} +} diff --git a/tests/reflection/thread-group-size.hlsl b/tests/reflection/thread-group-size.hlsl new file mode 100644 index 000000000..650a41e46 --- /dev/null +++ b/tests/reflection/thread-group-size.hlsl @@ -0,0 +1,11 @@ +//TEST:SIMPLE:-profile cs_5_0 -target reflection-json + +// Confirm that we provide reflection data for the `numthreads` attribute + +RWStructuredBuffer b; + +[numthreads(3,5,7)] +void main(uint3 tid : SV_DispatchThreadID) +{ + b[tid.x] = b[tid.x + 1] + 1.0f; +} \ No newline at end of file diff --git a/tests/reflection/thread-group-size.hlsl.expected b/tests/reflection/thread-group-size.hlsl.expected new file mode 100644 index 000000000..60d5e822c --- /dev/null +++ b/tests/reflection/thread-group-size.hlsl.expected @@ -0,0 +1,39 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "b", + "binding": {"kind": "unorderedAccess", "index": 0}, + "type": { + "kind": "resource", + "baseShape": "structuredBuffer", + "access": "readWrite" + } + } + ], + "entryPoints": [ + { + "name": "main", + "stage:": "compute", + "parameters": [ + { + "name": "tid", + "binding": {"kind": "vertexInput", "index": 0}, + "type": { + "kind": "vector", + "elementCount": 3, + "elementType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + } + ], + "threadGroupSize": [3, 5, 7] + } + ] +} +} -- cgit v1.2.3