Mesa (master): mesa/program: support referencing the clip-space clip-plane state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 17 09:26:22 UTC 2019


Module: Mesa
Branch: master
Commit: 439f4995916c3be4260217d5b10f450c9b3b3aa7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=439f4995916c3be4260217d5b10f450c9b3b3aa7

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Thu Oct  3 16:53:47 2019 -0400

mesa/program: support referencing the clip-space clip-plane state

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/program/prog_statevars.c | 13 +++++++++++++
 src/mesa/program/prog_statevars.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 1b35979d633..54afc1bf678 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -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");
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 1418f84f630..de457d1a7f4 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -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;
 




More information about the mesa-commit mailing list