[*] SM3.0 fixes

This commit is contained in:
Reece Wilson 2024-08-17 15:55:29 +01:00
parent 66363ac7e8
commit e4d6832d31

View File

@ -783,6 +783,9 @@ void CompilerHLSL::emit_builtin_inputs_in_struct()
break; break;
case BuiltInPrimitiveId: case BuiltInPrimitiveId:
if (legacy)
SPIRV_CROSS_THROW("Primitive ID not supported in SM 3.0 or lower.");
type = "uint"; type = "uint";
semantic = "SV_PrimitiveID"; semantic = "SV_PrimitiveID";
break; break;
@ -830,8 +833,16 @@ void CompilerHLSL::emit_builtin_inputs_in_struct()
break; break;
case BuiltInFrontFacing: case BuiltInFrontFacing:
if (legacy)
{
type = "float";
semantic = "VFACE";
}
else
{
type = "bool"; type = "bool";
semantic = "SV_IsFrontFace"; semantic = "SV_IsFrontFace";
}
break; break;
case BuiltInViewIndex: case BuiltInViewIndex:
@ -3146,6 +3157,20 @@ void CompilerHLSL::emit_hlsl_entry_point()
} }
break; break;
case BuiltInFrontFacing:
{
if (legacy)
statement(builtin, " = bool(stage_input.", builtin, " > 0.0 ? true : false);");
else
{
statement(builtin, " = int(stage_input.", builtin, ");");
}
break;
}
case BuiltInVertexId: case BuiltInVertexId:
case BuiltInVertexIndex: case BuiltInVertexIndex:
case BuiltInInstanceIndex: case BuiltInInstanceIndex: