[Mesa-dev] [PATCH v5 2/2] mesa/teximage: accept ASTC formats for 3D texture specification

Nanley Chery nanleychery at gmail.com
Tue Aug 25 14:06:18 PDT 2015


I'm planning to send out a v6 to fix an issue w/ a not-yet-upstreamed
piglit test I've developed for ASTC.

On Tue, Aug 25, 2015 at 1:00 PM, Nanley Chery <nanleychery at gmail.com> wrote:

> From: Nanley Chery <nanley.g.chery at intel.com>
>
> The ASTC spec was revised as follows:
>
>    Revision 2, April 28, 2015 - added CompressedTex{Sub,}Image3D to
>    commands accepting ASTC format tokens in the New Tokens section [...].
>
> Support only exists in the HDR submode:
>
>    Add a second new column "3D Tex." which is empty for all non-ASTC
>    formats. If only the LDR profile is supported by the implementation,
>    this column is also empty for all ASTC formats. If both the LDR and HDR
>    profiles are supported only, this column is checked for all ASTC
>    formats.
>
> LDR-only systems should generate an INVALID_OPERATION error when
> attempting to call CompressedTexImage3D with the TEXTURE_3D target.
>
> v2. return the proper error for LDR-only systems.
> v3. update is_astc_format().
> v4. use _mesa_is_astc_format().
> v5. place logic in _mesa_target_can_be_compressed.
>
> Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
> ---
>  src/mesa/main/teximage.c | 54
> +++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 47 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index c28cd03..5602123 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1854,19 +1854,59 @@ _mesa_target_can_be_compressed(const struct
> gl_context *ctx, GLenum target,
>              return write_error(error, GL_INVALID_OPERATION);
>
>        target_can_be_compresed =
> ctx->Extensions.ARB_texture_cube_map_array;
> -      break;
> -   case GL_TEXTURE_3D:
>
> -      /* See ETC2/EAC comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY. */
> -      if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
> +      /* From the KHR_texture_compression_astc_hdr spec:
> +       *
> +       *     Add a second new column "3D Tex." which is empty for all
> non-ASTC
> +       *     formats. If only the LDR profile is supported by the
> implementation,
> +       *     this column is also empty for all ASTC formats. If both the
> LDR and HDR
> +       *     profiles are supported only, this column is checked for all
> ASTC
> +       *     formats.
> +       *
> +       *     Add a third new column "Cube Map Array Tex." which is empty
> for all
> +       *     non-ASTC formats, and checked for all ASTC formats.
> +       *
> +       * and,
> +       *
> +       *     'An INVALID_OPERATION error is generated by
> CompressedTexImage3D
> +       *      if <internalformat> is TEXTURE_CUBE_MAP_ARRAY and the
> +       *      "Cube Map Array" column of table 8.19 is *not* checked, or
> if
> +       *      <internalformat> is TEXTURE_3D and the "3D Tex." column of
> table
> +       *      8.19 is *not* checked'
> +       *
> +       * The instances of <internalformat> above should say <target>.
> +       */
> +
> +      /* Throw an INVALID_OPERATION error if the target is
> +       * TEXTURE_CUBE_MAP_ARRAY and the format is not ASTC.
> +       */
> +      if (target_can_be_compresed &&
> +          ctx->Extensions.KHR_texture_compression_astc_ldr &&
> +          layout != MESA_FORMAT_LAYOUT_ASTC)
>           return write_error(error, GL_INVALID_OPERATION);
>
> -      if (layout == MESA_FORMAT_LAYOUT_BPTC) {
> +      break;
> +   case GL_TEXTURE_3D:
> +      switch (layout) {
> +      case MESA_FORMAT_LAYOUT_ETC2:
> +         /* See ETC2/EAC comment in case GL_TEXTURE_CUBE_MAP_ARRAY. */
> +         if (_mesa_is_gles3(ctx))
> +            return write_error(error, GL_INVALID_OPERATION);
> +         break;
> +      case MESA_FORMAT_LAYOUT_BPTC:
>           target_can_be_compresed =
> ctx->Extensions.ARB_texture_compression_bptc;
>           break;
> +      default:
> +         /* Throw an INVALID_OPERATION error if the target is TEXTURE_3D
> and
> +          * (the format is not ASTC or the hdr extension is not
> supported).
> +          * See comment in switch case GL_TEXTURE_CUBE_MAP_ARRAY for more
> info.
> +          */
> +         if (ctx->Extensions.KHR_texture_compression_astc_ldr &&
> +             (layout != MESA_FORMAT_LAYOUT_ASTC ||
> +             !ctx->Extensions.KHR_texture_compression_astc_hdr))
> +            return write_error(error, GL_INVALID_OPERATION);
> +         break;
>        }
> -
> -      break;
>     default:
>        break;
>     }
> --
> 2.5.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150825/d023ba30/attachment.html>


More information about the mesa-dev mailing list