[Mesa-dev] [RFC PATCH 6/5] mesa: add statevar for sample position palette

Chris Forbes chrisf at ijw.co.nz
Sun Nov 10 02:29:22 PST 2013


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz
---
 src/mesa/program/prog_statevars.c | 14 ++++++++++++++
 src/mesa/program/prog_statevars.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index f6fd535..cc923bb 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -352,6 +352,14 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
    case STATE_NUM_SAMPLES:
       ((int *)value)[0] = ctx->DrawBuffer->Visual.samples;
       return;
+   case STATE_SAMPLE_POSITIONS:
+      {
+         int i;
+         for (i = 0; i < ctx->DrawBuffer->Visual.samples; i++) {
+            ctx->Driver.GetSamplePosition(ctx, ctx->DrawBuffer, i, &value[2 * i]);
+         }
+      }
+      return;
    case STATE_DEPTH_RANGE:
       value[0] = ctx->Viewport.Near;                     /* near       */
       value[1] = ctx->Viewport.Far;                      /* far        */
@@ -669,6 +677,7 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
       return _NEW_TRACK_MATRIX;
 
    case STATE_NUM_SAMPLES:
+   case STATE_SAMPLE_POSITIONS:
       return _NEW_BUFFERS;
 
    case STATE_DEPTH_RANGE:
@@ -861,6 +870,9 @@ append_token(char *dst, gl_state_index k)
    case STATE_NUM_SAMPLES:
       append(dst, "numsamples");
       break;
+   case STATE_SAMPLE_POSITIONS:
+      append(dst, "samplepositions");
+      break;
    case STATE_DEPTH_RANGE:
       append(dst, "depth.range");
       break;
@@ -1038,6 +1050,8 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
       break;
    case STATE_NUM_SAMPLES:
       break;
+   case STATE_SAMPLE_POSITIONS:
+      break;
    case STATE_DEPTH_RANGE:
       break;
    case STATE_FRAGMENT_PROGRAM:
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h
index 23a9f48..87dece4 100644
--- a/src/mesa/program/prog_statevars.h
+++ b/src/mesa/program/prog_statevars.h
@@ -104,6 +104,7 @@ typedef enum gl_state_index_ {
    STATE_TEXENV_COLOR,
 
    STATE_NUM_SAMPLES,    /* An integer, not a float like the other state vars */
+   STATE_SAMPLE_POSITIONS,
 
    STATE_DEPTH_RANGE,
 
-- 
1.8.4.2



More information about the mesa-dev mailing list