mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-19 23:00:45 +01:00
radv: stop rallocing objects which don't belong to the shader under it
This doesn't work with NIR_DEBUG=serialize or NIR_DEBUG=clone. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Marek Olšák <maraeo@gmail.com> Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37573>
This commit is contained in:
parent
762a803aa7
commit
55018df38d
2 changed files with 6 additions and 3 deletions
|
|
@ -1128,7 +1128,7 @@ lower_any_hit_for_intersection(nir_shader *any_hit)
|
|||
static void
|
||||
nir_lower_intersection_shader(nir_shader *intersection, nir_shader *any_hit)
|
||||
{
|
||||
void *dead_ctx = ralloc_context(intersection);
|
||||
void *dead_ctx = ralloc_context(NULL);
|
||||
|
||||
nir_function_impl *any_hit_impl = NULL;
|
||||
struct hash_table *any_hit_var_remap = NULL;
|
||||
|
|
|
|||
|
|
@ -395,6 +395,7 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache,
|
|||
|
||||
uint32_t num_resume_shaders = 0;
|
||||
nir_shader **resume_shaders = NULL;
|
||||
void *mem_ctx = ralloc_context(NULL);
|
||||
|
||||
if (stage->stage != MESA_SHADER_INTERSECTION && !monolithic) {
|
||||
nir_builder b = nir_builder_at(nir_after_impl(nir_shader_get_entrypoint(stage->nir)));
|
||||
|
|
@ -407,11 +408,11 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache,
|
|||
.vectorizer_callback = ac_nir_mem_vectorize_callback,
|
||||
.vectorizer_data = &(struct ac_nir_config){pdev->info.gfx_level, !radv_use_llvm_for_stage(pdev, stage->stage)},
|
||||
};
|
||||
nir_lower_shader_calls(stage->nir, &opts, &resume_shaders, &num_resume_shaders, stage->nir);
|
||||
nir_lower_shader_calls(stage->nir, &opts, &resume_shaders, &num_resume_shaders, mem_ctx);
|
||||
}
|
||||
|
||||
unsigned num_shaders = num_resume_shaders + 1;
|
||||
nir_shader **shaders = ralloc_array(stage->nir, nir_shader *, num_shaders);
|
||||
nir_shader **shaders = ralloc_array(mem_ctx, nir_shader *, num_shaders);
|
||||
if (!shaders)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
|
|
@ -474,6 +475,7 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache,
|
|||
if (dump_shader)
|
||||
simple_mtx_unlock(&instance->shader_dump_mtx);
|
||||
|
||||
ralloc_free(mem_ctx);
|
||||
free(binary);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -495,6 +497,7 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache,
|
|||
if (dump_shader)
|
||||
simple_mtx_unlock(&instance->shader_dump_mtx);
|
||||
|
||||
ralloc_free(mem_ctx);
|
||||
free(binary);
|
||||
|
||||
*out_shader = shader;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue