aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r--mesalib/src/mesa/main/api_validate.c5
-rw-r--r--mesalib/src/mesa/main/context.c38
-rw-r--r--mesalib/src/mesa/main/texgetimage.c9
-rw-r--r--mesalib/src/mesa/main/teximage.c2
-rw-r--r--mesalib/src/mesa/main/varray.c6
5 files changed, 49 insertions, 11 deletions
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 51a3d1f01..9b80600de 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -112,9 +112,8 @@ check_valid_to_render(struct gl_context *ctx, const char *function)
switch (ctx->API) {
case API_OPENGLES2:
- /* For ES2, we can draw if any vertex array is enabled (and we
- * should always have a vertex program/shader). */
- if (ctx->Array.VAO->_Enabled == 0x0 || !ctx->VertexProgram._Current)
+ /* For ES2, we can draw if we have a vertex program/shader). */
+ if (!ctx->VertexProgram._Current)
return GL_FALSE;
break;
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 0edd66d6f..5a8f7184a 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -891,10 +891,24 @@ _mesa_generic_nop(void)
/**
- * Allocate and initialize a new dispatch table.
+ * Special no-op glFlush, see below.
+ */
+#if defined(_WIN32)
+static void GLAPIENTRY
+nop_glFlush(void)
+{
+ /* don't record an error like we do in _mesa_generic_nop() */
+}
+#endif
+
+
+/**
+ * Allocate and initialize a new dispatch table. All the dispatch
+ * function pointers will point at the _mesa_generic_nop() function
+ * which raises GL_INVALID_OPERATION.
*/
struct _glapi_table *
-_mesa_alloc_dispatch_table()
+_mesa_alloc_dispatch_table(void)
{
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
* In practice, this'll be the same for stand-alone Mesa. But for DRI
@@ -911,6 +925,26 @@ _mesa_alloc_dispatch_table()
for (i = 0; i < numEntries; i++) {
entry[i] = (_glapi_proc) _mesa_generic_nop;
}
+
+#if defined(_WIN32)
+ /* This is a special case for Windows in the event that
+ * wglGetProcAddress is called between glBegin/End().
+ *
+ * The MS opengl32.dll library apparently calls glFlush from
+ * wglGetProcAddress(). If we're inside glBegin/End(), glFlush
+ * will dispatch to _mesa_generic_nop() and we'll generate a
+ * GL_INVALID_OPERATION error.
+ *
+ * The specific case which hits this is piglit's primitive-restart
+ * test which calls glPrimitiveRestartNV() inside glBegin/End. The
+ * first time we call glPrimitiveRestartNV() Piglit's API dispatch
+ * code will try to resolve the function by calling wglGetProcAddress.
+ * This raises GL_INVALID_OPERATION and an assert(glGetError()==0)
+ * will fail causing the test to fail. By suppressing the error, the
+ * assertion passes and the test continues.
+ */
+ SET_Flush(table, nop_glFlush);
+#endif
}
return table;
}
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 2c54e4a35..cb5f7936c 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -78,8 +78,8 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
struct gl_texture_image *texImage)
{
const GLint width = texImage->Width;
- const GLint height = texImage->Height;
- const GLint depth = texImage->Depth;
+ GLint height = texImage->Height;
+ GLint depth = texImage->Depth;
GLint img, row;
GLfloat *depthRow = malloc(width * sizeof(GLfloat));
@@ -88,6 +88,11 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
return;
}
+ if (texImage->TexObject->Target == GL_TEXTURE_1D_ARRAY) {
+ depth = height;
+ height = 1;
+ }
+
for (img = 0; img < depth; img++) {
GLubyte *srcMap;
GLint srcRowStride;
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 647d28ab3..c0298af8e 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -2449,7 +2449,7 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
/* level check */
if (level < 0 || level >= _mesa_max_texture_levels(ctx, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%uD(level=%d)",
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTexSubImage%uD(level=%d)",
dimensions, level);
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 09bf52c42..96c2b26f7 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -1907,10 +1907,10 @@ static void
print_array(const char *name, GLint index, const struct gl_client_array *array)
{
if (index >= 0)
- printf(" %s[%d]: ", name, index);
+ fprintf(stderr, " %s[%d]: ", name, index);
else
- printf(" %s: ", name);
- printf("Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu)\n",
+ fprintf(stderr, " %s: ", name);
+ fprintf(stderr, "Ptr=%p, Type=0x%x, Size=%d, ElemSize=%u, Stride=%d, Buffer=%u(Size %lu)\n",
array->Ptr, array->Type, array->Size,
array->_ElementSize, array->StrideB,
array->BufferObj->Name, (unsigned long) array->BufferObj->Size);