Mesa (master): mesa: A change of gl_vertex_processing_mode needs an array update.

Mathias Fröhlich frohlich at kemper.freedesktop.org
Thu Mar 22 04:25:07 UTC 2018


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

Author: Mathias Fröhlich <mathias.froehlich at web.de>
Date:   Fri Mar 16 06:34:35 2018 +0100

mesa: A change of gl_vertex_processing_mode needs an array update.

Since arrays also handle the mapping of current values into the
disabled array slots, we need to tell the array update code that
this mapping has changed. Also mark only dirty if it has changed.

Reviewed-by: Brian Paul <brianp at vmware.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>

---

 src/mesa/main/state.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index a6ae3b9001..fb97165db9 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -466,6 +466,20 @@ set_new_array(struct gl_context *ctx)
 }
 
 
+static void
+set_vertex_processing_mode(struct gl_context *ctx, gl_vertex_processing_mode m)
+{
+   if (ctx->VertexProgram._VPMode == m)
+      return;
+
+   /* On change we may get new maps into the current values */
+   set_new_array(ctx);
+
+   /* Finally memorize the value */
+   ctx->VertexProgram._VPMode = m;
+}
+
+
 /**
  * Update ctx->VertexProgram._VPMode.
  * This is to distinguish whether we're running
@@ -477,11 +491,11 @@ void
 _mesa_update_vertex_processing_mode(struct gl_context *ctx)
 {
    if (ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX])
-      ctx->VertexProgram._VPMode = VP_MODE_SHADER;
+      set_vertex_processing_mode(ctx, VP_MODE_SHADER);
    else if (_mesa_arb_vertex_program_enabled(ctx))
-      ctx->VertexProgram._VPMode = VP_MODE_SHADER;
+      set_vertex_processing_mode(ctx, VP_MODE_SHADER);
    else
-      ctx->VertexProgram._VPMode = VP_MODE_FF;
+      set_vertex_processing_mode(ctx, VP_MODE_FF);
 }
 
 




More information about the mesa-commit mailing list