Skip to content

Commit 1816935

Browse files
authored
The gl_primitiveID built in type is int, but can be uint on HLSL. The change trys to cast for glsl targets to avoid glslang producing a type error. (shader-slang#962)
1 parent 30eee05 commit 1816935

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

source/slang/ir-glsl-legalize.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,9 @@ GLSLSystemValueInfo* getGLSLSystemValueInfo(
353353
else if(semanticName == "sv_primitiveid")
354354
{
355355
name = "gl_PrimitiveID";
356+
357+
auto builder = context->getBuilder();
358+
requiredType = builder->getBasicType(BaseType::Int);
356359
}
357360
else if (semanticName == "sv_rendertargetarrayindex")
358361
{

0 commit comments

Comments
 (0)