nir: Don't replace the nir_shader when NIR_TEST_CLONE=1
Instead, we add a new helper which stomps one nir_shader and replaces it with another. The new helper effectively just changes which pointer gets used for the base nir_shader. It should be 99% as good at testing cloning but without requiring that everything handle having the shader swapped out from under it constantly. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108957 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
@@ -2918,6 +2918,8 @@ nir_function_impl *nir_function_impl_clone(nir_shader *shader,
|
||||
nir_constant *nir_constant_clone(const nir_constant *c, nir_variable *var);
|
||||
nir_variable *nir_variable_clone(const nir_variable *c, nir_shader *shader);
|
||||
|
||||
void nir_shader_replace(nir_shader *dest, nir_shader *src);
|
||||
|
||||
nir_shader *nir_shader_serialize_deserialize(void *mem_ctx, nir_shader *s);
|
||||
|
||||
#ifndef NDEBUG
|
||||
@@ -2990,8 +2992,7 @@ static inline bool should_print_nir(void) { return false; }
|
||||
nir_validate_shader(nir, "after " #pass); \
|
||||
if (should_clone_nir()) { \
|
||||
nir_shader *clone = nir_shader_clone(ralloc_parent(nir), nir); \
|
||||
ralloc_free(nir); \
|
||||
nir = clone; \
|
||||
nir_shader_replace(nir, clone); \
|
||||
} \
|
||||
if (should_serialize_deserialize_nir()) { \
|
||||
void *mem_ctx = ralloc_parent(nir); \
|
||||
|
Reference in New Issue
Block a user