From d3ace603a97bdd031bdff7517728eff4d0fd6458 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Mon, 17 Aug 2015 21:33:49 +1000 Subject: [PATCH] mesa: check samples > 0 for glTex*Multisample MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Anuj Phogat --- 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 81e9e37f852..8b2f32ad973 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -5616,6 +5616,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.30.2