[Mesa-dev] (no subject)

Maxence Le Doré maxence.ledore at gmail.com
Wed Aug 21 20:46:54 PDT 2013


As ARB_seamless_cubemap_per_texture is word-to-word same as
AMD_seamless_cubemap_per_texture and this last already implemented we
can enable the ARB extension. This patch is a candidate for it :

>From eb2cf312a7c7ba70f22f8eb8d66aab8a1d78b6d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxence=20Le=20Dor=C3=A9?= <maxence.ledore at gmail.com>
Date: Thu, 22 Aug 2013 05:38:15 +0200
Subject: [PATCH] enable ARB_seamless_cubemap_per_texture

---
 src/gallium/docs/source/resources.rst  |    3 ++-
 src/mesa/main/extensions.c             |    1 +
 src/mesa/main/mtypes.h                 |    3 ++-
 src/mesa/main/samplerobj.c             |   15 ++++++++++-----
 src/mesa/main/texparam.c               |    5 ++++-
 src/mesa/state_tracker/st_extensions.c |    1 +
 6 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/gallium/docs/source/resources.rst
b/src/gallium/docs/source/resources.rst
index 56a86d6..a7f45a3 100644
--- a/src/gallium/docs/source/resources.rst
+++ b/src/gallium/docs/source/resources.rst
@@ -174,7 +174,8 @@ resulting in filtering taking samples from
multiple surfaces near to the edge.
 OpenGL: GL_TEXTURE_CUBE_MAP in GL 1.3 or EXT_texture_cube_map

 - PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or
GL_ARB_texture_non_power_of_two
-- Seamless cube maps require GL 3.2 or GL_ARB_seamless_cube_map or
GL_AMD_seamless_cubemap_per_texture
+- Seamless cube maps require GL 3.2 or GL_ARB_seamless_cube_map or
GL_ARB_seamless_cubemap_per_texture
+  or GL_AMD_seamless_cubemap_per_texture
 - Cube map arrays require GL 4.0 or GL_ARB_texture_cube_map_array

 D3D11: 2D array textures with the D3D11_RESOURCE_MISC_TEXTURECUBE flag
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 1a040ee..6b02b9b 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -120,6 +120,7 @@ static const struct extension extension_table[] = {
    { "GL_ARB_robustness",                          o(dummy_true),
                         GL,             2010 },
    { "GL_ARB_sampler_objects",                     o(dummy_true),
                         GL,             2009 },
    { "GL_ARB_seamless_cube_map",
o(ARB_seamless_cube_map),                   GL,             2009 },
+   { "GL_ARB_seamless_cubemap_per_texture",
o(ARB_seamless_cubemap_per_texture),        GL,             2013 },
    { "GL_ARB_shader_bit_encoding",
o(ARB_shader_bit_encoding),                 GL,             2010 },
    { "GL_ARB_shader_objects",                      o(dummy_true),
                         GL,             2002 },
    { "GL_ARB_shader_stencil_export",
o(ARB_shader_stencil_export),               GL,             2009 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 5f9b7f9..641e5a9 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1142,7 +1142,7 @@ struct gl_sampler_object
    GLenum CompareMode; /**< GL_ARB_shadow */
    GLenum CompareFunc; /**< GL_ARB_shadow */
    GLenum sRGBDecode;           /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
-   GLboolean CubeMapSeamless;   /**< GL_AMD_seamless_cubemap_per_texture */
+   GLboolean CubeMapSeamless;   /**<
GL_{ARB,AMD}_seamless_cubemap_per_texture */
 };


@@ -3056,6 +3056,7 @@ struct gl_extensions
    GLboolean ARB_occlusion_query2;
    GLboolean ARB_point_sprite;
    GLboolean ARB_seamless_cube_map;
+   GLboolean ARB_seamless_cubemap_per_texture;
    GLboolean ARB_shader_bit_encoding;
    GLboolean ARB_shader_stencil_export;
    GLboolean ARB_shader_texture_lod;
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 3857eda..0182531 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -568,7 +568,8 @@ static GLuint
 set_sampler_cube_map_seamless(struct gl_context *ctx,
                               struct gl_sampler_object *samp, GLboolean param)
 {
-   if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+   if (!ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+       !ctx->Extensions.ARB_seamless_cubemap_per_texture)
       return INVALID_PNAME;

    if (samp->CubeMapSeamless == param)
@@ -1176,7 +1177,8 @@ _mesa_GetSamplerParameteriv(GLuint sampler,
GLenum pname, GLint *params)
       params[3] = FLOAT_TO_INT(sampObj->BorderColor.f[3]);
       break;
    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
-      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+          !ctx->Extensions.ARB_seamless_cubemap_per_texture)
          goto invalid_pname;
       *params = sampObj->CubeMapSeamless;
       break;
@@ -1254,7 +1256,8 @@ _mesa_GetSamplerParameterfv(GLuint sampler,
GLenum pname, GLfloat *params)
       params[3] = sampObj->BorderColor.f[3];
       break;
    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
-      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+          !ctx->Extensions.ARB_seamless_cubemap_per_texture)
          goto invalid_pname;
       *params = (GLfloat) sampObj->CubeMapSeamless;
       break;
@@ -1333,7 +1336,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler,
GLenum pname, GLint *params)
       params[3] = sampObj->BorderColor.i[3];
       break;
    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
-      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+          !ctx->Extensions.ARB_seamless_cubemap_per_texture)
          goto invalid_pname;
       *params = sampObj->CubeMapSeamless;
       break;
@@ -1412,7 +1416,8 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler,
GLenum pname, GLuint *params)
       params[3] = sampObj->BorderColor.ui[3];
       break;
    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
-      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+          !ctx->Extensions.ARB_seamless_cubemap_per_texture)
          goto invalid_pname;
       *params = sampObj->CubeMapSeamless;
       break;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 757ae80..98fd325 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -571,7 +571,8 @@ set_tex_parameteri(struct gl_context *ctx,

    case GL_TEXTURE_CUBE_MAP_SEAMLESS:
       if (_mesa_is_desktop_gl(ctx)
-          && ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+          && (ctx->Extensions.AMD_seamless_cubemap_per_texture ||
+              ctx->Extensions.ARB_seamless_cubemap_per_texture)) {
          GLenum param = params[0];

          if (!target_allows_setting_sampler_parameters(texObj->Target))
@@ -1549,6 +1550,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum
pname, GLfloat *params )

       case GL_TEXTURE_CUBE_MAP_SEAMLESS:
          if (!_mesa_is_desktop_gl(ctx)
+             || !ctx->Extensions.ARB_seamless_cubemap_per_texture
              || !ctx->Extensions.AMD_seamless_cubemap_per_texture)
             goto invalid_pname;
          *params = (GLfloat) obj->Sampler.CubeMapSeamless;
@@ -1730,6 +1732,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum
pname, GLint *params )

       case GL_TEXTURE_CUBE_MAP_SEAMLESS:
          if (!_mesa_is_desktop_gl(ctx)
+             || !ctx->Extensions.ARB_seamless_cubemap_per_texture
              || !ctx->Extensions.AMD_seamless_cubemap_per_texture)
             goto invalid_pname;
          *params = (GLint) obj->Sampler.CubeMapSeamless;
diff --git a/src/mesa/state_tracker/st_extensions.c
b/src/mesa/state_tracker/st_extensions.c
index 0b7001b..fa73e35 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -378,6 +378,7 @@ void st_init_extensions(struct st_context *st)
       { o(ARB_occlusion_query2),             PIPE_CAP_OCCLUSION_QUERY
                 },
       { o(ARB_point_sprite),                 PIPE_CAP_POINT_SPRITE
                 },
       { o(ARB_seamless_cube_map),
PIPE_CAP_SEAMLESS_CUBE_MAP                },
+      { o(ARB_seamless_cubemap_per_texture),
PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE    },
       { o(ARB_shader_stencil_export),
PIPE_CAP_SHADER_STENCIL_EXPORT            },
       { o(ARB_shader_texture_lod),           PIPE_CAP_SM3
                 },
       { o(ARB_shadow),
PIPE_CAP_TEXTURE_SHADOW_MAP               },
-- 
1.7.9.5


More information about the mesa-dev mailing list