Mesa (master): mesa: optimize GL_PRIMITIVE_RESTART_NV more
Marek Olšák
mareko at kemper.freedesktop.org
Tue Jun 27 16:45:18 UTC 2017
Module: Mesa
Branch: master
Commit: 984f7feeb49240716e98b9f11ee944481f00e568
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=984f7feeb49240716e98b9f11ee944481f00e568
Author: Marek Olšák <marek.olsak at amd.com>
Date: Thu Jun 22 17:16:14 2017 +0200
mesa: optimize GL_PRIMITIVE_RESTART_NV more
And other client state changes don't have to call
update_derived_primitive_restart_state.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/mesa/main/enable.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 18a288d35c..2e5fb00931 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -66,7 +66,6 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
struct gl_vertex_array_object *vao = ctx->Array.VAO;
GLbitfield64 flag;
GLboolean *var;
- uint64_t new_state = _NEW_ARRAY;
switch (cap) {
case GL_VERTEX_ARRAY:
@@ -111,13 +110,15 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
/* GL_NV_primitive_restart */
case GL_PRIMITIVE_RESTART_NV:
- if (!ctx->Extensions.NV_primitive_restart) {
+ if (!ctx->Extensions.NV_primitive_restart)
goto invalid_enum_error;
- }
- var = &ctx->Array.PrimitiveRestart;
- flag = 0;
- new_state = 0; /* primitive restart is not a vertex array state */
- break;
+ if (ctx->Array.PrimitiveRestart == state)
+ return;
+
+ FLUSH_VERTICES(ctx, 0);
+ ctx->Array.PrimitiveRestart = state;
+ update_derived_primitive_restart_state(ctx);
+ return;
default:
goto invalid_enum_error;
@@ -126,12 +127,10 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
if (*var == state)
return;
- FLUSH_VERTICES(ctx, new_state);
+ FLUSH_VERTICES(ctx, _NEW_ARRAY);
*var = state;
- update_derived_primitive_restart_state(ctx);
-
if (state)
vao->_Enabled |= flag;
else
More information about the mesa-commit
mailing list