diff options
author | Timothy Arceri <[email protected]> | 2016-11-04 20:02:21 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-01-06 11:21:40 +1100 |
commit | a1da57c19c27505b9eab4792355f2f1b5c774a0a (patch) | |
tree | acb5353c05fee5e416c4b2bdd993975818af7687 /src/compiler/glsl | |
parent | 3d2485f011c4f1c7de35871ca359a84415bfcc06 (diff) |
st/mesa/glsl/i965: move ImageUnits and ImageAccess fields 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.
We drop the memset on ImageUnits because gl_program is already
created using rzalloc().
Reviewed-by: Lionel Landwerlin <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r-- | src/compiler/glsl/link_uniform_initializers.cpp | 5 | ||||
-rw-r--r-- | src/compiler/glsl/link_uniforms.cpp | 3 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/glsl/link_uniform_initializers.cpp b/src/compiler/glsl/link_uniform_initializers.cpp index 93340baf61f..6f05a3a8098 100644 --- a/src/compiler/glsl/link_uniform_initializers.cpp +++ b/src/compiler/glsl/link_uniform_initializers.cpp @@ -141,9 +141,10 @@ set_opaque_binding(void *mem_ctx, gl_shader_program *prog, storage->opaque[sh].active) { for (unsigned i = 0; i < elements; i++) { const unsigned index = storage->opaque[sh].index + i; - if (index >= ARRAY_SIZE(shader->ImageUnits)) + if (index >= ARRAY_SIZE(shader->Program->sh.ImageUnits)) break; - shader->ImageUnits[index] = storage->storage[i].i; + shader->Program->sh.ImageUnits[index] = + storage->storage[i].i; } } } diff --git a/src/compiler/glsl/link_uniforms.cpp b/src/compiler/glsl/link_uniforms.cpp index 256afa32fb6..cd00837cca9 100644 --- a/src/compiler/glsl/link_uniforms.cpp +++ b/src/compiler/glsl/link_uniforms.cpp @@ -613,7 +613,7 @@ private: this->next_image += MAX2(1, uniform->array_elements); for (unsigned i = first; i < MIN2(next_image, MAX_IMAGE_UNIFORMS); i++) - prog->_LinkedShaders[shader_type]->ImageAccess[i] = access; + prog->_LinkedShaders[shader_type]->Program->sh.ImageAccess[i] = access; } } @@ -1308,7 +1308,6 @@ link_assign_uniform_locations(struct gl_shader_program *prog, * types cannot have initializers." */ memset(sh->SamplerUnits, 0, sizeof(sh->SamplerUnits)); - memset(sh->ImageUnits, 0, sizeof(sh->ImageUnits)); link_update_uniform_buffer_variables(sh, i); |