SPIRV-Cross/reference/shaders-msl
Hans-Kristian Arntzen acae607703 Register implied expression reads in OpLoad/OpAccessChain.
This is required to avoid relying on complex sub-expression elimination
in compilers, and generates cleaner code.

The problem case is if a complex expression is used in an access chain,
like:

Composite comp = buffer[texture(...)];
vec4 a = comp.a + comp.b + comp.c;

Before, we did not have common subexpression tracking for
OpLoad/OpAccessChain, so we easily ended up with code like:

vec4 a = buffer[texture(...)].a + buffer[texture(...)].b + buffer[texture(...)].c;

A good compiler will optimize this, but we should not rely on it, and
forcing texture(...) to a temporary also looks better.

The solution is to add a vector "implied_expression_reads", which works
similarly to expression_dependencies. We also need an extra mechanism in
to_expression which lets us skip expression read checking and do it
later. E.g. for expr -> access chain -> load, we should only trigger
a read of expr when using the loaded expression.
2019-01-04 14:56:12 +01:00
..
asm Test loading from and storing to packed vectors. 2018-11-14 10:47:20 -06:00
comp Support bitcasts of 16-bit types. 2018-11-05 14:56:36 -06:00
desktop-only Correct carry/borrow bit checks. 2018-11-14 10:13:56 -06:00
flatten MSL: Emit F{Min,Max,Clamp} as fast:: and N{Min,Max,Clamp} as precise::. 2018-09-01 23:01:46 -05:00
frag Register implied expression reads in OpLoad/OpAccessChain. 2019-01-04 14:56:12 +01:00
legacy/vert CompilerMSL support matrices & arrays in stage-in & stage-out. 2018-06-12 11:41:35 -04:00
vert MSL: Emit wrapper for SSign (sign() for int types) 2018-11-08 13:08:34 +10:00
vulkan Add support for 8- and 16-bit types to GLSL and MSL. 2018-11-01 10:20:57 -05:00