Mesa (main): virgl: Fix relocating the re-writing the transformation code

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 13 10:13:13 UTC 2022


Module: Mesa
Branch: main
Commit: a30ff9056147352e9537a97072232f942d502bb4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a30ff9056147352e9537a97072232f942d502bb4

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Wed Apr 13 11:59:20 2022 +0200

virgl: Fix relocating the re-writing the transformation code

The transformation must come before the code emission.

Fixes: 6a264e7024a29eb7

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15919>

---

 src/gallium/drivers/virgl/virgl_tgsi.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/virgl/virgl_tgsi.c b/src/gallium/drivers/virgl/virgl_tgsi.c
index 9e6158b1690..747ac0e043b 100644
--- a/src/gallium/drivers/virgl/virgl_tgsi.c
+++ b/src/gallium/drivers/virgl/virgl_tgsi.c
@@ -151,7 +151,7 @@ virgl_tgsi_transform_property(struct tgsi_transform_context *ctx,
    case TGSI_PROPERTY_NUM_CLIPDIST_ENABLED:
    case TGSI_PROPERTY_NUM_CULLDIST_ENABLED:
       if (vtctx->cull_enabled)
-	 ctx->emit_property(ctx, prop);
+    ctx->emit_property(ctx, prop);
       break;
    case TGSI_PROPERTY_NEXT_SHADER:
       break;
@@ -260,7 +260,7 @@ virgl_tgsi_rewrite_src_for_input_temp(struct virgl_input_temp *temp, struct tgsi
 
 static void
 virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
-				 struct tgsi_full_instruction *inst)
+             struct tgsi_full_instruction *inst)
 {
    struct virgl_transform_context *vtctx = (struct virgl_transform_context *)ctx;
    if (vtctx->fake_fp64 &&
@@ -382,7 +382,6 @@ virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
          inst->Src[i].Register.SwizzleW = TGSI_SWIZZLE_W;
       }
    }
-   ctx->emit_instruction(ctx, inst);
 
    /* virglrenderer doesn't resolve non-float output write properly,
     * so we have to first write to a temporary */
@@ -408,6 +407,8 @@ virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
       inst->Src[0].Register.SwizzleW = 3;
    }
 
+   ctx->emit_instruction(ctx, inst);
+
    for (unsigned i = 0; i < inst->Instruction.NumDstRegs; i++) {
       if (vtctx->num_writemask_fixups &&
          inst->Dst[i].Register.File == TGSI_FILE_TEMPORARY &&



More information about the mesa-commit mailing list