diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index e1dceb565a8..77ea39dd6bc 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -38,25 +38,6 @@ #include "program/prog_print.h" -/** - * Prior to drawing anything with glBegin, glDrawArrays, etc. this function - * is called to see if it's valid to render. This involves checking that - * the current shader is valid and the framebuffer is complete. - * It also check the current pipeline object is valid if any. - * If an error is detected it'll be recorded here. - * \return GL_TRUE if OK to render, GL_FALSE if not - */ -GLboolean -_mesa_valid_to_render(struct gl_context *ctx, const char *where) -{ - /* This depends on having up to date derived state (shaders) */ - if (ctx->NewState) - _mesa_update_state(ctx); - - return GL_TRUE; -} - - /** * Compute the bitmask of allowed primitive types (ValidPrimMask) depending * on shaders and current states. This is used by draw validation. @@ -524,8 +505,8 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, bool uses_vao, /* This might update ValidPrimMask, so it must be done before ValidPrimMask * is checked. */ - if (!_mesa_valid_to_render(ctx, name)) - return false; + if (ctx->NewState) + _mesa_update_state(ctx); /* All primitive type enums are less than 32, so we can use the shift. */ if (mode >= 32 || !((1u << mode) & ctx->ValidPrimMask)) { diff --git a/src/mesa/main/draw_validate.h b/src/mesa/main/draw_validate.h index 1962edad239..7ea2b97e5ad 100644 --- a/src/mesa/main/draw_validate.h +++ b/src/mesa/main/draw_validate.h @@ -38,9 +38,6 @@ struct gl_context; struct gl_transform_feedback_object; -extern GLboolean -_mesa_valid_to_render(struct gl_context *ctx, const char *where); - extern GLboolean _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, bool uses_vao, const char *name); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 97e92ebf7cb..60e1b87cabf 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -72,10 +72,8 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, */ _mesa_set_vp_override(ctx, GL_TRUE); - /* Note: this call does state validation */ - if (!_mesa_valid_to_render(ctx, "glDrawPixels")) { - goto end; /* the error code was recorded */ - } + if (ctx->NewState) + _mesa_update_state(ctx); if (!ctx->DrawPixValid) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels"); @@ -243,10 +241,8 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, */ _mesa_set_vp_override(ctx, GL_TRUE); - /* Note: this call does state validation */ - if (!_mesa_valid_to_render(ctx, "glCopyPixels")) { - goto end; /* the error code was recorded */ - } + if (ctx->NewState) + _mesa_update_state(ctx); if (!ctx->DrawPixValid) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels"); @@ -331,11 +327,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height, return; /* do nothing */ } - /* Note: this call does state validation */ - if (!_mesa_valid_to_render(ctx, "glBitmap")) { - /* the error code was recorded */ - return; - } + if (ctx->NewState) + _mesa_update_state(ctx); if (!ctx->DrawPixValid) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap");