summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-05 10:10:02 +1100
committerTimothy Arceri <[email protected]>2017-01-06 11:21:41 +1100
commitf5bc127b2f140213a8ceb58c4ed2d9b9a4c0449c (patch)
tree135b5edd05c97dfb21803b56cc1e3352a14a8cb5 /src/compiler
parentf62eb6c7eb22cd97c691ebdb5f25eb5fe8e9ed11 (diff)
st/mesa/glsl/i965: move ShaderStorageBlocks to gl_program
Having it here rather than in gl_linked_shader allows us to simplify the code. Also it is error prone to depend on the gl_linked_shader for programs in current use because a failed linking attempt will free infomation about the current program. In i965 we could be trying to recompile a shader variant but may have lost some required fields. Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/link_uniforms.cpp3
-rw-r--r--src/compiler/glsl/linker.cpp9
-rw-r--r--src/compiler/glsl/lower_ubo_reference.cpp2
3 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp
index dba46771ec2..90eac5cc512 100644
--- a/src/compiler/glsl/link_uniforms.cpp
+++ b/src/compiler/glsl/link_uniforms.cpp
@@ -903,7 +903,8 @@ link_update_uniform_buffer_variables(struct gl_linked_shader *shader,
unsigned num_blocks = var->data.mode == ir_var_uniform ?
shader->Program->info.num_ubos : shader->Program->info.num_ssbos;
struct gl_uniform_block **blks = var->data.mode == ir_var_uniform ?
- shader->Program->sh.UniformBlocks : shader->ShaderStorageBlocks;
+ shader->Program->sh.UniformBlocks :
+ shader->Program->sh.ShaderStorageBlocks;
if (var->is_interface_instance()) {
const ir_array_refcount_entry *const entry = v.get_variable_entry(var);
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 9de89f40abd..38cbbfa680f 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -1159,7 +1159,7 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog,
struct gl_uniform_block **sh_blks;
if (validate_ssbo) {
sh_num_blocks = prog->_LinkedShaders[i]->Program->info.num_ssbos;
- sh_blks = sh->ShaderStorageBlocks;
+ sh_blks = sh->Program->sh.ShaderStorageBlocks;
} else {
sh_num_blocks = prog->_LinkedShaders[i]->Program->info.num_ubos;
sh_blks = sh->Program->sh.UniformBlocks;
@@ -1194,7 +1194,8 @@ interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog,
struct gl_linked_shader *sh = prog->_LinkedShaders[i];
struct gl_uniform_block **sh_blks = validate_ssbo ?
- sh->ShaderStorageBlocks : sh->Program->sh.UniformBlocks;
+ sh->Program->sh.ShaderStorageBlocks :
+ sh->Program->sh.UniformBlocks;
blks[j].stageref |= sh_blks[stage_index]->stageref;
sh_blks[stage_index] = &blks[j];
@@ -2281,11 +2282,11 @@ link_intrastage_shaders(void *mem_ctx,
linked->Program->info.num_ubos = num_ubo_blocks;
/* Copy ssbo blocks to linked shader list */
- linked->ShaderStorageBlocks =
+ 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->ShaderStorageBlocks[i] = &ssbo_blocks[i];
+ linked->Program->sh.ShaderStorageBlocks[i] = &ssbo_blocks[i];
}
linked->Program->info.num_ssbos = num_ssbo_blocks;
diff --git a/src/compiler/glsl/lower_ubo_reference.cpp b/src/compiler/glsl/lower_ubo_reference.cpp
index 02a97bd352e..bfaddac3add 100644
--- a/src/compiler/glsl/lower_ubo_reference.cpp
+++ b/src/compiler/glsl/lower_ubo_reference.cpp
@@ -290,7 +290,7 @@ lower_ubo_reference_visitor::setup_for_load_or_store(void *mem_ctx,
struct gl_uniform_block **blocks;
if (this->buffer_access_type != ubo_load_access) {
num_blocks = shader->Program->info.num_ssbos;
- blocks = shader->ShaderStorageBlocks;
+ blocks = shader->Program->sh.ShaderStorageBlocks;
} else {
num_blocks = shader->Program->info.num_ubos;
blocks = shader->Program->sh.UniformBlocks;