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:  c5cc9ed29b
    virgl: Switch to nir-to-tgsi by default.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6929

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17765>
This commit is contained in:
Gert Wollny 2022-07-27 15:13:12 +02:00 committed by Marge Bot
parent 9ba62ea8fb
commit ce42fc4fa1
3 changed files with 6 additions and 3 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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);