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

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Erik Faye-Lund 2019-10-03 16:53:47 -04:00
parent 71c0dcf266
commit 439f499591
2 changed files with 14 additions and 0 deletions

View 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");

View 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;