aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-09 15:52:33 +0200
committermarha <marha@users.sourceforge.net>2012-05-09 15:52:33 +0200
commit8a448108ec0bc3a0a488b2234e0d12aee503c67c (patch)
tree22e71069622608062b2f5eab3ef485438cd32122 /mesalib/src/mesa/main
parent62068b3bc534d504e40df34847b4436f1a496f35 (diff)
downloadvcxsrv-8a448108ec0bc3a0a488b2234e0d12aee503c67c.tar.gz
vcxsrv-8a448108ec0bc3a0a488b2234e0d12aee503c67c.tar.bz2
vcxsrv-8a448108ec0bc3a0a488b2234e0d12aee503c67c.zip
libX11 mesa xserver xkeyboard-config
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/api_arrayelt.c10
-rw-r--r--mesalib/src/mesa/main/context.c2
-rw-r--r--mesalib/src/mesa/main/dlist.c32
-rw-r--r--mesalib/src/mesa/main/extensions.c2
-rw-r--r--mesalib/src/mesa/main/fbobject.c14
-rw-r--r--mesalib/src/mesa/main/mtypes.h19
-rw-r--r--mesalib/src/mesa/main/teximage.c32
7 files changed, 92 insertions, 19 deletions
diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c
index 7bf55f319..6de6de2b7 100644
--- a/mesalib/src/mesa/main/api_arrayelt.c
+++ b/mesalib/src/mesa/main/api_arrayelt.c
@@ -1643,12 +1643,20 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt )
const struct _glapi_table * const disp = GET_DISPATCH();
GLboolean do_map;
+ /* If PrimitiveRestart is enabled and the index is the RestartIndex
+ * then we call PrimitiveRestartNV and return.
+ */
+ if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) {
+ CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ());
+ return;
+ }
+
if (actx->NewState) {
assert(!actx->mapped_vbos);
_ae_update_state( ctx );
}
- /* Determine if w need to map/unmap VBOs */
+ /* Determine if we need to map/unmap VBOs */
do_map = actx->nr_vbos && !actx->mapped_vbos;
if (do_map)
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index d75351c85..7e2ac98b9 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -792,6 +792,7 @@ init_attrib_groups(struct gl_context *ctx)
/* Miscellaneous */
ctx->NewState = _NEW_ALL;
+ ctx->NewDriverState = ~0;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
ctx->ResetStatus = (GLenum) GL_NO_ERROR;
ctx->varying_vp_inputs = VERT_BIT_ALL;
@@ -1290,6 +1291,7 @@ _mesa_copy_context( const struct gl_context *src, struct gl_context *dst,
/* XXX FIXME: Call callbacks?
*/
dst->NewState = _NEW_ALL;
+ dst->NewDriverState = ~0;
}
#endif
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 8cfb97c26..c1c65ea25 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -134,7 +134,7 @@ do { \
do { \
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
- _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
return retval; \
} \
} while (0)
@@ -149,7 +149,7 @@ do { \
do { \
if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON || \
ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
- _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" ); \
+ _mesa_compile_error( ctx, GL_INVALID_OPERATION, "glBegin/End" ); \
return; \
} \
} while (0)
@@ -5673,17 +5673,25 @@ save_Indexfv(const GLfloat * v)
static void GLAPIENTRY
save_EdgeFlag(GLboolean x)
{
- save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? (GLfloat)1.0 : (GLfloat)0.0);
+ save_Attr1fNV(VERT_ATTRIB_EDGEFLAG, x ? 1.0f : 0.0f);
}
-static inline GLboolean compare4fv( const GLfloat *a,
- const GLfloat *b,
- GLuint count )
+
+/**
+ * Compare 'count' elements of vectors 'a' and 'b'.
+ * \return GL_TRUE if equal, GL_FALSE if different.
+ */
+static inline GLboolean
+compare_vec(const GLfloat *a, const GLfloat *b, GLuint count)
{
return memcmp( a, b, count * sizeof(GLfloat) ) == 0;
}
-
+
+/**
+ * This glMaterial function is used for glMaterial calls that are outside
+ * a glBegin/End pair. For glMaterial inside glBegin/End, see the VBO code.
+ */
static void GLAPIENTRY
save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
{
@@ -5698,7 +5706,7 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
case GL_FRONT_AND_BACK:
break;
default:
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(face)");
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(face)");
return;
}
@@ -5717,7 +5725,7 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
args = 3;
break;
default:
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "material(pname)");
+ _mesa_compile_error(ctx, GL_INVALID_ENUM, "glMaterial(pname)");
return;
}
@@ -5734,7 +5742,8 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
if (bitmask & (1 << i)) {
if (ctx->ListState.ActiveMaterialSize[i] == args &&
- compare4fv(ctx->ListState.CurrentMaterial[i], param, args)) {
+ compare_vec(ctx->ListState.CurrentMaterial[i], param, args)) {
+ /* no change in material value */
bitmask &= ~(1 << i);
}
else {
@@ -5744,8 +5753,7 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param)
}
}
- /* If this call has effect, return early:
- */
+ /* If this call has no effect, return early */
if (bitmask == 0)
return;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 5f2c74a75..a843a4092 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -754,7 +754,7 @@ get_extension_override( struct gl_context *ctx )
/* Remove trailing space. */
len = strlen(extra_exts);
- if (extra_exts[len - 1] == ' ')
+ if (len > 0 && extra_exts[len - 1] == ' ')
extra_exts[len - 1] = '\0';
return extra_exts;
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 26ae1087c..f56369483 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -2023,7 +2023,11 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
_glthread_LOCK_MUTEX(fb->Mutex);
if (texObj) {
if (attachment == GL_DEPTH_ATTACHMENT &&
- texObj == fb->Attachment[BUFFER_STENCIL].Texture) {
+ texObj == fb->Attachment[BUFFER_STENCIL].Texture &&
+ level == fb->Attachment[BUFFER_STENCIL].TextureLevel &&
+ _mesa_tex_target_to_face(textarget) ==
+ fb->Attachment[BUFFER_STENCIL].CubeMapFace &&
+ zoffset == fb->Attachment[BUFFER_STENCIL].Zoffset) {
/* The texture object is already attached to the stencil attachment
* point. Don't create a new renderbuffer; just reuse the stencil
* attachment's. This is required to prevent a GL error in
@@ -2032,8 +2036,12 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
reuse_framebuffer_texture_attachment(fb, BUFFER_DEPTH,
BUFFER_STENCIL);
} else if (attachment == GL_STENCIL_ATTACHMENT &&
- texObj == fb->Attachment[BUFFER_DEPTH].Texture) {
- /* As above, but with depth and stencil juxtaposed. */
+ texObj == fb->Attachment[BUFFER_DEPTH].Texture &&
+ level == fb->Attachment[BUFFER_DEPTH].TextureLevel &&
+ _mesa_tex_target_to_face(textarget) ==
+ fb->Attachment[BUFFER_DEPTH].CubeMapFace &&
+ zoffset == fb->Attachment[BUFFER_DEPTH].Zoffset) {
+ /* As above, but with depth and stencil transposed. */
reuse_framebuffer_texture_attachment(fb, BUFFER_STENCIL,
BUFFER_DEPTH);
} else {
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 2b709ded6..06ca0d5df 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1636,6 +1636,11 @@ struct gl_array_attrib
/* GL_ARB_vertex_buffer_object */
struct gl_buffer_object *ArrayBufferObj;
+
+ /**
+ * Vertex arrays as consumed by a driver.
+ * The array pointer is set up only by the VBO module. */
+ const struct gl_client_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */
};
@@ -3252,6 +3257,17 @@ typedef enum
API_OPENGLES2
} gl_api;
+/**
+ * Driver-specific state flags.
+ *
+ * These are or'd with gl_context::NewDriverState to notify a driver about
+ * a state change. The driver sets the flags at context creation and
+ * the meaning of the bits set is opaque to core Mesa.
+ */
+struct gl_driver_flags
+{
+ GLbitfield NewArray; /**< Vertex array state */
+};
/**
* Mesa rendering context.
@@ -3411,6 +3427,9 @@ struct gl_context
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
+ GLbitfield NewDriverState;/**< bitwise-or of flags from DriverFlags */
+
+ struct gl_driver_flags DriverFlags;
GLboolean ViewportInitialized; /**< has viewport size been initialized? */
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 50095d2c6..694f6fa00 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -531,6 +531,32 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
/**
+ * Is the given texture format a generic compressed format?
+ */
+static GLboolean
+is_generic_compressed_format(GLenum format)
+{
+ switch (format) {
+ case GL_COMPRESSED_RED:
+ case GL_COMPRESSED_RG:
+ case GL_COMPRESSED_RGB:
+ case GL_COMPRESSED_RGBA:
+ case GL_COMPRESSED_ALPHA:
+ case GL_COMPRESSED_LUMINANCE:
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
+ case GL_COMPRESSED_INTENSITY:
+ case GL_COMPRESSED_SRGB:
+ case GL_COMPRESSED_SRGB_ALPHA:
+ case GL_COMPRESSED_SLUMINANCE:
+ case GL_COMPRESSED_SLUMINANCE_ALPHA:
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
+
+/**
* For cube map faces, return a face index in [0,5].
* For other targets return 0;
*/
@@ -1705,7 +1731,8 @@ texture_error_check( struct gl_context *ctx,
}
/* additional checks for compressed textures */
- if (_mesa_is_compressed_format(ctx, internalFormat)) {
+ if (_mesa_is_compressed_format(ctx, internalFormat) ||
+ is_generic_compressed_format(internalFormat)) {
if (!target_can_be_compressed(ctx, target, internalFormat)) {
if (!isProxy)
_mesa_error(ctx, GL_INVALID_ENUM,
@@ -2036,7 +2063,8 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
- if (_mesa_is_compressed_format(ctx, internalFormat)) {
+ if (_mesa_is_compressed_format(ctx, internalFormat) ||
+ is_generic_compressed_format(internalFormat)) {
if (!target_can_be_compressed(ctx, target, internalFormat)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glCopyTexImage%dD(target)", dimensions);