mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 14:40:10 +01:00
mesa: move FBO completeness checking from draws to state changes
_mesa_update_framebuffer_visual already calls _mesa_update_valid_to_render- _state, so we just need to call it where FBOs are marked incomplete. This is a step towards removing _mesa_valid_to_render. 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:
parent
8e747d9af0
commit
7c35ec4d2f
3 changed files with 18 additions and 8 deletions
|
|
@ -160,12 +160,6 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
|
|||
}
|
||||
}
|
||||
|
||||
if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
|
||||
"%s(incomplete framebuffer)", where);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (!check_blend_func_error(ctx)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
|
@ -213,6 +207,18 @@ _mesa_update_valid_to_render_state(struct gl_context *ctx)
|
|||
ctx->ValidPrimMask = 0;
|
||||
ctx->DrawPixValid = false;
|
||||
|
||||
/* The default error is GL_INVALID_OPERATION if mode is a valid enum.
|
||||
* It can be overriden by following code if we should return a different
|
||||
* error.
|
||||
*/
|
||||
ctx->DrawGLError = GL_INVALID_OPERATION;
|
||||
|
||||
if (!ctx->DrawBuffer ||
|
||||
ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
ctx->DrawGLError = GL_INVALID_FRAMEBUFFER_OPERATION;
|
||||
return;
|
||||
}
|
||||
|
||||
/* A pipeline object is bound */
|
||||
if (shader->Name && !shader->Validated &&
|
||||
!_mesa_validate_program_pipeline(ctx, shader))
|
||||
|
|
@ -564,11 +570,11 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, bool uses_vao,
|
|||
/* All primitive type enums are less than 32, so we can use the shift. */
|
||||
if (mode >= 32 || !((1u << mode) & ctx->ValidPrimMask)) {
|
||||
/* If the primitive type is not in SupportedPrimMask, set GL_INVALID_ENUM,
|
||||
* else set GL_INVALID_OPERATION.
|
||||
* else set DrawGLError (e.g. GL_INVALID_OPERATION).
|
||||
*/
|
||||
_mesa_error(ctx,
|
||||
mode >= 32 || !((1u << mode) & ctx->SupportedPrimMask) ?
|
||||
GL_INVALID_ENUM : GL_INVALID_OPERATION,
|
||||
GL_INVALID_ENUM : ctx->DrawGLError,
|
||||
"%s(mode=%x)", name, mode);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -717,6 +717,8 @@ fbo_incomplete(struct gl_context *ctx, const char *msg, int index)
|
|||
if (MESA_DEBUG_FLAGS & DEBUG_INCOMPLETE_FBO) {
|
||||
_mesa_debug(NULL, "FBO Incomplete: %s [%d]\n", msg, index);
|
||||
}
|
||||
|
||||
_mesa_update_valid_to_render_state(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5235,6 +5235,8 @@ struct gl_context
|
|||
*/
|
||||
GLbitfield ValidPrimMask;
|
||||
|
||||
GLenum16 DrawGLError; /**< GL error to return from draw calls */
|
||||
|
||||
/**
|
||||
* Whether DrawPixels/CopyPixels/Bitmap are valid to render.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue