aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-13 10:09:30 +0200
committermarha <marha@users.sourceforge.net>2012-08-13 10:09:30 +0200
commit9ddf44af81782451cee798e06749ce3067a14a41 (patch)
treef84b06f6897929113f080d8e505621fa6bf73fb9 /mesalib/src/mesa/main
parentf8e35ebbe71eed74ccf68af8ccda4182f1edc7f0 (diff)
downloadvcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.tar.gz
vcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.tar.bz2
vcxsrv-9ddf44af81782451cee798e06749ce3067a14a41.zip
mesa pixman xkeyboard-config xserver git update 13 Aug 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/attrib.c13
-rw-r--r--mesalib/src/mesa/main/bufferobj.c44
-rw-r--r--mesalib/src/mesa/main/condrender.c2
-rw-r--r--mesalib/src/mesa/main/context.c26
-rw-r--r--mesalib/src/mesa/main/dd.h9
-rw-r--r--mesalib/src/mesa/main/dlist.c27
-rw-r--r--mesalib/src/mesa/main/enable.c4
-rw-r--r--mesalib/src/mesa/main/fbobject.c8
-rw-r--r--mesalib/src/mesa/main/get.c13
-rw-r--r--mesalib/src/mesa/main/glformats.c8
-rw-r--r--mesalib/src/mesa/main/mipmap.c3
-rw-r--r--mesalib/src/mesa/main/mtypes.h4
-rw-r--r--mesalib/src/mesa/main/samplerobj.h4
-rw-r--r--mesalib/src/mesa/main/texformat.c4
-rw-r--r--mesalib/src/mesa/main/teximage.c28
-rw-r--r--mesalib/src/mesa/main/texobj.c3
-rw-r--r--mesalib/src/mesa/main/texparam.c2
-rw-r--r--mesalib/src/mesa/main/texstore.c17
-rw-r--r--mesalib/src/mesa/main/texstore.h5
-rw-r--r--mesalib/src/mesa/main/varray.c5
-rw-r--r--mesalib/src/mesa/main/version.c29
21 files changed, 153 insertions, 105 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 8bc7c348f..9cab35b0c 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -135,6 +135,9 @@ struct gl_enable_attrib
/* GL_ARB_point_sprite / GL_NV_point_sprite */
GLboolean PointSprite;
GLboolean FragmentShaderATI;
+
+ /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
+ GLboolean sRGBEnabled;
};
@@ -322,6 +325,9 @@ _mesa_PushAttrib(GLbitfield mask)
attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled;
attr->VertexProgramTwoSide = ctx->VertexProgram.TwoSideEnabled;
save_attrib_data(&head, GL_ENABLE_BIT, attr);
+
+ /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
+ attr->sRGBEnabled = ctx->Color.sRGBEnabled;
}
if (mask & GL_EVAL_BIT) {
@@ -617,6 +623,10 @@ pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable)
enable->VertexProgramTwoSide,
GL_VERTEX_PROGRAM_TWO_SIDE_ARB);
+ /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
+ TEST_AND_UPDATE(ctx->Color.sRGBEnabled, enable->sRGBEnabled,
+ GL_FRAMEBUFFER_SRGB);
+
/* texture unit enables */
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
const GLbitfield enabled = enable->Texture[i];
@@ -981,6 +991,9 @@ _mesa_PopAttrib(void)
_mesa_set_enable(ctx, GL_DITHER, color->DitherFlag);
_mesa_ClampColorARB(GL_CLAMP_FRAGMENT_COLOR_ARB, color->ClampFragmentColor);
_mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
+
+ /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
}
break;
case GL_CURRENT_BIT:
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 48edd89c9..22d7927bb 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -656,6 +656,28 @@ _mesa_free_buffer_objects( struct gl_context *ctx )
ctx->UniformBufferBindings = NULL;
}
+static void
+handle_bind_buffer_gen(struct gl_context *ctx,
+ GLenum target,
+ GLuint buffer,
+ struct gl_buffer_object **buf_handle)
+{
+ struct gl_buffer_object *buf = *buf_handle;
+
+ if (!buf || buf == &DummyBufferObject) {
+ /* If this is a new buffer object id, or one which was generated but
+ * never used before, allocate a buffer object now.
+ */
+ ASSERT(ctx->Driver.NewBufferObject);
+ buf = ctx->Driver.NewBufferObject(ctx, buffer, target);
+ if (!buf) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
+ return;
+ }
+ _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, buf);
+ *buf_handle = buf;
+ }
+}
/**
* Bind the specified target to buffer for the specified context.
@@ -691,18 +713,7 @@ bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
else {
/* non-default buffer object */
newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!newBufObj || newBufObj == &DummyBufferObject) {
- /* If this is a new buffer object id, or one which was generated but
- * never used before, allocate a buffer object now.
- */
- ASSERT(ctx->Driver.NewBufferObject);
- newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
- if (!newBufObj) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
- return;
- }
- _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj);
- }
+ handle_bind_buffer_gen(ctx, target, buffer, &newBufObj);
}
/* bind new buffer */
@@ -875,6 +886,13 @@ _mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
}
}
+ /* unbind UBO binding points */
+ for (j = 0; j < ctx->Const.MaxUniformBufferBindings; j++) {
+ if (ctx->UniformBufferBindings[j].BufferObject == bufObj) {
+ _mesa_BindBufferBase( GL_UNIFORM_BUFFER, j, 0 );
+ }
+ }
+
if (ctx->UniformBuffer == bufObj) {
_mesa_BindBufferARB( GL_UNIFORM_BUFFER, 0 );
}
@@ -2089,6 +2107,7 @@ _mesa_BindBufferRange(GLenum target, GLuint index,
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
+ handle_bind_buffer_gen(ctx, target, buffer, &bufObj);
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
@@ -2134,6 +2153,7 @@ _mesa_BindBufferBase(GLenum target, GLuint index, GLuint buffer)
} else {
bufObj = _mesa_lookup_bufferobj(ctx, buffer);
}
+ handle_bind_buffer_gen(ctx, target, buffer, &bufObj);
if (!bufObj) {
_mesa_error(ctx, GL_INVALID_OPERATION,
diff --git a/mesalib/src/mesa/main/condrender.c b/mesalib/src/mesa/main/condrender.c
index 57f371521..bfd2b0818 100644
--- a/mesalib/src/mesa/main/condrender.c
+++ b/mesalib/src/mesa/main/condrender.c
@@ -139,6 +139,8 @@ _mesa_check_conditional_render(struct gl_context *ctx)
case GL_QUERY_BY_REGION_NO_WAIT:
/* fall-through */
case GL_QUERY_NO_WAIT:
+ if (!q->Ready)
+ ctx->Driver.CheckQuery(ctx, q);
return q->Ready ? (q->Result > 0) : GL_TRUE;
default:
_mesa_problem(ctx, "Bad cond render mode %s in "
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 7616eb78b..b78bceeb9 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -476,7 +476,8 @@ _mesa_init_current(struct gl_context *ctx)
* Important: drivers should override these with actual limits.
*/
static void
-init_program_limits(GLenum type, struct gl_program_constants *prog)
+init_program_limits(struct gl_context *ctx, GLenum type,
+ struct gl_program_constants *prog)
{
prog->MaxInstructions = MAX_PROGRAM_INSTRUCTIONS;
prog->MaxAluInstructions = MAX_PROGRAM_INSTRUCTIONS;
@@ -542,7 +543,9 @@ init_program_limits(GLenum type, struct gl_program_constants *prog)
prog->LowInt = prog->HighInt = prog->MediumInt;
prog->MaxUniformBlocks = 12;
- prog->MaxCombinedUniformComponents = prog->MaxUniformComponents;
+ prog->MaxCombinedUniformComponents = (prog->MaxUniformComponents +
+ ctx->Const.MaxUniformBlockSize / 4 *
+ prog->MaxUniformBlocks);
}
@@ -589,14 +592,21 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxSpotExponent = 128.0;
ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH;
ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT;
+
+ /** GL_ARB_uniform_buffer_object */
+ ctx->Const.MaxCombinedUniformBlocks = 36;
+ ctx->Const.MaxUniformBufferBindings = 36;
+ ctx->Const.MaxUniformBlockSize = 16384;
+ ctx->Const.UniformBufferOffsetAlignment = 1;
+
#if FEATURE_ARB_vertex_program
- init_program_limits(GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram);
+ init_program_limits(ctx, GL_VERTEX_PROGRAM_ARB, &ctx->Const.VertexProgram);
#endif
#if FEATURE_ARB_fragment_program
- init_program_limits(GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram);
+ init_program_limits(ctx, GL_FRAGMENT_PROGRAM_ARB, &ctx->Const.FragmentProgram);
#endif
#if FEATURE_ARB_geometry_shader4
- init_program_limits(MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram);
+ init_program_limits(ctx, MESA_GEOMETRY_PROGRAM, &ctx->Const.GeometryProgram);
#endif
ctx->Const.MaxProgramMatrices = MAX_PROGRAM_MATRICES;
ctx->Const.MaxProgramMatrixStackDepth = MAX_PROGRAM_MATRIX_STACK_DEPTH;
@@ -655,12 +665,6 @@ _mesa_init_constants(struct gl_context *ctx)
ctx->Const.MaxTransformFeedbackInterleavedComponents = 4 * MAX_FEEDBACK_ATTRIBS;
ctx->Const.MaxVertexStreams = 1;
- /** GL_ARB_uniform_buffer_object */
- ctx->Const.MaxCombinedUniformBlocks = 36;
- ctx->Const.MaxUniformBufferBindings = 36;
- ctx->Const.MaxUniformBlockSize = 16384;
- ctx->Const.UniformBufferOffsetAlignment = 1;
-
/* GL 3.2: hard-coded for now: */
ctx->Const.ProfileMask = GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index e60d019bb..226897b19 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -208,8 +208,6 @@ struct dd_function_table {
*/
void (*TexImage)(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
@@ -273,9 +271,6 @@ struct dd_function_table {
*/
void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLsizei width, GLsizei height, GLsizei depth,
- GLint border,
GLsizei imageSize, const GLvoid *data);
/**
@@ -329,9 +324,7 @@ struct dd_function_table {
/** Called to allocate memory for a single texture image */
GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx,
- struct gl_texture_image *texImage,
- gl_format format, GLsizei width,
- GLsizei height, GLsizei depth);
+ struct gl_texture_image *texImage);
/** Free the memory for a single texture image */
void (*FreeTextureImageBuffer)(struct gl_context *ctx,
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 510fd1e18..5a813e98a 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -482,6 +482,9 @@ typedef enum
OPCODE_DRAW_TRANSFORM_FEEDBACK_INSTANCED,
OPCODE_DRAW_TRANSFORM_FEEDBACK_STREAM_INSTANCED,
+ /* ARB_uniform_buffer_object */
+ OPCODE_UNIFORM_BLOCK_BINDING,
+
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -7582,6 +7585,23 @@ save_EndConditionalRender(void)
}
}
+static void GLAPIENTRY
+save_UniformBlockBinding(GLuint prog, GLuint index, GLuint binding)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_UNIFORM_BLOCK_BINDING, 3);
+ if (n) {
+ n[1].ui = prog;
+ n[2].ui = index;
+ n[3].ui = binding;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_UniformBlockBinding(ctx->Exec, (prog, index, binding));
+ }
+}
+
/**
* Save an error-generating command into display list.
@@ -8877,6 +8897,10 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_EndConditionalRenderNV(ctx->Exec, ());
break;
+ case OPCODE_UNIFORM_BLOCK_BINDING:
+ CALL_UniformBlockBinding(ctx->Exec, (n[1].ui, n[2].ui, n[3].ui));
+ break;
+
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
break;
@@ -10632,6 +10656,9 @@ _mesa_create_save_table(void)
/* GL_ARB_debug_output (no dlist support) */
_mesa_init_errors_dispatch(table);
+ /* GL_ARB_uniform_buffer_object */
+ SET_UniformBlockBinding(table, save_UniformBlockBinding);
+
/* GL_NV_primitive_restart */
SET_PrimitiveRestartIndexNV(table, _mesa_PrimitiveRestartIndex);
diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c
index c811f2a9c..f8110578a 100644
--- a/mesalib/src/mesa/main/enable.c
+++ b/mesalib/src/mesa/main/enable.c
@@ -902,7 +902,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
* GL_PRIMITIVE_RESTART_NV (which is client state).
*/
case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ if (ctx->Version < 31) {
goto invalid_enum_error;
}
if (ctx->Array.PrimitiveRestart != state) {
@@ -1419,7 +1419,7 @@ _mesa_IsEnabled( GLenum cap )
/* GL 3.1 primitive restart */
case GL_PRIMITIVE_RESTART:
- if (ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ if (ctx->Version < 31) {
goto invalid_enum_error;
}
return ctx->Array.PrimitiveRestart;
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index eb03b0918..d558d7f87 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -1226,7 +1226,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGBA8I_EXT:
case GL_RGBA16I_EXT:
case GL_RGBA32I_EXT:
- return ctx->VersionMajor >= 3 ||
+ return ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer ? GL_RGBA : 0;
case GL_RGB8UI_EXT:
@@ -1235,7 +1235,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
- return ctx->VersionMajor >= 3 ||
+ return ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer ? GL_RGB : 0;
case GL_R8UI:
@@ -1244,7 +1244,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_R16I:
case GL_R32UI:
case GL_R32I:
- return ctx->VersionMajor >= 3 ||
+ return ctx->Version >= 30 ||
(ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer) ? GL_RED : 0;
@@ -1254,7 +1254,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
case GL_RG16I:
case GL_RG32UI:
case GL_RG32I:
- return ctx->VersionMajor >= 3 ||
+ return ctx->Version >= 30 ||
(ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c
index 16ad2c430..332dfaf7f 100644
--- a/mesalib/src/mesa/main/get.c
+++ b/mesalib/src/mesa/main/get.c
@@ -1303,8 +1303,8 @@ static const struct value_desc values[] = {
/* GL 3.0 */
{ GL_NUM_EXTENSIONS, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
- { GL_MAJOR_VERSION, CONTEXT_INT(VersionMajor), extra_version_30 },
- { GL_MINOR_VERSION, CONTEXT_INT(VersionMinor), extra_version_30 },
+ { GL_MAJOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
+ { GL_MINOR_VERSION, LOC_CUSTOM, TYPE_INT, 0, extra_version_30 },
{ GL_CONTEXT_FLAGS, CONTEXT_INT(Const.ContextFlags), extra_version_30 },
/* GL3.0 / GL_EXT_framebuffer_sRGB */
@@ -1486,6 +1486,13 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
GLuint unit, *p;
switch (d->pname) {
+ case GL_MAJOR_VERSION:
+ v->value_int = ctx->Version / 10;
+ break;
+ case GL_MINOR_VERSION:
+ v->value_int = ctx->Version % 10;
+ break;
+
case GL_TEXTURE_1D:
case GL_TEXTURE_2D:
case GL_TEXTURE_3D:
@@ -1848,7 +1855,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
static GLboolean
check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d)
{
- const GLuint version = ctx->VersionMajor * 10 + ctx->VersionMinor;
+ const GLuint version = ctx->Version;
int total, enabled;
const int *e;
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index 4fe0ae078..daf1b7667 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -1237,7 +1237,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->VersionMajor >= 3 ||
+ return (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
@@ -1252,7 +1252,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->VersionMajor >= 3 ||
+ return (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_BYTE_3_3_2:
@@ -1274,7 +1274,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_INT:
case GL_UNSIGNED_INT:
/* NOTE: no packed formats w/ BGR format */
- return (ctx->VersionMajor >= 3 ||
+ return (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
default:
@@ -1290,7 +1290,7 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
case GL_UNSIGNED_SHORT:
case GL_INT:
case GL_UNSIGNED_INT:
- return (ctx->VersionMajor >= 3 ||
+ return (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer)
? GL_NO_ERROR : GL_INVALID_ENUM;
case GL_UNSIGNED_SHORT_4_4_4_4:
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 9f531ae20..00d3e8f9e 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -1865,8 +1865,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
width, height, depth,
border, intFormat, format);
- ctx->Driver.AllocTextureImageBuffer(ctx, dstImage,
- format, width, height, depth);
+ ctx->Driver.AllocTextureImageBuffer(ctx, dstImage);
/* in case the mipmap level is part of an FBO: */
_mesa_update_fbo_texture(ctx, texObj, face, level);
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index e8adac99d..8fcb6b456 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -3424,8 +3424,8 @@ struct gl_context
/** Extension information */
struct gl_extensions Extensions;
- /** Version info */
- GLuint VersionMajor, VersionMinor;
+ /** GL version integer, for example 31 for GL 3.1, or 20 for GLES 2.0. */
+ GLuint Version;
char *VersionString;
/** \name State attribute stack (for glPush/PopAttrib) */
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index 2b0cd7946..e70ee4881 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -33,8 +33,10 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
{
if (ctx->Texture.Unit[unit].Sampler)
return ctx->Texture.Unit[unit].Sampler;
- else
+ else if (ctx->Texture.Unit[unit]._Current)
return &ctx->Texture.Unit[unit]._Current->Sampler;
+ else
+ return NULL;
}
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index d360f0e22..275e69e31 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -719,7 +719,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
}
}
- if (ctx->VersionMajor >= 3 ||
+ if (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
case GL_RGB8UI_EXT:
@@ -838,7 +838,7 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
}
}
- if (ctx->VersionMajor >= 3 ||
+ if (ctx->Version >= 30 ||
(ctx->Extensions.ARB_texture_rg &&
ctx->Extensions.EXT_texture_integer)) {
switch (internalFormat) {
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index d2746c6f3..569adc16a 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -332,7 +332,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
#endif /* FEATURE_EXT_texture_sRGB */
- if (ctx->VersionMajor >= 3 ||
+ if (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
case GL_RGBA8UI_EXT:
@@ -406,7 +406,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_R16UI:
case GL_R32I:
case GL_R32UI:
- if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
+ if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_R8:
@@ -431,7 +431,7 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
case GL_RG16UI:
case GL_RG32I:
case GL_RG32UI:
- if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_texture_integer)
+ if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_integer)
break;
/* FALLTHROUGH */
case GL_RG:
@@ -1732,7 +1732,7 @@ texture_error_check( struct gl_context *ctx,
target != GL_TEXTURE_RECTANGLE_ARB &&
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
- (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4))) {
+ (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) {
if (!isProxy)
_mesa_error(ctx, GL_INVALID_ENUM,
"glTexImage(target/internalFormat)");
@@ -1764,7 +1764,7 @@ texture_error_check( struct gl_context *ctx,
}
/* additional checks for integer textures */
- if ((ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) &&
+ if ((ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) &&
(_mesa_is_enum_format_integer(format) !=
_mesa_is_enum_format_integer(internalFormat))) {
if (!isProxy) {
@@ -1937,7 +1937,7 @@ subtexture_error_check2( struct gl_context *ctx, GLuint dimensions,
}
}
- if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_texture_integer) {
+ if (ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) {
/* both source and dest must be integer-valued, or neither */
if (_mesa_is_format_integer_color(destTex->TexFormat) !=
_mesa_is_enum_format_integer(format)) {
@@ -2616,8 +2616,7 @@ teximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Give the texture to the driver. <pixels> may be null. */
- ctx->Driver.TexImage(ctx, dims, texImage, internalFormat,
- width, height, depth, border, format,
+ ctx->Driver.TexImage(ctx, dims, texImage, format,
type, pixels, unpack);
check_gen_mipmap(ctx, target, texObj, level);
@@ -2945,8 +2944,8 @@ copyteximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Allocate texture memory (no pixel data yet) */
- ctx->Driver.TexImage(ctx, dims, texImage, internalFormat,
- width, height, 1, border, GL_NONE, GL_NONE,
+ ctx->Driver.TexImage(ctx, dims, texImage,
+ GL_NONE, GL_NONE,
NULL, &ctx->Unpack);
if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
@@ -3551,10 +3550,8 @@ compressedteximage(struct gl_context *ctx, GLuint dims,
width, height, depth,
border, internalFormat, texFormat);
- ctx->Driver.CompressedTexImage(ctx, dims, texImage,
- internalFormat,
- width, height, depth,
- border, imageSize, data);
+ ctx->Driver.CompressedTexImage(ctx, dims, texImage, imageSize,
+ data);
check_gen_mipmap(ctx, target, texObj, level);
@@ -3860,8 +3857,7 @@ validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat)
* any mention of R/RG formats, but they appear in the GL 3.1 core
* specification.
*/
- if (ctx->VersionMajor < 3 ||
- (ctx->VersionMajor == 3 && ctx->VersionMinor == 0)) {
+ if (ctx->Version <= 30) {
GLenum base_format = _mesa_get_format_base_format(format);
if (base_format == GL_R || base_format == GL_RG)
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 529a6d449..f70da4fbc 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -807,8 +807,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
0, /* border */
GL_RGBA, texFormat);
- ctx->Driver.TexImage(ctx, dims, texImage, GL_RGBA,
- width, height, depth, 0,
+ ctx->Driver.TexImage(ctx, dims, texImage,
GL_RGBA, GL_UNSIGNED_BYTE, texel,
&ctx->DefaultPacking);
}
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 9213499a4..9e7c3e457 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -1016,7 +1016,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
*params = _mesa_get_format_bits(texFormat, pname);
break;
case GL_TEXTURE_SHARED_SIZE:
- if (ctx->VersionMajor < 3 &&
+ if (ctx->Version < 30 &&
!ctx->Extensions.EXT_texture_shared_exponent)
goto invalid_pname;
*params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0;
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index ab9fdf26d..544c08d73 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -4336,25 +4336,22 @@ void
_mesa_store_teximage(struct gl_context *ctx,
GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing)
{
assert(dims == 1 || dims == 2 || dims == 3);
- if (width == 0 || height == 0 || depth == 0)
+ if (texImage->Width == 0 || texImage->Height == 0 || texImage->Depth == 0)
return;
/* allocate storage for texture data */
- if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
- width, height, depth)) {
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
return;
}
store_texsubimage(ctx, texImage,
- 0, 0, 0, width, height, depth,
+ 0, 0, 0, texImage->Width, texImage->Height, texImage->Depth,
format, type, pixels, packing, "glTexImage");
}
@@ -4382,9 +4379,6 @@ _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
void
_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
GLsizei imageSize, const GLvoid *data)
{
/* only 2D compressed images are supported at this time */
@@ -4403,15 +4397,14 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
ASSERT(texImage->Depth == 1);
/* allocate storage for texture data */
- if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage, texImage->TexFormat,
- width, height, 1)) {
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;
}
_mesa_store_compressed_texsubimage(ctx, dims, texImage,
0, 0, 0,
- width, height, depth,
+ texImage->Width, texImage->Height, texImage->Depth,
texImage->TexFormat,
imageSize, data);
}
diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h
index 5a1c01423..7af532d65 100644
--- a/mesalib/src/mesa/main/texstore.h
+++ b/mesalib/src/mesa/main/texstore.h
@@ -93,8 +93,6 @@ extern void
_mesa_store_teximage(struct gl_context *ctx,
GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLint width, GLint height, GLint depth, GLint border,
GLenum format, GLenum type, const GLvoid *pixels,
const struct gl_pixelstore_attrib *packing);
@@ -111,9 +109,6 @@ _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims,
extern void
_mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *texImage,
- GLint internalFormat,
- GLint width, GLint height, GLint depth,
- GLint border,
GLsizei imageSize, const GLvoid *data);
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 7ec7cfee6..327fabbc1 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -568,7 +568,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname,
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
return array->BufferObj->Name;
case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- if (ctx->VersionMajor >= 3 || ctx->Extensions.EXT_gpu_shader4) {
+ if (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4) {
return array->Integer;
}
goto error;
@@ -1092,8 +1092,7 @@ _mesa_PrimitiveRestartIndex(GLuint index)
{
GET_CURRENT_CONTEXT(ctx);
- if (!ctx->Extensions.NV_primitive_restart &&
- ctx->VersionMajor * 10 + ctx->VersionMinor < 31) {
+ if (!ctx->Extensions.NV_primitive_restart && ctx->Version < 31) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glPrimitiveRestartIndexNV()");
return;
}
diff --git a/mesalib/src/mesa/main/version.c b/mesalib/src/mesa/main/version.c
index 85e623142..59c81aedc 100644
--- a/mesalib/src/mesa/main/version.c
+++ b/mesalib/src/mesa/main/version.c
@@ -33,22 +33,25 @@
* are point-separated version numbers, such as "3.0".
*/
static void
-override_version(struct gl_context *ctx, GLuint *major, GLuint *minor)
+override_version(struct gl_context *ctx)
{
const char *env_var = "MESA_GL_VERSION_OVERRIDE";
const char *version;
int n;
+ int major, minor;
version = getenv(env_var);
if (!version) {
return;
}
- n = sscanf(version, "%u.%u", major, minor);
+ n = sscanf(version, "%u.%u", &major, &minor);
if (n != 2) {
fprintf(stderr, "error: invalid value for %s: %s\n", env_var, version);
return;
}
+
+ ctx->Version = major * 10 + minor;
}
/**
@@ -218,10 +221,9 @@ compute_version(struct gl_context *ctx)
minor = 2;
}
- ctx->VersionMajor = major;
- ctx->VersionMinor = minor;
+ ctx->Version = major * 10 + minor;
- override_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
+ override_version(ctx);
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
@@ -231,7 +233,7 @@ compute_version(struct gl_context *ctx)
" (" MESA_GIT_SHA1 ")"
#endif
,
- ctx->VersionMajor, ctx->VersionMinor);
+ ctx->Version / 10, ctx->Version % 10);
}
}
@@ -248,11 +250,9 @@ compute_version_es1(struct gl_context *ctx)
ctx->Extensions.EXT_point_parameters);
if (ver_1_1) {
- ctx->VersionMajor = 1;
- ctx->VersionMinor = 1;
+ ctx->Version = 11;
} else if (ver_1_0) {
- ctx->VersionMajor = 1;
- ctx->VersionMinor = 0;
+ ctx->Version = 10;
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
}
@@ -265,7 +265,7 @@ compute_version_es1(struct gl_context *ctx)
" (" MESA_GIT_SHA1 ")"
#endif
,
- ctx->VersionMinor);
+ ctx->Version % 10);
}
}
@@ -285,8 +285,7 @@ compute_version_es2(struct gl_context *ctx)
ctx->Extensions.ARB_texture_non_power_of_two &&
ctx->Extensions.EXT_blend_equation_separate);
if (ver_2_0) {
- ctx->VersionMajor = 2;
- ctx->VersionMinor = 0;
+ ctx->Version = 20;
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
}
@@ -303,14 +302,14 @@ compute_version_es2(struct gl_context *ctx)
}
/**
- * Set the context's VersionMajor, VersionMinor, VersionString fields.
+ * Set the context's Version and VersionString fields.
* This should only be called once as part of context initialization
* or to perform version check for GLX_ARB_create_context_profile.
*/
void
_mesa_compute_version(struct gl_context *ctx)
{
- if (ctx->VersionMajor)
+ if (ctx->Version)
return;
switch (ctx->API) {