summaryrefslogtreecommitdiffstats
path: root/tests/compute/unbounded-array-of-array-syntax.slang
diff options
context:
space:
mode:
authorsriramm-nv <85252063+sriramm-nv@users.noreply.github.com>2024-04-19 09:12:56 -0700
committerGitHub <noreply@github.com>2024-04-19 09:12:56 -0700
commit7c162eba5329eae7755e55298a455a144fcb0dce (patch)
tree55702104206d790242dab7cebbda44b8dd056a35 /tests/compute/unbounded-array-of-array-syntax.slang
parenta3a5e7ea4e2ec15dd385c169578f5770f49b6e1c (diff)
Enable NonUniformResourceIndex support for glsl, hlsl and spirv (#3899)
Fixes #387676* ForceInline SampleLevel to allow decorations to apply * explictly add all the SPIRVAsmOperand Insts in non-differentiable list, which might get inadvertently processed when these functions are inlined into the main shader * Support NonUniformResourceIndex for SPIR-V target Fixes #3876 * add a new IR instruction for NonUniformResourceIndex * slang ir emitter for nonuniform resource index * update the hlsl meta slang * Add test cases for NonUniformResourceIndex access for buffers and textures, with/without cast, nested access etc. * add default c-like emitter for nonuniformresourceinfo * added hlsl emitter * added glsl emitter * requisites for spirv enabling - new decorator for nonuniformresourceindex - emitter for nonuniformresourceindex signature change * add hasResourceType checker * add rwStructBuffType in resourcetype checker * add a case for nonuniformres in emitDecorations * DO NOT COMMIT: This change adds special handling for RWStructBuf within the isResourceType function, if it is a pointer to this resource, return true to make it work with nonuniformres test * spirv emitter for decorations - update the emitLocalInst to perform decorations at the end * added main spirv emitter code * slang emit spirv bugfix * hacky way of supporting Call Inst * move code to cleanup nonuniform inst into helper function * remove stale codefrom test * add spirv decoration for nonuniform * update test to remove global variables * update coherent-2 test * update comment for special handling * update the spirv legalize to handle nested nonuniforms improved logic that handles call ops, rwstructbuf, nested nonuniforms etc. * update nonuniform-array-of-tex test * missed removing nonuniform inst causing duplicate decorations * add glsl and hlsl variants of nonuniform tests * repurpose the hasResource function into something specific for nonuniform inst decoration helper * clean up comments and code around spirv-legalization to emit nonuniform inst by recursively looking into the inst * use the helper canDecorateNonUniformInst to convert `nonUniformResourceInfo` inst to decoration * converted compute/unbounded-array-of-array cross compile test into a simple check test * update contains Resource helper function to be more generic * clean up the case for opcall handling with nonuniform resource inst * update ptr to struct buffer check to be more explicit and rename the function to check for ptr to resource type * update comments and fix the test for coherent * fix typos * update logic on spirv legalize to delete dead instructions - for some reason this doesn't automatically happen * add comments to declarations * add NonuniformResourceIndex to the non-differential inst list
Diffstat (limited to 'tests/compute/unbounded-array-of-array-syntax.slang')
-rw-r--r--tests/compute/unbounded-array-of-array-syntax.slang19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/compute/unbounded-array-of-array-syntax.slang b/tests/compute/unbounded-array-of-array-syntax.slang
index bba8605f2..35316d114 100644
--- a/tests/compute/unbounded-array-of-array-syntax.slang
+++ b/tests/compute/unbounded-array-of-array-syntax.slang
@@ -1,7 +1,7 @@
//IGNORE_TEST:CPU_REFLECTION: -profile cs_5_0 -entry computeMain -target cpp
//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute
//TEST:CROSS_COMPILE:-target dxbc-assembly -entry computeMain -profile cs_5_1
-//TEST:CROSS_COMPILE:-target spirv-assembly -entry computeMain -profile cs_5_1
+//TEST:SIMPLE(filecheck=CHECK):-target spirv-assembly -entry computeMain -profile cs_5_1
//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
@@ -16,6 +16,23 @@ RWStructuredBuffer<int> g_aoa[];
[numthreads(8, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
+ // CHECK: OpCapability {{(ShaderNonUniform|StorageBufferArrayNonUniformIndexing)}}
+ // CHECK: OpCapability {{(ShaderNonUniform|StorageBufferArrayNonUniformIndexing)}}
+ // CHECK-DAG: OpDecorate %[[N1:[a-zA-Z0-9_]+]] NonUniform
+ // CHECK-DAG: OpDecorate %[[N2:[a-zA-Z0-9_]+]] NonUniform
+ // CHECK-DAG: OpDecorate %[[N3:[a-zA-Z0-9_]+]] NonUniform
+ // CHECK-DAG: OpDecorate %[[N4:[a-zA-Z0-9_]+]] NonUniform
+ // CHECK-DAG: OpDecorate %[[B0:[a-zA-Z0-9_]+]] Binding 0
+ // CHECK-DAG: OpDecorate %[[B1:[a-zA-Z0-9_]+]] Binding 1
+ // CHECK-DAG: %[[P1:[a-zA-Z0-9_]+]] = OpTypePointer Uniform %int
+ // CHECK-DAG: %[[P2:[a-zA-Z0-9_]+]] = OpTypePointer Uniform %StructuredBuffer_int_t_0
+ // CHECK: %[[N1]] = OpCopyObject %int
+ // CHECK: %{{.*}} = OpAccessChain %[[P2]] %[[B1]] %[[N1]]
+ // CHECK: %[[N2]] = OpCopyObject %int
+ // CHECK: %[[N3]] = OpAccessChain %[[P1]] %[[B1]] %[[N2]]
+ // CHECK: %[[N4]] = OpLoad %int %[[N3]]
+ // CHECK: %{{.*}} = OpAccessChain %[[P1]] %[[B0]] %int_{{.*}}
+ // CHECK: OpStore %{{.*}} %[[N4]]
int index = int(dispatchThreadID.x);
int baseIndex = index >> 2;