From 439f4995916c3be4260217d5b10f450c9b3b3aa7 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Thu, 3 Oct 2019 16:53:47 -0400 Subject: [PATCH] mesa/program: support referencing the clip-space clip-plane state MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- 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; -- 2.30.2