Mesa (main): virgl: Add an extra mov for int outputs from constant and immediate inputs
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 12 10:54:12 UTC 2022
Module: Mesa
Branch: main
Commit: d1c7a7b1317c518e160cc6d37245de22b2bfa60d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d1c7a7b1317c518e160cc6d37245de22b2bfa60d
Author: Gert Wollny <gert.wollny at collabora.com>
Date: Tue Apr 12 11:47:31 2022 +0200
virgl: Add an extra mov for int outputs from constant and immediate inputs
virglrenderer doesn't properly emit the conversion code when the source
is a integer value and the output is also integer.
Fixes on NTT:
dEQP-GLES31.functional.shaders.sample_variables.sample_mask.inverse_per_*
v2: fix typo (Emma)
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15836>
---
src/gallium/drivers/virgl/virgl_tgsi.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/gallium/drivers/virgl/virgl_tgsi.c b/src/gallium/drivers/virgl/virgl_tgsi.c
index 2a4f8bd3abe..5e67278aa9b 100644
--- a/src/gallium/drivers/virgl/virgl_tgsi.c
+++ b/src/gallium/drivers/virgl/virgl_tgsi.c
@@ -329,6 +329,27 @@ virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
inst->Src[0].Register.Index = vtctx->src_temp;
}
+ /* virglrenderer doesn't resolve non-float output write properly,
+ * so we have to first write to a temporary */
+ if ((inst->Src[0].Register.File == TGSI_FILE_CONSTANT ||
+ inst->Src[0].Register.File == TGSI_FILE_IMMEDIATE) &&
+ inst->Dst[0].Register.File == TGSI_FILE_OUTPUT &&
+ tgsi_opcode_infer_dst_type(inst->Instruction.Opcode, 0) != TGSI_TYPE_FLOAT) {
+ struct tgsi_full_instruction op_to_temp = *inst;
+ op_to_temp.Dst[0].Register.File = TGSI_FILE_TEMPORARY;
+ op_to_temp.Dst[0].Register.Index = vtctx->src_temp;
+ ctx->emit_instruction(ctx, &op_to_temp);
+
+ inst->Instruction.Opcode = TGSI_OPCODE_MOV;
+ inst->Src[0].Register.File = TGSI_FILE_TEMPORARY;
+ inst->Src[0].Register.Index = vtctx->src_temp;
+ inst->Src[0].Register.Indirect = 0;
+ inst->Src[0].Register.SwizzleX = 0;
+ inst->Src[0].Register.SwizzleY = 1;
+ inst->Src[0].Register.SwizzleZ = 2;
+ inst->Src[0].Register.SwizzleW = 3;
+ }
+
for (unsigned i = 0; i < inst->Instruction.NumDstRegs; i++) {
/* virglrenderer would fail to compile on clipdist, clipvertex, and some
* two-sided-related color writes without a full writemask. So, we write
More information about the mesa-commit
mailing list