mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 16:20:13 +01:00
glsl: remove reparent_ir
This ralloc garbage collection shouldn't be needed since we trash the IR after glsl_to_nir anyway. Freeing the ralloc context is moved after glsl_to_nir. Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36425>
This commit is contained in:
parent
361683e0a6
commit
b29ba6a276
3 changed files with 3 additions and 47 deletions
|
|
@ -2231,9 +2231,6 @@ opt_shader(const struct gl_constants *consts,
|
|||
do_vec_index_to_cond_assign(shader->ir);
|
||||
|
||||
validate_ir_tree(shader->ir);
|
||||
|
||||
/* Retain any live IR, but trash the rest. */
|
||||
reparent_ir(shader->ir, shader->ir);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -2422,9 +2419,6 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
}
|
||||
}
|
||||
|
||||
delete state->symbols;
|
||||
ralloc_free(state);
|
||||
|
||||
if (ctx->_Shader && ctx->_Shader->Flags & GLSL_DUMP) {
|
||||
if (shader->CompileStatus) {
|
||||
assert(shader->ir);
|
||||
|
|
@ -2454,6 +2448,9 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader,
|
|||
source_blake3);
|
||||
}
|
||||
|
||||
delete state->symbols;
|
||||
ralloc_free(state);
|
||||
|
||||
if (ctx->Cache && shader->CompileStatus == COMPILE_SUCCESS) {
|
||||
char sha1_buf[41];
|
||||
disk_cache_put_key(ctx->Cache, shader->disk_cache_sha1);
|
||||
|
|
|
|||
|
|
@ -2191,44 +2191,6 @@ visit_exec_list_safe(ir_exec_list *list, ir_visitor *visitor)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
steal_memory(ir_instruction *ir, void *new_ctx)
|
||||
{
|
||||
ir_variable *var = ir->as_variable();
|
||||
ir_function *fn = ir->as_function();
|
||||
ir_constant *constant = ir->as_constant();
|
||||
if (var != NULL && var->constant_value != NULL)
|
||||
steal_memory(var->constant_value, ir);
|
||||
|
||||
if (var != NULL && var->constant_initializer != NULL)
|
||||
steal_memory(var->constant_initializer, ir);
|
||||
|
||||
if (fn != NULL && fn->subroutine_types)
|
||||
ralloc_steal(new_ctx, fn->subroutine_types);
|
||||
|
||||
/* The components of aggregate constants are not visited by the normal
|
||||
* visitor, so steal their values by hand.
|
||||
*/
|
||||
if (constant != NULL &&
|
||||
(glsl_type_is_array(constant->type) || glsl_type_is_struct(constant->type))) {
|
||||
for (unsigned int i = 0; i < constant->type->length; i++) {
|
||||
steal_memory(constant->const_elements[i], ir);
|
||||
}
|
||||
}
|
||||
|
||||
ralloc_steal(new_ctx, ir);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
reparent_ir(ir_exec_list *list, void *mem_ctx)
|
||||
{
|
||||
ir_foreach_in_list(ir_instruction, node, list) {
|
||||
visit_tree(node, steal_memory, mem_ctx);
|
||||
}
|
||||
}
|
||||
|
||||
enum mesa_prim
|
||||
gl_to_mesa_prim(GLenum prim)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2440,9 +2440,6 @@ detect_recursion_unlinked(struct _mesa_glsl_parse_state *state,
|
|||
void
|
||||
clone_ir_list(void *mem_ctx, ir_exec_list *out, const ir_exec_list *in);
|
||||
|
||||
extern void
|
||||
reparent_ir(ir_exec_list *list, void *mem_ctx);
|
||||
|
||||
extern char *
|
||||
prototype_string(const glsl_type *return_type, const char *name,
|
||||
ir_exec_list *parameters);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue