nil: Move nil_tic_format to nil_format_table.h

This gets it out of nil_format.c/h and decouples things a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
This commit is contained in:
Faith Ekstrand
2024-04-05 15:39:31 -05:00
committed by Marge Bot
parent dde95fc039
commit cdaa8e67e3
4 changed files with 22 additions and 25 deletions
-8
View File
@@ -102,11 +102,3 @@ nil_format_to_depth_stencil(enum pipe_format format)
assert(fmt->support & NIL_FORMAT_SUPPORTS_DEPTH_STENCIL_BIT);
return fmt->czt;
}
const struct nil_tic_format *
nil_tic_format_for_pipe(enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
const struct nil_format_info *fmt = &nil_format_table[format];
return fmt->tic.comp_sizes == 0 ? NULL : &fmt->tic;
}
-15
View File
@@ -40,19 +40,4 @@ uint8_t nil_format_to_color_target(enum pipe_format format);
uint8_t nil_format_to_depth_stencil(enum pipe_format format);
struct nil_tic_format {
unsigned comp_sizes:8;
unsigned type_r:3;
unsigned type_g:3;
unsigned type_b:3;
unsigned type_a:3;
unsigned src_x:3;
unsigned src_y:3;
unsigned src_z:3;
unsigned src_w:3;
};
const struct nil_tic_format *
nil_tic_format_for_pipe(enum pipe_format format);
#endif /* NIL_FORMAT_H */
+13 -1
View File
@@ -17,7 +17,7 @@ TEMPLATE_H = template.Template(text="""\
#ifndef ${guard}
#define ${guard}
#include "nil_format.h"
#include "util/format/u_format.h"
enum nil_format_support_flags {
NIL_FORMAT_SUPPORTS_TEXTURE_BIT = BITFIELD_BIT(0),
@@ -29,6 +29,18 @@ enum nil_format_support_flags {
NIL_FORMAT_SUPPORTS_SCANOUT_BIT = BITFIELD_BIT(6),
};
struct nil_tic_format {
unsigned comp_sizes:8;
unsigned type_r:3;
unsigned type_g:3;
unsigned type_b:3;
unsigned type_a:3;
unsigned src_x:3;
unsigned src_y:3;
unsigned src_z:3;
unsigned src_w:3;
};
struct nil_format_info {
unsigned czt:8;
unsigned support:24;
+9 -1
View File
@@ -4,7 +4,7 @@
*/
#include "nil_image.h"
#include "nil_format.h"
#include "nil_format_table.h"
#include "util/bitpack_helpers.h"
#include "nouveau_device.h"
@@ -94,6 +94,14 @@ __set_bool(uint32_t *o, bool b, unsigned lo, unsigned hi)
#define TH_NVC097_SET_U(o, VER, FIELD, val) \
TH_SET_U((o), NVC097, _##VER, FIELD, (val));
static const struct nil_tic_format *
nil_tic_format_for_pipe(enum pipe_format format)
{
assert(format < PIPE_FORMAT_COUNT);
const struct nil_format_info *fmt = &nil_format_table[format];
return fmt->tic.comp_sizes == 0 ? NULL : &fmt->tic;
}
static inline uint32_t
nv9097_th_bl_source(const struct nil_tic_format *fmt,
enum pipe_swizzle swz, bool is_int)