Remove redundant constructor calls for scalar types

This commit is contained in:
Arseny Kapoulkine 2017-01-24 08:09:58 -08:00
parent ed04c95b08
commit 32a561a6c3
2 changed files with 10 additions and 4 deletions

View File

@ -14,6 +14,6 @@ void main()
oB = vec4(UBO[4].y, UBO[5].y, UBO[6].y, UBO[7].y);
oC = UBO[9];
oD = vec4(UBO[10].x, UBO[11].x, UBO[12].x, UBO[13].x);
oE = vec4(UBO[1].z, float(UBO[6].y), UBO[9].z, float(UBO[12].y));
oE = vec4(UBO[1].z, UBO[6].y, UBO[9].z, UBO[12].y);
}

View File

@ -3418,8 +3418,11 @@ std::string CompilerGLSL::flattened_access_chain_vector(uint32_t base, const uin
{
std::string expr;
expr += type_to_glsl_constructor(target_type);
expr += "(";
if (target_type.vecsize > 1)
{
expr += type_to_glsl_constructor(target_type);
expr += "(";
}
for (uint32_t i = 0; i < target_type.vecsize; ++i)
{
@ -3440,7 +3443,10 @@ std::string CompilerGLSL::flattened_access_chain_vector(uint32_t base, const uin
expr += vector_swizzle(1, index % 4);
}
expr += ")";
if (target_type.vecsize > 1)
{
expr += ")";
}
return expr;
}