Merge pull request #1941 from KhronosGroup/fix-1934
MSL: Potentially cast loaded Input variables.
This commit is contained in:
commit
bfefb5f511
@ -69,7 +69,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
|
||||
c[1] = in.c_1;
|
||||
e[0] = in.e_0;
|
||||
e[1] = in.e_1;
|
||||
out.FragColor = float4(float(int(in.a.x)), float(in.b.x), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy);
|
||||
out.FragColor = float4(float(int(short(in.a.x))), float(int(in.b.x)), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ vertex main0_out main0(main0_in in [[stage_in]])
|
||||
c[1] = in.c_1;
|
||||
d[0] = in.d_0;
|
||||
d[1] = in.d_1;
|
||||
out.gl_Position = float4(float(int(in.a.x)), float(in.b.x), float(uint(c[1])), float(d[0].w));
|
||||
out.gl_Position = float4(float(int(short(in.a.x))), float(int(in.b.x)), float(uint(c[1])), float(d[0].w));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ fragment main0_out main0(main0_in in [[stage_in]])
|
||||
c[1] = in.c_1;
|
||||
e[0] = in.e_0;
|
||||
e[1] = in.e_1;
|
||||
out.FragColor = float4(float(int(in.a.x)), float(in.b.x), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy);
|
||||
out.FragColor = float4(float(int(short(in.a.x))), float(int(in.b.x)), float2(float(uint(c[1])), float(e[0].w)) + in.d.xy);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ vertex main0_out main0(main0_in in [[stage_in]])
|
||||
c[1] = in.c_1;
|
||||
d[0] = in.d_0;
|
||||
d[1] = in.d_1;
|
||||
out.gl_Position = float4(float(int(in.a.x)), float(in.b.x), float(uint(c[1])), float(d[0].w));
|
||||
out.gl_Position = float4(float(int(short(in.a.x))), float(int(in.b.x)), float(uint(c[1])), float(d[0].w));
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -15685,9 +15685,19 @@ void CompilerMSL::cast_from_variable_load(uint32_t source_id, std::string &expr,
|
||||
if (var && var->storage == StorageClassWorkgroup && expr_type.basetype == SPIRType::Boolean)
|
||||
expr = join(type_to_glsl(expr_type), "(", expr, ")");
|
||||
|
||||
// Only interested in standalone builtin variables.
|
||||
// Only interested in standalone builtin variables in the switch below.
|
||||
if (!has_decoration(source_id, DecorationBuiltIn))
|
||||
{
|
||||
// If the backing variable does not match our expected sign, we can fix it up here.
|
||||
// See ensure_correct_input_type().
|
||||
if (var && var->storage == StorageClassInput)
|
||||
{
|
||||
auto &base_type = get<SPIRType>(var->basetype);
|
||||
if (base_type.basetype != SPIRType::Struct && expr_type.basetype != base_type.basetype)
|
||||
expr = join(type_to_glsl(expr_type), "(", expr, ")");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto builtin = static_cast<BuiltIn>(get_decoration(source_id, DecorationBuiltIn));
|
||||
auto expected_type = expr_type.basetype;
|
||||
|
Loading…
Reference in New Issue
Block a user