panfrost: Move nir_lower_io outside of postprocess
Moving it out of there will allow us to shuffle and move API specific parts out of there. Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Olivia Lee <olivia.lee@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36776>
This commit is contained in:
committed by
Marge Bot
parent
a3f935c850
commit
310eabacc0
@@ -467,6 +467,12 @@ panfrost_bind_fs_state(struct pipe_context *pctx, void *hwcso)
|
||||
panfrost_update_shader_variant(ctx, MESA_SHADER_VERTEX);
|
||||
}
|
||||
|
||||
static int
|
||||
glsl_type_size(const struct glsl_type *type, bool bindless)
|
||||
{
|
||||
return glsl_count_attribute_slots(type, false);
|
||||
}
|
||||
|
||||
static void *
|
||||
panfrost_create_shader_state(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *cso)
|
||||
@@ -499,6 +505,21 @@ panfrost_create_shader_state(struct pipe_context *pctx,
|
||||
/* Then run the suite of lowering and optimization, including I/O lowering */
|
||||
struct panfrost_device *dev = pan_device(pctx->screen);
|
||||
pan_shader_preprocess(nir, panfrost_device_gpu_id(dev));
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||
glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics);
|
||||
|
||||
if (dev->arch >= 6 && nir->info.stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_vs);
|
||||
if (dev->arch >= 6 && nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
|
||||
|
||||
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
|
||||
* offsets it could figure out are constant. Do some constant folding
|
||||
* before bifrost_nir_lower_store_component below.
|
||||
*/
|
||||
NIR_PASS(_, nir, nir_opt_constant_folding);
|
||||
|
||||
pan_shader_postprocess(nir, panfrost_device_gpu_id(dev));
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
|
||||
@@ -5137,12 +5137,6 @@ va_gather_stats(bi_context *ctx, unsigned size, struct valhall_stats *out)
|
||||
MAX2(MAX3(out->fma, out->cvt, out->sfu), MAX3(out->v, out->t, out->ls));
|
||||
}
|
||||
|
||||
static int
|
||||
glsl_type_size(const struct glsl_type *type, bool bindless)
|
||||
{
|
||||
return glsl_count_attribute_slots(type, false);
|
||||
}
|
||||
|
||||
/* Split stores to memory. We don't split stores to vertex outputs, since
|
||||
* nir_lower_io_vars_to_temporaries will ensure there's only a single write.
|
||||
*/
|
||||
@@ -5954,19 +5948,6 @@ void
|
||||
bifrost_postprocess_nir(nir_shader *nir, unsigned gpu_id)
|
||||
{
|
||||
MESA_TRACE_FUNC();
|
||||
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||
glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_vs);
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
|
||||
|
||||
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
|
||||
* offsets it could figure out are constant. Do some constant folding
|
||||
* before bifrost_nir_lower_store_component below.
|
||||
*/
|
||||
NIR_PASS(_, nir, nir_opt_constant_folding);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
NIR_PASS(_, nir, nir_lower_mediump_io,
|
||||
|
||||
@@ -210,12 +210,6 @@ attach_constants(compiler_context *ctx, midgard_instruction *ins,
|
||||
memcpy(&ins->constants, constants, 16);
|
||||
}
|
||||
|
||||
static int
|
||||
glsl_type_size(const struct glsl_type *type, bool bindless)
|
||||
{
|
||||
return glsl_count_attribute_slots(type, false);
|
||||
}
|
||||
|
||||
static bool
|
||||
midgard_nir_lower_global_load_instr(nir_builder *b, nir_intrinsic_instr *intr,
|
||||
void *data)
|
||||
@@ -403,9 +397,6 @@ midgard_postprocess_nir(nir_shader *nir, unsigned gpu_id)
|
||||
{
|
||||
unsigned quirks = midgard_get_quirks(gpu_id);
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||
glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX) {
|
||||
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even
|
||||
* for offsets it could figure out are constant. Do some
|
||||
|
||||
@@ -762,6 +762,12 @@ lookup_ycbcr_conversion(const void *_state, uint32_t set,
|
||||
&sampler->vk.ycbcr_conversion->state : NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
glsl_type_size(const struct glsl_type *type, bool bindless)
|
||||
{
|
||||
return glsl_count_attribute_slots(type, false);
|
||||
}
|
||||
|
||||
static void
|
||||
panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
|
||||
uint32_t set_layout_count,
|
||||
@@ -918,6 +924,21 @@ panvk_lower_nir(struct panvk_device *dev, nir_shader *nir,
|
||||
}
|
||||
|
||||
pan_shader_preprocess(nir, compile_input->gpu_id);
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||
glsl_type_size, nir_lower_io_use_interpolated_input_intrinsics);
|
||||
|
||||
if (nir->info.stage == MESA_SHADER_VERTEX)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_vs);
|
||||
if (nir->info.stage == MESA_SHADER_FRAGMENT)
|
||||
NIR_PASS(_, nir, pan_nir_lower_noperspective_fs);
|
||||
|
||||
/* nir_lower[_explicit]_io is lazy and emits mul+add chains even for
|
||||
* offsets it could figure out are constant. Do some constant folding
|
||||
* before bifrost_nir_lower_store_component below.
|
||||
*/
|
||||
NIR_PASS(_, nir, nir_opt_constant_folding);
|
||||
|
||||
pan_shader_postprocess(nir, compile_input->gpu_id);
|
||||
|
||||
if (stage == MESA_SHADER_VERTEX)
|
||||
|
||||
Reference in New Issue
Block a user