diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp index 07e8b27429..953d4d1ecd 100644 --- a/source/slang/slang-ir.cpp +++ b/source/slang/slang-ir.cpp @@ -3970,7 +3970,10 @@ static TypeCastStyle _getTypeStyleId(IRType* type) { return _getTypeStyleId(matrixType->getElementType()); } + // Try to simplify style if we can, otherwise just handle it unsimplified auto style = getTypeStyle(type->getOp()); + if (style == kIROp_Invalid) + style = type->getOp(); switch (style) { case kIROp_IntType: diff --git a/tests/metal/simple-vertex-position.slang b/tests/metal/simple-vertex-position.slang new file mode 100644 index 0000000000..f76e7fcd6a --- /dev/null +++ b/tests/metal/simple-vertex-position.slang @@ -0,0 +1,16 @@ +//TEST:SIMPLE(filecheck=METAL): -target metal -stage vertex -entry vertexMain +//TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage vertex -entry vertexMain +//TEST:SIMPLE(filecheck=WGSL): -target wgsl -stage vertex -entry vertexMain +//TEST:SIMPLE(filecheck=WGSLSPIRV): -target wgsl-spirv-asm -stage vertex -entry vertexMain + +//METAL: position +//METALLIB: @vertexMain + +//WGSL: @builtin(position) +//WGSLSPIRV: %vertexMain = OpFunction + +// Vertex Shader which writes to position +void vertexMain(out float4 position : SV_Position) +{ + position = float4(0.6, 0.1, 0.6, 0.33); +}