From ce42fc4fa16e8c32ea11cd49da1fb72f1e8a12e1 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 27 Jul 2022 15:13:12 +0200 Subject: [PATCH] virgL: lower fneg and fabs The host doesn't currently handle source mods on immediate values correctly, so lower the ops that would create these source mods. v2: update trace checksum Fixes: c5cc9ed29b50ada77f875ad0d999678021678922 virgl: Switch to nir-to-tgsi by default. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6929 Signed-off-by: Gert Wollny Reviewed-by: Italo Nicola Part-of: --- src/gallium/drivers/virgl/ci/traces-virgl.yml | 2 +- src/gallium/drivers/virgl/virgl_context.c | 6 ++++-- src/gallium/drivers/virgl/virgl_screen.c | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/virgl/ci/traces-virgl.yml b/src/gallium/drivers/virgl/ci/traces-virgl.yml index a015fd5fccc..82396976550 100644 --- a/src/gallium/drivers/virgl/ci/traces-virgl.yml +++ b/src/gallium/drivers/virgl/ci/traces-virgl.yml @@ -207,7 +207,7 @@ traces: - path: itoral-gl-terrain-demo/demo-v2.trace expectations: - device: gl-virgl - checksum: 716d4fe36a6212b161285fed8a423ee8 + checksum: 37780a6eaa38a55700e8207e89009f56 - path: neverball/neverball-v2.trace expectations: - device: gl-virgl diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c index c90b3ea7ec8..771c204d65a 100644 --- a/src/gallium/drivers/virgl/virgl_context.c +++ b/src/gallium/drivers/virgl/virgl_context.c @@ -686,7 +686,8 @@ static void *virgl_shader_encoder(struct pipe_context *ctx, if (shader->type == PIPE_SHADER_IR_NIR) { struct nir_to_tgsi_options options = { - .unoptimized_ra = true + .unoptimized_ra = true, + .lower_fabs = true }; nir_shader *s = nir_shader_clone(NULL, shader->ir.nir); @@ -1375,7 +1376,8 @@ static void *virgl_create_compute_state(struct pipe_context *ctx, if (state->ir_type == PIPE_SHADER_IR_NIR) { struct nir_to_tgsi_options options = { - .unoptimized_ra = true + .unoptimized_ra = true, + .lower_fabs = true }; nir_shader *s = nir_shader_clone(NULL, state->prog); ntt_tokens = tokens = nir_to_tgsi_options(s, vctx->base.screen, &options); /* takes ownership */ diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 862812c014e..4a9443aa296 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -1088,6 +1088,7 @@ virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *c * ffract+fsub back into ffloor. */ screen->compiler_options.lower_ffloor = true; + screen->compiler_options.lower_fneg = true; } slab_create_parent(&screen->transfer_pool, sizeof(struct virgl_transfer), 16);