mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-31 05:30:11 +01:00
mesa: add clear_bufferfv() helper
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
0127af1281
commit
33b47306e4
1 changed files with 23 additions and 14 deletions
|
|
@ -506,11 +506,10 @@ _mesa_ClearNamedFramebufferuiv(GLuint framebuffer, GLenum buffer,
|
|||
* New in GL 3.0
|
||||
* Clear fixed-pt or float color buffer or depth buffer (not stencil).
|
||||
*/
|
||||
void GLAPIENTRY
|
||||
_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
|
||||
static ALWAYS_INLINE void
|
||||
clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
|
||||
const GLfloat *value, bool no_error)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
FLUSH_VERTICES(ctx, 0);
|
||||
FLUSH_CURRENT(ctx, 0);
|
||||
|
||||
|
|
@ -527,7 +526,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
|
|||
* value of MAX DRAW BUFFERS minus one; or if buffer is DEPTH,
|
||||
* STENCIL, or DEPTH STENCIL and drawbuffer is not zero."
|
||||
*/
|
||||
if (drawbuffer != 0) {
|
||||
if (!no_error && drawbuffer != 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",
|
||||
drawbuffer);
|
||||
return;
|
||||
|
|
@ -549,7 +548,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
|
|||
case GL_COLOR:
|
||||
{
|
||||
const GLbitfield mask = make_color_buffer_mask(ctx, drawbuffer);
|
||||
if (mask == INVALID_MASK) {
|
||||
if (!no_error && mask == INVALID_MASK) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glClearBufferfv(drawbuffer=%d)",
|
||||
drawbuffer);
|
||||
return;
|
||||
|
|
@ -569,19 +568,29 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
/* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
|
||||
* of the OpenGL 4.5 spec states:
|
||||
*
|
||||
* "An INVALID_ENUM error is generated by ClearBufferfv and
|
||||
* ClearNamedFramebufferfv if buffer is not COLOR or DEPTH."
|
||||
*/
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)",
|
||||
_mesa_enum_to_string(buffer));
|
||||
if (!no_error) {
|
||||
/* Page 498 of the PDF, section '17.4.3.1 Clearing Individual Buffers'
|
||||
* of the OpenGL 4.5 spec states:
|
||||
*
|
||||
* "An INVALID_ENUM error is generated by ClearBufferfv and
|
||||
* ClearNamedFramebufferfv if buffer is not COLOR or DEPTH."
|
||||
*/
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glClearBufferfv(buffer=%s)",
|
||||
_mesa_enum_to_string(buffer));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
clear_bufferfv(ctx, buffer, drawbuffer, value, 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