From 92d529e7e4dee7a024a7745d28911857b5042fe9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Mon, 31 Jul 2017 11:58:29 +0000 Subject: [PATCH] freedreno: a2xx: Support TEXTURE_RECT Denormalized texture coordinates are required for text rendering in GALLIUM_HUD. Signed-off-by: Wladimir J. van der Laan Reviewed-by: Ilia Mirkin Reviewed-by: Rob Clark --- src/gallium/drivers/freedreno/a2xx/fd2_compiler.c | 3 ++- src/gallium/drivers/freedreno/a2xx/ir-a2xx.c | 1 + src/gallium/drivers/freedreno/a2xx/ir-a2xx.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c b/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c index 2ffd8cd5a77..9f2fc6168ba 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_compiler.c @@ -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: */ diff --git a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c index 163c2820384..42a9ab494e6 100644 --- a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c +++ b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.c @@ -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; diff --git a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h index 36ed2043b2f..c4b6c18e24c 100644 --- a/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h +++ b/src/gallium/drivers/freedreno/a2xx/ir-a2xx.h @@ -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; -- 2.30.2