diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-04-08 10:56:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-08 10:56:00 -0400 |
| commit | a9214f34358b2fc0bf61ef90e3719a13b180b423 (patch) | |
| tree | 115b49d976f871a9f529436e201cf2f4a1a59401 /tests | |
| parent | ba232e44cbb016a4e7c111b42458394027369c5e (diff) | |
Remove static struct members from layout and reflection (#1310)
* * Added MemberFilterStyle - controls action of FilteredMemberList and FilteredMemberRefList
* Splt out template implementations
* Use more standard method names dofr FilteredMemberRefList
* Added reflect-static.slang test
* Added isNotEmpty/isEmpty to filtered lists
* Added ability to index into filtered list (so not require building of array)
* Default MemberFilterStyle to All.
* Remove explicit MemberFilterStyle::All
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/reflection/reflect-static.slang | 34 | ||||
| -rw-r--r-- | tests/reflection/reflect-static.slang.expected | 125 |
2 files changed, 159 insertions, 0 deletions
diff --git a/tests/reflection/reflect-static.slang b/tests/reflection/reflect-static.slang new file mode 100644 index 000000000..f7a44cde8 --- /dev/null +++ b/tests/reflection/reflect-static.slang @@ -0,0 +1,34 @@ +//TEST:REFLECTION:-profile cs_6_0 -target hlsl -entry computeMain + +struct Thing +{ + static int value; +}; + +struct AnotherThing +{ + int a; + int b; + static Texture2D t; +}; + + +ConstantBuffer<Thing> cbThing; +ConstantBuffer<AnotherThing> cbAnotherThing; + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + Texture2D t = AnotherThing::t; + + float4 v = t.Load(int3(dispatchThreadID.x, dispatchThreadID.y, 0)); + + int m = cbAnotherThing.a + cbAnotherThing.b + Thing::value; + + m += int(v.x); + + outputBuffer[dispatchThreadID.x] = m; +} diff --git a/tests/reflection/reflect-static.slang.expected b/tests/reflection/reflect-static.slang.expected new file mode 100644 index 000000000..46bae4a17 --- /dev/null +++ b/tests/reflection/reflect-static.slang.expected @@ -0,0 +1,125 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "cbThing", + "type": { + "kind": "constantBuffer", + "elementType": { + "kind": "struct", + "name": "Thing", + "fields": [ + + ] + }, + "containerVarLayout": { + + }, + "elementVarLayout": { + "type": { + "kind": "struct", + "name": "Thing", + "fields": [ + + ] + } + } + } + }, + { + "name": "cbAnotherThing", + "binding": {"kind": "constantBuffer", "index": 0}, + "type": { + "kind": "constantBuffer", + "elementType": { + "kind": "struct", + "name": "AnotherThing", + "fields": [ + { + "name": "a", + "type": { + "kind": "scalar", + "scalarType": "int32" + }, + "binding": {"kind": "uniform", "offset": 0, "size": 4} + }, + { + "name": "b", + "type": { + "kind": "scalar", + "scalarType": "int32" + }, + "binding": {"kind": "uniform", "offset": 4, "size": 4} + } + ] + }, + "containerVarLayout": { + "binding": {"kind": "constantBuffer", "index": 0} + }, + "elementVarLayout": { + "type": { + "kind": "struct", + "name": "AnotherThing", + "fields": [ + { + "name": "a", + "type": { + "kind": "scalar", + "scalarType": "int32" + }, + "binding": {"kind": "uniform", "offset": 0, "size": 4} + }, + { + "name": "b", + "type": { + "kind": "scalar", + "scalarType": "int32" + }, + "binding": {"kind": "uniform", "offset": 4, "size": 4} + } + ] + }, + "binding": {"kind": "uniform", "offset": 0, "size": 8} + } + } + }, + { + "name": "outputBuffer", + "binding": {"kind": "unorderedAccess", "index": 0}, + "type": { + "kind": "resource", + "baseShape": "structuredBuffer", + "access": "readWrite", + "resultType": { + "kind": "scalar", + "scalarType": "int32" + } + } + } + ], + "entryPoints": [ + { + "name": "computeMain", + "stage:": "compute", + "parameters": [ + { + "name": "dispatchThreadID", + "semanticName": "SV_DISPATCHTHREADID", + "type": { + "kind": "vector", + "elementCount": 3, + "elementType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + } + ], + "threadGroupSize": [4, 1, 1] + } + ] +} +} |
