summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-09-21 08:22:07 -0600
committerBrian Paul <[email protected]>2011-09-21 08:22:07 -0600
commit0e6646db3248057b7750031d825535cd7a0e5aec (patch)
tree25fc910e905a30d3b7c0d04c84e71305a6e76ca9 /src/mesa/vbo
parent51002968c97758c30511eefab1bd1358b8380e15 (diff)
mesa: check glBegin()/glDrawArrays()/etc mode with _mesa_valid_prim_mode()
We now raise an GL_INVALID_ENUM in glBegin() if mode is illegal, as was done in Yuanhan Liu's original patch. Take geometry shaders support into account too. Reviewed-by: Yuanhan Liu <[email protected]>
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_exec_api.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index cad7c4639ac..150589bec5e 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -42,6 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/light.h"
#include "main/api_arrayelt.h"
#include "main/api_noop.h"
+#include "main/api_validate.h"
#include "main/dispatch.h"
#include "vbo_context.h"
@@ -552,6 +553,7 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j )
#endif /* FEATURE_evaluators */
+
/**
* Called via glBegin.
*/
@@ -563,6 +565,11 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
int i;
+ if (!_mesa_valid_prim_mode(ctx, mode)) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBegin");
+ return;
+ }
+
if (ctx->NewState) {
_mesa_update_state( ctx );