Mesa (master): main: fix the validation of the number of samples

Martin Peres mperes at kemper.freedesktop.org
Wed Mar 25 08:07:15 UTC 2015


Module: Mesa
Branch: master
Commit: fc76fac4199f06e26d6c9b4fbb87b85f802b06f3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fc76fac4199f06e26d6c9b4fbb87b85f802b06f3

Author: Martin Peres <martin.peres at linux.intel.com>
Date:   Fri Feb 13 18:14:15 2015 +0200

main: fix the validation of the number of samples

Maybe this should be the job of the dispatch layer.

v2:
- add the section name and pdf page number of the quote (Laura)
- OpenGL 3.0 core does not exist, get rid of "core"

Signed-off-by: Martin Peres <martin.peres at linux.intel.com>

---

 src/mesa/main/multisample.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c
index 0e9207b..816837b 100644
--- a/src/mesa/main/multisample.c
+++ b/src/mesa/main/multisample.c
@@ -150,6 +150,15 @@ GLenum
 _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
                          GLenum internalFormat, GLsizei samples)
 {
+   /* Section 2.5 (GL Errors) of OpenGL 3.0 specification, page 16:
+    *
+    * "If a negative number is provided where an argument of type sizei or
+    * sizeiptr is specified, the error INVALID VALUE is generated."
+    */
+   if (samples < 0) {
+      return GL_INVALID_VALUE;
+   }
+
    /* Section 4.4 (Framebuffer objects), page 198 of the OpenGL ES 3.0.0
     * specification says:
     *




More information about the mesa-commit mailing list