@ echo "running $(MKDEP)"
@ touch depend
@$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
- > /dev/null
+ > /dev/null 2>/dev/null
subdirs:
obj->Vertex.StrideB = 0;
obj->Vertex.Ptr = NULL;
obj->Vertex.Enabled = GL_FALSE;
- obj->Vertex.Flags = CA_CLIENT_DATA;
obj->Normal.Type = GL_FLOAT;
obj->Normal.Stride = 0;
obj->Normal.StrideB = 0;
obj->Normal.Ptr = NULL;
obj->Normal.Enabled = GL_FALSE;
- obj->Normal.Flags = CA_CLIENT_DATA;
obj->Color.Size = 4;
obj->Color.Type = GL_FLOAT;
obj->Color.Stride = 0;
obj->Color.StrideB = 0;
obj->Color.Ptr = NULL;
obj->Color.Enabled = GL_FALSE;
- obj->Color.Flags = CA_CLIENT_DATA;
obj->SecondaryColor.Size = 4;
obj->SecondaryColor.Type = GL_FLOAT;
obj->SecondaryColor.Stride = 0;
obj->SecondaryColor.StrideB = 0;
obj->SecondaryColor.Ptr = NULL;
obj->SecondaryColor.Enabled = GL_FALSE;
- obj->SecondaryColor.Flags = CA_CLIENT_DATA;
obj->FogCoord.Size = 1;
obj->FogCoord.Type = GL_FLOAT;
obj->FogCoord.Stride = 0;
obj->FogCoord.StrideB = 0;
obj->FogCoord.Ptr = NULL;
obj->FogCoord.Enabled = GL_FALSE;
- obj->FogCoord.Flags = CA_CLIENT_DATA;
obj->Index.Type = GL_FLOAT;
obj->Index.Stride = 0;
obj->Index.StrideB = 0;
obj->Index.Ptr = NULL;
obj->Index.Enabled = GL_FALSE;
- obj->Index.Flags = CA_CLIENT_DATA;
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
obj->TexCoord[i].Size = 4;
obj->TexCoord[i].Type = GL_FLOAT;
obj->TexCoord[i].StrideB = 0;
obj->TexCoord[i].Ptr = NULL;
obj->TexCoord[i].Enabled = GL_FALSE;
- obj->TexCoord[i].Flags = CA_CLIENT_DATA;
}
obj->EdgeFlag.Stride = 0;
obj->EdgeFlag.StrideB = 0;
obj->EdgeFlag.Ptr = NULL;
obj->EdgeFlag.Enabled = GL_FALSE;
- obj->EdgeFlag.Flags = CA_CLIENT_DATA;
for (i = 0; i < VERT_ATTRIB_MAX; i++) {
obj->VertexAttrib[i].Size = 4;
obj->VertexAttrib[i].Type = GL_FLOAT;
obj->VertexAttrib[i].Ptr = NULL;
obj->VertexAttrib[i].Enabled = GL_FALSE;
obj->VertexAttrib[i].Normalized = GL_FALSE;
- obj->VertexAttrib[i].Flags = CA_CLIENT_DATA;
}
#if FEATURE_ARB_vertex_buffer_object
client_state( GLcontext *ctx, GLenum cap, GLboolean state )
{
GLuint flag;
- GLuint *var;
+ GLboolean *var;
switch (cap) {
case GL_VERTEX_ARRAY:
};
-#define CA_CLIENT_DATA 0x1 /**< Data not allocated by mesa */
-
/**
* Client vertex array attributes
GLsizei Stride; /**< user-specified stride */
GLsizei StrideB; /**< actual stride in bytes */
const GLubyte *Ptr; /**< Points to array data */
- GLbitfield Enabled; /**< one of the _NEW_ARRAY_ bits */
+ GLboolean Enabled; /**< Enabled flag is a boolean */
GLboolean Normalized; /**< GL_ARB_vertex_program */
/**< GL_ARB_vertex_buffer_object */
struct gl_buffer_object *BufferObj;
GLuint _MaxElement;
-
- GLbitfield Flags;
};
struct gl_client_array SecondaryColor;
struct gl_client_array FogCoord;
struct gl_client_array Index;
- struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
struct gl_client_array EdgeFlag;
+ struct gl_client_array TexCoord[MAX_TEXTURE_COORD_UNITS];
/*@}*/
/** Generic arrays for vertex programs/shaders */
#define _NEW_ARRAY_TEXCOORD_5 VERT_BIT_TEX5
#define _NEW_ARRAY_TEXCOORD_6 VERT_BIT_TEX6
#define _NEW_ARRAY_TEXCOORD_7 VERT_BIT_TEX7
-#define _NEW_ARRAY_ATTRIB_0 0x10000 /* start at bit 16 */
+#define _NEW_ARRAY_ATTRIB_0 VERT_BIT_GENERIC0 /* start at bit 16 */
#define _NEW_ARRAY_ALL 0xffffffff
math/m_vector.c \
math/m_xform.c
-ARRAY_CACHE_SOURCES = \
- array_cache/ac_context.c \
- array_cache/ac_import.c
-
SWRAST_SOURCES = \
swrast/s_aaline.c \
swrast/s_aatriangle.c \
swrast_setup/ss_triangle.c
TNL_SOURCES = \
- tnl/t_array_api.c \
- tnl/t_array_import.c \
tnl/t_context.c \
tnl/t_pipeline.c \
- tnl/t_save_api.c \
- tnl/t_save_loopback.c \
- tnl/t_save_playback.c \
+ tnl/t_draw.c \
tnl/t_vb_arbprogram.c \
tnl/t_vb_arbprogram_sse.c \
tnl/t_vb_arbshader.c\
tnl/t_vp_build.c \
tnl/t_vertex.c \
tnl/t_vertex_sse.c \
- tnl/t_vertex_generic.c \
- tnl/t_vtx_api.c \
- tnl/t_vtx_generic.c \
- tnl/t_vtx_x86.c \
- tnl/t_vtx_eval.c \
- tnl/t_vtx_exec.c
+ tnl/t_vertex_generic.c
+VBO_SOURCES = \
+ vbo/vbo_context.c \
+ vbo/vbo_exec.c \
+ vbo/vbo_exec_api.c \
+ vbo/vbo_exec_array.c \
+ vbo/vbo_exec_draw.c \
+ vbo/vbo_exec_eval.c \
+ vbo/vbo_save.c \
+ vbo/vbo_save_api.c \
+ vbo/vbo_save_draw.c \
+ vbo/vbo_save_loopback.c
SHADER_SOURCES = \
SOLO_SOURCES = \
$(MAIN_SOURCES) \
$(MATH_SOURCES) \
- $(ARRAY_CACHE_SOURCES) \
+ $(VBO_SOURCES) \
$(TNL_SOURCES) \
$(SHADER_SOURCES) \
$(SWRAST_SOURCES) \
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
+ tnl->nr_blocks = 0;
+
return GL_TRUE;
}
GLuint min_index,
GLuint max_index );
+
+
+#define NR_LEGACY_ATTRIBS 16
+#define NR_GENERIC_ATTRIBS 16
+#define NR_MAT_ATTRIBS 12
+
+static void init_legacy_currval(GLcontext *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->legacy_currval;
+ GLuint i;
+
+ memset(arrays, 0, sizeof(*arrays) * NR_LEGACY_ATTRIBS);
+
+ /* Set up a constant (StrideB == 0) array for each current
+ * attribute:
+ */
+ for (i = 0; i < NR_LEGACY_ATTRIBS; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ switch (i) {
+ case VBO_ATTRIB_EDGEFLAG:
+ cl->Type = GL_UNSIGNED_BYTE;
+ cl->Ptr = (const void *)&ctx->Current.EdgeFlag;
+ break;
+ case VBO_ATTRIB_INDEX:
+ cl->Type = GL_FLOAT;
+ cl->Ptr = (const void *)&ctx->Current.Index;
+ break;
+ default:
+ cl->Type = GL_FLOAT;
+ cl->Ptr = (const void *)ctx->Current.Attrib[i];
+ break;
+ }
+
+ /* This will have to be determined at runtime:
+ */
+ cl->Size = 1;
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->BufferObj = ctx->Array.NullBufferObj;
+ }
+}
+
+
+static void init_generic_currval(GLcontext *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->generic_currval;
+ GLuint i;
+
+ memset(arrays, 0, sizeof(*arrays) * NR_GENERIC_ATTRIBS);
+
+ for (i = 0; i < NR_GENERIC_ATTRIBS; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ /* This will have to be determined at runtime:
+ */
+ cl->Size = 1;
+
+ cl->Type = GL_FLOAT;
+ cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->BufferObj = ctx->Array.NullBufferObj;
+ }
+}
+
+
+static void init_mat_currval(GLcontext *ctx)
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct gl_client_array *arrays = vbo->mat_currval;
+ GLuint i;
+
+ memset(arrays, 0, sizeof(*arrays) * NR_GENERIC_ATTRIBS);
+
+ /* Set up a constant (StrideB == 0) array for each current
+ * attribute:
+ */
+ for (i = 0; i < NR_GENERIC_ATTRIBS; i++) {
+ struct gl_client_array *cl = &arrays[i];
+
+ /* Size is fixed for the material attributes, for others will
+ * be determined at runtime:
+ */
+ switch (i - VERT_ATTRIB_GENERIC0) {
+ case MAT_ATTRIB_FRONT_SHININESS:
+ case MAT_ATTRIB_BACK_SHININESS:
+ cl->Size = 1;
+ break;
+ case MAT_ATTRIB_FRONT_INDEXES:
+ case MAT_ATTRIB_BACK_INDEXES:
+ cl->Size = 3;
+ break;
+ default:
+ cl->Size = 4;
+ break;
+ }
+
+ if (i < MAT_ATTRIB_MAX)
+ cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
+ else
+ cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
+
+ cl->Type = GL_FLOAT;
+ cl->Stride = 0;
+ cl->StrideB = 0;
+ cl->Enabled = 1;
+ cl->BufferObj = ctx->Array.NullBufferObj;
+ }
+}
+
+
+
GLboolean _vbo_CreateContext( GLcontext *ctx )
{
struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
vbo_exec_init( ctx );
vbo_save_init( ctx );
+
+ init_legacy_currval( ctx );
+ init_generic_currval( ctx );
+ init_mat_currval( ctx );
+
+ /* Build mappings from VERT_ATTRIB -> VBO_ATTRIB depending on type
+ * of vertex program active.
+ */
+ {
+ GLuint i;
+
+ /* When no vertex program, pull in the material attributes in
+ * the 16..32 generic range.
+ */
+ for (i = 0; i < 16; i++)
+ vbo->map_vp_none[i] = i;
+ for (i = 0; i < 12; i++)
+ vbo->map_vp_none[16+i] = VBO_ATTRIB_MAT_FRONT_AMBIENT + i;
+ for (i = 0; i < 4; i++)
+ vbo->map_vp_none[28+i] = i;
+
+ for (i = 0; i < VERT_ATTRIB_MAX; i++)
+ vbo->map_vp_arb[i] = i;
+ }
+
+
/* By default:
*/
vbo->draw_prims = _tnl_draw_prims;
FREE(vbo_context(ctx));
ctx->swtnl_im = NULL;
-
}
struct vbo_context {
+ struct gl_client_array legacy_currval[16];
+ struct gl_client_array generic_currval[16];
+ struct gl_client_array mat_currval[16];
+
+ GLuint map_vp_none[32];
+ GLuint map_vp_arb[32];
+
struct vbo_exec_context exec;
struct vbo_save_context save;
#include "vbo_context.h"
-#define NR_LEGACY_ATTRIBS 16
-#define NR_GENERIC_ATTRIBS 16
-#define NR_MAT_ATTRIBS 12
-
-static void init_legacy_currval(GLcontext *ctx)
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
- struct gl_client_array *arrays = exec->legacy_currval;
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * NR_LEGACY_ATTRIBS);
-
- /* Set up a constant (StrideB == 0) array for each current
- * attribute:
- */
- for (i = 0; i < NR_LEGACY_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- switch (i) {
- case VBO_ATTRIB_EDGEFLAG:
- cl->Type = GL_UNSIGNED_BYTE;
- cl->Ptr = (const void *)&ctx->Current.EdgeFlag;
- break;
- case VBO_ATTRIB_INDEX:
- cl->Type = GL_FLOAT;
- cl->Ptr = (const void *)&ctx->Current.Index;
- break;
- default:
- cl->Type = GL_FLOAT;
- cl->Ptr = (const void *)ctx->Current.Attrib[i];
- break;
- }
-
- /* This will have to be determined at runtime:
- */
- cl->Size = 1;
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->BufferObj = ctx->Array.NullBufferObj;
- }
-}
-
-
-static void init_generic_currval(GLcontext *ctx)
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
- struct gl_client_array *arrays = exec->generic_currval;
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * NR_GENERIC_ATTRIBS);
-
- for (i = 0; i < NR_GENERIC_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- /* This will have to be determined at runtime:
- */
- cl->Size = 1;
-
- cl->Type = GL_FLOAT;
- cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->BufferObj = ctx->Array.NullBufferObj;
- }
-}
-
-
-static void init_mat_currval(GLcontext *ctx)
-{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
- struct gl_client_array *arrays = exec->mat_currval;
- GLuint i;
-
- memset(arrays, 0, sizeof(*arrays) * NR_GENERIC_ATTRIBS);
-
- /* Set up a constant (StrideB == 0) array for each current
- * attribute:
- */
- for (i = 0; i < NR_GENERIC_ATTRIBS; i++) {
- struct gl_client_array *cl = &arrays[i];
-
- /* Size is fixed for the material attributes, for others will
- * be determined at runtime:
- */
- switch (i - VERT_ATTRIB_GENERIC0) {
- case MAT_ATTRIB_FRONT_SHININESS:
- case MAT_ATTRIB_BACK_SHININESS:
- cl->Size = 1;
- break;
- case MAT_ATTRIB_FRONT_INDEXES:
- case MAT_ATTRIB_BACK_INDEXES:
- cl->Size = 3;
- break;
- default:
- cl->Size = 4;
- break;
- }
-
- if (i < MAT_ATTRIB_MAX)
- cl->Ptr = (const void *)ctx->Light.Material.Attrib[i];
- else
- cl->Ptr = (const void *)ctx->Current.Attrib[VERT_ATTRIB_GENERIC0 + i];
-
- cl->Type = GL_FLOAT;
- cl->Stride = 0;
- cl->StrideB = 0;
- cl->Enabled = 1;
- cl->BufferObj = ctx->Array.NullBufferObj;
- }
-}
-
void vbo_exec_init( GLcontext *ctx )
{
vbo_exec_vtx_init( exec );
vbo_exec_array_init( exec );
- init_legacy_currval( ctx );
- init_generic_currval( ctx );
- init_mat_currval( ctx );
-
ctx->Driver.NeedFlush = 0;
ctx->Driver.CurrentExecPrimitive = PRIM_OUTSIDE_BEGIN_END;
ctx->Driver.FlushVertices = vbo_exec_FlushVertices;
GLcontext *ctx;
GLvertexformat vtxfmt;
- struct gl_client_array legacy_currval[16];
- struct gl_client_array generic_currval[16];
- struct gl_client_array mat_currval[16];
-
struct {
struct gl_buffer_object *bufferobj;
GLubyte *buffer_map;
static void recalculate_input_bindings( GLcontext *ctx )
{
- struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
const struct gl_client_array **inputs = &exec->array.inputs[0];
GLuint i;
if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else
- inputs[i] = &exec->legacy_currval[i];
+ inputs[i] = &vbo->legacy_currval[i];
}
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC0 + i] = &exec->mat_currval[i];
+ inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->mat_currval[i];
}
break;
case VP_NV:
else if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else
- inputs[i] = &exec->legacy_currval[i];
+ inputs[i] = &vbo->legacy_currval[i];
}
break;
case VP_ARB:
else if (exec->array.legacy_array[0]->Enabled)
inputs[0] = exec->array.legacy_array[0];
else
- inputs[0] = &exec->legacy_currval[0];
+ inputs[0] = &vbo->legacy_currval[0];
for (i = 1; i <= VERT_ATTRIB_TEX7; i++) {
if (exec->array.legacy_array[i]->Enabled)
inputs[i] = exec->array.legacy_array[i];
else
- inputs[i] = &exec->legacy_currval[i];
+ inputs[i] = &vbo->legacy_currval[i];
}
for (i = 0; i < 16; i++) {
if (exec->array.generic_array[0]->Enabled)
inputs[VERT_ATTRIB_GENERIC0 + i] = exec->array.generic_array[i];
else
- inputs[VERT_ATTRIB_GENERIC0 + i] = &exec->generic_currval[i];
+ inputs[VERT_ATTRIB_GENERIC0 + i] = &vbo->generic_currval[i];
}
break;
}
}
+
/* TODO: populate these as the vertex is defined:
*/
-static void vbo_exec_bind_arrays( struct vbo_exec_context *exec )
+static void vbo_exec_bind_arrays( GLcontext *ctx )
{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
struct gl_client_array *arrays = exec->vtx.arrays;
GLuint count = exec->vtx.vert_count;
GLubyte *data = exec->vtx.buffer_map;
+ const GLuint *map;
GLuint attr;
- memcpy(arrays, exec->legacy_currval, 16 * sizeof(arrays[0]));
- memcpy(arrays + 16, exec->mat_currval, 16 * sizeof(arrays[0]));
+ /* Install the default (ie Current) attributes first, then overlay
+ * all active ones.
+ */
+ switch (get_program_mode(exec->ctx)) {
+ case VP_NONE:
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->mat_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_none;
+ break;
+ case VP_NV:
+ case VP_ARB:
+ /* The aliasing of attributes for NV vertex programs has already
+ * occurred. NV vertex programs cannot access material values,
+ * nor attributes greater than VERT_ATTRIB_TEX7.
+ */
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_arb;
+ break;
+ }
/* Make all active attributes (including edgeflag) available as
* arrays of floats.
*/
- for (attr = 0; attr < VBO_ATTRIB_MAX ; attr++) {
- if (exec->vtx.attrsz[attr]) {
+ for (attr = 0; attr < VERT_ATTRIB_MAX ; attr++) {
+ GLuint src = map[attr];
+
+ if (exec->vtx.attrsz[src]) {
arrays[attr].Ptr = (void *)data;
- arrays[attr].Size = exec->vtx.attrsz[attr];
+ arrays[attr].Size = exec->vtx.attrsz[src];
arrays[attr].StrideB = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Stride = exec->vtx.vertex_size * sizeof(GLfloat);
arrays[attr].Type = GL_FLOAT;
if (exec->vtx.copied.nr != exec->vtx.vert_count) {
GLcontext *ctx = exec->ctx;
- vbo_exec_bind_arrays( exec );
+ vbo_exec_bind_arrays( ctx );
vbo_context(ctx)->draw_prims( ctx,
exec->vtx.inputs,
/* Treat the vertex storage as a VBO, define vertex arrays pointing
* into it:
*/
-static void vbo_bind_vertex_list( struct vbo_save_context *save,
+static void vbo_bind_vertex_list( GLcontext *ctx,
const struct vbo_save_vertex_list *node )
{
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_save_context *save = &vbo->save;
struct gl_client_array *arrays = save->arrays;
GLuint data = node->buffer_offset;
+ const GLuint *map;
GLuint attr;
- memset(arrays, 0, VBO_ATTRIB_MAX * sizeof(arrays[0]));
+ /* Install the default (ie Current) attributes first, then overlay
+ * all active ones.
+ */
+ switch (get_program_mode(ctx)) {
+ case VP_NONE:
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->mat_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_none;
+ break;
+ case VP_NV:
+ case VP_ARB:
+ /* The aliasing of attributes for NV vertex programs has already
+ * occurred. NV vertex programs cannot access material values,
+ * nor attributes greater than VERT_ATTRIB_TEX7.
+ */
+ memcpy(arrays, vbo->legacy_currval, 16 * sizeof(arrays[0]));
+ memcpy(arrays + 16, vbo->generic_currval, 16 * sizeof(arrays[0]));
+ map = vbo->map_vp_arb;
+ break;
+ }
for (attr = 0; attr <= VBO_ATTRIB_INDEX; attr++) {
if (node->attrsz[attr]) {
return;
}
- vbo_bind_vertex_list( save, node );
+ vbo_bind_vertex_list( ctx, node );
vbo_context(ctx)->draw_prims( ctx,
save->inputs,