[Mesa-dev] [PATCH 1/4] mesa: gl_NumSamples should always be at least one

Neil Roberts neil at linux.intel.com
Thu Feb 18 12:07:43 UTC 2016


Looks good to me. Interestingly we have a test for it in Piglit which
gets run with samples=0 and it is currently passing so presumably it is
broken.

Reviewed-by: Neil Roberts <neil at linux.intel.com>

- Neil

Ilia Mirkin <imirkin at alum.mit.edu> writes:

> From ARB_sample_shading:
>
>     "gl_NumSamples is the total number of samples in the framebuffer,
>      or one if rendering to a non-multisample framebuffer"
>
> So make sure to always pass in at least 1.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  src/mesa/program/prog_statevars.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
> index eed2412..489f75f 100644
> --- a/src/mesa/program/prog_statevars.c
> +++ b/src/mesa/program/prog_statevars.c
> @@ -353,7 +353,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
>        }
>        return;
>     case STATE_NUM_SAMPLES:
> -      ((int *)value)[0] = _mesa_geometric_samples(ctx->DrawBuffer);
> +      ((int *)value)[0] = MAX2(1, _mesa_geometric_samples(ctx->DrawBuffer));
>        return;
>     case STATE_DEPTH_RANGE:
>        value[0] = ctx->ViewportArray[0].Near;                /* near       */
> -- 
> 2.4.10
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list