Skip to content

Commit 29a6a8d

Browse files
committed
Fix SPIRV validation errors.
1 parent d8e64b2 commit 29a6a8d

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

source/slang/slang-emit-spirv.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5222,6 +5222,7 @@ struct SPIRVEmitContext : public SourceEmitterBase, public SPIRVEmitSharedContex
52225222
case IRTargetBuiltinVarName::SpvInstanceIndex:
52235223
return getBuiltinGlobalVar(inst->getFullType(), SpvBuiltInInstanceIndex, inst);
52245224
case IRTargetBuiltinVarName::SpvBaseInstance:
5225+
requireSPIRVCapability(SpvCapabilityDrawParameters);
52255226
return getBuiltinGlobalVar(inst->getFullType(), SpvBuiltInBaseInstance, inst);
52265227
}
52275228
}

source/slang/slang-ir-glsl-legalize.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@ GLSLSystemValueInfo* getGLSLSystemValueInfo(
626626
requiredType = builder->getBasicType(BaseType::Int);
627627
name = "gl_InstanceIndex";
628628
targetVarName = IRTargetBuiltinVarName::HlslInstanceID;
629+
context->requireSPIRVVersion(SemanticVersion(1, 3));
630+
context->requireGLSLExtension(toSlice("GL_ARB_shader_draw_parameters"));
629631
}
630632
else if (semanticName == "sv_isfrontface")
631633
{

0 commit comments

Comments
 (0)