agx: Print agx_dim appropriately
Easier to read, and gets us closer to proper disasm in Mesa. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804>
This commit is contained in:

committed by
Marge Bot

parent
6c95572ef0
commit
f665229d77
@@ -989,23 +989,23 @@ agx_tex_dim(enum glsl_sampler_dim dim, bool array)
|
|||||||
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 array ? AGX_DIM_TEX_1D_ARRAY : AGX_DIM_TEX_1D;
|
return array ? AGX_DIM_1D_ARRAY : AGX_DIM_1D;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_2D:
|
case GLSL_SAMPLER_DIM_2D:
|
||||||
case GLSL_SAMPLER_DIM_RECT:
|
case GLSL_SAMPLER_DIM_RECT:
|
||||||
case GLSL_SAMPLER_DIM_EXTERNAL:
|
case GLSL_SAMPLER_DIM_EXTERNAL:
|
||||||
return array ? AGX_DIM_TEX_2D_ARRAY : AGX_DIM_TEX_2D;
|
return array ? AGX_DIM_2D_ARRAY : AGX_DIM_2D;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_MS:
|
case GLSL_SAMPLER_DIM_MS:
|
||||||
assert(!array && "multisampled arrays unsupported");
|
assert(!array && "multisampled arrays unsupported");
|
||||||
return AGX_DIM_TEX_2D_MS;
|
return AGX_DIM_2D_MS;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_3D:
|
case GLSL_SAMPLER_DIM_3D:
|
||||||
assert(!array && "3D arrays unsupported");
|
assert(!array && "3D arrays unsupported");
|
||||||
return AGX_DIM_TEX_3D;
|
return AGX_DIM_3D;
|
||||||
|
|
||||||
case GLSL_SAMPLER_DIM_CUBE:
|
case GLSL_SAMPLER_DIM_CUBE:
|
||||||
return array ? AGX_DIM_TEX_CUBE_ARRAY : AGX_DIM_TEX_CUBE;
|
return array ? AGX_DIM_CUBE_ARRAY : AGX_DIM_CUBE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("Invalid sampler dim\n");
|
unreachable("Invalid sampler dim\n");
|
||||||
|
@@ -257,17 +257,6 @@ enum agx_lod_mode {
|
|||||||
AGX_LOD_MODE_LOD_GRAD_MIN = 12
|
AGX_LOD_MODE_LOD_GRAD_MIN = 12
|
||||||
};
|
};
|
||||||
|
|
||||||
enum agx_dim {
|
|
||||||
AGX_DIM_TEX_1D = 0,
|
|
||||||
AGX_DIM_TEX_1D_ARRAY = 1,
|
|
||||||
AGX_DIM_TEX_2D = 2,
|
|
||||||
AGX_DIM_TEX_2D_ARRAY = 3,
|
|
||||||
AGX_DIM_TEX_2D_MS = 4,
|
|
||||||
AGX_DIM_TEX_3D = 5,
|
|
||||||
AGX_DIM_TEX_CUBE = 6,
|
|
||||||
AGX_DIM_TEX_CUBE_ARRAY = 7
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Forward declare for branch target */
|
/* Forward declare for branch target */
|
||||||
struct agx_block;
|
struct agx_block;
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ template = """/*
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "util/macros.h"
|
||||||
|
|
||||||
/* Listing of opcodes */
|
/* Listing of opcodes */
|
||||||
|
|
||||||
@@ -38,10 +39,22 @@ enum agx_opcode {
|
|||||||
|
|
||||||
% for name in enums:
|
% for name in enums:
|
||||||
enum agx_${name} {
|
enum agx_${name} {
|
||||||
% for k in enums[name]:
|
% for k, v in enums[name].items():
|
||||||
AGX_${name.upper()}_${enums[name][k].replace('.', '_').upper()} = ${k},
|
AGX_${name.upper()}_${v.replace('.', '_').upper()} = ${k},
|
||||||
% endfor
|
% endfor
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline const char *
|
||||||
|
agx_${name}_as_str(enum agx_${name} x)
|
||||||
|
{
|
||||||
|
switch (x) {
|
||||||
|
% for k, v in enums[name].items():
|
||||||
|
case AGX_${name.upper()}_${v.replace('.', '_').upper()}: return "${v}";
|
||||||
|
% endfor
|
||||||
|
default: unreachable("Nonexhaustive enum");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
/* Runtime accessible info on each defined opcode */
|
/* Runtime accessible info on each defined opcode */
|
||||||
|
@@ -93,7 +93,18 @@ SHIFT = immediate("shift")
|
|||||||
MASK = immediate("mask")
|
MASK = immediate("mask")
|
||||||
BFI_MASK = immediate("bfi_mask")
|
BFI_MASK = immediate("bfi_mask")
|
||||||
LOD_MODE = immediate("lod_mode", "enum agx_lod_mode")
|
LOD_MODE = immediate("lod_mode", "enum agx_lod_mode")
|
||||||
DIM = immediate("dim", "enum agx_dim")
|
|
||||||
|
DIM = enum("dim", {
|
||||||
|
0: '1d',
|
||||||
|
1: '1d_array',
|
||||||
|
2: '2d',
|
||||||
|
3: '2d_array',
|
||||||
|
4: '2d_ms',
|
||||||
|
5: '3d',
|
||||||
|
6: 'cube',
|
||||||
|
7: 'cube_array'
|
||||||
|
})
|
||||||
|
|
||||||
OFFSET = immediate("offset", "bool")
|
OFFSET = immediate("offset", "bool")
|
||||||
SHADOW = immediate("shadow", "bool")
|
SHADOW = immediate("shadow", "bool")
|
||||||
SCOREBOARD = immediate("scoreboard")
|
SCOREBOARD = immediate("scoreboard")
|
||||||
|
@@ -173,7 +173,7 @@ agx_print_instr(agx_instr *I, FILE *fp)
|
|||||||
else
|
else
|
||||||
print_comma = true;
|
print_comma = true;
|
||||||
|
|
||||||
fprintf(fp, "dim %u", I->dim); // TODO enumify
|
fputs(agx_dim_as_str(I->dim), fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.immediates & AGX_IMMEDIATE_SCOREBOARD) {
|
if (info.immediates & AGX_IMMEDIATE_SCOREBOARD) {
|
||||||
|
Reference in New Issue
Block a user