Open expipiplus1 opened 10 months ago
Ran this test with slang-test and found the following IR generated:
func %computeMain : Func(Void, Vec(UInt, 3 : Int))
{
block %3(
[nameHint("dispatchThreadID")]
[semantic("SV_DispatchThreadID", 0 : Int)]
param %dispatchThreadID : Vec(UInt, 3 : Int)):
[nameHint("dispatchThreadID")]
let %dispatchThreadID1 : Vec(UInt, 3 : Int) = DebugVar(%1, 9 : UInt, 6 : UInt, 0 : UInt)
DebugValue(%dispatchThreadID1, %dispatchThreadID)
DebugLine(%1, 11 : UInt, 11 : UInt, 5 : UInt, 6 : UInt)
DebugLine(%1, 11 : UInt, 11 : UInt, 5 : UInt, 6 : UInt)
DebugLine(%1, 11 : UInt, 11 : UInt, 5 : UInt, 6 : UInt)
[DebugLocation(%1, 11 : UInt, 31 : UInt)]
[nameHint("v")]
let %v : Vec(Vec(Int, 2 : Int), 2 : Int) = DebugVar(%1, 11 : UInt, 31 : UInt)
[DebugLocation(%1, 11 : UInt, 31 : UInt)]
[nameHint("v")]
let %v1 : Ptr(Vec(Vec(Int, 2 : Int), 2 : Int)) = var
DebugLine(%1, 12 : UInt, 12 : UInt, 5 : UInt, 6 : UInt)
let %4 : Ptr(Vec(Int, 2 : Int)) = getElementPtr(%v1, 0 : Int)
let %5 : Ptr(Int) = getElementPtr(%4, 0 : Int)
store(%5, 1 : Int)
DebugValue(%v, 1 : Int, 0 : Int, 0 : Int)
DebugLine(%1, 13 : UInt, 13 : UInt, 5 : UInt, 6 : UInt)
let %6 : UInt = swizzle(%dispatchThreadID, 0 : Int)
let %7 : Ptr(Float) = rwstructuredBufferGetElementPtr(%outputBuffer, %6)
let %8 : Vec(Vec(Int, 2 : Int), 2 : Int) = load(%v1)
let %9 : Vec(Int, 2 : Int) = swizzle(%8, 0 : Int)
let %10 : Int = getElement(%9, 0 : Int)
let %11 : Float = castIntToFloat(%10)
store(%7, %11)
return_val(void_constant)
}
And fails with the error:
tests/bugs/unary-swizzle-subscript.slang(13): error 55200: 'vector<vector<int,2>,2>' is not a supported builtin type for the target.
outputBuffer[dispatchThreadID.x] = v.x[0];
^
Based on discussion on the PR#4277, this is going to be prevented from the user side. and a suitable test will be added to capture this behavior.
See also https://github.com/shader-slang/slang/issues/320