aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-07-21 14:19:27 +0200
committerSamuel Pitoiset <[email protected]>2017-08-02 12:54:31 +0200
commit1ed61e0239feb5f08236df9a8e74cd8fb78c13e8 (patch)
treeca0d054bb0b702d46d08a170b919892e95252d5d /src/mesa
parent5e05e7debcc176c9bae72478552337417dddafd2 (diff)
mesa: add clear_bufferi() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/clear.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 853d445b7ef..4c3400412cd 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -622,33 +622,34 @@ _mesa_ClearNamedFramebufferfv(GLuint framebuffer, GLenum buffer,
* New in GL 3.0
* Clear depth/stencil buffer only.
*/
-void GLAPIENTRY
-_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
- GLfloat depth, GLint stencil)
+static ALWAYS_INLINE void
+clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
+ GLfloat depth, GLint stencil, bool no_error)
{
- GET_CURRENT_CONTEXT(ctx);
GLbitfield mask = 0;
FLUSH_VERTICES(ctx, 0);
FLUSH_CURRENT(ctx, 0);
- if (buffer != GL_DEPTH_STENCIL) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfi(buffer=%s)",
- _mesa_enum_to_string(buffer));
- return;
- }
+ if (!no_error) {
+ if (buffer != GL_DEPTH_STENCIL) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfi(buffer=%s)",
+ _mesa_enum_to_string(buffer));
+ 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);
- 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);
+ return;
+ }
}
if (ctx->RasterDiscard)
@@ -682,6 +683,15 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
}
+void GLAPIENTRY
+_mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
+ GLfloat depth, GLint stencil)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ clear_bufferfi(ctx, buffer, drawbuffer, depth, stencil, false);
+}
+
+
/**
* The ClearBuffer framework is so complicated and so riddled with the
* assumption that the framebuffer is bound that, for now, we will just fake