diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-06-10 09:39:17 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-06-11 08:44:18 -0700 |
commit | ed1c48e91d0d43e2e796e904d6093f2474a1e00d (patch) | |
tree | 7c5570bfe6ac01d7f75fb73b40ffb6b64d8a6e34 /src/gallium/drivers/panfrost/midgard | |
parent | b586ed51f337dc8ab2140bdec01e5ce4c61538ce (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/midgard')
-rw-r--r-- | src/gallium/drivers/panfrost/midgard/disassemble.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/midgard/midgard.h | 8 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/midgard/midgard_compile.c | 16 |
3 files changed, 7 insertions, 24 deletions
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 */ |