pco: move uses_usclib flag into shader data
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37439>
This commit is contained in:
@@ -216,6 +216,7 @@ typedef struct _pco_common_data {
|
||||
bool empty; /** Whether the shader is empty. */
|
||||
bool point_sampler; /** Whether the shader uses a point sampler. */
|
||||
bool ia_sampler; /** Does the shader use an input attachment sampler? */
|
||||
bool usclib; /** Does the shader use usclib functions? */
|
||||
} uses;
|
||||
|
||||
bool robust_buffer_access;
|
||||
|
||||
@@ -1758,10 +1758,8 @@ bool pco_nir_compute_instance_check(nir_shader *shader);
|
||||
bool pco_nir_link_clip_cull_vars(nir_shader *producer, nir_shader *consumer);
|
||||
bool pco_nir_lower_algebraic(nir_shader *shader);
|
||||
bool pco_nir_lower_algebraic_late(nir_shader *shader);
|
||||
bool pco_nir_lower_atomics(nir_shader *shader, bool *uses_usclib);
|
||||
bool pco_nir_lower_barriers(nir_shader *shader,
|
||||
pco_data *data,
|
||||
bool *uses_usclib);
|
||||
bool pco_nir_lower_atomics(nir_shader *shader, pco_data *data);
|
||||
bool pco_nir_lower_barriers(nir_shader *shader, pco_data *data);
|
||||
bool pco_nir_lower_clip_cull_vars(nir_shader *shader);
|
||||
bool pco_nir_lower_demote_samples(nir_shader *shader);
|
||||
bool pco_nir_lower_fs_intrinsics(nir_shader *shader);
|
||||
|
||||
@@ -731,8 +731,6 @@ static bool robustness_filter(const nir_intrinsic_instr *intr,
|
||||
*/
|
||||
void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
||||
{
|
||||
bool uses_usclib = false;
|
||||
|
||||
NIR_PASS(_,
|
||||
nir,
|
||||
nir_opt_access,
|
||||
@@ -740,7 +738,7 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
||||
|
||||
NIR_PASS(_, nir, nir_opt_barrier_modes);
|
||||
NIR_PASS(_, nir, nir_opt_combine_barriers, NULL, NULL);
|
||||
NIR_PASS(_, nir, pco_nir_lower_barriers, data, &uses_usclib);
|
||||
NIR_PASS(_, nir, pco_nir_lower_barriers, data);
|
||||
|
||||
NIR_PASS(_, nir, nir_lower_memory_model);
|
||||
|
||||
@@ -788,7 +786,7 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
||||
|
||||
NIR_PASS(_, nir, pco_nir_lower_vk, data);
|
||||
NIR_PASS(_, nir, pco_nir_lower_io);
|
||||
NIR_PASS(_, nir, pco_nir_lower_atomics, &uses_usclib);
|
||||
NIR_PASS(_, nir, pco_nir_lower_atomics, data);
|
||||
|
||||
NIR_PASS(_, nir, nir_opt_constant_folding);
|
||||
|
||||
@@ -869,7 +867,7 @@ void pco_lower_nir(pco_ctx *ctx, nir_shader *nir, pco_data *data)
|
||||
NIR_PASS(_, nir, pco_nir_pvi, &data->vs);
|
||||
}
|
||||
|
||||
if (uses_usclib) {
|
||||
if (data->common.uses.usclib) {
|
||||
assert(ctx->usclib);
|
||||
|
||||
nir_link_shader_functions(nir, ctx->usclib);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
static nir_def *lower_barrier(nir_builder *b, nir_instr *instr, void *cb_data)
|
||||
{
|
||||
struct shader_info *info = &b->shader->info;
|
||||
bool *barrier_emitted = cb_data;
|
||||
bool *uses_usclib = cb_data;
|
||||
|
||||
nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
|
||||
mesa_scope exec_scope = nir_intrinsic_execution_scope(intr);
|
||||
@@ -51,7 +51,7 @@ static nir_def *lower_barrier(nir_builder *b, nir_instr *instr, void *cb_data)
|
||||
info->shared_size += sizeof(uint32_t);
|
||||
info->zero_initialize_shared_memory = true;
|
||||
|
||||
*barrier_emitted = true;
|
||||
*uses_usclib = true;
|
||||
|
||||
unsigned num_slots = DIV_ROUND_UP(wg_size, ROGUE_MAX_INSTANCES_PER_TASK);
|
||||
|
||||
@@ -82,17 +82,13 @@ static bool is_barrier(const nir_instr *instr, UNUSED const void *cb_data)
|
||||
* \param[in,out] shader NIR shader.
|
||||
* \return True if the pass made progress.
|
||||
*/
|
||||
bool pco_nir_lower_barriers(nir_shader *shader,
|
||||
pco_data *data,
|
||||
bool *uses_usclib)
|
||||
bool pco_nir_lower_barriers(nir_shader *shader, pco_data *data)
|
||||
{
|
||||
bool barrier_emitted = false;
|
||||
bool progress = nir_shader_lower_instructions(shader,
|
||||
is_barrier,
|
||||
lower_barrier,
|
||||
&barrier_emitted);
|
||||
&data->common.uses.usclib);
|
||||
|
||||
*uses_usclib |= barrier_emitted;
|
||||
data->common.uses.barriers |= progress;
|
||||
|
||||
return progress;
|
||||
@@ -143,10 +139,10 @@ static bool is_lowerable_atomic(const nir_instr *instr,
|
||||
* \param[in,out] shader NIR shader.
|
||||
* \return True if the pass made progress.
|
||||
*/
|
||||
bool pco_nir_lower_atomics(nir_shader *shader, bool *uses_usclib)
|
||||
bool pco_nir_lower_atomics(nir_shader *shader, pco_data *data)
|
||||
{
|
||||
return nir_shader_lower_instructions(shader,
|
||||
is_lowerable_atomic,
|
||||
lower_atomic,
|
||||
uses_usclib);
|
||||
&data->common.uses.usclib);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user