mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
mesa: add clear_bufferi() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
5e05e7debc
commit
1ed61e0239
1 changed files with 30 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue