From 221488e2b2d6ed1507377f9a8e0932c2435a1b23 Mon Sep 17 00:00:00 2001 From: Devon7925 Date: Thu, 20 Feb 2025 16:44:46 -0700 Subject: [PATCH 1/4] Add inner texture type to reflection json --- source/slang/slang-reflection-json.cpp | 4 ++ tests/reflection/arrays.hlsl.expected | 30 +++++++++- tests/reflection/binding-gl.hlsl.expected | 30 +++++++++- .../binding-push-constant-gl.hlsl.expected | 30 +++++++++- tests/reflection/cross-compile.slang.expected | 10 +++- tests/reflection/default-space.slang.expected | 30 +++++++++- .../explicit-register-space.slang.expected | 10 +++- .../global-type-params.slang.expected | 10 +++- tests/reflection/multi-file.hlsl.expected | 50 ++++++++++++++-- ...ameter-block-explicit-space.slang.expected | 60 +++++++++++++++++-- .../parameter-block.slang.1.expected | 30 +++++++++- .../parameter-block.slang.2.expected | 30 +++++++++- .../reflection/parameter-block.slang.expected | 30 +++++++++- .../reflect-imported-code.hlsl.expected | 20 ++++++- tests/reflection/reflection0.hlsl.expected | 10 +++- .../resource-in-cbuffer.hlsl.expected | 20 ++++++- .../reflection/shared-modifier.hlsl.expected | 10 +++- tests/reflection/texture-resource-type.slang | 21 +++++++ .../unbounded-arrays.hlsl.1.expected | 50 ++++++++++++++-- .../reflection/used-parameters.slang.expected | 40 +++++++++++-- 20 files changed, 475 insertions(+), 50 deletions(-) create mode 100644 tests/reflection/texture-resource-type.slang diff --git a/source/slang/slang-reflection-json.cpp b/source/slang/slang-reflection-json.cpp index 993832ad61..4e8b6b2a47 100644 --- a/source/slang/slang-reflection-json.cpp +++ b/source/slang/slang-reflection-json.cpp @@ -514,6 +514,10 @@ static void emitReflectionTypeInfoJSON(PrettyWriter& writer, slang::TypeReflecti break; case SLANG_STRUCTURED_BUFFER: + case SLANG_TEXTURE_1D: + case SLANG_TEXTURE_2D: + case SLANG_TEXTURE_3D: + case SLANG_TEXTURE_CUBE: if (auto resultType = type->getResourceResultType()) { writer.maybeComma(); diff --git a/tests/reflection/arrays.hlsl.expected b/tests/reflection/arrays.hlsl.expected index f53d63723c..3e0bd6723e 100644 --- a/tests/reflection/arrays.hlsl.expected +++ b/tests/reflection/arrays.hlsl.expected @@ -90,7 +90,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -101,7 +109,15 @@ standard output = { "elementCount": 16, "elementType": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } }, @@ -110,7 +126,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 17}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/binding-gl.hlsl.expected b/tests/reflection/binding-gl.hlsl.expected index 73c4da3aef..67df7c2679 100644 --- a/tests/reflection/binding-gl.hlsl.expected +++ b/tests/reflection/binding-gl.hlsl.expected @@ -90,7 +90,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -98,7 +106,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "space": 3, "index": 2}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -106,7 +122,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/binding-push-constant-gl.hlsl.expected b/tests/reflection/binding-push-constant-gl.hlsl.expected index 6570625e99..7321c5face 100644 --- a/tests/reflection/binding-push-constant-gl.hlsl.expected +++ b/tests/reflection/binding-push-constant-gl.hlsl.expected @@ -147,7 +147,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -155,7 +163,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "space": 3, "index": 2}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -163,7 +179,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/cross-compile.slang.expected b/tests/reflection/cross-compile.slang.expected index f85e4e0e9a..2cd77fee22 100644 --- a/tests/reflection/cross-compile.slang.expected +++ b/tests/reflection/cross-compile.slang.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/default-space.slang.expected b/tests/reflection/default-space.slang.expected index c6ec6c19ff..17cc327363 100644 --- a/tests/reflection/default-space.slang.expected +++ b/tests/reflection/default-space.slang.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "space": 99, "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -25,7 +33,15 @@ standard output = { "name": "b", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} } @@ -43,7 +59,15 @@ standard output = { "name": "b", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} } diff --git a/tests/reflection/explicit-register-space.slang.expected b/tests/reflection/explicit-register-space.slang.expected index 725318084b..a43efd2bd9 100644 --- a/tests/reflection/explicit-register-space.slang.expected +++ b/tests/reflection/explicit-register-space.slang.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "space": 2, "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/reflection/global-type-params.slang.expected b/tests/reflection/global-type-params.slang.expected index 0da9c975e2..07180b7ea7 100644 --- a/tests/reflection/global-type-params.slang.expected +++ b/tests/reflection/global-type-params.slang.expected @@ -71,7 +71,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/multi-file.hlsl.expected b/tests/reflection/multi-file.hlsl.expected index 0472a0b0ae..804e5874ff 100644 --- a/tests/reflection/multi-file.hlsl.expected +++ b/tests/reflection/multi-file.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -135,7 +143,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -261,7 +277,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 2}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -387,7 +411,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 3}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -395,7 +427,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 4}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/reflection/parameter-block-explicit-space.slang.expected b/tests/reflection/parameter-block-explicit-space.slang.expected index 9080298399..347f0fd5cf 100644 --- a/tests/reflection/parameter-block-explicit-space.slang.expected +++ b/tests/reflection/parameter-block-explicit-space.slang.expected @@ -29,7 +29,15 @@ standard output = { "name": "at1", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -37,7 +45,15 @@ standard output = { "name": "at2", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 1} }, @@ -77,7 +93,15 @@ standard output = { "name": "at1", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -85,7 +109,15 @@ standard output = { "name": "at2", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 1} }, @@ -131,7 +163,15 @@ standard output = { "name": "bt", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -171,7 +211,15 @@ standard output = { "name": "bt", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, diff --git a/tests/reflection/parameter-block.slang.1.expected b/tests/reflection/parameter-block.slang.1.expected index 5b1b456243..59fe157873 100644 --- a/tests/reflection/parameter-block.slang.1.expected +++ b/tests/reflection/parameter-block.slang.1.expected @@ -20,7 +20,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -45,7 +53,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -70,7 +86,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/reflection/parameter-block.slang.2.expected b/tests/reflection/parameter-block.slang.2.expected index 31477df38c..ef7b21e1a3 100644 --- a/tests/reflection/parameter-block.slang.2.expected +++ b/tests/reflection/parameter-block.slang.2.expected @@ -17,7 +17,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -42,7 +50,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -67,7 +83,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/reflection/parameter-block.slang.expected b/tests/reflection/parameter-block.slang.expected index 48b1bccbdd..f3c31d4a95 100644 --- a/tests/reflection/parameter-block.slang.expected +++ b/tests/reflection/parameter-block.slang.expected @@ -17,7 +17,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "descriptorTableSlot", "index": 0} }, @@ -42,7 +50,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "descriptorTableSlot", "index": 0} }, @@ -64,7 +80,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/reflection/reflect-imported-code.hlsl.expected b/tests/reflection/reflect-imported-code.hlsl.expected index cff6c50bbe..8a906d0f7a 100644 --- a/tests/reflection/reflect-imported-code.hlsl.expected +++ b/tests/reflection/reflect-imported-code.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -63,7 +71,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/reflection0.hlsl.expected b/tests/reflection/reflection0.hlsl.expected index 10f228cb18..f435aa8290 100644 --- a/tests/reflection/reflection0.hlsl.expected +++ b/tests/reflection/reflection0.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/resource-in-cbuffer.hlsl.expected b/tests/reflection/resource-in-cbuffer.hlsl.expected index 7d4251684e..f85a5fb59f 100644 --- a/tests/reflection/resource-in-cbuffer.hlsl.expected +++ b/tests/reflection/resource-in-cbuffer.hlsl.expected @@ -32,7 +32,15 @@ standard output = { "name": "myTexture", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, @@ -76,7 +84,15 @@ standard output = { "name": "myTexture", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, diff --git a/tests/reflection/shared-modifier.hlsl.expected b/tests/reflection/shared-modifier.hlsl.expected index 61774ed197..252c764d26 100644 --- a/tests/reflection/shared-modifier.hlsl.expected +++ b/tests/reflection/shared-modifier.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/reflection/texture-resource-type.slang b/tests/reflection/texture-resource-type.slang new file mode 100644 index 0000000000..2455ba611f --- /dev/null +++ b/tests/reflection/texture-resource-type.slang @@ -0,0 +1,21 @@ +// texture-resource-type.slang + +// Tests reflection of inner texture type. + +//TEST:REFLECTION:-stage compute -entry main -target hlsl + +Texture2D NoParameters; +Texture2D FloatTexture; +Texture2D FloatTwoTexture; +Texture2D FloatFourTexture; +Texture2D IntTexture; +Texture2D IntTwoTexture; +Texture2D IntFourTexture; +Texture2D UintTexture; +Texture2D UintTwoTexture; +Texture2D UintFourTexture; + +[numthreads(1, 1, 1)] +void main(uint3 dispatchThreadID : SV_DispatchThreadID) +{ +} diff --git a/tests/reflection/unbounded-arrays.hlsl.1.expected b/tests/reflection/unbounded-arrays.hlsl.1.expected index c8d8f6bed5..05c997409f 100644 --- a/tests/reflection/unbounded-arrays.hlsl.1.expected +++ b/tests/reflection/unbounded-arrays.hlsl.1.expected @@ -23,7 +23,15 @@ standard output = { "elementCount": 0, "elementType": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } }, @@ -32,7 +40,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -40,7 +56,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -60,7 +84,15 @@ standard output = { "binding": {"kind": "shaderResource", "space": 1, "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -77,7 +109,15 @@ standard output = { "name": "t", "type": { "kind": "resource", - "baseShape": "texture3D" + "baseShape": "texture3D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, diff --git a/tests/reflection/used-parameters.slang.expected b/tests/reflection/used-parameters.slang.expected index fb63e55f90..0a4fba1049 100644 --- a/tests/reflection/used-parameters.slang.expected +++ b/tests/reflection/used-parameters.slang.expected @@ -107,7 +107,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -115,7 +123,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -164,7 +180,15 @@ standard output = { "type": { "kind": "resource", "baseShape": "texture2D", - "access": "readWrite" + "access": "readWrite", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -173,7 +197,15 @@ standard output = { "type": { "kind": "resource", "baseShape": "texture2D", - "access": "readWrite" + "access": "readWrite", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { From 3978cb8fe66f0c7a7ae313e2414be9b47c4839e9 Mon Sep 17 00:00:00 2001 From: Devon7925 Date: Thu, 20 Feb 2025 16:51:56 -0700 Subject: [PATCH 2/4] Add expected result of test --- .../texture-resource-type.slang.expected | 220 ++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 tests/reflection/texture-resource-type.slang.expected diff --git a/tests/reflection/texture-resource-type.slang.expected b/tests/reflection/texture-resource-type.slang.expected new file mode 100644 index 0000000000..48d1f0f797 --- /dev/null +++ b/tests/reflection/texture-resource-type.slang.expected @@ -0,0 +1,220 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "NoParameters", + "binding": {"kind": "shaderResource", "index": 0}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + } + }, + { + "name": "FloatTexture", + "binding": {"kind": "shaderResource", "index": 1}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } + } + }, + { + "name": "FloatTwoTexture", + "binding": {"kind": "shaderResource", "index": 2}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 2, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + } + }, + { + "name": "FloatFourTexture", + "binding": {"kind": "shaderResource", "index": 3}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + } + }, + { + "name": "IntTexture", + "binding": {"kind": "shaderResource", "index": 4}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "int32" + } + } + }, + { + "name": "IntTwoTexture", + "binding": {"kind": "shaderResource", "index": 5}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 2, + "elementType": { + "kind": "scalar", + "scalarType": "int32" + } + } + } + }, + { + "name": "IntFourTexture", + "binding": {"kind": "shaderResource", "index": 6}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "int32" + } + } + } + }, + { + "name": "UintTexture", + "binding": {"kind": "shaderResource", "index": 7}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + }, + { + "name": "UintTwoTexture", + "binding": {"kind": "shaderResource", "index": 8}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 2, + "elementType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + } + }, + { + "name": "UintFourTexture", + "binding": {"kind": "shaderResource", "index": 9}, + "type": { + "kind": "resource", + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + } + } + ], + "entryPoints": [ + { + "name": "main", + "stage": "compute", + "parameters": [ + { + "name": "dispatchThreadID", + "semanticName": "SV_DISPATCHTHREADID", + "type": { + "kind": "vector", + "elementCount": 3, + "elementType": { + "kind": "scalar", + "scalarType": "uint32" + } + } + } + ], + "threadGroupSize": [1, 1, 1], + "bindings": [ + { + "name": "NoParameters", + "binding": {"kind": "shaderResource", "index": 0, "used": 0} + }, + { + "name": "FloatTexture", + "binding": {"kind": "shaderResource", "index": 1, "used": 0} + }, + { + "name": "FloatTwoTexture", + "binding": {"kind": "shaderResource", "index": 2, "used": 0} + }, + { + "name": "FloatFourTexture", + "binding": {"kind": "shaderResource", "index": 3, "used": 0} + }, + { + "name": "IntTexture", + "binding": {"kind": "shaderResource", "index": 4, "used": 0} + }, + { + "name": "IntTwoTexture", + "binding": {"kind": "shaderResource", "index": 5, "used": 0} + }, + { + "name": "IntFourTexture", + "binding": {"kind": "shaderResource", "index": 6, "used": 0} + }, + { + "name": "UintTexture", + "binding": {"kind": "shaderResource", "index": 7, "used": 0} + }, + { + "name": "UintTwoTexture", + "binding": {"kind": "shaderResource", "index": 8, "used": 0} + }, + { + "name": "UintFourTexture", + "binding": {"kind": "shaderResource", "index": 9, "used": 0} + } + ] + } + ] +} +} From 6310e0fad718098adce71faa7ebebb148db86529 Mon Sep 17 00:00:00 2001 From: Devon7925 Date: Fri, 21 Feb 2025 12:03:07 -0700 Subject: [PATCH 3/4] Adjust test expected results --- .../hlsl-to-vulkan-array.hlsl.expected | 10 +++++++++- .../hlsl-to-vulkan-combined.hlsl.expected | 16 +++++++++++++-- .../hlsl-to-vulkan-global.hlsl.expected | 10 +++++++++- ...lsl-to-vulkan-shift-implicit.hlsl.expected | 20 +++++++++++++++++-- .../hlsl-to-vulkan-shift.hlsl.expected | 20 +++++++++++++++++-- .../cpp-resource-reflection.slang.64.expected | 6 +++++- .../sampler-feedback-basic.slang.expected | 12 +++++++++-- 7 files changed, 83 insertions(+), 11 deletions(-) diff --git a/tests/bindings/hlsl-to-vulkan-array.hlsl.expected b/tests/bindings/hlsl-to-vulkan-array.hlsl.expected index c5d71a65fd..b8deb13142 100644 --- a/tests/bindings/hlsl-to-vulkan-array.hlsl.expected +++ b/tests/bindings/hlsl-to-vulkan-array.hlsl.expected @@ -22,7 +22,15 @@ standard output = { "name": "tex", "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } }, "binding": {"kind": "shaderResource", "index": 0} }, diff --git a/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected b/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected index 1194d50b4c..32c99bd784 100644 --- a/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected +++ b/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected @@ -9,7 +9,11 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } } }, { @@ -17,7 +21,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 1}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } ], diff --git a/tests/bindings/hlsl-to-vulkan-global.hlsl.expected b/tests/bindings/hlsl-to-vulkan-global.hlsl.expected index 7fe1f8e422..8d3a19458f 100644 --- a/tests/bindings/hlsl-to-vulkan-global.hlsl.expected +++ b/tests/bindings/hlsl-to-vulkan-global.hlsl.expected @@ -25,7 +25,15 @@ standard output = { "binding": {"kind": "descriptorTableSlot", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected index a873b4149b..85d13552a9 100644 --- a/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected +++ b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 10}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -81,7 +89,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 11}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected b/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected index 23e2b1bdae..fd54b96922 100644 --- a/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected +++ b/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected @@ -9,7 +9,15 @@ standard output = { "binding": {"kind": "shaderResource", "index": 5}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { @@ -81,7 +89,15 @@ standard output = { "binding": {"kind": "shaderResource", "space": 2, "index": 7}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } }, { diff --git a/tests/cross-compile/cpp-resource-reflection.slang.64.expected b/tests/cross-compile/cpp-resource-reflection.slang.64.expected index b863827e98..4ded43e3ee 100644 --- a/tests/cross-compile/cpp-resource-reflection.slang.64.expected +++ b/tests/cross-compile/cpp-resource-reflection.slang.64.expected @@ -95,7 +95,11 @@ standard output = { "binding": {"kind": "uniform", "offset": 24, "size": 8}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } } }, { diff --git a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected index 2464028180..fe6eb13353 100644 --- a/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected +++ b/tests/hlsl-intrinsic/sampler-feedback/sampler-feedback-basic.slang.expected @@ -67,7 +67,11 @@ standard output = { "binding": {"kind": "shaderResource", "index": 0}, "type": { "kind": "resource", - "baseShape": "texture2D" + "baseShape": "texture2D", + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } } }, { @@ -76,7 +80,11 @@ standard output = { "type": { "kind": "resource", "baseShape": "texture2D", - "array": true + "array": true, + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } } }, { From 24a2b7df8243cf16d270be5b9fa32b2106a71f96 Mon Sep 17 00:00:00 2001 From: Devon7925 Date: Mon, 24 Feb 2025 18:25:20 -0700 Subject: [PATCH 4/4] Fix ci test result --- tests/reflection/unbounded-arrays.hlsl.1.expected | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/reflection/unbounded-arrays.hlsl.1.expected b/tests/reflection/unbounded-arrays.hlsl.1.expected index 05c997409f..e4eb111ffb 100644 --- a/tests/reflection/unbounded-arrays.hlsl.1.expected +++ b/tests/reflection/unbounded-arrays.hlsl.1.expected @@ -75,7 +75,15 @@ standard output = { "elementCount": 0, "elementType": { "kind": "resource", - "baseShape": "textureCube" + "baseShape": "textureCube", + "resultType": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } } } },