mesa: add skeleton code for DrawPixels/CopyPixels/Bitmap precomputed validation

This is for precomputing draw time validation in state changes.
The next commit will use this.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
This commit is contained in:
Marek Olšák 2021-01-30 18:56:38 -05:00 committed by Marge Bot
parent c24a03d035
commit b6e84f56f7
3 changed files with 28 additions and 0 deletions

View file

@ -249,14 +249,22 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
{
struct gl_pipeline_object *shader = ctx->_Shader;
unsigned mask = ctx->SupportedPrimMask;
bool drawpix_valid = true;
if (_mesa_is_no_error_enabled(ctx)) {
ctx->ValidPrimMask = mask;
ctx->DrawPixValid = drawpix_valid;
return;
}
/* Start with an empty mask and set this to the trimmed mask at the end. */
ctx->ValidPrimMask = 0;
ctx->DrawPixValid = false;
/* TODO: insert code here */
/* DrawPixels/CopyPixels/Bitmap is valid after this point. */
ctx->DrawPixValid = true;
/* Section 11.2 (Tessellation) of the ES 3.2 spec says:
*

View file

@ -77,6 +77,11 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
goto end; /* the error code was recorded */
}
if (!ctx->DrawPixValid) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels");
goto end;
}
/* GL 3.0 introduced a new restriction on glDrawPixels() over what was in
* GL_EXT_texture_integer. From section 3.7.4 ("Rasterization of Pixel
* Rectangles) on page 151 of the GL 3.0 specification:
@ -243,6 +248,11 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
goto end; /* the error code was recorded */
}
if (!ctx->DrawPixValid) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels");
goto end;
}
/* Check read buffer's status (draw buffer was already checked) */
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
@ -327,6 +337,11 @@ _mesa_Bitmap( GLsizei width, GLsizei height,
return;
}
if (!ctx->DrawPixValid) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap");
return;
}
if (ctx->RasterDiscard)
return;

View file

@ -5234,6 +5234,11 @@ struct gl_context
*/
GLbitfield ValidPrimMask;
/**
* Whether DrawPixels/CopyPixels/Bitmap are valid to render.
*/
bool DrawPixValid;
/** \name The various 4x4 matrix stacks */
/*@{*/
struct gl_matrix_stack ModelviewMatrixStack;