From 0fe55d6d8793fcd005b6d3c0ccaa0afbc27c069f Mon Sep 17 00:00:00 2001 From: Sriram Murali <85252063+sriramm-nv@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:58:54 -0700 Subject: Disallow multi-dim vector subscript in slang IR (#4277) Fixes bug #3180 This test verifies the check for illegal swizzle on vector types, whose element is not a basic Type (int, float). The check captures the failure within swizzle access on a nested vector subscript element. vector, 2> a int b = a[0].x; // illegal Co-authored-by: Yong He --- tests/bugs/g3180-swizzle-nd-vectors.slang | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/bugs/g3180-swizzle-nd-vectors.slang diff --git a/tests/bugs/g3180-swizzle-nd-vectors.slang b/tests/bugs/g3180-swizzle-nd-vectors.slang new file mode 100644 index 000000000..a6d81740f --- /dev/null +++ b/tests/bugs/g3180-swizzle-nd-vectors.slang @@ -0,0 +1,18 @@ +//TEST:SIMPLE(filecheck=CHECK):-target cpp -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK):-target glsl -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-via-glsl -entry computeMain -stage compute +//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly -entry computeMain -stage compute + +// This test tests that assigning to a subscript of a unary swizzle works + +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + vector, 2> v; + v.x[0] = 1; + // CHECK: ([[# @LINE+1]]): error 55200: 'vector' is not a supported builtin type for the target. + outputBuffer[dispatchThreadID.x] = v.x[0]; +} -- cgit v1.2.3