gallium/ureg: Sort the output decls.

glsl_to_tgsi had been emitting outputs in sorted order, and it seems virgl
has a dependency on that -- it collects outputs into an array and indexes
by the subtracting the ".First" value of the first one seen, even if
that's not the first entry in the array.

Fixes the regressions in deqp-gles2 on virgl with ST_DEBUG=force_nir, and
fixes neverball trace rendering.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11934>
This commit is contained in:
Eric Anholt 2021-03-12 13:53:33 -08:00 committed by Marge Bot
parent 929558776e
commit af0fa5016d
2 changed files with 14 additions and 3 deletions

View File

@ -135,7 +135,7 @@ struct ureg_program
} system_value[UREG_MAX_SYSTEM_VALUE];
unsigned nr_system_values;
struct {
struct ureg_output_decl {
enum tgsi_semantic semantic_name;
unsigned semantic_index;
unsigned streams;
@ -1819,6 +1819,13 @@ emit_property(struct ureg_program *ureg,
out[1].prop_data.Data = data;
}
static int
output_sort(const void *in_a, const void *in_b)
{
const struct ureg_output_decl *a = in_a, *b = in_b;
return a->first - b->first;
}
static void emit_decls( struct ureg_program *ureg )
{
@ -1908,6 +1915,11 @@ static void emit_decls( struct ureg_program *ureg )
TGSI_WRITEMASK_XYZW, 0, FALSE);
}
/* While not required by TGSI spec, virglrenderer has a dependency on the
* outputs being sorted.
*/
qsort(ureg->output, ureg->nr_outputs, sizeof(ureg->output[0]), output_sort);
if (ureg->supports_any_inout_decl_range) {
for (i = 0; i < ureg->nr_outputs; i++) {
emit_decl_semantic(ureg,

View File

@ -215,11 +215,10 @@ traces:
# expectations:
# - device: gl-virgl
# checksum: 9571117bf4eab6fe29b12f6c3d42d865
# The neverball foreground is actually missing
- path: neverball/neverball.trace
expectations:
- device: gl-virgl
checksum: aa91b3f52d233ecded7d5979351b6859
checksum: 6936cde5edab2b3fd02115ef36015cde
# Crash
# - path: pathfinder/canvas_moire.trace
# expectations: