diff options
author | Brian Paul <[email protected]> | 2018-01-19 21:03:07 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2018-01-29 08:35:14 -0700 |
commit | b080fc6199cd47ff2da632521b5baf52e747745f (patch) | |
tree | 7b23aa219059b09b6a6b0ddf4c2920fd032de834 | |
parent | 35e0ff5bd5cf4e8c5755b0f93cc739a4b68b91e1 (diff) |
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 <[email protected]>
-rw-r--r-- | src/mesa/vbo/vbo_exec.h | 7 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 6 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 7 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_private.h | 22 | ||||
-rw-r--r-- | 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 f1e3881b1f9..f02f4591fcc 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 d990fdf7a8d..b11da09dd1c 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 653a05ad0f4..5cea7fe8793 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 353525644a7..d78593c7fa2 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 8cfe10bdc55..60405d54ead 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]; |