From: Alyssa Rosenzweig Date: Wed, 5 Aug 2020 22:11:15 +0000 (-0400) Subject: panfrost: Treat texture dimension as first-class X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d0b3ef051e437392cb6bfff5eccf3579c1fe905;p=mesa.git 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 Part-of: --- diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index 9ffbf495618..4e54f280c84 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -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"); diff --git a/src/panfrost/midgard/midgard.h b/src/panfrost/midgard/midgard.h index d93b845098b..bcda23262f0 100644 --- a/src/panfrost/midgard/midgard.h +++ b/src/panfrost/midgard/midgard.h @@ -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. diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 174013f42fa..50260d577d2 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -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"); diff --git a/src/panfrost/midgard/midgard_derivatives.c b/src/panfrost/midgard/midgard_derivatives.c index ca31f0a37ce..29f459418e1 100644 --- a/src/panfrost/midgard/midgard_derivatives.c +++ b/src/panfrost/midgard/midgard_derivatives.c @@ -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,