<div dir="ltr">On 14 October 2013 10:12, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Number of samples will be required in fragment shader program by new<br>
GLSL builtin uniform "gl_NumSamples".<br>
<br>
Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
---<br>
 src/mesa/program/prog_statevars.c | 11 +++++++++++<br>
 src/mesa/program/prog_statevars.h |  2 ++<br>
 2 files changed, 13 insertions(+)<br>
<br>
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c<br>
index 145c07c..8f798da 100644<br>
--- a/src/mesa/program/prog_statevars.c<br>
+++ b/src/mesa/program/prog_statevars.c<br>
@@ -349,6 +349,9 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],<br>
          }<br>
       }<br>
       return;<br>
+   case STATE_NUM_SAMPLES:<br>
+      ((int *)value)[0] = ctx->DrawBuffer->Visual.samples;<br>
+      return;<br>
    case STATE_DEPTH_RANGE:<br>
       value[0] = ctx->Viewport.Near;                     /* near       */<br>
       value[1] = ctx->Viewport.Far;                      /* far        */<br>
@@ -665,6 +668,9 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])<br>
    case STATE_PROGRAM_MATRIX:<br>
       return _NEW_TRACK_MATRIX;<br>
<br>
+   case STATE_NUM_SAMPLES:<br>
+      return _NEW_MULTISAMPLE;<br></blockquote><div><br></div><div>I think this should be _NEW_BUFFERS.  _NEW_MULTISAMPLE is only flagged when something in gl_multisample_attrib changes, and nothing in that category affects ctx->DrawBuffer->Visual.samples.<br>
<br></div><div>With that fixed, this patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+<br>
    case STATE_DEPTH_RANGE:<br>
       return _NEW_VIEWPORT;<br>
<br>
@@ -852,6 +858,9 @@ append_token(char *dst, gl_state_index k)<br>
    case STATE_TEXENV_COLOR:<br>
       append(dst, "texenv");<br>
       break;<br>
+   case STATE_NUM_SAMPLES:<br>
+      append(dst, "num.samples");<br>
+      break;<br>
    case STATE_DEPTH_RANGE:<br>
       append(dst, "depth.range");<br>
       break;<br>
@@ -1027,6 +1036,8 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])<br>
       break;<br>
    case STATE_FOG_COLOR:<br>
       break;<br>
+   case STATE_NUM_SAMPLES:<br>
+      break;<br>
    case STATE_DEPTH_RANGE:<br>
       break;<br>
    case STATE_FRAGMENT_PROGRAM:<br>
diff --git a/src/mesa/program/prog_statevars.h b/src/mesa/program/prog_statevars.h<br>
index ec22b73..c3081c4 100644<br>
--- a/src/mesa/program/prog_statevars.h<br>
+++ b/src/mesa/program/prog_statevars.h<br>
@@ -103,6 +103,8 @@ typedef enum gl_state_index_ {<br>
<br>
    STATE_TEXENV_COLOR,<br>
<br>
+   STATE_NUM_SAMPLES,<br>
+<br>
    STATE_DEPTH_RANGE,<br>
<br>
    STATE_VERTEX_PROGRAM,<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>