Mesa (master): vbo: move, rename vp_mode enums, get_program_mode() function

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 29 16:06:24 UTC 2018


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

Author: Brian Paul <brianp at vmware.com>
Date:   Fri Jan 19 21:03:07 2018 -0700

vbo: move, rename vp_mode enums, get_program_mode() function

Instead of NONE/ARB use FF/SHADER.  Move the enum declaration to
vbo_private.h where it's used.

Reviewed-by: Mathias Fröhlich <mathias.froehlich at web.de>

---

 src/mesa/vbo/vbo_exec.h       |  7 -------
 src/mesa/vbo/vbo_exec_array.c |  6 +++---
 src/mesa/vbo/vbo_exec_draw.c  |  7 ++++---
 src/mesa/vbo/vbo_private.h    | 22 ++++++++++++++++------
 src/mesa/vbo/vbo_save_draw.c  |  7 ++++---
 5 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index f1e3881b1f..f02f4591fc 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -52,13 +52,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define VBO_VERT_BUFFER_SIZE (1024*64)	/* bytes */
 
 
-/** Current vertex program mode */
-enum vp_mode {
-   VP_NONE,   /**< fixed function */
-   VP_ARB     /**< ARB vertex program or GLSL vertex shader */
-};
-
-
 struct vbo_exec_eval1_map {
    struct gl_1d_map *map;
    GLuint sz;
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index d990fdf7a8..b11da09dd1 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -319,8 +319,8 @@ recalculate_input_bindings(struct gl_context *ctx)
    GLbitfield const_inputs = 0x0;
    GLuint i;
 
-   switch (get_program_mode(ctx)) {
-   case VP_NONE:
+   switch (get_vp_mode(ctx)) {
+   case VP_FF:
       /* When no vertex program is active (or the vertex program is generated
        * from fixed-function state).  We put the material values into the
        * generic slots.  This is the only situation where material values
@@ -351,7 +351,7 @@ recalculate_input_bindings(struct gl_context *ctx)
       }
       break;
 
-   case VP_ARB:
+   case VP_SHADER:
       /* There are no shaders in OpenGL ES 1.x, so this code path should be
        * impossible to reach.  The meta code is careful to not use shaders in
        * ES1.
diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c
index 653a05ad0f..5cea7fe879 100644
--- a/src/mesa/vbo/vbo_exec_draw.c
+++ b/src/mesa/vbo/vbo_exec_draw.c
@@ -185,8 +185,9 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
    }
 
    /* Overlay other active attributes */
-   switch (get_program_mode(exec->ctx)) {
-   case VP_NONE:
+   switch (get_vp_mode(exec->ctx)) {
+   case VP_FF:
+      /* Point the generic attributes at the legacy material values */
       for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
          assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
          exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
@@ -194,7 +195,7 @@ vbo_exec_bind_arrays(struct gl_context *ctx)
       }
       map = vbo->map_vp_none;
       break;
-   case VP_ARB:
+   case VP_SHADER:
       for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
          assert(VERT_ATTRIB_GENERIC(attr) < ARRAY_SIZE(exec->vtx.inputs));
          exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 353525644a..d78593c7fa 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -73,18 +73,28 @@ vbo_context(struct gl_context *ctx)
 
 
 /**
- * Return VP_x token to indicate whether we're running fixed-function
- * vertex transformation, an NV vertex program or ARB vertex program/shader.
+ * Current vertex processing mode: fixed function vs. shader.
+ * In reality, fixed function is probably implemented by a shader but that's
+ * not what we care about here.
+ */
+enum vp_mode {
+   VP_FF,    /**< legacy / fixed function */
+   VP_SHADER /**< ARB vertex program or GLSL vertex shader */
+};
+
+
+/**
+ * Get current vertex processing mode (fixed function vs. shader).
  */
 static inline enum vp_mode
-get_program_mode( struct gl_context *ctx )
+get_vp_mode( struct gl_context *ctx )
 {
    if (!ctx->VertexProgram._Current)
-      return VP_NONE;
+      return VP_FF;
    else if (ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram)
-      return VP_NONE;
+      return VP_FF;
    else
-      return VP_ARB;
+      return VP_SHADER;
 }
 
 
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 8cfe10bdc5..60405d54ea 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -164,15 +164,16 @@ bind_vertex_list(struct gl_context *ctx,
    }
 
    /* Overlay other active attributes */
-   switch (get_program_mode(ctx)) {
-   case VP_NONE:
+   switch (get_vp_mode(ctx)) {
+   case VP_FF:
+      /* Point the generic attributes at the legacy material values */
       for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
          save->inputs[VERT_ATTRIB_GENERIC(attr)] =
             &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
       }
       map = vbo->map_vp_none;
       break;
-   case VP_ARB:
+   case VP_SHADER:
       for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
          save->inputs[VERT_ATTRIB_GENERIC(attr)] =
             &vbo->currval[VBO_ATTRIB_GENERIC0+attr];




More information about the mesa-commit mailing list