panfrost: Treat texture dimension as first-class

Instead of hiding behind a cmdstream enum. The raw values have a very
simple interpretation as dimension.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6196>
This commit is contained in:
Alyssa Rosenzweig 2020-08-05 18:11:15 -04:00 committed by Marge Bot
parent 5a3088e85f
commit 1d0b3ef051
4 changed files with 11 additions and 10 deletions

View File

@ -1282,10 +1282,10 @@ print_texture_format(FILE *fp, int format)
fprintf(fp, ".");
switch (format) {
DEFINE_CASE(MALI_TEX_1D, "1d");
DEFINE_CASE(MALI_TEX_2D, "2d");
DEFINE_CASE(MALI_TEX_3D, "3d");
DEFINE_CASE(MALI_TEX_CUBE, "cube");
DEFINE_CASE(1, "1d");
DEFINE_CASE(2, "2d");
DEFINE_CASE(3, "3d");
DEFINE_CASE(0, "cube");
default:
unreachable("Bad format");

View File

@ -679,7 +679,7 @@ __attribute__((__packed__))
unsigned cont : 1;
unsigned last : 1;
enum mali_texture_type format : 2;
unsigned format : 2;
/* Are sampler_handle/texture_handler respectively set by registers? If
* true, the lower 8-bits of the respective field is a register word.

View File

@ -1973,25 +1973,26 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
}
}
/* Returns dimension with 0 special casing cubemaps */
static unsigned
midgard_tex_format(enum glsl_sampler_dim dim)
{
switch (dim) {
case GLSL_SAMPLER_DIM_1D:
case GLSL_SAMPLER_DIM_BUF:
return MALI_TEX_1D;
return 1;
case GLSL_SAMPLER_DIM_2D:
case GLSL_SAMPLER_DIM_MS:
case GLSL_SAMPLER_DIM_EXTERNAL:
case GLSL_SAMPLER_DIM_RECT:
return MALI_TEX_2D;
return 2;
case GLSL_SAMPLER_DIM_3D:
return MALI_TEX_3D;
return 3;
case GLSL_SAMPLER_DIM_CUBE:
return MALI_TEX_CUBE;
return 0;
default:
DBG("Unknown sampler dim type\n");

View File

@ -108,7 +108,7 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr)
.src_types = { nir_type_float32, nir_type_float32 },
.op = mir_derivative_op(instr->op),
.texture = {
.format = MALI_TEX_2D,
.format = 2,
.in_reg_full = 1,
.out_full = 1,
.sampler_type = MALI_SAMPLER_FLOAT,