aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-10-03 16:53:47 -0400
committerErik Faye-Lund <[email protected]>2019-10-17 10:41:36 +0200
commit439f4995916c3be4260217d5b10f450c9b3b3aa7 (patch)
treefe92e01d5c5eda7ffa333110e26a84ed94206ce1
parent71c0dcf26621f0403586a1b09df7e7cecb063979 (diff)
mesa/program: support referencing the clip-space clip-plane state
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r--src/mesa/program/prog_statevars.c13
-rw-r--r--src/mesa/program/prog_statevars.h1
2 files changed, 14 insertions, 0 deletions
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;