diff options
| author | James Helferty (NVIDIA) <jhelferty@nvidia.com> | 2025-08-27 20:08:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-28 03:08:54 +0000 |
| commit | 80ddf40274fdca93f2ae95a247ff3af122aec6ac (patch) | |
| tree | 859c48522f93cf4c1119221c1679c11b1160f857 /tests/spirv/capability-storage-input-output.slang | |
| parent | 1681bc67fbae57b54b66c5dcfcbf315d1efa831b (diff) | |
Add SPIRV OpCapability for 8/16bit use in storage (#8194)
Emits the appropriate OpCapability for 8- and 16-bit type usage:
- UniformAndStorageBuffer8BitAccess: for 16-bit types in
SpvStorageClassUniform and SpvStorageClassStorageBuffer
- UniformAndStorageBuffer16BitAccess: for 16-bit types in
SpvStorageClassUniform and SpvStorageClassStorageBuffer
- StoragePushConstant8: for 8-bit types in SpvStorageClassPushConstant
- StoragePushConstant16: for 16-bit types in SpvStorageClassPushConstant
- StorageInputOutput16: for 16-bit types in SpvStorageClassInput and
SpvStorageClassOutput
Generated with Claude Code, with revisions.
Fixes #7879.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: James Helferty (NVIDIA) <jhelferty-nv@users.noreply.github.com>
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/spirv/capability-storage-input-output.slang')
| -rw-r--r-- | tests/spirv/capability-storage-input-output.slang | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/spirv/capability-storage-input-output.slang b/tests/spirv/capability-storage-input-output.slang new file mode 100644 index 000000000..0cccd26c7 --- /dev/null +++ b/tests/spirv/capability-storage-input-output.slang @@ -0,0 +1,44 @@ +//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DIN_HALF
+//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DIN_UINT16
+//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DOUT_HALF
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile spirv_1_3
+
+//CHECK16: OpCapability StorageInputOutput16
+//CHECK-NOT: OpCapability StorageInputOutput16
+
+struct VertexInput {
+#ifdef IN_HALF
+ half4 position : POSITION;
+#else
+ float4 position : POSITION;
+#endif
+#ifdef IN_UINT16
+ uint16_t id : ID;
+#else
+ uint32_t id : ID;
+#endif
+};
+
+#ifdef OUT_HALF
+#define OUT_TYPE half4
+#else
+#define OUT_TYPE float4
+#endif
+
+struct VertexOutput {
+ float4 position : SV_POSITION;
+ OUT_TYPE color : COLOR;
+};
+
+[shader("vertex")]
+VertexOutput vertexMain(VertexInput input)
+{
+ VertexOutput output;
+ output.position = float4(input.position);
+ if (input.id == 0) {
+ output.color = OUT_TYPE(input.position);
+ } else {
+ output.color = OUT_TYPE(0);
+ }
+ return output;
+}
|
