[Mesa-dev] [PATCH v2 11/16] compiler: Add a new STATE_VAR_ADVANCED_BLENDING_MODE built-in uniform.

Francisco Jerez currojerez at riseup.net
Mon Aug 22 20:49:43 UTC 2016


Kenneth Graunke <kenneth at whitecape.org> writes:

> This will be used for emulating GL_KHR_advanced_blend_equation features
> in shader code.  We'll pass in the blending mode that's in use, and use
> that in (effectively) a switch statement in the shader.
>
> v2: Use the new _AdvancedBlendMode field.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> Reviewed-by: Francisco Jerez <currojerez at riseup.net> [v1]

v2 is still:

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

> ---
>  src/mesa/program/prog_statevars.c | 10 ++++++++++
>  src/mesa/program/prog_statevars.h |  5 +++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
> index 8dddc0b..6e6007e 100644
> --- a/src/mesa/program/prog_statevars.c
> +++ b/src/mesa/program/prog_statevars.c
> @@ -609,6 +609,10 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
>              val[0].i = ctx->TessCtrlProgram.patch_vertices;
>           return;
>  
> +      case STATE_ADVANCED_BLENDING_MODE:
> +         val[0].i = ctx->Color.BlendEnabled ? ctx->Color._AdvancedBlendMode : 0;
> +         return;
> +
>        /* XXX: make sure new tokens added here are also handled in the 
>         * _mesa_program_state_flags() switch, below.
>         */
> @@ -719,6 +723,9 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
>        case STATE_FB_WPOS_Y_TRANSFORM:
>           return _NEW_BUFFERS;
>  
> +      case STATE_ADVANCED_BLENDING_MODE:
> +         return _NEW_COLOR;
> +
>        default:
>           /* unknown state indexes are silently ignored and
>           *  no flag set, since it is handled by the driver.
> @@ -925,6 +932,9 @@ append_token(char *dst, gl_state_index k)
>     case STATE_FB_WPOS_Y_TRANSFORM:
>        append(dst, "FbWposYTransform");
>        break;
> +   case STATE_ADVANCED_BLENDING_MODE:
> +      append(dst, "AdvancedBlendingMode");
> +      break;
>     default:
>        /* probably STATE_INTERNAL_DRIVER+i (driver private state) */
>        append(dst, "driverState");
> diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
> index e716d90..7fecb37 100644
> --- a/src/mesa/program/prog_statevars.h
> +++ b/src/mesa/program/prog_statevars.h
> @@ -130,6 +130,11 @@ typedef enum gl_state_index_ {
>     STATE_FB_WPOS_Y_TRANSFORM,   /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
>     STATE_TCS_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TCS (integer) */
>     STATE_TES_PATCH_VERTICES_IN, /**< gl_PatchVerticesIn for TES (integer) */
> +   /**
> +    * A single enum gl_blend_support_qualifier value representing the
> +    * currently active advanced blending equation, or zero if disabled.
> +    */
> +   STATE_ADVANCED_BLENDING_MODE,
>     STATE_INTERNAL_DRIVER	/* first available state index for drivers (must be last) */
>  } gl_state_index;
>  
> -- 
> 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/2d58fd25/attachment-0001.sig>


More information about the mesa-dev mailing list