Module: Mesa
Branch: 7.9
Commit: 09cb5815aec1d5562a40ad5612d7e1dd9f598de5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=09cb5815aec1d5562a40ad5612d7e1dd9f598de5

Author: Brian Paul <bri...@vmware.com>
Date:   Wed Jan 12 18:12:46 2011 -0700

mesa: don't assert in GetIntegerIndexed, etc

We were getting an assertion upon invalid pname.

NOTE: This is a candidate for the 7.9 and 7.10 branches.
(cherry picked from commit 67722ae403526d8b267e29ed2ac962b806001ce5)

---

 src/mesa/main/get.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 4524a41..596d7d2 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -2346,8 +2346,10 @@ void GLAPIENTRY
 _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetBooleanIndexedv", pname, index, &v);
 
-   switch (find_value_indexed("glGetBooleanIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = INT_TO_BOOLEAN(v.value_int);
       break;
@@ -2361,7 +2363,7 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, 
GLboolean *params )
       params[0] = INT64_TO_BOOLEAN(v.value_int);
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 
@@ -2369,8 +2371,10 @@ void GLAPIENTRY
 _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
 
-   switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = v.value_int;
       break;
@@ -2384,7 +2388,7 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, 
GLint *params )
       params[0] = INT64_TO_INT(v.value_int);
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 
@@ -2393,8 +2397,10 @@ void GLAPIENTRY
 _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
 {
    union value v;
+   enum value_type type =
+      find_value_indexed("glGetIntegerIndexedv", pname, index, &v);      
 
-   switch (find_value_indexed("glGetIntegerIndexedv", pname, index, &v)) {
+   switch (type) {
    case TYPE_INT:
       params[0] = v.value_int;
       break;
@@ -2408,7 +2414,7 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, 
GLint64 *params )
       params[0] = v.value_int;
       break;
    default:
-      assert(0);
+      ; /* nothing - GL error was recorded */
    }
 }
 #endif /* FEATURE_ARB_sync */

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to