In the commit message, s/requried/required/ Does holding onto the whole texture object make things easier? I had assumed you could get by just referencing the right gl_texture_image, but maybe that doesn't work out.
On Mon, Nov 25, 2013 at 6:00 PM, Francisco Jerez <[email protected]> wrote: > --- > src/mesa/main/config.h | 1 + > src/mesa/main/dd.h | 1 + > src/mesa/main/mtypes.h | 100 > +++++++++++++++++++++++++++++++++++++++++++++++++ > src/mesa/main/texobj.c | 1 + > 4 files changed, 103 insertions(+) > > diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h > index 22bbfa0..8bd9765 100644 > --- a/src/mesa/main/config.h > +++ b/src/mesa/main/config.h > @@ -175,6 +175,7 @@ > #define MAX_COMBINED_ATOMIC_BUFFERS (MAX_UNIFORM_BUFFERS * 6) > /* Size of an atomic counter in bytes according to > ARB_shader_atomic_counters */ > #define ATOMIC_COUNTER_SIZE 4 > +#define MAX_IMAGE_UNITS 32 > /*@}*/ > > /** > diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h > index b5b874f..648062f 100644 > --- a/src/mesa/main/dd.h > +++ b/src/mesa/main/dd.h > @@ -39,6 +39,7 @@ struct gl_buffer_object; > struct gl_context; > struct gl_display_list; > struct gl_framebuffer; > +struct gl_image_unit; > struct gl_pixelstore_attrib; > struct gl_program; > struct gl_renderbuffer; > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > index e9750f4..7be0664 100644 > --- a/src/mesa/main/mtypes.h > +++ b/src/mesa/main/mtypes.h > @@ -1207,6 +1207,9 @@ struct gl_texture_object > > /** GL_OES_EGL_image_external */ > GLint RequiredTextureImageUnits; > + > + /** GL_ARB_shader_image_load_store */ > + GLenum ImageFormatCompatibility; > }; > > > @@ -2373,6 +2376,29 @@ struct gl_shader > */ > GLenum OutputType; > } Geom; > + > + /** > + * 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_UNITS]; > + > + /** > + * Access qualifier specified in the shader for each image uniform. > + * 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_UNITS]; > + > + /** > + * Number of image uniforms defined in the shader. > + */ > + GLuint NumImages; > }; > > > @@ -3077,9 +3103,13 @@ struct gl_program_constants > GLuint MaxUniformBlocks; > GLuint MaxCombinedUniformComponents; > GLuint MaxTextureImageUnits; > + > /* GL_ARB_shader_atomic_counters */ > GLuint MaxAtomicBuffers; > GLuint MaxAtomicCounters; > + > + /* GL_ARB_shader_image_load_store */ > + GLuint MaxImageUniforms; > }; > > > @@ -3302,6 +3332,12 @@ struct gl_constants > /** GL_ARB_vertex_attrib_binding */ > GLint MaxVertexAttribRelativeOffset; > GLint MaxVertexAttribBindings; > + > + /* GL_ARB_shader_image_load_store */ > + GLuint MaxImageUnits; > + GLuint MaxCombinedImageUnitsAndFragmentOutputs; > + GLuint MaxImageSamples; > + GLuint MaxCombinedImageUniforms; > }; > > > @@ -3727,6 +3763,11 @@ struct gl_driver_flags > * gl_context::AtomicBufferBindings > */ > GLbitfield NewAtomicBuffer; > + > + /** > + * gl_context::ImageUnits > + */ > + GLbitfield NewImageUnits; > }; > > struct gl_uniform_buffer_binding > @@ -3744,6 +3785,60 @@ struct gl_uniform_buffer_binding > }; > > /** > + * ARB_shader_image_load_store image unit. > + */ > +struct gl_image_unit > +{ > + /** > + * Texture object bound to this unit. > + */ > + struct gl_texture_object *TexObj; > + > + /** > + * Level of the texture object bound to this unit. > + */ > + GLuint Level; > + > + /** > + * \c GL_TRUE if the whole level is bound as an array of layers, \c > + * GL_FALSE if only some specific layer of the texture is bound. > + * \sa Layer > + */ > + GLboolean Layered; > + > + /** > + * Layer of the texture object bound to this unit, or zero if \c > + * Layered is \c GL_TRUE. > + */ > + GLuint Layer; > + > + /** > + * Access allowed to this texture image. Either \c GL_READ_ONLY, > + * \c GL_WRITE_ONLY or \c GL_READ_WRITE. > + */ > + GLenum Access; > + > + /** > + * GL internal format that determines the interpretation of the > + * image memory when shader image operations are performed through > + * this unit. > + */ > + GLenum Format; > + > + /** > + * Mesa format corresponding to \c Format. > + */ > + gl_format _ActualFormat; > + > + /** > + * GL_TRUE if the state of this image unit is valid and access from > + * the shader is allowed. Otherwise loads from this unit should > + * return zero and stores should have no effect. > + */ > + GLboolean _Valid; > +}; > + > +/** > * Binding point for an atomic counter buffer object. > */ > struct gl_atomic_buffer_binding > @@ -3933,6 +4028,11 @@ struct gl_context > struct gl_atomic_buffer_binding > AtomicBufferBindings[MAX_COMBINED_ATOMIC_BUFFERS]; > > + /** > + * Array of image units for ARB_shader_image_load_store. > + */ > + struct gl_image_unit ImageUnits[MAX_IMAGE_UNITS]; > + > /*@}*/ > > struct gl_meta_state *Meta; /**< for "meta" operations */ > diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c > index abd30c5..4f732fc 100644 > --- a/src/mesa/main/texobj.c > +++ b/src/mesa/main/texobj.c > @@ -157,6 +157,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, > obj->Sampler.sRGBDecode = GL_DECODE_EXT; > obj->BufferObjectFormat = GL_R8; > obj->_BufferObjectFormat = MESA_FORMAT_R8; > + obj->ImageFormatCompatibility = GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE; > } > > > -- > 1.8.3.4 > > _______________________________________________ > mesa-dev mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
