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@web.de>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)] =
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user