aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/clear.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-11-09 17:05:56 +0100
committermarha <marha@users.sourceforge.net>2011-11-09 17:05:56 +0100
commit72d7f8d5af476f12dc75eab4fa9d59364cbec190 (patch)
tree1efac13a52811bfd28ae51538b15f87cbfaf8939 /mesalib/src/mesa/main/clear.c
parenta3d796bcc7de83fd88b42e09c6a82a8df4f9b836 (diff)
parenta8e5f06fe01732fbd643bc435dd3b8eaa602defe (diff)
downloadvcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.gz
vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.tar.bz2
vcxsrv-72d7f8d5af476f12dc75eab4fa9d59364cbec190.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mapi/glapi/glapi.h
Diffstat (limited to 'mesalib/src/mesa/main/clear.c')
-rw-r--r--mesalib/src/mesa/main/clear.c84
1 files changed, 84 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/clear.c b/mesalib/src/mesa/main/clear.c
index c35675fb4..2e27c951b 100644
--- a/mesalib/src/mesa/main/clear.c
+++ b/mesalib/src/mesa/main/clear.c
@@ -326,6 +326,13 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
switch (buffer) {
case GL_STENCIL:
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "ClearBuffer generates an INVALID VALUE error if buffer is
+ * COLOR and drawbuffer is less than zero, or greater than the
+ * value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH,
+ * STENCIL, or DEPTH STENCIL and drawbuffer is not zero."
+ */
if (drawbuffer != 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)",
drawbuffer);
@@ -373,6 +380,25 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
}
}
break;
+ case GL_DEPTH:
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "The result of ClearBuffer is undefined if no conversion between
+ * the type of the specified value and the type of the buffer being
+ * cleared is defined (for example, if ClearBufferiv is called for a
+ * fixed- or floating-point buffer, or if ClearBufferfv is called
+ * for a signed or unsigned integer buffer). This is not an error."
+ *
+ * In this case we take "undefined" and "not an error" to mean "ignore."
+ * Note that we still need to generate an error for the invalid
+ * drawbuffer case (see the GL_STENCIL case above).
+ */
+ if (drawbuffer != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferiv(drawbuffer=%d)",
+ drawbuffer);
+ return;
+ }
+ return;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferiv(buffer=%s)",
_mesa_lookup_enum_by_nr(buffer));
@@ -424,6 +450,31 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
}
}
break;
+ case GL_DEPTH:
+ case GL_STENCIL:
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "The result of ClearBuffer is undefined if no conversion between
+ * the type of the specified value and the type of the buffer being
+ * cleared is defined (for example, if ClearBufferiv is called for a
+ * fixed- or floating-point buffer, or if ClearBufferfv is called
+ * for a signed or unsigned integer buffer). This is not an error."
+ *
+ * In this case we take "undefined" and "not an error" to mean "ignore."
+ * Even though we could do something sensible for GL_STENCIL, page 263
+ * (page 279 of the PDF) says:
+ *
+ * "Only ClearBufferiv should be used to clear stencil buffers."
+ *
+ * Note that we still need to generate an error for the invalid
+ * drawbuffer case (see the GL_STENCIL case in _mesa_ClearBufferiv).
+ */
+ if (drawbuffer != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferuiv(drawbuffer=%d)",
+ drawbuffer);
+ return;
+ }
+ return;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferuiv(buffer=%s)",
_mesa_lookup_enum_by_nr(buffer));
@@ -450,6 +501,13 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
switch (buffer) {
case GL_DEPTH:
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "ClearBuffer generates an INVALID VALUE error if buffer is
+ * COLOR and drawbuffer is less than zero, or greater than the
+ * value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH,
+ * STENCIL, or DEPTH STENCIL and drawbuffer is not zero."
+ */
if (drawbuffer != 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",
drawbuffer);
@@ -498,6 +556,25 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
}
}
break;
+ case GL_STENCIL:
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "The result of ClearBuffer is undefined if no conversion between
+ * the type of the specified value and the type of the buffer being
+ * cleared is defined (for example, if ClearBufferiv is called for a
+ * fixed- or floating-point buffer, or if ClearBufferfv is called
+ * for a signed or unsigned integer buffer). This is not an error."
+ *
+ * In this case we take "undefined" and "not an error" to mean "ignore."
+ * Note that we still need to generate an error for the invalid
+ * drawbuffer case (see the GL_DEPTH case above).
+ */
+ if (drawbuffer != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",
+ drawbuffer);
+ return;
+ }
+ return;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)",
_mesa_lookup_enum_by_nr(buffer));
@@ -525,6 +602,13 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
return;
}
+ /* Page 264 (page 280 of the PDF) of the OpenGL 3.0 spec says:
+ *
+ * "ClearBuffer generates an INVALID VALUE error if buffer is
+ * COLOR and drawbuffer is less than zero, or greater than the
+ * value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH,
+ * STENCIL, or DEPTH STENCIL and drawbuffer is not zero."
+ */
if (drawbuffer != 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfi(drawbuffer=%d)",
drawbuffer);