[Mesa-dev] [PATCH v2 09/16] mesa: Restyle _mesa_check_blend_func_error().

Francisco Jerez currojerez at riseup.net
Mon Aug 22 20:00:27 UTC 2016


Kenneth Graunke <kenneth at whitecape.org> writes:

> I'm about to add more error conditions to this function, so I wanted to
> move the current spec citation above the code that checks it.  Indenting
> it required reformatting, so I tried to move it to our newer style.
>
> While there, I also decided to drop some GL type usage, and drop the
> unnecessary "_mesa_" prefix on a static function.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  src/mesa/main/context.c | 30 +++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 574c0fb..4ff0979 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -1855,28 +1855,28 @@ _mesa_Flush(void)
>  }
>  
>  
> -/*
> - * ARB_blend_func_extended - ERRORS section
> - * "The error INVALID_OPERATION is generated by Begin or any procedure that
> - *  implicitly calls Begin if any draw buffer has a blend function requiring the
> - *  second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
> - *  ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that has more than
> - *  the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachements."
> - */
> -static GLboolean
> -_mesa_check_blend_func_error(struct gl_context *ctx)
> +static bool
> +check_blend_func_error(struct gl_context *ctx)
>  {
> -   GLuint i;
> -   for (i = ctx->Const.MaxDualSourceDrawBuffers;
> +   /* The ARB_blend_func_extended spec's ERRORS section says:
> +    *
> +    *    "The error INVALID_OPERATION is generated by Begin or any procedure
> +    *     that implicitly calls Begin if any draw buffer has a blend function
> +    *     requiring the second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR,
> +    *     SRC1_ALPHA or ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that
> +    *     has more than the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active
> +    *     color attachements."
> +    */
> +   for (unsigned i = ctx->Const.MaxDualSourceDrawBuffers;
>  	i < ctx->DrawBuffer->_NumColorDrawBuffers;
>  	i++) {
>        if (ctx->Color.Blend[i]._UsesDualSrc) {
>  	 _mesa_error(ctx, GL_INVALID_OPERATION,
>  		     "dual source blend on illegal attachment");
> -	 return GL_FALSE;
> +	 return false;
>        }
>     }
> -   return GL_TRUE;
> +   return true;
>  }
>  
>  
> @@ -1951,7 +1951,7 @@ _mesa_valid_to_render(struct gl_context *ctx, const char *where)
>        return GL_FALSE;
>     }
>  
> -   if (_mesa_check_blend_func_error(ctx) == GL_FALSE) {
> +   if (!check_blend_func_error(ctx)) {
>        return GL_FALSE;
>     }
>  
> -- 
> 2.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160822/3502ecd6/attachment.sig>


More information about the mesa-dev mailing list