mesa/st: move Clear to new direct call

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
Dave Airlie 2021-12-07 10:54:42 +10:00 committed by Marge Bot
parent 889ac0f1b9
commit 4e13c7d46a
5 changed files with 12 additions and 33 deletions

View File

@ -41,7 +41,7 @@
#include "mtypes.h"
#include "state.h"
#include "state_tracker/st_cb_clear.h"
void GLAPIENTRY
_mesa_ClearIndex( GLfloat c )
@ -221,8 +221,7 @@ clear(struct gl_context *ctx, GLbitfield mask, bool no_error)
bufferMask |= BUFFER_BIT_ACCUM;
}
assert(ctx->Driver.Clear);
ctx->Driver.Clear(ctx, bufferMask);
st_Clear(ctx, bufferMask);
}
}
@ -377,12 +376,12 @@ clear_bufferiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
&& !ctx->RasterDiscard) {
/* Save current stencil clear value, set to 'value', do the
* stencil clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
* XXX in the future we may have a new st_ClearBuffer()
* hook instead.
*/
const GLuint clearSave = ctx->Stencil.Clear;
ctx->Stencil.Clear = *value;
ctx->Driver.Clear(ctx, BUFFER_BIT_STENCIL);
st_Clear(ctx, BUFFER_BIT_STENCIL);
ctx->Stencil.Clear = clearSave;
}
break;
@ -402,7 +401,7 @@ clear_bufferiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
/* set color */
COPY_4V(ctx->Color.ClearColor.i, value);
/* clear buffer(s) */
ctx->Driver.Clear(ctx, mask);
st_Clear(ctx, mask);
/* restore color */
ctx->Color.ClearColor = clearSave;
}
@ -495,7 +494,7 @@ clear_bufferuiv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
/* set color */
COPY_4V(ctx->Color.ClearColor.ui, value);
/* clear buffer(s) */
ctx->Driver.Clear(ctx, mask);
st_Clear(ctx, mask);
/* restore color */
ctx->Color.ClearColor = clearSave;
}
@ -590,7 +589,7 @@ clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
&& !ctx->RasterDiscard) {
/* Save current depth clear value, set to 'value', do the
* depth clear and restore the clear value.
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
* XXX in the future we may have a new st_ClearBuffer()
* hook instead.
*/
const GLclampd clearSave = ctx->Depth.Clear;
@ -608,7 +607,7 @@ clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
_mesa_has_depth_float_channel(rb->InternalFormat);
ctx->Depth.Clear = is_float_depth ? *value : SATURATE(*value);
ctx->Driver.Clear(ctx, BUFFER_BIT_DEPTH);
st_Clear(ctx, BUFFER_BIT_DEPTH);
ctx->Depth.Clear = clearSave;
}
/* clear depth buffer to value */
@ -629,7 +628,7 @@ clear_bufferfv(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
/* set color */
COPY_4V(ctx->Color.ClearColor.f, value);
/* clear buffer(s) */
ctx->Driver.Clear(ctx, mask);
st_Clear(ctx, mask);
/* restore color */
ctx->Color.ClearColor = clearSave;
}
@ -759,7 +758,7 @@ clear_bufferfi(struct gl_context *ctx, GLenum buffer, GLint drawbuffer,
ctx->Stencil.Clear = stencil;
/* clear buffers */
ctx->Driver.Clear(ctx, mask);
st_Clear(ctx, mask);
/* restore */
ctx->Depth.Clear = clearDepthSave;

View File

@ -134,13 +134,6 @@ struct dd_function_table {
*/
void (*Flush)(struct gl_context *ctx, unsigned gallium_flush_flags);
/**
* Clear the color/depth/stencil/accum buffer(s).
* \param buffers a bitmask of BUFFER_BIT_* flags indicating which
* renderbuffers need to be cleared.
*/
void (*Clear)( struct gl_context *ctx, GLbitfield buffers );
/**
* Execute glRasterPos, updating the ctx->Current.Raster fields
*/

View File

@ -419,11 +419,7 @@ is_stencil_masked(struct gl_context *ctx, struct gl_renderbuffer *rb)
return (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
}
/**
* Called via ctx->Driver.Clear()
*/
static void
void
st_Clear(struct gl_context *ctx, GLbitfield mask)
{
struct st_context *st = st_context(ctx);
@ -561,9 +557,3 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
_mesa_clear_accum_buffer(ctx);
}
void
st_init_clear_functions(struct dd_function_table *functions)
{
functions->Clear = st_Clear;
}

View File

@ -41,9 +41,7 @@ extern void
st_destroy_clear(struct st_context *st);
extern void
st_init_clear_functions(struct dd_function_table *functions);
void st_Clear(struct gl_context *ctx, GLbitfield mask);
#endif /* ST_CB_CLEAR_H */

View File

@ -930,7 +930,6 @@ st_init_driver_functions(struct pipe_screen *screen,
st_init_draw_functions(screen, functions);
st_init_blit_functions(functions);
st_init_bufferobject_functions(screen, functions);
st_init_clear_functions(functions);
st_init_bitmap_functions(functions);
st_init_copy_image_functions(functions);
st_init_drawpixels_functions(functions);