[Mesa-dev] [PATCH 1/2] mesa: implement AMD_seamless_cubemap_per_texture
Marek Olšák
maraeo at gmail.com
Tue May 3 06:55:37 PDT 2011
---
src/mesa/main/extensions.c | 1 +
src/mesa/main/mtypes.h | 2 ++
src/mesa/main/texobj.c | 2 ++
src/mesa/main/texparam.c | 32 ++++++++++++++++++++++++++++++++
4 files changed, 37 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..ad65b55 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1370,6 +1370,7 @@ struct gl_texture_object
GLint CropRect[4]; /**< GL_OES_draw_texture */
GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
+ GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
GLboolean _Complete; /**< Is texture object complete? */
GLboolean _RenderToTexture; /**< Any rendering to this 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/texobj.c b/src/mesa/main/texobj.c
index 43d6e52..2272110 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -146,6 +146,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Swizzle[2] = GL_BLUE;
obj->Swizzle[3] = GL_ALPHA;
obj->_Swizzle = SWIZZLE_NOOP;
+ obj->CubeMapSeamless = GL_FALSE;
obj->Sampler.sRGBDecode = GL_DECODE_EXT;
}
@@ -259,6 +260,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->_Complete = src->_Complete;
COPY_4V(dest->Swizzle, src->Swizzle);
dest->_Swizzle = src->_Swizzle;
+ dest->CubeMapSeamless = src->CubeMapSeamless;
}
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index f86a8cf..05f77b3 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->CubeMapSeamless) {
+ flush(ctx);
+ texObj->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->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->CubeMapSeamless;
+ }
+ else {
+ error = GL_TRUE;
+ }
+
default:
; /* silence warnings */
}
--
1.7.4.1
More information about the mesa-dev
mailing list