aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-03 08:16:19 +0200
committermarha <marha@users.sourceforge.net>2012-08-03 09:35:02 +0200
commit18e75aa6ae27a6e44d93babd96afbbe0cd6077c8 (patch)
treea6124cc965bba51de50907418ce63ab4540f582d /mesalib/src/mesa/main
parent49838240b7d4cff1ffed1bd91e495f6919061f90 (diff)
downloadvcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.tar.gz
vcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.tar.bz2
vcxsrv-18e75aa6ae27a6e44d93babd96afbbe0cd6077c8.zip
pixman mesa git update 3 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/attrib.c2
-rw-r--r--mesalib/src/mesa/main/bufferobj.c4
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp5
-rw-r--r--mesalib/src/mesa/main/get.c7
-rw-r--r--mesalib/src/mesa/main/mtypes.h6
-rw-r--r--mesalib/src/mesa/main/samplerobj.c65
-rw-r--r--mesalib/src/mesa/main/samplerobj.h11
-rw-r--r--mesalib/src/mesa/main/texobj.c4
-rw-r--r--mesalib/src/mesa/main/texparam.c8
-rw-r--r--mesalib/src/mesa/main/texstate.c2
-rw-r--r--mesalib/src/mesa/main/version.c2
12 files changed, 89 insertions, 29 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 318d576e8..8bc7c348f 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -806,7 +806,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
samp->CompareFunc);
}
if (ctx->Extensions.ARB_depth_texture)
- _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, samp->DepthMode);
+ _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, obj->DepthMode);
}
/* remove saved references to the texture objects */
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 7d72092a2..48edd89c9 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -131,7 +131,7 @@ get_buffer(struct gl_context *ctx, const char *func, GLenum target)
}
-static inline GLenum
+static inline GLbitfield
default_access_mode(const struct gl_context *ctx)
{
/* Table 2.6 on page 31 (page 44 of the PDF) of the OpenGL 1.5 spec says:
@@ -150,7 +150,7 @@ default_access_mode(const struct gl_context *ctx)
* The difference is because GL_OES_mapbuffer only supports mapping buffers
* write-only.
*/
- return (ctx->API == API_OPENGLES)
+ return _mesa_is_gles(ctx)
? GL_MAP_WRITE_BIT : (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
}
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index a7b481ca7..5e13a9357 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -113,7 +113,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_point_sprite", o(ARB_point_sprite), GL, 2003 },
{ "GL_ARB_provoking_vertex", o(EXT_provoking_vertex), GL, 2009 },
{ "GL_ARB_robustness", o(dummy_true), GL, 2010 },
- { "GL_ARB_sampler_objects", o(ARB_sampler_objects), GL, 2009 },
+ { "GL_ARB_sampler_objects", o(dummy_true), GL, 2009 },
{ "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 },
{ "GL_ARB_shader_bit_encoding", o(ARB_shader_bit_encoding), GL, 2010 },
{ "GL_ARB_shader_objects", o(ARB_shader_objects), GL, 2002 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 0233f3802..f743ce109 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -33,6 +33,7 @@ extern "C" {
#include "mtypes.h"
#include "main/uniforms.h"
#include "main/macros.h"
+#include "main/samplerobj.h"
#include "program/program.h"
#include "program/prog_parameter.h"
#include "program/prog_cache.h"
@@ -428,11 +429,13 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
const struct gl_texture_object *texObj = texUnit->_Current;
const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
+ const struct gl_sampler_object *samp;
GLenum format;
if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
continue;
+ samp = _mesa_get_samplerobj(ctx, i);
format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
key->unit[i].enabled = 1;
@@ -444,7 +447,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
translate_tex_src_bit(texUnit->_ReallyEnabled);
key->unit[i].shadow =
- ((texObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
+ ((samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
((format == GL_DEPTH_COMPONENT) ||
(format == GL_DEPTH_STENCIL_EXT)));
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index b9c98fb22..16ad2c430 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -284,11 +284,6 @@ static const int extra_GLSL_130[] = {
EXTRA_END
};
-static const int extra_ARB_sampler_objects[] = {
- EXT(ARB_sampler_objects),
- EXTRA_END
-};
-
static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
EXT(ARB_uniform_buffer_object),
EXT(ARB_geometry_shader4),
@@ -1304,7 +1299,7 @@ static const struct value_desc values[] = {
/* GL_ARB_sampler_objects / GL 3.3 */
{ GL_SAMPLER_BINDING,
- LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, extra_ARB_sampler_objects },
+ LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, NO_EXTRA },
/* GL 3.0 */
{ GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 7d7213f4d..e8adac99d 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1253,9 +1253,6 @@ struct gl_sampler_object
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 */
};
@@ -1272,6 +1269,8 @@ struct gl_texture_object
struct gl_sampler_object Sampler;
+ GLenum DepthMode; /**< GL_ARB_depth_texture */
+
GLfloat Priority; /**< in [0,1] */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
@@ -2966,7 +2965,6 @@ struct gl_extensions
GLboolean ARB_occlusion_query;
GLboolean ARB_occlusion_query2;
GLboolean ARB_point_sprite;
- GLboolean ARB_sampler_objects;
GLboolean ARB_seamless_cube_map;
GLboolean ARB_shader_bit_encoding;
GLboolean ARB_shader_objects;
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 5d1b2adbb..dc8adfc3f 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -133,10 +133,8 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
sampObj->CompareFailValue = 0.0;
sampObj->sRGBDecode = GL_DECODE_EXT;
sampObj->CubeMapSeamless = GL_FALSE;
- sampObj->DepthMode = 0;
}
-
/**
* Fallback for ctx->Driver.NewSamplerObject();
*/
@@ -162,7 +160,7 @@ _mesa_delete_sampler_object(struct gl_context *ctx,
}
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_GenSamplers(GLsizei count, GLuint *samplers)
{
GET_CURRENT_CONTEXT(ctx);
@@ -194,7 +192,7 @@ _mesa_GenSamplers(GLsizei count, GLuint *samplers)
}
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
{
GET_CURRENT_CONTEXT(ctx);
@@ -244,7 +242,7 @@ _mesa_IsSampler(GLuint sampler)
}
-static void GLAPIENTRY
+void GLAPIENTRY
_mesa_BindSampler(GLuint unit, GLuint sampler)
{
struct gl_sampler_object *sampObj;
@@ -584,8 +582,25 @@ set_sampler_cube_map_seamless(struct gl_context *ctx,
return GL_TRUE;
}
+static GLuint
+set_sampler_srgb_decode(struct gl_context *ctx,
+ struct gl_sampler_object *samp, GLenum param)
+{
+ if (!ctx->Extensions.EXT_texture_sRGB_decode)
+ return INVALID_PNAME;
-static void GLAPIENTRY
+ if (samp->sRGBDecode == param)
+ return GL_FALSE;
+
+ if (param != GL_DECODE_EXT && param != GL_SKIP_DECODE_EXT)
+ return INVALID_VALUE;
+
+ flush(ctx);
+ samp->sRGBDecode = param;
+ return GL_TRUE;
+}
+
+void GLAPIENTRY
_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
{
struct gl_sampler_object *sampObj;
@@ -636,6 +651,9 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, param);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, param);
+ break;
case GL_TEXTURE_BORDER_COLOR:
/* fall-through */
default:
@@ -720,6 +738,9 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) param);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) param);
+ break;
case GL_TEXTURE_BORDER_COLOR:
/* fall-through */
default:
@@ -801,6 +822,9 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
{
GLfloat c[4];
@@ -892,6 +916,9 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, (GLboolean) params[0]);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colorf(ctx, sampObj, params);
break;
@@ -974,6 +1001,9 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colori(ctx, sampObj, params);
break;
@@ -1057,6 +1087,9 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
res = set_sampler_cube_map_seamless(ctx, sampObj, params[0]);
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ res = set_sampler_srgb_decode(ctx, sampObj, (GLenum) params[0]);
+ break;
case GL_TEXTURE_BORDER_COLOR:
res = set_sampler_border_colorui(ctx, sampObj, params);
break;
@@ -1151,6 +1184,11 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ctx->Extensions.EXT_texture_sRGB_decode)
+ goto invalid_pname;
+ *params = (GLenum) sampObj->sRGBDecode;
+ break;
default:
goto invalid_pname;
}
@@ -1224,6 +1262,11 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
goto invalid_pname;
*params = (GLfloat) sampObj->CubeMapSeamless;
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ctx->Extensions.EXT_texture_sRGB_decode)
+ goto invalid_pname;
+ *params = (GLfloat) sampObj->sRGBDecode;
+ break;
default:
goto invalid_pname;
}
@@ -1298,6 +1341,11 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ctx->Extensions.EXT_texture_sRGB_decode)
+ goto invalid_pname;
+ *params = (GLenum) sampObj->sRGBDecode;
+ break;
default:
goto invalid_pname;
}
@@ -1372,6 +1420,11 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
goto invalid_pname;
*params = sampObj->CubeMapSeamless;
break;
+ case GL_TEXTURE_SRGB_DECODE_EXT:
+ if (!ctx->Extensions.EXT_texture_sRGB_decode)
+ goto invalid_pname;
+ *params = (GLenum) sampObj->sRGBDecode;
+ break;
default:
goto invalid_pname;
}
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index 0bfda4351..2b0cd7946 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -77,5 +77,16 @@ _mesa_init_sampler_object_functions(struct dd_function_table *driver);
extern void
_mesa_init_sampler_object_dispatch(struct _glapi_table *disp);
+extern void GLAPIENTRY
+_mesa_BindSampler(GLuint unit, GLuint sampler);
+
+extern void GLAPIENTRY
+_mesa_GenSamplers(GLsizei count, GLuint *samplers);
+
+extern void GLAPIENTRY
+_mesa_DeleteSamplers(GLsizei count, const GLuint *samplers);
+
+extern void GLAPIENTRY
+_mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param);
#endif /* SAMPLEROBJ_H */
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index e0494c940..529a6d449 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -145,7 +145,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */
- obj->Sampler.DepthMode = GL_LUMINANCE; /* ARB_depth_texture */
+ obj->DepthMode = GL_LUMINANCE;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
obj->Swizzle[1] = GL_GREEN;
@@ -259,7 +259,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
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->DepthMode = src->DepthMode;
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
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 1376219d7..9213499a4 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -383,14 +383,14 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->Extensions.ARB_depth_texture) {
- if (texObj->Sampler.DepthMode == params[0])
+ if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
params[0] == GL_INTENSITY ||
params[0] == GL_ALPHA ||
(ctx->Extensions.ARB_texture_rg && params[0] == GL_RED)) {
flush(ctx);
- texObj->Sampler.DepthMode = params[0];
+ texObj->DepthMode = params[0];
return GL_TRUE;
}
goto invalid_param;
@@ -1157,7 +1157,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
case GL_DEPTH_TEXTURE_MODE_ARB:
if (!ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
- *params = (GLfloat) obj->Sampler.DepthMode;
+ *params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
*params = obj->Sampler.LodBias;
@@ -1303,7 +1303,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
case GL_DEPTH_TEXTURE_MODE_ARB:
if (!ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
- *params = (GLint) obj->Sampler.DepthMode;
+ *params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
*params = (GLint) obj->Sampler.LodBias;
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 8ca9092ce..fa1fef27e 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -407,7 +407,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
- format = texObj->Sampler.DepthMode;
+ format = texObj->DepthMode;
}
calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
texUnit->_CurrentCombine = & texUnit->_EnvMode;
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 91ef2dff4..85e623142 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -170,12 +170,12 @@ compute_version(struct gl_context *ctx)
ctx->Extensions.ARB_explicit_attrib_location &&
ctx->Extensions.ARB_instanced_arrays &&
ctx->Extensions.ARB_occlusion_query2 &&
- ctx->Extensions.ARB_sampler_objects &&
ctx->Extensions.ARB_shader_bit_encoding &&
ctx->Extensions.ARB_texture_rgb10_a2ui &&
ctx->Extensions.ARB_timer_query &&
ctx->Extensions.ARB_vertex_type_2_10_10_10_rev &&
ctx->Extensions.EXT_texture_swizzle);
+ /* ARB_sampler_objects is always enabled in mesa */
if (ver_3_3) {
major = 3;