[Mesa-dev] [PATCH 3/4] mesa: Allow relax various desktop-only checks for cube arrays

Chris Forbes chrisf at ijw.co.nz
Tue May 31 05:28:42 UTC 2016


Signed-off-by: Chris Forbes <chrisforbes at google.com>
---
 src/mesa/main/get.c              | 2 +-
 src/mesa/main/get_hash_params.py | 6 +++---
 src/mesa/main/teximage.c         | 3 ++-
 src/mesa/main/texobj.c           | 2 +-
 src/mesa/main/texparam.c         | 3 ++-
 src/mesa/main/texstorage.c       | 3 ++-
 6 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 9f70749..4f46572 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1914,7 +1914,7 @@ tex_binding_to_index(const struct gl_context *ctx, GLenum binding)
               _mesa_has_OES_texture_buffer(ctx)) ?
              TEXTURE_BUFFER_INDEX : -1;
    case GL_TEXTURE_BINDING_CUBE_MAP_ARRAY:
-      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array
+      return ctx->Extensions.ARB_texture_cube_map_array
          ? TEXTURE_CUBE_ARRAY_INDEX : -1;
    case GL_TEXTURE_BINDING_2D_MULTISAMPLE:
       return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 2124072..7193296 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -458,6 +458,9 @@ descriptor=[
   [ "MIN_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MinProgramTextureGatherOffset), extra_ARB_texture_gather"],
   [ "MAX_PROGRAM_TEXTURE_GATHER_OFFSET", "CONTEXT_INT(Const.MaxProgramTextureGatherOffset), extra_ARB_texture_gather"],
 
+# GL_ARB_texture_cube_map_array / ES3.1 with GL_OES_texture_cube_map_array
+  [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ],
+
 # GL_ARB_compute_shader / GLES 3.1
   [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "CONTEXT_INT(Const.MaxComputeWorkGroupInvocations), extra_ARB_compute_shader_es31" ],
   [ "MAX_COMPUTE_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_COMPUTE].MaxUniformBlocks), extra_ARB_compute_shader_es31" ],
@@ -851,9 +854,6 @@ descriptor=[
 # GL_ARB_map_buffer_alignment
   [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), NO_EXTRA" ],
 
-# GL_ARB_texture_cube_map_array
-  [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ],
-
 # GL_ARB_texture_gather
   [ "MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB", "CONTEXT_INT(Const.MaxProgramTextureGatherComponents), extra_ARB_texture_gather"],
 
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 58b7f27..bfe0b18 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1474,8 +1474,9 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
       case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
          return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array;
       case GL_TEXTURE_CUBE_MAP_ARRAY:
-      case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
          return ctx->Extensions.ARB_texture_cube_map_array;
+      case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
+         return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array;
       default:
          return GL_FALSE;
       }
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index ed630bd..2e9d9e3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1579,7 +1579,7 @@ _mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target)
       return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
          ? TEXTURE_EXTERNAL_INDEX : -1;
    case GL_TEXTURE_CUBE_MAP_ARRAY:
-      return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array
+      return ctx->Extensions.ARB_texture_cube_map_array
          ? TEXTURE_CUBE_ARRAY_INDEX : -1;
    case GL_TEXTURE_2D_MULTISAMPLE:
       return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_multisample) ||
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index ba83f8f..d701b87 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -1243,6 +1243,8 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
        */
       return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
          _mesa_has_OES_texture_buffer(ctx);
+   case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
+      return ctx->Extensions.ARB_texture_cube_map_array;
    }
 
    if (!_mesa_is_desktop_gl(ctx))
@@ -1257,7 +1259,6 @@ _mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target
       return GL_TRUE;
    case GL_PROXY_TEXTURE_CUBE_MAP:
       return ctx->Extensions.ARB_texture_cube_map;
-   case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
    case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
       return ctx->Extensions.ARB_texture_cube_map_array;
    case GL_TEXTURE_RECTANGLE_NV:
diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index f4a0760..46869bb 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -55,7 +55,8 @@ legal_texobj_target(struct gl_context *ctx, GLuint dims, GLenum target)
        && target != GL_TEXTURE_2D
        && target != GL_TEXTURE_CUBE_MAP
        && target != GL_TEXTURE_3D
-       && target != GL_TEXTURE_2D_ARRAY)
+       && target != GL_TEXTURE_2D_ARRAY
+       && (target != GL_TEXTURE_CUBE_MAP_ARRAY || !ctx->Extensions.ARB_texture_cube_map_array))
       return GL_FALSE;
 
    switch (dims) {
-- 
2.8.3



More information about the mesa-dev mailing list