Created attachment 133219 [details] test to demonstrate error. I've written a cut down test that shows a problem virgl hits. It triggers an assert in the validation that the ir->type and ir->operands[0]->type for an abs op are the same and they aren't. temp0[1].x = float(inversesqrt( abs(temp0[0]).x)); temp0[1].y = float(inversesqrt( abs(temp0[0]).y)); is the construct that the compiler squashes incorrectly. Not sure what pass is responsible for this yet.
ah looks like do_vectorize START GLSL optimization do_vectorize ( (declare (location=0 shader_out ) vec4 gl_Position) (declare (shader_in ) (array vec4 3) vertex) (declare (shader_out ) vec4 temp) (declare (temporary ) vec4 temp0_0) (declare (temporary ) vec4 temp0_1) ( function main (signature void (parameters ) ( (assign (xyzw) (var_ref temp0_0) (array_ref (var_ref vertex) (constant int (0)) ) ) (assign (xy) (var_ref temp0_1) (expression vec2 rsq (swiz xy (expression vec2 abs (var_ref temp0_0) ) )) ) (assign (xyzw) (var_ref gl_Position) (array_ref (var_ref vertex) (constant int (0)) ) ) (assign (xyzw) (var_ref temp) (var_ref temp0_1) ) (emit-vertex (constant int (0)) ) )) )
START GLSL optimization optimize_split_arrays ( (declare (location=0 shader_out ) vec4 gl_Position) (declare (shader_in ) (array vec4 3) vertex) (declare (shader_out ) vec4 temp) (declare (temporary ) vec4 temp0_0) (declare (temporary ) vec4 temp0_1) ( function main (signature void (parameters ) ( (assign (xyzw) (var_ref temp0_0) (array_ref (var_ref vertex) (constant int (0)) ) ) (assign (x) (var_ref temp0_1) (expression float rsq (swiz x (expression vec4 abs (var_ref temp0_0) ) )) ) (assign (y) (var_ref temp0_1) (expression float rsq (swiz y (expression vec4 abs (var_ref temp0_0) ) )) ) (assign (xyzw) (var_ref gl_Position) (array_ref (var_ref vertex) (constant int (0)) ) ) (assign (xyzw) (var_ref temp) (var_ref temp0_1) ) (emit-vertex (constant int (0)) ) )) previous IR before bad opt.
Created attachment 133221 [details] [review] hacky attempt at fixing it.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/813.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.