mesa/program: support referencing the clip-space clip-plane state
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 3 Oct 2019 20:53:47 +0000 (16:53 -0400)
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 1b35979d633fa5a621a762fb70f64bd505eaf5b9..54afc1bf678f6f858c63926154a1ce36a45470fb 100644 (file)
@@ -606,6 +606,13 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index16 state[],
          value[0] = ctx->Color.AlphaRefUnclamped;
          return;
 
+      case STATE_CLIP_INTERNAL:
+         {
+            const GLuint plane = (GLuint) state[2];
+            COPY_4V(value, ctx->Transform._ClipUserPlane[plane]);
+         }
+         return;
+
       /* XXX: make sure new tokens added here are also handled in the 
        * _mesa_program_state_flags() switch, below.
        */
@@ -720,6 +727,9 @@ _mesa_program_state_flags(const gl_state_index16 state[STATE_LENGTH])
       case STATE_ALPHA_REF:
          return _NEW_COLOR;
 
+      case STATE_CLIP_INTERNAL:
+         return _NEW_TRANSFORM | _NEW_PROJECTION;
+
       default:
          /* unknown state indexes are silently ignored and
          *  no flag set, since it is handled by the driver.
@@ -929,6 +939,9 @@ append_token(char *dst, gl_state_index k)
    case STATE_ALPHA_REF:
       append(dst, "alphaRef");
       break;
+   case STATE_CLIP_INTERNAL:
+      append(dst, "clipInternal");
+      break;
    default:
       /* probably STATE_INTERNAL_DRIVER+i (driver private state) */
       append(dst, "driverState");
index 1418f84f630fa9f1acab76c7b4048c1d4d14093a..de457d1a7f42b9edf05c0933f28dd6f9e2835c7c 100644 (file)
@@ -130,6 +130,7 @@ typedef enum gl_state_index_ {
     */
    STATE_ADVANCED_BLENDING_MODE,
    STATE_ALPHA_REF,        /* alpha-test reference value */
+   STATE_CLIP_INTERNAL,    /* similar to STATE_CLIPPLANE, but in clip-space */
    STATE_INTERNAL_DRIVER       /* first available state index for drivers (must be last) */
 } gl_state_index;