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/mesa/main | |
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/mesa/main')
-rw-r--r-- | src/mesa/main/mtypes.h | 40 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 2 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2693a8068c0..fa14c87a2c0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1980,6 +1980,25 @@ struct gl_program GLuint MaxSubroutineFunctionIndex; struct gl_subroutine_function *SubroutineFunctions; + /** + * Map from image uniform index to image unit (set by glUniform1i()) + * + * An image uniform index is associated with each image uniform by + * the linker. The image index associated with each uniform is + * stored in the \c gl_uniform_storage::image field. + */ + GLubyte ImageUnits[MAX_IMAGE_UNIFORMS]; + + /** + * Access qualifier specified in the shader for each image uniform + * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY or \c + * GL_READ_WRITE. + * + * It may be different, though only more strict than the value of + * \c gl_image_unit::Access for the corresponding image unit. + */ + GLenum ImageAccess[MAX_IMAGE_UNIFORMS]; + union { struct { /** @@ -2375,28 +2394,9 @@ struct gl_linked_shader struct glsl_symbol_table *symbols; /** - * Map from image uniform index to image unit (set by glUniform1i()) - * - * An image uniform index is associated with each image uniform by - * the linker. The image index associated with each uniform is - * stored in the \c gl_uniform_storage::image field. - */ - GLubyte ImageUnits[MAX_IMAGE_UNIFORMS]; - - /** - * Access qualifier specified in the shader for each image uniform - * index. Either \c GL_READ_ONLY, \c GL_WRITE_ONLY or \c - * GL_READ_WRITE. - * - * It may be different, though only more strict than the value of - * \c gl_image_unit::Access for the corresponding image unit. - */ - GLenum ImageAccess[MAX_IMAGE_UNIFORMS]; - - /** * Number of image uniforms defined in the shader. It specifies * the number of valid elements in the \c ImageUnits and \c - * ImageAccess arrays above. + * ImageAccess arrays. */ GLuint NumImages; diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 3108d348d6f..ec6d2774844 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -908,7 +908,7 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, struct gl_linked_shader *sh = shProg->_LinkedShaders[i]; for (int j = 0; j < count; j++) - sh->ImageUnits[uni->opaque[i].index + offset + j] = + sh->Program->sh.ImageUnits[uni->opaque[i].index + offset + j] = ((GLint *) values)[j]; } } |