mesa: inline _mesa_valid_to_render now that it doesn't do validation

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-24 18:09:19 -05:00 committed by Marge Bot
parent bf9d61a3d4
commit ad057b7f60
3 changed files with 8 additions and 37 deletions

View file

@ -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)) {

View file

@ -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);

View file

@ -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");