summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-06-28 04:07:12 -0400
committerGitHub <noreply@github.com>2024-06-28 04:07:12 -0400
commite49419b0637a357d2e713a0435f0c5ad0c102487 (patch)
tree61f815078f7b3b6187abd28101cea76f611462a2 /tests
parentfd32b1879c8a4de7e97a99be7e0e8093ade8b340 (diff)
Implement HLSL resource bindings and default type `float4` to `SubpassInput<T>` (#4462)
* Add case to `emitVectorReshape` for `vector<>` type, `scalar` value 1. Add new case 2. Add test * fix warning * fix warning * Implement HLSL resource bindings and default type `float4` to `SubpassInput<T>` fixes: #4440 1. Removed GLSLInputAttachmentIndexLayout modifier and the somewhat 'hacky' binding model 'Input Attachment' previously relied upon. This was changed to work with the slang-type-layout rules system. This change allows Slang automatic bindings, HLSL bindings, GLSL bindings, and translation of GLSL to and from HLSL bindings to work. 2. Added default argument `float4` to SubpassInput<T>. 3. Merged glsl.meta and hlsl.meta SubpassInput logic. * fix InputAttachment attribute checks fix InputAttachment attribute checks for HLSL and GLSL syntax * remove unused var * validate attribute correctly Attributes do not have type information. We must check the type expression to validate attribute usage. * remove hacky validation type based validation before types are fully resolved is quite hacky and unstable to changes and wrapped types * fix warning * remove redundant `!= nullptr` * remove extra `!= nullptr` * fix some warnings/errors * subpass capability to limit to dxc & remove default values in some functions * revert logic to previous logic revert logic to return if we have a binding regardless of if a VarDecl is given the binding
Diffstat (limited to 'tests')
-rw-r--r--tests/glsl-intrinsic/subpass-input/input-attachment-index-use-error.slang11
-rw-r--r--tests/glsl-intrinsic/subpass-input/subpass-input-hlsl.slang32
2 files changed, 32 insertions, 11 deletions
diff --git a/tests/glsl-intrinsic/subpass-input/input-attachment-index-use-error.slang b/tests/glsl-intrinsic/subpass-input/input-attachment-index-use-error.slang
deleted file mode 100644
index 889a4e205..000000000
--- a/tests/glsl-intrinsic/subpass-input/input-attachment-index-use-error.slang
+++ /dev/null
@@ -1,11 +0,0 @@
-//TEST:SIMPLE(filecheck=CHECK): -target glsl -stage fragment -entry main -allow-glsl
-#version 450
-
-// CHECK: error 31207
-layout (input_attachment_index = 1, set = 0, binding = 1) uniform vec3 image;
-
-layout (location = 0) out vec4 outColor;
-
-void main() {
- outColor = vec4(0);
-} \ No newline at end of file
diff --git a/tests/glsl-intrinsic/subpass-input/subpass-input-hlsl.slang b/tests/glsl-intrinsic/subpass-input/subpass-input-hlsl.slang
new file mode 100644
index 000000000..0b8e4896f
--- /dev/null
+++ b/tests/glsl-intrinsic/subpass-input/subpass-input-hlsl.slang
@@ -0,0 +1,32 @@
+//TEST:SIMPLE(filecheck=CHECK_GLSL): -target glsl -stage fragment -entry main -allow-glsl
+//TEST:SIMPLE(filecheck=CHECK_SPV): -target spirv -emit-spirv-directly -stage fragment -entry main -allow-glsl
+//TEST:SIMPLE(filecheck=CHECK_HLSL): -target hlsl -stage fragment -entry main -allow-glsl
+
+// CHECK_SPV-DAG: OpEntryPoint
+// CHECK_SPV-DAG: InputAttachmentIndex 3
+// CHECK_SPV-DAG: InputAttachmentIndex
+
+// CHECK_GLSL-DAG: void main()
+// CHECK_GLSL-DAG: input_attachment_index = 3
+// CHECK_GLSL-DAG: input_attachment_index
+
+// CHECK_HLSL-DAG: main()
+// CHECK_HLSL-DAG: [vk::input_attachment_index(3)]
+// CHECK_HLSL-DAG: vk::input_attachment_index
+[[vk::input_attachment_index(3)]] SubpassInput subpassHLSL1;
+SubpassInput subpassHLSL2;
+
+RWTexture2D<float4> t;
+
+layout (location = 0) out vec4 outColor;
+
+void main() {
+// CHECK_SPV-COUNT-2: OpImageRead
+// CHECK_GLSL-COUNT-2: subpassLoad
+// CHECK_HLSL-COUNT-2: SubpassLoad
+ outColor = vec4(true
+ && subpassHLSL1.SubpassLoad() == vec4(1)
+ && subpassHLSL2.SubpassLoad() == vec4(1)
+ && t.Load(int2(0,0)) != float4(0,0,0,0)
+ );
+} \ No newline at end of file