From: Alyssa Rosenzweig Date: Mon, 10 Jun 2019 16:39:17 +0000 (-0700) Subject: panfrost/midgard: Expand texture to 4-channel swizzle X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed1c48e91d0d43e2e796e904d6093f2474a1e00d;p=mesa.git panfrost/midgard: Expand texture to 4-channel swizzle This eliminates some unknowns, clarifies 3D textures, and will maybe help with array/shadow textures? Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/midgard/disassemble.c b/src/gallium/drivers/panfrost/midgard/disassemble.c index 3d4a56f4908..9e744f6b287 100644 --- a/src/gallium/drivers/panfrost/midgard/disassemble.c +++ b/src/gallium/drivers/panfrost/midgard/disassemble.c @@ -1091,8 +1091,7 @@ print_texture_word(uint32_t *word, unsigned tabs) printf(", "); print_texture_reg(/*texture->in_reg_full*/true, texture->in_reg_select, texture->in_reg_upper); - printf(".%c%c, ", "xyzw"[texture->in_reg_swizzle_left], - "xyzw"[texture->in_reg_swizzle_right]); + print_swizzle_vec4(texture->in_reg_swizzle, false, false); /* TODO: can offsets be full words? */ if (texture->has_offset) { @@ -1108,15 +1107,13 @@ print_texture_word(uint32_t *word, unsigned tabs) /* While not zero in general, for these simple instructions the * following unknowns are zero, so we don't include them */ - if (texture->unknown1 || - texture->unknown2 || + if (texture->unknown2 || texture->unknown3 || texture->unknown4 || texture->unknownA || texture->unknownB || texture->unknown8 || texture->unknown9) { - printf("// unknown1 = 0x%x\n", texture->unknown1); printf("// unknown2 = 0x%x\n", texture->unknown2); printf("// unknown3 = 0x%x\n", texture->unknown3); printf("// unknown4 = 0x%x\n", texture->unknown4); diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h index 995eaa9a90a..5d38f3f5483 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard.h +++ b/src/gallium/drivers/panfrost/midgard/midgard.h @@ -505,13 +505,9 @@ __attribute__((__packed__)) unsigned in_reg_select : 1; unsigned in_reg_upper : 1; + unsigned in_reg_swizzle : 8; - unsigned in_reg_swizzle_left : 2; - unsigned in_reg_swizzle_right : 2; - - unsigned unknown1 : 2; - - unsigned unknown8 : 4; + unsigned unknown8 : 2; unsigned out_full : 1; diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 4ea8834de2b..e7c093e9a29 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -1372,12 +1372,13 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr) .texture_handle = texture_index, .sampler_handle = sampler_index, - /* TODO: Don't force xyzw */ - .swizzle = SWIZZLE(COMPONENT_X, COMPONENT_Y, COMPONENT_Z, COMPONENT_W), + /* TODO: Regalloc it in */ + .swizzle = SWIZZLE_XYZW, .mask = 0xF, /* TODO: half */ //.in_reg_full = 1, + .in_reg_swizzle = SWIZZLE_XYZW, .out_full = 1, .filter = 1, @@ -1394,17 +1395,6 @@ emit_tex(compiler_context *ctx, nir_tex_instr *instr) ins.texture.in_reg_select = in_reg; ins.texture.out_reg_select = out_reg; - /* TODO: Dynamic swizzle input selection, half-swizzles? */ - if (instr->sampler_dim == GLSL_SAMPLER_DIM_3D) { - ins.texture.in_reg_swizzle_right = COMPONENT_X; - ins.texture.in_reg_swizzle_left = COMPONENT_Y; - //ins.texture.in_reg_swizzle_third = COMPONENT_Z; - } else { - ins.texture.in_reg_swizzle_left = COMPONENT_X; - ins.texture.in_reg_swizzle_right = COMPONENT_Y; - //ins.texture.in_reg_swizzle_third = COMPONENT_X; - } - emit_mir_instruction(ctx, ins); /* Simultaneously alias the destination and emit a move for it. The move will be eliminated if possible */