freedreno: a2xx: Support TEXTURE_RECT
authorWladimir J. van der Laan <laanwj@gmail.com>
Mon, 31 Jul 2017 11:58:29 +0000 (11:58 +0000)
committerWladimir J. van der Laan <laanwj@gmail.com>
Sat, 31 Mar 2018 06:17:59 +0000 (06:17 +0000)
Denormalized texture coordinates are required for text rendering in
GALLIUM_HUD.

Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/a2xx/fd2_compiler.c
src/gallium/drivers/freedreno/a2xx/ir-a2xx.c
src/gallium/drivers/freedreno/a2xx/ir-a2xx.h

index 2ffd8cd5a773f84f7454721aa08ac59371b39f4a..9f2fc6168ba8cb2a233ec7eb0e5cce5e727fa7cf 100644 (file)
@@ -791,6 +791,7 @@ translate_tex(struct fd2_compile_context *ctx,
        instr = ir2_instr_create(next_exec_cf(ctx), IR2_FETCH);
        instr->fetch.opc = TEX_FETCH;
        instr->fetch.is_cube = (inst->Texture.Texture == TGSI_TEXTURE_3D);
+       instr->fetch.is_rect = (inst->Texture.Texture == TGSI_TEXTURE_RECT);
        assert(inst->Texture.NumOffsets <= 1); // TODO what to do in other cases?
 
        /* save off the tex fetch to be patched later with correct const_idx: */
@@ -802,7 +803,7 @@ translate_tex(struct fd2_compile_context *ctx,
        reg = add_src_reg(ctx, instr, coord);
 
        /* blob compiler always sets 3rd component to same as 1st for 2d: */
-       if (inst->Texture.Texture == TGSI_TEXTURE_2D)
+       if (inst->Texture.Texture == TGSI_TEXTURE_2D || inst->Texture.Texture == TGSI_TEXTURE_RECT)
                reg->swizzle[2] = reg->swizzle[0];
 
        /* dst register needs to be marked for sync: */
index 163c2820384b28bef82f43b8dabf35c125277a3f..42a9ab494e6ca649d231ef29f71393f8838b94b3 100644 (file)
@@ -341,6 +341,7 @@ static int instr_emit_fetch(struct ir2_instruction *instr,
                tex->use_comp_lod = 1;
                tex->use_reg_lod = !instr->fetch.is_cube;
                tex->sample_location = SAMPLE_CENTER;
+               tex->tx_coord_denorm = instr->fetch.is_rect;
 
                if (instr->pred != IR2_PRED_NONE) {
                        tex->pred_select = 1;
index 36ed2043b2f8bfe11817c4823ab7de377d4bcb70..c4b6c18e24c469af2736c1a44a2ee42d178bcc8a 100644 (file)
@@ -74,6 +74,7 @@ struct ir2_instruction {
                        unsigned const_idx;
                        /* texture fetch specific: */
                        bool is_cube : 1;
+                       bool is_rect : 1;
                        /* vertex fetch specific: */
                        unsigned const_idx_sel;
                        enum a2xx_sq_surfaceformat fmt;