diff options
author | Marek Olšák <[email protected]> | 2020-03-22 16:40:32 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2020-04-06 10:29:16 -0400 |
commit | e6bc1702f484be1ecb592295c4877281075798be (patch) | |
tree | 9f6482f91c3b22a30eb9d70ce573bd30d24f7df2 /src/mesa/main/enable.c | |
parent | 10beee8a7757e956ab0e02ec8402ec1273d8edce (diff) |
mesa: precompute _mesa_primitive_restart_index during state changes
Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
Diffstat (limited to 'src/mesa/main/enable.c')
-rw-r--r-- | src/mesa/main/enable.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 7410b0faddf..7e0162b0040 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -44,13 +44,14 @@ #include "varray.h" -static void -update_derived_primitive_restart_state(struct gl_context *ctx) +void +_mesa_update_derived_primitive_restart_state(struct gl_context *ctx) { - /* Update derived primitive restart state. - */ - ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart - || ctx->Array.PrimitiveRestartFixedIndex; + ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart || + ctx->Array.PrimitiveRestartFixedIndex; + ctx->Array._RestartIndex[0] = _mesa_primitive_restart_index(ctx, 1); + ctx->Array._RestartIndex[1] = _mesa_primitive_restart_index(ctx, 2); + ctx->Array._RestartIndex[3] = _mesa_primitive_restart_index(ctx, 4); } @@ -118,7 +119,7 @@ client_state(struct gl_context *ctx, struct gl_vertex_array_object* vao, FLUSH_VERTICES(ctx, 0); ctx->Array.PrimitiveRestart = state; - update_derived_primitive_restart_state(ctx); + _mesa_update_derived_primitive_restart_state(ctx); return; default: @@ -1200,7 +1201,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Array.PrimitiveRestart != state) { FLUSH_VERTICES(ctx, 0); ctx->Array.PrimitiveRestart = state; - update_derived_primitive_restart_state(ctx); + _mesa_update_derived_primitive_restart_state(ctx); } break; @@ -1210,7 +1211,7 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) if (ctx->Array.PrimitiveRestartFixedIndex != state) { FLUSH_VERTICES(ctx, 0); ctx->Array.PrimitiveRestartFixedIndex = state; - update_derived_primitive_restart_state(ctx); + _mesa_update_derived_primitive_restart_state(ctx); } break; |