aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/mesa/main/compiler.h6
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/mtypes.h2
-rw-r--r--mesalib/src/mesa/main/samplerobj.c58
-rw-r--r--mesalib/src/mesa/main/texobj.c2
-rw-r--r--mesalib/src/mesa/main/texparam.c32
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c8
9 files changed, 108 insertions, 6 deletions
diff --git a/mesalib/src/mesa/main/compiler.h b/mesalib/src/mesa/main/compiler.h
index f2b344fd1..b5cac72d3 100644
--- a/mesalib/src/mesa/main/compiler.h
+++ b/mesalib/src/mesa/main/compiler.h
@@ -333,7 +333,7 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
#ifndef M_PI
-#define M_PI (3.1415926536)
+#define M_PI (3.14159265358979323846)
#endif
#ifndef M_E
@@ -344,10 +344,6 @@ static INLINE GLuint CPU_TO_LE32(GLuint x)
#define M_LOG2E (1.4426950408889634074)
#endif
-#ifndef ONE_DIV_LN2
-#define ONE_DIV_LN2 (1.442695040888963456)
-#endif
-
#ifndef ONE_DIV_SQRT_LN2
#define ONE_DIV_SQRT_LN2 (1.201122408786449815)
#endif
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 1884d3e1a..e2413f7a9 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/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/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 02fdeffb6..4ec15d1e2 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/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/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 4642b80d7..473190638 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/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;
}
@@ -567,6 +568,25 @@ set_sampler_max_anisotropy(struct gl_context *ctx,
}
+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)
+ return INVALID_PNAME;
+
+ if (samp->CubeMapSeamless == param)
+ return GL_FALSE;
+
+ if (param != GL_TRUE && param != GL_FALSE)
+ return INVALID_VALUE;
+
+ flush(ctx);
+ samp->CubeMapSeamless = param;
+ return GL_TRUE;
+}
+
+
static void GLAPIENTRY
_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
{
@@ -615,6 +635,9 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) param);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, param);
+ break;
case GL_TEXTURE_BORDER_COLOR:
/* fall-through */
default:
@@ -696,6 +719,9 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, param);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) param);
+ break;
case GL_TEXTURE_BORDER_COLOR:
/* fall-through */
default:
@@ -774,6 +800,9 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
{
GLfloat c[4];
@@ -862,6 +891,9 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, params[0]);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colorf(ctx, sampObj, params);
break;
@@ -941,6 +973,9 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colori(ctx, sampObj, params);
break;
@@ -1021,6 +1056,9 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
res = set_sampler_max_anisotropy(ctx, sampObj, (GLfloat) params[0]);
break;
+ case GL_TEXTURE_CUBE_MAP_SEAMLESS:
+ res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colorui(ctx, sampObj, params);
break;
@@ -1110,6 +1148,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 +1221,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 +1295,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 +1369,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/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 426347e1b..9dc065a5d 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/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/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 74e1f4a1b..545c44ab9 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/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 */
}
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 6a3752810..ddda78e19 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -459,7 +459,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
value[0] = (ctx->Fog.End == ctx->Fog.Start)
? 1.0f : (GLfloat)(-1.0F / (ctx->Fog.End - ctx->Fog.Start));
value[1] = ctx->Fog.End * -value[0];
- value[2] = (GLfloat)(ctx->Fog.Density * ONE_DIV_LN2);
+ value[2] = (GLfloat)(ctx->Fog.Density * M_LOG2E); /* M_LOG2E == 1/ln(2) */
value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2);
return;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index 80e6cb02c..e1700d6a9 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -201,6 +201,9 @@ update_samplers(struct st_context *st)
= st_compare_func_to_pipe(msamp->CompareFunc);
}
+ sampler->seamless_cube_map =
+ st->ctx->Texture.CubeMapSeamless || msamp->CubeMapSeamless;
+
st->state.num_samplers = su + 1;
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 0c5e1991c..acad668d2 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -595,4 +595,12 @@ void st_init_extensions(struct st_context *st)
PIPE_BIND_SAMPLER_VIEW)) {
ctx->Extensions.EXT_packed_float = GL_TRUE;
}
+
+ if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE)) {
+ ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
+ ctx->Extensions.AMD_seamless_cubemap_per_texture = GL_TRUE;
+ }
+ else if (screen->get_param(screen, PIPE_CAP_SEAMLESS_CUBE_MAP)) {
+ ctx->Extensions.ARB_seamless_cube_map = GL_TRUE;
+ }
}