mesa: expose alpha-ref as a state-variable
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 4 Jul 2019 08:07:27 +0000 (10:07 +0200)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 17 Oct 2019 08:41:36 +0000 (10:41 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/program/prog_statevars.c
src/mesa/program/prog_statevars.h

index 5178b61ec4ad0e00637ace8d1d1d9b578b3ad31f..1b35979d633fa5a621a762fb70f64bd505eaf5b9 100644 (file)
@@ -602,6 +602,10 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
                       ctx->Color.BlendEnabled, ctx->Color._AdvancedBlendMode);
          return;
 
+      case STATE_ALPHA_REF:
+         value[0] = ctx->Color.AlphaRefUnclamped;
+         return;
+
       /* XXX: make sure new tokens added here are also handled in the 
        * _mesa_program_state_flags() switch, below.
        */
@@ -713,6 +717,9 @@ _mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
       case STATE_ADVANCED_BLENDING_MODE:
          return _NEW_COLOR;
 
+      case STATE_ALPHA_REF:
+         return _NEW_COLOR;
+
       default:
          /* unknown state indexes are silently ignored and
          *  no flag set, since it is handled by the driver.
@@ -919,6 +926,9 @@ append_token(char *dst, gl_state_index k)
    case STATE_ADVANCED_BLENDING_MODE:
       append(dst, "AdvancedBlendingMode");
       break;
+   case STATE_ALPHA_REF:
+      append(dst, "alphaRef");
+      break;
    default:
       /* probably STATE_INTERNAL_DRIVER+i (driver private state) */
       append(dst, "driverState");
index f28d2bb4a372fa2e4244dba36ceb2b09847bb61e..1418f84f630fa9f1acab76c7b4048c1d4d14093a 100644 (file)
@@ -129,6 +129,7 @@ typedef enum gl_state_index_ {
     * currently active advanced blending equation, or zero if disabled.
     */
    STATE_ADVANCED_BLENDING_MODE,
+   STATE_ALPHA_REF,        /* alpha-test reference value */
    STATE_INTERNAL_DRIVER       /* first available state index for drivers (must be last) */
 } gl_state_index;