[Mesa-dev] [PATCH 5/7] mesa: Update TexStorage to support ARB_texture_view

Chris Forbes chrisf at ijw.co.nz
Wed Nov 6 12:14:50 PST 2013


The only interesting targets in teximagemultisample are
GL_TEXTURE_2D_MULTISAMPLE and GL_TEXTURE_2D_MULTISAMPLE_ARRAY.

On Thu, Nov 7, 2013 at 8:55 AM, Courtney Goeltzenleuchter
<courtney at lunarg.com> wrote:
> TexStorage and TexStorageMultisample updates texture object
> state needed by ARB_texture_view extension.
>
> Set appropriate TextureView state in texture object.
>
> mesa: Add ARB_texture_view
>
> Signed-off-by: Courtney Goeltzenleuchter <courtney at LunarG.com>
> ---
>  src/mesa/main/teximage.c   | 38 ++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/texstorage.c | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 793c5d3..c01f72e 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -4348,6 +4348,44 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples,
>        }
>
>        texObj->Immutable = immutable;
> +
> +      if (immutable) {
> +         /* If the command is successful,
> +          * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
> +          * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
> +          * If the texture target is TEXTURE_1D_ARRAY then
> +          * TEXTURE_VIEW_NUM_LAYERS becomes height.
> +          * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
> +          * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes depth.
> +          * If the texture target is TEXTURE_CUBE_MAP, then
> +          * TEXTURE_VIEW_NUM_LAYERS becomes 6.
> +          * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
> +          * ARB_texture_multisample: Multisample textures do
> +          * not have multiple image levels.
> +          */
> +         texObj->Immutable = GL_TRUE;
> +         texObj->ImmutableLevels = 1;
> +         texObj->MinLevel = 0;
> +         texObj->NumLevels = 1;
> +         texObj->MinLayer = 0;
> +         texObj->NumLayers = 1;
> +         switch (target) {
> +         case GL_TEXTURE_1D_ARRAY:
> +            texObj->NumLayers = height;
> +            break;
> +
> +         case GL_TEXTURE_2D_ARRAY:
> +         case GL_TEXTURE_CUBE_MAP_ARRAY:
> +         case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> +            texObj->NumLayers = depth;
> +            break;
> +
> +         case GL_TEXTURE_CUBE_MAP:
> +            texObj->NumLayers = 6;
> +            break;
> +         }
> +      }
> +
>        _mesa_update_fbo_texture(ctx, texObj, 0, 0);
>     }
>  }
> diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
> index 84b8f82..4da3c91 100644
> --- a/src/mesa/main/texstorage.c
> +++ b/src/mesa/main/texstorage.c
> @@ -436,8 +436,41 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat,
>           return;
>        }
>
> +      /* If the command is successful,
> +       * TEXTURE_IMMUTABLE_FORMAT becomes TRUE.
> +       * TEXTURE_IMMUTABLE_LEVELS and TEXTURE_VIEW_NUM_LEVELS become levels.
> +       * If the texture target is TEXTURE_1D_ARRAY then
> +       * TEXTURE_VIEW_NUM_LAYERS becomes height.
> +       * If the texture target is TEXTURE_2D_ARRAY, TEXTURE_CUBE_MAP_ARRAY,
> +       * or TEXTURE_2D_MULTISAMPLE_ARRAY then TEXTURE_VIEW_NUM_LAYERS becomes depth.
> +       * If the texture target is TEXTURE_CUBE_MAP, then
> +       * TEXTURE_VIEW_NUM_LAYERS becomes 6.
> +       * For any other texture target, TEXTURE_VIEW_NUM_LAYERS becomes 1.
> +       */
> +
>        texObj->Immutable = GL_TRUE;
>        texObj->ImmutableLevels = levels;
> +      texObj->MinLevel = 0;
> +      texObj->NumLevels = levels;
> +      texObj->MinLayer = 0;
> +      texObj->NumLayers = 1;
> +      switch (target)
> +      {
> +      case GL_TEXTURE_1D_ARRAY:
> +         texObj->NumLayers = height;
> +         break;
> +
> +      case GL_TEXTURE_2D_ARRAY:
> +      case GL_TEXTURE_CUBE_MAP_ARRAY:
> +      case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
> +         texObj->NumLayers = depth;
> +         break;
> +
> +      case GL_TEXTURE_CUBE_MAP:
> +         texObj->NumLayers = 6;
> +         break;
> +      }
> +
>     }
>  }
>
> --
> 1.8.1.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list