diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-01-06 12:33:17 +0300 |
---|---|---|
committer | Hans-Kristian Arntzen <post@arntzen-software.no> | 2021-01-06 12:33:17 +0300 |
commit | ab9200ffdff1e485a8c398995afb291137a14c99 (patch) | |
tree | 3e7009bee841c4bf9007df41bf928527961389f2 /spirv_msl.cpp | |
parent | df4f8ef8fef36d8a4d4ff3f041a00939e48f0851 (diff) |
MSL: Don't flatten builtin arrays unless they're part of IO interface.
Diffstat (limited to 'spirv_msl.cpp')
-rw-r--r-- | spirv_msl.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 9c2852a7..12ec2db5 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -9906,7 +9906,14 @@ string CompilerMSL::to_struct_member(const SPIRType &type, uint32_t member_type_ physical_type.basetype != SPIRType::SampledImage) { BuiltIn builtin = BuiltInMax; - if (is_member_builtin(type, index, &builtin)) + + // Special handling. In [[stage_out]] or [[stage_in]] blocks, + // we need flat arrays, but if we're somehow declaring gl_PerVertex for constant array reasons, we want + // template array types to be declared. + bool is_ib_in_out = + ((stage_out_var_id && get_stage_out_struct_type().self == type.self) || + (stage_in_var_id && get_stage_in_struct_type().self == type.self)); + if (is_ib_in_out && is_member_builtin(type, index, &builtin)) is_using_builtin_array = true; array_type = type_to_array_glsl(physical_type); } |