[Mesa-dev] [PATCH 3/8] mesa: Pass number of samples as a program state variable
Paul Berry
stereotype441 at gmail.com
Fri Oct 18 23:44:24 CEST 2013
On 14 October 2013 10:12, Anuj Phogat <anuj.phogat at gmail.com> wrote:
> Number of samples will be required in fragment shader program by new
> GLSL builtin uniform "gl_NumSamples".
>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
> src/mesa/program/prog_statevars.c | 11 +++++++++++
> src/mesa/program/prog_statevars.h | 2 ++
> 2 files changed, 13 insertions(+)
>
> diff --git a/src/mesa/program/prog_statevars.c
> b/src/mesa/program/prog_statevars.c
> index 145c07c..8f798da 100644
> --- a/src/mesa/program/prog_statevars.c
> +++ b/src/mesa/program/prog_statevars.c
> @@ -349,6 +349,9 @@ _mesa_fetch_state(struct gl_context *ctx, const
> gl_state_index state[],
> }
> }
> return;
> + case STATE_NUM_SAMPLES:
> + ((int *)value)[0] = ctx->DrawBuffer->Visual.samples;
> + return;
> case STATE_DEPTH_RANGE:
> value[0] = ctx->Viewport.Near; /* near */
> value[1] = ctx->Viewport.Far; /* far */
> @@ -665,6 +668,9 @@ _mesa_program_state_flags(const gl_state_index
> state[STATE_LENGTH])
> case STATE_PROGRAM_MATRIX:
> return _NEW_TRACK_MATRIX;
>
> + case STATE_NUM_SAMPLES:
> + return _NEW_MULTISAMPLE;
>
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.
With that fixed, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> +
> case STATE_DEPTH_RANGE:
> return _NEW_VIEWPORT;
>
> @@ -852,6 +858,9 @@ append_token(char *dst, gl_state_index k)
> case STATE_TEXENV_COLOR:
> append(dst, "texenv");
> break;
> + case STATE_NUM_SAMPLES:
> + append(dst, "num.samples");
> + break;
> case STATE_DEPTH_RANGE:
> append(dst, "depth.range");
> break;
> @@ -1027,6 +1036,8 @@ _mesa_program_state_string(const gl_state_index
> state[STATE_LENGTH])
> break;
> case STATE_FOG_COLOR:
> break;
> + case STATE_NUM_SAMPLES:
> + 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 ec22b73..c3081c4 100644
> --- a/src/mesa/program/prog_statevars.h
> +++ b/src/mesa/program/prog_statevars.h
> @@ -103,6 +103,8 @@ typedef enum gl_state_index_ {
>
> STATE_TEXENV_COLOR,
>
> + STATE_NUM_SAMPLES,
> +
> STATE_DEPTH_RANGE,
>
> STATE_VERTEX_PROGRAM,
> --
> 1.8.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131018/a972e7c1/attachment.html>
More information about the mesa-dev
mailing list