pan/lib: Move pan_fixup_blend_type to pan_blend.c
Also move bifrost_blend_type_from_nir to pan_blend.c, rename it and makes it not GENX. This part is related to blend so it makes more sense to have it there and this will allow us to make pan_shader.c not GENX. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34895>
This commit is contained in:
@@ -466,6 +466,30 @@ pan_pack_blend(const struct pan_blend_equation equation)
|
||||
return out.opaque[0];
|
||||
}
|
||||
|
||||
enum mali_register_file_format
|
||||
pan_blend_type_from_nir(nir_alu_type nir_type)
|
||||
{
|
||||
switch (nir_type) {
|
||||
case 0: /* Render target not in use */
|
||||
return 0;
|
||||
case nir_type_float16:
|
||||
return MALI_REGISTER_FILE_FORMAT_F16;
|
||||
case nir_type_float32:
|
||||
return MALI_REGISTER_FILE_FORMAT_F32;
|
||||
case nir_type_int32:
|
||||
return MALI_REGISTER_FILE_FORMAT_I32;
|
||||
case nir_type_uint32:
|
||||
return MALI_REGISTER_FILE_FORMAT_U32;
|
||||
case nir_type_int16:
|
||||
return MALI_REGISTER_FILE_FORMAT_I16;
|
||||
case nir_type_uint16:
|
||||
return MALI_REGISTER_FILE_FORMAT_U16;
|
||||
default:
|
||||
unreachable("Unsupported blend shader type for NIR alu type");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* ifndef PAN_ARCH */
|
||||
|
||||
static const char *
|
||||
@@ -757,6 +781,20 @@ GENX(pan_inline_rt_conversion)(nir_shader *s, enum pipe_format *formats)
|
||||
return nir_shader_intrinsics_pass(s, inline_rt_conversion,
|
||||
nir_metadata_control_flow, formats);
|
||||
}
|
||||
|
||||
#if PAN_ARCH <= 7
|
||||
enum mali_register_file_format
|
||||
GENX(pan_fixup_blend_type)(nir_alu_type T_size, enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
unsigned size = nir_alu_type_get_type_size(T_size);
|
||||
nir_alu_type T_format = pan_unpacked_type_for_format(desc);
|
||||
nir_alu_type T = nir_alu_type_get_base_type(T_format) | size;
|
||||
|
||||
return pan_blend_type_from_nir(T);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* ifndef PAN_ARCH */
|
||||
|
||||
@@ -124,6 +124,7 @@ bool pan_blend_is_homogenous_constant(unsigned mask, const float *constants);
|
||||
void pan_blend_to_fixed_function_equation(const struct pan_blend_equation eq,
|
||||
struct MALI_BLEND_EQUATION *equation);
|
||||
|
||||
enum mali_register_file_format pan_blend_type_from_nir(nir_alu_type nir_type);
|
||||
uint32_t pan_pack_blend(const struct pan_blend_equation equation);
|
||||
|
||||
#ifdef PAN_ARCH
|
||||
@@ -137,6 +138,11 @@ uint64_t GENX(pan_blend_get_internal_desc)(enum pipe_format fmt, unsigned rt,
|
||||
unsigned force_size, bool dithered);
|
||||
|
||||
bool GENX(pan_inline_rt_conversion)(nir_shader *s, enum pipe_format *formats);
|
||||
|
||||
#if PAN_ARCH <= 7
|
||||
enum mali_register_file_format
|
||||
GENX(pan_fixup_blend_type)(nir_alu_type T_size, enum pipe_format format);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "pan_shader.h"
|
||||
#include "panfrost/clc/panfrost_compile.h"
|
||||
#include "pan_blend.h"
|
||||
#include "pan_format.h"
|
||||
|
||||
#if PAN_ARCH <= 5
|
||||
@@ -46,45 +47,6 @@ GENX(pan_shader_get_compiler_options)(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if PAN_ARCH >= 6
|
||||
static enum mali_register_file_format
|
||||
bifrost_blend_type_from_nir(nir_alu_type nir_type)
|
||||
{
|
||||
switch (nir_type) {
|
||||
case 0: /* Render target not in use */
|
||||
return 0;
|
||||
case nir_type_float16:
|
||||
return MALI_REGISTER_FILE_FORMAT_F16;
|
||||
case nir_type_float32:
|
||||
return MALI_REGISTER_FILE_FORMAT_F32;
|
||||
case nir_type_int32:
|
||||
return MALI_REGISTER_FILE_FORMAT_I32;
|
||||
case nir_type_uint32:
|
||||
return MALI_REGISTER_FILE_FORMAT_U32;
|
||||
case nir_type_int16:
|
||||
return MALI_REGISTER_FILE_FORMAT_I16;
|
||||
case nir_type_uint16:
|
||||
return MALI_REGISTER_FILE_FORMAT_U16;
|
||||
default:
|
||||
unreachable("Unsupported blend shader type for NIR alu type");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if PAN_ARCH <= 7
|
||||
enum mali_register_file_format
|
||||
GENX(pan_fixup_blend_type)(nir_alu_type T_size, enum pipe_format format)
|
||||
{
|
||||
const struct util_format_description *desc = util_format_description(format);
|
||||
unsigned size = nir_alu_type_get_type_size(T_size);
|
||||
nir_alu_type T_format = pan_unpacked_type_for_format(desc);
|
||||
nir_alu_type T = nir_alu_type_get_base_type(T_format) | size;
|
||||
|
||||
return bifrost_blend_type_from_nir(T);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* This is only needed on Midgard. It's the same on both v4 and v5, so only
|
||||
* compile once to avoid the GenXML dependency for calls.
|
||||
*/
|
||||
@@ -241,7 +203,7 @@ GENX(pan_shader_compile)(nir_shader *s, struct panfrost_compile_inputs *inputs,
|
||||
/* This is "redundant" information, but is needed in a draw-time hot path */
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(info->bifrost.blend); ++i) {
|
||||
info->bifrost.blend[i].format =
|
||||
bifrost_blend_type_from_nir(info->bifrost.blend[i].type);
|
||||
pan_blend_type_from_nir(info->bifrost.blend[i].type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -75,11 +75,6 @@ void GENX(pan_shader_compile)(nir_shader *nir,
|
||||
struct util_dynarray *binary,
|
||||
struct pan_shader_info *info);
|
||||
|
||||
#if PAN_ARCH >= 6 && PAN_ARCH <= 7
|
||||
enum mali_register_file_format
|
||||
GENX(pan_fixup_blend_type)(nir_alu_type T_size, enum pipe_format format);
|
||||
#endif
|
||||
|
||||
#if PAN_ARCH >= 9
|
||||
static inline enum mali_shader_stage
|
||||
pan_shader_stage(const struct pan_shader_info *info)
|
||||
|
||||
Reference in New Issue
Block a user