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:
parent
5a3088e85f
commit
1d0b3ef051
|
@ -1282,10 +1282,10 @@ print_texture_format(FILE *fp, int format)
|
||||||
fprintf(fp, ".");
|
fprintf(fp, ".");
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
DEFINE_CASE(MALI_TEX_1D, "1d");
|
DEFINE_CASE(1, "1d");
|
||||||
DEFINE_CASE(MALI_TEX_2D, "2d");
|
DEFINE_CASE(2, "2d");
|
||||||
DEFINE_CASE(MALI_TEX_3D, "3d");
|
DEFINE_CASE(3, "3d");
|
||||||
DEFINE_CASE(MALI_TEX_CUBE, "cube");
|
DEFINE_CASE(0, "cube");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Bad format");
|
unreachable("Bad format");
|
||||||
|
|
|
@ -679,7 +679,7 @@ __attribute__((__packed__))
|
||||||
unsigned cont : 1;
|
unsigned cont : 1;
|
||||||
unsigned last : 1;
|
unsigned last : 1;
|
||||||
|
|
||||||
enum mali_texture_type format : 2;
|
unsigned format : 2;
|
||||||
|
|
||||||
/* Are sampler_handle/texture_handler respectively set by registers? If
|
/* Are sampler_handle/texture_handler respectively set by registers? If
|
||||||
* true, the lower 8-bits of the respective field is a register word.
|
* true, the lower 8-bits of the respective field is a register word.
|
||||||
|
|
|
@ -1973,25 +1973,26 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns dimension with 0 special casing cubemaps */
|
||||||
static unsigned
|
static unsigned
|
||||||
midgard_tex_format(enum glsl_sampler_dim dim)
|
midgard_tex_format(enum glsl_sampler_dim dim)
|
||||||
{
|
{
|
||||||
switch (dim) {
|
switch (dim) {
|
||||||
case GLSL_SAMPLER_DIM_1D:
|
case GLSL_SAMPLER_DIM_1D:
|
||||||
case GLSL_SAMPLER_DIM_BUF:
|
case GLSL_SAMPLER_DIM_BUF:
|
||||||
return MALI_TEX_1D;
|
return 1;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_2D:
|
case GLSL_SAMPLER_DIM_2D:
|
||||||
case GLSL_SAMPLER_DIM_MS:
|
case GLSL_SAMPLER_DIM_MS:
|
||||||
case GLSL_SAMPLER_DIM_EXTERNAL:
|
case GLSL_SAMPLER_DIM_EXTERNAL:
|
||||||
case GLSL_SAMPLER_DIM_RECT:
|
case GLSL_SAMPLER_DIM_RECT:
|
||||||
return MALI_TEX_2D;
|
return 2;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_3D:
|
case GLSL_SAMPLER_DIM_3D:
|
||||||
return MALI_TEX_3D;
|
return 3;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_CUBE:
|
case GLSL_SAMPLER_DIM_CUBE:
|
||||||
return MALI_TEX_CUBE;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DBG("Unknown sampler dim type\n");
|
DBG("Unknown sampler dim type\n");
|
||||||
|
|
|
@ -108,7 +108,7 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr)
|
||||||
.src_types = { nir_type_float32, nir_type_float32 },
|
.src_types = { nir_type_float32, nir_type_float32 },
|
||||||
.op = mir_derivative_op(instr->op),
|
.op = mir_derivative_op(instr->op),
|
||||||
.texture = {
|
.texture = {
|
||||||
.format = MALI_TEX_2D,
|
.format = 2,
|
||||||
.in_reg_full = 1,
|
.in_reg_full = 1,
|
||||||
.out_full = 1,
|
.out_full = 1,
|
||||||
.sampler_type = MALI_SAMPLER_FLOAT,
|
.sampler_type = MALI_SAMPLER_FLOAT,
|
||||||
|
|
Loading…
Reference in New Issue