Mesa (master): mesa: implement AMD_seamless_cubemap_per_texture

Marek Olšák mareko at kemper.freedesktop.org
Fri May 6 18:14:56 UTC 2011


Module: Mesa
Branch: master
Commit: a19c42ffc606b594558a0c4f981662442ad6bb83
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a19c42ffc606b594558a0c4f981662442ad6bb83

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue May  3 11:37:25 2011 +0200

mesa: implement AMD_seamless_cubemap_per_texture

---

 src/mesa/main/extensions.c |    1 +
 src/mesa/main/mtypes.h     |    2 ++
 src/mesa/main/samplerobj.c |   21 +++++++++++++++++++++
 src/mesa/main/texobj.c     |    2 ++
 src/mesa/main/texparam.c   |   32 ++++++++++++++++++++++++++++++++
 5 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 1062cde..a9ef8fa 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -260,6 +260,7 @@ static const struct extension extension_table[] = {
    { "GL_3DFX_texture_compression_FXT1",           o(TDFX_texture_compression_FXT1),           GL,             1999 },
    { "GL_AMD_conservative_depth",                  o(AMD_conservative_depth),                  GL,             2009 },
    { "GL_AMD_draw_buffers_blend",                  o(ARB_draw_buffers_blend),                  GL,             2009 },
+   { "GL_AMD_seamless_cubemap_per_texture",        o(AMD_seamless_cubemap_per_texture),        GL,             2009 },
    { "GL_AMD_shader_stencil_export",               o(ARB_shader_stencil_export),               GL,             2009 },
    { "GL_APPLE_client_storage",                    o(APPLE_client_storage),                    GL,             2002 },
    { "GL_APPLE_object_purgeable",                  o(APPLE_object_purgeable),                  GL,             2006 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index fba65e8..29c8cfd 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1339,6 +1339,7 @@ struct gl_sampler_object
    GLenum CompareFunc;		/**< GL_ARB_shadow */
    GLfloat CompareFailValue;    /**< GL_ARB_shadow_ambient */
    GLenum sRGBDecode;           /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
+   GLboolean CubeMapSeamless;   /**< GL_AMD_seamless_cubemap_per_texture */
 
    /* deprecated sampler state */
    GLenum DepthMode;		/**< GL_ARB_depth_texture */
@@ -2885,6 +2886,7 @@ struct gl_extensions
    GLboolean OES_standard_derivatives;
    /* vendor extensions */
    GLboolean AMD_conservative_depth;
+   GLboolean AMD_seamless_cubemap_per_texture;
    GLboolean APPLE_client_storage;
    GLboolean APPLE_packed_pixels;
    GLboolean APPLE_vertex_array_object;
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 4a28c91..6e53f64 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -133,6 +133,7 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
    sampObj->CompareFunc = GL_LEQUAL;
    sampObj->CompareFailValue = 0.0;
    sampObj->sRGBDecode = GL_FALSE;
+   sampObj->CubeMapSeamless = GL_FALSE;
    sampObj->DepthMode = 0;
 }
 
@@ -1110,6 +1111,11 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
       params[2] = FLOAT_TO_INT(sampObj->BorderColor.f[2]);
       params[3] = FLOAT_TO_INT(sampObj->BorderColor.f[3]);
       break;
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+         goto invalid_pname;
+      *params = sampObj->CubeMapSeamless;
+      break;
    default:
       goto invalid_pname;
    }
@@ -1178,6 +1184,11 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
       params[2] = sampObj->BorderColor.f[2];
       params[3] = sampObj->BorderColor.f[3];
       break;
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+         goto invalid_pname;
+      *params = (GLfloat) sampObj->CubeMapSeamless;
+      break;
    default:
       goto invalid_pname;
    }
@@ -1247,6 +1258,11 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
       params[2] = sampObj->BorderColor.i[2];
       params[3] = sampObj->BorderColor.i[3];
       break;
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+         goto invalid_pname;
+      *params = sampObj->CubeMapSeamless;
+      break;
    default:
       goto invalid_pname;
    }
@@ -1316,6 +1332,11 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
       params[2] = sampObj->BorderColor.ui[2];
       params[3] = sampObj->BorderColor.ui[3];
       break;
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+         goto invalid_pname;
+      *params = sampObj->CubeMapSeamless;
+      break;
    default:
       goto invalid_pname;
    }
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 43d6e52..f2d214f 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -141,6 +141,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
    obj->Sampler.CompareFunc = GL_LEQUAL;       /* ARB_shadow */
    obj->Sampler.CompareFailValue = 0.0F;       /* ARB_shadow_ambient */
    obj->Sampler.DepthMode = GL_LUMINANCE;      /* ARB_depth_texture */
+   obj->Sampler.CubeMapSeamless = GL_FALSE;
    obj->Swizzle[0] = GL_RED;
    obj->Swizzle[1] = GL_GREEN;
    obj->Swizzle[2] = GL_BLUE;
@@ -251,6 +252,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
    dest->Sampler.CompareMode = src->Sampler.CompareMode;
    dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
    dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
+   dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
    dest->Sampler.DepthMode = src->Sampler.DepthMode;
    dest->_MaxLevel = src->_MaxLevel;
    dest->_MaxLambda = src->_MaxLambda;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index f86a8cf..4b9dcb5 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -439,6 +439,20 @@ set_tex_parameteri(struct gl_context *ctx,
       }
       goto invalid_pname;
 
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+         GLenum param = params[0];
+         if (param != GL_TRUE && param != GL_FALSE) {
+            goto invalid_param;
+         }
+         if (param != texObj->Sampler.CubeMapSeamless) {
+            flush(ctx);
+            texObj->Sampler.CubeMapSeamless = param;
+         }
+         return GL_TRUE;
+      }
+      goto invalid_pname;
+
    default:
       goto invalid_pname;
    }
@@ -580,6 +594,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
    case GL_TEXTURE_COMPARE_FUNC_ARB:
    case GL_DEPTH_TEXTURE_MODE_ARB:
    case GL_TEXTURE_SRGB_DECODE_EXT:
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
       {
          /* convert float param to int */
          GLint p[4];
@@ -629,6 +644,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    case GL_TEXTURE_COMPARE_FUNC_ARB:
    case GL_DEPTH_TEXTURE_MODE_ARB:
    case GL_TEXTURE_SRGB_DECODE_EXT:
+   case GL_TEXTURE_CUBE_MAP_SEAMLESS:
       {
          /* convert float param to int */
          GLint p[4];
@@ -1235,6 +1251,14 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
          }
          break;
 
+      case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+      if (ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+         *params = (GLfloat) obj->Sampler.CubeMapSeamless;
+      }
+      else {
+         error = GL_TRUE;
+      }
+
       default:
 	 error = GL_TRUE;
 	 break;
@@ -1396,6 +1420,14 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
          }
          break;
 
+      case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+         if (ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+            *params = (GLint) obj->Sampler.CubeMapSeamless;
+         }
+         else {
+            error = GL_TRUE;
+         }
+
       default:
          ; /* silence warnings */
    }




More information about the mesa-commit mailing list