summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-06-20 11:09:34 +1000
committerTimothy Arceri <[email protected]>2017-02-17 11:18:43 +1100
commitcad1a9bfde61b634d95041d02f527093fd590677 (patch)
treeb08602bd243098fb9ed4ee9af70f392a8752005f /src
parent01d1e5a7ad4883d3f3aa7675711a5acd38736325 (diff)
glsl: don't reprocess or clear UBOs on cache fallback
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/glsl/linker.cpp62
-rw-r--r--src/mesa/main/shaderobj.c16
2 files changed, 42 insertions, 36 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index c875e410eaf..72fea65a894 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -2252,32 +2252,34 @@ link_intrastage_shaders(void *mem_ctx,
v.run(linked->ir);
v.fixup_unnamed_interface_types();
- /* Link up uniform blocks defined within this stage. */
- link_uniform_blocks(mem_ctx, ctx, prog, linked, &ubo_blocks,
- &num_ubo_blocks, &ssbo_blocks, &num_ssbo_blocks);
-
- if (!prog->data->LinkStatus) {
- _mesa_delete_linked_shader(ctx, linked);
- return NULL;
- }
+ if (!prog->data->cache_fallback) {
+ /* Link up uniform blocks defined within this stage. */
+ link_uniform_blocks(mem_ctx, ctx, prog, linked, &ubo_blocks,
+ &num_ubo_blocks, &ssbo_blocks, &num_ssbo_blocks);
- /* Copy ubo blocks to linked shader list */
- linked->Program->sh.UniformBlocks =
- ralloc_array(linked, gl_uniform_block *, num_ubo_blocks);
- ralloc_steal(linked, ubo_blocks);
- for (unsigned i = 0; i < num_ubo_blocks; i++) {
- linked->Program->sh.UniformBlocks[i] = &ubo_blocks[i];
- }
- linked->Program->info.num_ubos = num_ubo_blocks;
+ if (!prog->data->LinkStatus) {
+ _mesa_delete_linked_shader(ctx, linked);
+ return NULL;
+ }
- /* Copy ssbo blocks to linked shader list */
- linked->Program->sh.ShaderStorageBlocks =
- ralloc_array(linked, gl_uniform_block *, num_ssbo_blocks);
- ralloc_steal(linked, ssbo_blocks);
- for (unsigned i = 0; i < num_ssbo_blocks; i++) {
- linked->Program->sh.ShaderStorageBlocks[i] = &ssbo_blocks[i];
+ /* Copy ubo blocks to linked shader list */
+ linked->Program->sh.UniformBlocks =
+ ralloc_array(linked, gl_uniform_block *, num_ubo_blocks);
+ ralloc_steal(linked, ubo_blocks);
+ for (unsigned i = 0; i < num_ubo_blocks; i++) {
+ linked->Program->sh.UniformBlocks[i] = &ubo_blocks[i];
+ }
+ linked->Program->info.num_ubos = num_ubo_blocks;
+
+ /* Copy ssbo blocks to linked shader list */
+ linked->Program->sh.ShaderStorageBlocks =
+ ralloc_array(linked, gl_uniform_block *, num_ssbo_blocks);
+ ralloc_steal(linked, ssbo_blocks);
+ for (unsigned i = 0; i < num_ssbo_blocks; i++) {
+ linked->Program->sh.ShaderStorageBlocks[i] = &ssbo_blocks[i];
+ }
+ linked->Program->info.num_ssbos = num_ssbo_blocks;
}
- linked->Program->info.num_ssbos = num_ssbo_blocks;
/* At this point linked should contain all of the linked IR, so
* validate it to make sure nothing went wrong.
@@ -4870,13 +4872,15 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (prog->SeparateShader)
disable_varying_optimizations_for_sso(prog);
- /* Process UBOs */
- if (!interstage_cross_validate_uniform_blocks(prog, false))
- goto done;
+ if (!prog->data->cache_fallback) {
+ /* Process UBOs */
+ if (!interstage_cross_validate_uniform_blocks(prog, false))
+ goto done;
- /* Process SSBOs */
- if (!interstage_cross_validate_uniform_blocks(prog, true))
- goto done;
+ /* Process SSBOs */
+ if (!interstage_cross_validate_uniform_blocks(prog, true))
+ goto done;
+ }
/* Do common optimization before assigning storage for attributes,
* uniforms, and varyings. Later optimization could possibly make
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 1ed19a683a3..8a5fa5e2dfc 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -351,13 +351,15 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
ralloc_free(shProg->data->InfoLog);
shProg->data->InfoLog = ralloc_strdup(shProg->data, "");
- ralloc_free(shProg->data->UniformBlocks);
- shProg->data->UniformBlocks = NULL;
- shProg->data->NumUniformBlocks = 0;
-
- ralloc_free(shProg->data->ShaderStorageBlocks);
- shProg->data->ShaderStorageBlocks = NULL;
- shProg->data->NumShaderStorageBlocks = 0;
+ if (!shProg->data->cache_fallback) {
+ ralloc_free(shProg->data->UniformBlocks);
+ shProg->data->UniformBlocks = NULL;
+ shProg->data->NumUniformBlocks = 0;
+
+ ralloc_free(shProg->data->ShaderStorageBlocks);
+ shProg->data->ShaderStorageBlocks = NULL;
+ shProg->data->NumShaderStorageBlocks = 0;
+ }
if (shProg->data->AtomicBuffers && !shProg->data->cache_fallback) {
ralloc_free(shProg->data->AtomicBuffers);