From f738b913e6b3aa4e3e9bea41d37e634c6952536f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 7 Aug 2009 09:30:53 -0600 Subject: [PATCH] mesa: use valid_fragment_program() helper --- src/mesa/main/drawpix.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index ec8a45cb94e..4e0cc056c74 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -35,6 +35,18 @@ #include "state.h" + +/** + * If a fragment program is enabled, check that it's valid. + * \return GL_TRUE if valid, GL_FALSE otherwise + */ +static GLboolean +valid_fragment_program(GLcontext *ctx) +{ + return !(ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled); +} + + #if _HAVE_FULL_GL /* @@ -56,7 +68,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, _mesa_update_state(ctx); } - if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawPixels (invalid fragment program)"); return; @@ -142,7 +154,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, _mesa_update_state(ctx); } - if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels (invalid fragment program)"); return; @@ -215,7 +227,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, _mesa_update_state(ctx); } - if (ctx->FragmentProgram.Enabled && !ctx->FragmentProgram._Enabled) { + if (!valid_fragment_program(ctx)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBitmap (invalid fragment program)"); return; -- 2.30.2