[Mesa-dev] [PATCH 55/68] glsl: skip more uniform initialisation when doing fallback linking
Timothy Arceri
timothy.arceri at collabora.com
Wed Jun 1 06:23:36 UTC 2016
We already pull these values from the metadata cache so no need to
recreate them.
---
src/compiler/glsl/linker.cpp | 22 ++++++++++++++--------
src/mesa/main/shaderobj.c | 8 +++++---
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 32985c3..41480a7 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4500,6 +4500,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
return;
#endif
+ bool create_program_metadata = !is_cache_fallback || !prog->UniformStorage;
+
void *mem_ctx = ralloc_context(NULL); // temporary linker context
prog->ARB_fragment_coord_conventions_enable = false;
@@ -4685,8 +4687,10 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
last = i;
}
- num_explicit_uniform_locs = check_explicit_uniform_locations(ctx, prog);
- link_assign_subroutine_types(prog);
+ if (create_program_metadata) {
+ num_explicit_uniform_locs = check_explicit_uniform_locations(ctx, prog);
+ link_assign_subroutine_types(prog);
+ }
if (!prog->LinkStatus)
goto done;
@@ -4952,14 +4956,16 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
num_explicit_uniform_locs,
ctx->Const.MaxUserAssignableUniformLocations,
is_cache_fallback);
- link_assign_atomic_counter_resources(ctx, prog);
store_fragdepth_layout(prog);
- link_calculate_subroutine_compat(prog);
- check_resources(ctx, prog);
- check_subroutine_resources(prog);
- check_image_resources(ctx, prog);
- link_check_atomic_counter_resources(ctx, prog);
+ if (create_program_metadata) {
+ link_assign_atomic_counter_resources(ctx, prog);
+ link_calculate_subroutine_compat(prog);
+ check_resources(ctx, prog);
+ check_subroutine_resources(prog);
+ check_image_resources(ctx, prog);
+ link_check_atomic_counter_resources(ctx, prog);
+ }
if (!prog->LinkStatus)
goto done;
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 87e8b40..64fc52c 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -301,9 +301,11 @@ _mesa_clear_shader_program_data(struct gl_shader_program *shProg,
shProg->ShaderStorageBlocks = NULL;
shProg->NumShaderStorageBlocks = 0;
- ralloc_free(shProg->AtomicBuffers);
- shProg->AtomicBuffers = NULL;
- shProg->NumAtomicBuffers = 0;
+ if (shProg->AtomicBuffers && !is_cache_fallback) {
+ ralloc_free(shProg->AtomicBuffers);
+ shProg->AtomicBuffers = NULL;
+ shProg->NumAtomicBuffers = 0;
+ }
if (shProg->ProgramResourceList) {
ralloc_free(shProg->ProgramResourceList);
--
2.5.5
More information about the mesa-dev
mailing list