lavapipe: rename inline uniform function params

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
This commit is contained in:
Mike Blumenkrantz 2023-03-06 15:03:13 -05:00 committed by Marge Bot
parent 990fa82c61
commit 7718d7f31a
2 changed files with 16 additions and 16 deletions

View file

@ -129,16 +129,16 @@ process_node(nir_cf_node *node, nir_loop_info *info,
}
bool
lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *shader)
lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *nir)
{
bool ret = false;
struct set *stores = _mesa_set_create(shader, _mesa_hash_pointer, _mesa_key_pointer_equal);
nir_foreach_function(function, shader) {
struct set *stores = _mesa_set_create(nir, _mesa_hash_pointer, _mesa_key_pointer_equal);
nir_foreach_function(function, nir) {
if (function->impl) {
nir_metadata_require(function->impl, nir_metadata_loop_analysis, nir_var_all);
foreach_list_typed(nir_cf_node, node, node, &function->impl->body)
process_node(node, NULL, (uint32_t*)pipeline->shaders[shader->info.stage].inlines.uniform_offsets, pipeline->shaders[shader->info.stage].inlines.count, stores);
process_node(node, NULL, (uint32_t*)pipeline->shaders[nir->info.stage].inlines.uniform_offsets, pipeline->shaders[nir->info.stage].inlines.count, stores);
}
}
const unsigned threshold = 5;
@ -152,21 +152,21 @@ lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *shader)
}
if (counter >= threshold) {
uint8_t new_num[PIPE_MAX_CONSTANT_BUFFERS];
memcpy(new_num, pipeline->shaders[shader->info.stage].inlines.count, sizeof(new_num));
memcpy(new_num, pipeline->shaders[nir->info.stage].inlines.count, sizeof(new_num));
uint32_t *uni_offsets =
(uint32_t *) pipeline->shaders[shader->info.stage].inlines.uniform_offsets;
(uint32_t *) pipeline->shaders[nir->info.stage].inlines.uniform_offsets;
if (nir_collect_src_uniforms(src, 0, uni_offsets, new_num,
PIPE_MAX_CONSTANT_BUFFERS, UINT_MAX)) {
ret = true;
memcpy(pipeline->shaders[shader->info.stage].inlines.count, new_num, sizeof(new_num));
memcpy(pipeline->shaders[nir->info.stage].inlines.count, new_num, sizeof(new_num));
}
}
}
for (unsigned i = 0; i < PIPE_MAX_CONSTANT_BUFFERS; i++) {
if (pipeline->shaders[shader->info.stage].inlines.count[i]) {
pipeline->shaders[shader->info.stage].inlines.can_inline |= BITFIELD_BIT(i);
if (pipeline->shaders[nir->info.stage].inlines.count[i]) {
pipeline->shaders[nir->info.stage].inlines.can_inline |= BITFIELD_BIT(i);
break;
}
}
@ -174,12 +174,12 @@ lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *shader)
}
void
lvp_inline_uniforms(nir_shader *shader, const struct lvp_pipeline *pipeline, const uint32_t *uniform_values, uint32_t ubo)
lvp_inline_uniforms(nir_shader *nir, const struct lvp_pipeline *pipeline, const uint32_t *uniform_values, uint32_t ubo)
{
if (!pipeline->shaders[shader->info.stage].inlines.can_inline)
if (!pipeline->shaders[nir->info.stage].inlines.can_inline)
return;
nir_foreach_function(function, shader) {
nir_foreach_function(function, nir) {
if (function->impl) {
nir_builder b;
nir_builder_init(&b, function->impl);
@ -199,8 +199,8 @@ lvp_inline_uniforms(nir_shader *shader, const struct lvp_pipeline *pipeline, con
intr->dest.ssa.bit_size == 32) {
int num_components = intr->dest.ssa.num_components;
uint32_t offset = nir_src_as_uint(intr->src[1]);
const unsigned num_uniforms = pipeline->shaders[shader->info.stage].inlines.count[ubo];
const unsigned *uniform_dw_offsets = pipeline->shaders[shader->info.stage].inlines.uniform_offsets[ubo];
const unsigned num_uniforms = pipeline->shaders[nir->info.stage].inlines.count[ubo];
const unsigned *uniform_dw_offsets = pipeline->shaders[nir->info.stage].inlines.uniform_offsets[ubo];
if (num_components == 1) {
/* Just replace the uniform load to constant load. */

View file

@ -635,9 +635,9 @@ lvp_shader_optimize(nir_shader *nir);
void *
lvp_pipeline_compile_stage(struct lvp_pipeline *pipeline, nir_shader *nir);
bool
lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *shader);
lvp_find_inlinable_uniforms(struct lvp_pipeline *pipeline, nir_shader *nir);
void
lvp_inline_uniforms(nir_shader *shader, const struct lvp_pipeline *pipeline, const uint32_t *uniform_values, uint32_t ubo);
lvp_inline_uniforms(nir_shader *nir, const struct lvp_pipeline *pipeline, const uint32_t *uniform_values, uint32_t ubo);
void *
lvp_pipeline_compile(struct lvp_pipeline *pipeline, nir_shader *base_nir);
#ifdef __cplusplus