diff options
author | Timothy Arceri <[email protected]> | 2017-11-08 09:54:22 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-11-09 12:07:48 +1100 |
commit | cf05bb506a075c9e3b8a3c374b928ff0367c49b2 (patch) | |
tree | 2a08cd32fdc212b488894b45936eb6a9ed06453a /src/compiler/glsl | |
parent | a16dc04ad51c32e5c7d136e4dd6273d983385d3f (diff) |
glsl: drop cache_fallback
This turned out to be a dead end, it is much easier and less error
prone to just cache the IR used by the drivers backend e.g. TGSI or
NIR.
Cc: "17.2 17.3" <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/link_uniforms.cpp | 15 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 85 | ||||
-rw-r--r-- | src/compiler/glsl/shader_cache.cpp | 2 |
3 files changed, 42 insertions, 60 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 7d141549f55..3da015eb7fd 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -1400,13 +1400,6 @@ link_assign_uniform_storage(struct gl_context *ctx, sizeof(shader->Program->sh.SamplerTargets)); } - /* If this is a fallback compile for a cache miss we already have the - * correct uniform mappings and we don't want to reinitialise uniforms so - * just return now. - */ - if (prog->data->cache_fallback) - return; - #ifndef NDEBUG for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) { assert(prog->data->UniformStorage[i].storage != NULL || @@ -1431,11 +1424,9 @@ void link_assign_uniform_locations(struct gl_shader_program *prog, struct gl_context *ctx) { - if (!prog->data->cache_fallback) { - ralloc_free(prog->data->UniformStorage); - prog->data->UniformStorage = NULL; - prog->data->NumUniformStorage = 0; - } + ralloc_free(prog->data->UniformStorage); + prog->data->UniformStorage = NULL; + prog->data->NumUniformStorage = 0; if (prog->UniformHash != NULL) { prog->UniformHash->clear(); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 3b8734fc8b8..cb2a6c7892a 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2264,8 +2264,7 @@ link_intrastage_shaders(void *mem_ctx, return NULL; } - if (!prog->data->cache_fallback) - _mesa_reference_shader_program_data(ctx, &gl_prog->sh.data, prog->data); + _mesa_reference_shader_program_data(ctx, &gl_prog->sh.data, prog->data); /* Don't use _mesa_reference_program() just take ownership */ linked->Program = gl_prog; @@ -2322,34 +2321,32 @@ link_intrastage_shaders(void *mem_ctx, v.run(linked->ir); v.fixup_unnamed_interface_types(); - 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); + /* 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->LinkStatus) { + _mesa_delete_linked_shader(ctx, linked); + return NULL; + } - /* 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; + /* 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; /* At this point linked should contain all of the linked IR, so * validate it to make sure nothing went wrong. @@ -4639,14 +4636,12 @@ link_and_validate_uniforms(struct gl_context *ctx, update_array_sizes(prog); link_assign_uniform_locations(prog, ctx); - if (!prog->data->cache_fallback) { - 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); - } + 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); } static bool @@ -4960,10 +4955,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) last = i; } - if (!prog->data->cache_fallback) { - check_explicit_uniform_locations(ctx, prog); - link_assign_subroutine_types(prog); - } + check_explicit_uniform_locations(ctx, prog); + link_assign_subroutine_types(prog); if (!prog->data->LinkStatus) goto done; @@ -5028,15 +5021,13 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->SeparateShader) disable_varying_optimizations_for_sso(prog); - if (!prog->data->cache_fallback) { - /* Process UBOs */ - if (!interstage_cross_validate_uniform_blocks(prog, false)) - goto done; + /* 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/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index 8fd2774bdfa..89da19914fe 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -1299,7 +1299,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx, return false; struct disk_cache *cache = ctx->Cache; - if (!cache || prog->data->cache_fallback || prog->data->skip_cache) + if (!cache || prog->data->skip_cache) return false; /* Include bindings when creating sha1. These bindings change the resulting |