summaryrefslogtreecommitdiff
path: root/tests/spirv/capability-storage-push-constant.slang
diff options
context:
space:
mode:
authorJames Helferty (NVIDIA) <jhelferty@nvidia.com>2025-08-27 20:08:54 -0700
committerGitHub <noreply@github.com>2025-08-28 03:08:54 +0000
commit80ddf40274fdca93f2ae95a247ff3af122aec6ac (patch)
tree859c48522f93cf4c1119221c1679c11b1160f857 /tests/spirv/capability-storage-push-constant.slang
parent1681bc67fbae57b54b66c5dcfcbf315d1efa831b (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-push-constant.slang')
-rw-r--r--tests/spirv/capability-storage-push-constant.slang35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/spirv/capability-storage-push-constant.slang b/tests/spirv/capability-storage-push-constant.slang
new file mode 100644
index 000000000..6cb540da9
--- /dev/null
+++ b/tests/spirv/capability-storage-push-constant.slang
@@ -0,0 +1,35 @@
+//TEST:SIMPLE(filecheck=CHECK8): -target spirv -profile spirv_1_3 -DCONST_UINT8
+//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DCONST_UINT16
+//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DCONST_HALF
+//TEST:SIMPLE(filecheck=CHECKBOTH): -target spirv -profile spirv_1_3 -DCONST_UINT8 -DCONST_HALF
+//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile spirv_1_3
+
+//CHECK8: OpCapability StoragePushConstant8
+//CHECK16: OpCapability StoragePushConstant16
+//CHECKBOTH-DAG: OpCapability StoragePushConstant8
+//CHECKBOTH-DAG: OpCapability StoragePushConstant16
+//CHECK-NOT: OpCapability StoragePushConstant16
+
+struct PushConstants {
+#if defined(CONST_HALF)
+ half4 color;
+#else
+ float4 color;
+#endif
+#if defined(CONST_UINT8)
+ int8_t index;
+#elif defined(CONST_UINT16)
+ int16_t index;
+#else
+ int32_t index;
+#endif
+};
+
+[[vk::push_constant]]
+PushConstants pushConstants;
+
+[shader("vertex")]
+float4 vertexMain() : SV_POSITION
+{
+ return float4(pushConstants.color);
+}