MSL: Only do address-of expression when needed.

This commit is contained in:
Hans-Kristian Arntzen 2023-12-06 15:01:32 +01:00
parent ed7ba43062
commit 0836c81e73

View File

@ -10027,7 +10027,8 @@ string CompilerGLSL::access_chain_internal(uint32_t base, const uint32_t *indice
// We are considered to have a pointer to array and one element shifts by one array at a time.
// If we use normal array indexing, we'll first decay to pointer, and lose the array-ness,
// so we have to take pointer to array explicitly.
expr = enclose_expression(address_of_expression(expr));
if (!should_dereference(base))
expr = enclose_expression(address_of_expression(expr));
}
if (ptr_chain && i == 0)