[Mesa-dev] [PATCH 1/2] mesa: check samples > 0 for glTex*Multisample

Anuj Phogat anuj.phogat at gmail.com
Mon Aug 17 12:30:10 PDT 2015


On Mon, Aug 17, 2015 at 4:53 AM, Timothy Arceri <t_arceri at yahoo.com.au> wrote:
> The GL 4.5 spec says its an GL_INVALID_VALUE error if samples equals 0 for
> glTexImage*Multisample and an GL_INVALID_VALUE error if samples < 1 for
> glTexStorage*Multisample.
>
> The spec says its undefined what happens if glTexImage*Multisample is passed
> a samples value < 0 but we currently already produced a GL_INVALID_VALUE error
> in this case, this is also consistent with the Nvidia binary.
>
> Cc: Tapani Pälli <tapani.palli at intel.com>
> ---
>  src/mesa/main/teximage.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 23609e7..6f60829 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -5599,6 +5599,11 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
>        return;
>     }
>
> +   if (samples < 1) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "%s(samples < 1)", func);
> +      return;
> +   }
> +
>     if (!check_multisample_target(dims, target, dsa)) {
>        if (dsa) {
>           _mesa_error(ctx, GL_INVALID_OPERATION, "%s(target)", func);
> --
> 2.4.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

I also noticed that GL 4.1 onwards if samples > max_samples
error is changed from invalid_value to invalid_operation. But, still
keeps invalid_value for samples < 0.

Both patches are:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list