Disabling lower_fragdata_array causes shader-db to crash for some drivers
Since commit:
commit 1c2bf82d24a12c3a25c563ca601f0da859b767e7
Author: Timothy Arceri tarceri@itsqueeze.com
Date: Wed Oct 30 11:34:27 2019 +1100
glsl: disable lower_fragdata_array() for NIR drivers
V3D started to crash in shader-db runs when hitting some Portal 2 shaders, such as portal-2/high/65.shader_test which has a single write to gl_FragData[0].
The driver backend expects all its output variables to be scalar and asserts on this. Before the commit mentioned above this was ensured via lower_fragdata_array(), but since that commit, with that Portal-2 shader, we receive gl_FragData as an array variable with 4 elements.
This behavior can be observed with Iris too which receives a shader with:
decl_var shader_out INTERP_MODE_NONE coherent restrict vec4[8] gl_FragData (FRAG_RESULT_DATA0, 8, 0)
but the Iris driver seems to not be affected by this (at least it does not crash) unlike V3D, which relies on the definition of the output variables to to do its output setup.
I should mention that this seems to be a corner case, since there are other tests that use gl_FragData where this issue doesn't occur (that is, we don't receive an array gl_FragData in the backend). I think the thing that is special about this shader is that NIR seems to be optimizing out all the fragment shader code, so that the resulting shader has no writes to gl_FragData, in which case, it doesn't seem to be scalarizing the definition of the variable.