mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
pco, pygen: add bitset support for op mods
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32258>
This commit is contained in:
parent
7c57e25550
commit
561098cf7d
3 changed files with 13 additions and 5 deletions
|
|
@ -55,6 +55,7 @@ const struct pco_op_mod_info pco_op_mod_info[_PCO_OP_MOD_COUNT] = {
|
|||
.print_early = ${str(op_mod.t.print_early).lower()},
|
||||
.type = ${op_mod.ctype},
|
||||
% if op_mod.t.base_type == BaseType.enum:
|
||||
.is_bitset = ${str(op_mod.t.enum.is_bitset).lower()},
|
||||
.strs = (const char * []){
|
||||
% for elem in op_mod.t.enum.elems.values():
|
||||
[${elem.cname}] = "${elem.string}",
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ extern const struct pco_op_info pco_op_info[_PCO_OP_COUNT];
|
|||
/** Op mod info. */
|
||||
struct pco_op_mod_info {
|
||||
bool print_early : 1; /** Set if printed before the op. */
|
||||
bool is_bitset : 1; /** Set if type is an enum bitset. */
|
||||
enum pco_mod_type type; /** Datatype. */
|
||||
union {
|
||||
const char *str; /** Mod name. */
|
||||
|
|
|
|||
|
|
@ -370,11 +370,17 @@ static void pco_print_instr_mods(pco_print_state *state,
|
|||
break;
|
||||
|
||||
case PCO_MOD_TYPE_ENUM:
|
||||
if (strlen(mod_info->strs[val])) {
|
||||
if (print_early)
|
||||
pco_printf(state, "%s ", mod_info->strs[val]);
|
||||
else
|
||||
pco_printf(state, ".%s", mod_info->strs[val]);
|
||||
if (mod_info->is_bitset) {
|
||||
u_foreach_bit (bit, val) {
|
||||
pco_printf(state, ".%s", mod_info->strs[1U << bit]);
|
||||
}
|
||||
} else {
|
||||
if (strlen(mod_info->strs[val])) {
|
||||
if (print_early)
|
||||
pco_printf(state, "%s ", mod_info->strs[val]);
|
||||
else
|
||||
pco_printf(state, ".%s", mod_info->strs[val]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue