Skip to content

Implement EXT_shader_image_load_store

This MR implements EXT_shader_image_load_store.

Since Mesa already support ARB_shader_image_load_store this MR implements the delta between the 2 specification, as documented in in the (0) How does this extension differ from the similar EXT_shader_image_load_store? section of the ARB spec:

     * "size" layout qualifiers replaced with "format" qualifiers.

Done in commit cd8a88e7

     * Image loads aren't restricted to "1x8", "1x16", "1x32", "2x32", and
      "4x32" formats.  Instead, each supported image format has a layout
      qualifier, and values loaded from images are converted to an
      vec4/ivec4/uvec4 representation appropriate for the image format.

My understanding is that it's a benefit from the new qualifier and so is irrelevant to the EXT implementation.

    * For textures not allocated by the GL (e.g., images shared from other
      external APIs), implementations need not support image unit formats
      that don't match the texture format, unless they are in the same
      "class", which is generally the case only if component counts and
      sizes are exactly the same.

Again, I think it's not relevant because only the ARB spec has a paragraph about textures allocated outside the GL

    * Image variables used exclusively for image stores need not declare a
      format qualifier.

Done. The writeonly qualifier is not supported in the EXT spec and there's a check in ast_to_hir.cpp to disallow this (see ffef4ecd).

    * Added the built-in GLSL constants "gl_MaxImageUnits",
      "gl_MaxCombinedImageUnitsAndFragmentOutputs", and
      "gl_MaxImageSamples".

These are only added if the ARB is enabled.

    * BindImageTexture throws INVALID_VALUE if <level> or <layer> is
      negative.

Done in 3e29c7d7.

    * The <format> parameter of BindImageTexture was changed from an "int"
      to an "enum".  In the EXT, <format> copied TexImage*'s
      <internalformat> parameter, which is an "int" because that's how it
      was defined in OpenGL 1.0 (where the parameter was called
      <components> and the now-deprecated "1", "2", "3", and "4" formats
      were the only ones supported).

Done in 3e29c7d7.

    * Added implemenentation-dependent limits on the number of active
      image uniforms (MAX_*_IMAGE_UNIFORMS) for each stage, and combined
      across all stages.  Also added corresponding GLSL constants
      "gl_Max*ImageUniforms".

Irrelevant to the EXT.

    * The atomicIncWrap() and atomicDecWrap() built-in functions present
      in the EXT have been removed.

Added. That's the biggest source of changes.

Note: only tgsi + radeonsi supports the newly added opcode. Is this enough to land the MR, or support for other drivers must be added as well?

    * The <index> parameter of BindImageTextureEXT has been renamed to
      <unit> for BindImageTexture.

Done.

I've also submitted a piglit MR - the tests pass on radeonsi with the commits of this MR.

Merge request reports