glsl-optimizer icon indicating copy to clipboard operation
glsl-optimizer copied to clipboard

Do mat_op_to_vec optimizations

Open aras-p opened this issue 11 years ago • 0 comments

do_mat_op_to_vec could be called after constant folding. The kind of optimizations this does:

Original code: vec3 N = normalize((sys_WorldMatrix * vec4( vec3( 1.0, 0.0, 0.0 ), 0 )).xyz); Current: tmpvar_1 = normalize((sys_WorldMatrix * vec4(1.0, 0.0, 0.0, 0.0)).xyz); With mat_op_to_vec: tmpvar_1 = normalize(sys_WorldMatrix[0].xyz);

However just running that turns all matrix ops into vectors, which both looks long and (potentially?) has some downsides.

Find a way to only do the mat_op_to_vec when less than "all" results are used?

aras-p avatar Apr 30 '13 20:04 aras-p