aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/vbo
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
committermarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
commit0e3699334faf92f508b6c187a261548b656b0dd3 (patch)
tree28d7e84df7b54a3e6f85bf83e38efba937288fd3 /mesalib/src/mesa/vbo
parentc1194ccd395fdbb23c9ab56bc340ee20a5feeb82 (diff)
downloadvcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.gz
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.bz2
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.zip
fontconfig libX11 mesa pixman xserver git update 20 april 2012
Diffstat (limited to 'mesalib/src/mesa/vbo')
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.c13
-rw-r--r--mesalib/src/mesa/vbo/vbo_context.h10
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.c4
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec.h1
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c10
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c100
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_draw.c12
-rw-r--r--mesalib/src/mesa/vbo/vbo_save.c10
-rw-r--r--mesalib/src/mesa/vbo/vbo_save_draw.c10
9 files changed, 65 insertions, 105 deletions
diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c
index d83f2fd23..5f1c72bc1 100644
--- a/mesalib/src/mesa/vbo/vbo_context.c
+++ b/mesalib/src/mesa/vbo/vbo_context.c
@@ -47,7 +47,7 @@ static GLuint check_size( const GLfloat *attr )
static void init_legacy_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->legacy_currval;
+ struct gl_client_array *arrays = &vbo->currval[VBO_ATTRIB_POS];
GLuint i;
memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_FF_MAX);
@@ -77,7 +77,7 @@ static void init_legacy_currval(struct gl_context *ctx)
static void init_generic_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->generic_currval;
+ struct gl_client_array *arrays = &vbo->currval[VBO_ATTRIB_GENERIC0];
GLuint i;
memset(arrays, 0, sizeof(*arrays) * VERT_ATTRIB_GENERIC_MAX);
@@ -104,7 +104,8 @@ static void init_generic_currval(struct gl_context *ctx)
static void init_mat_currval(struct gl_context *ctx)
{
struct vbo_context *vbo = vbo_context(ctx);
- struct gl_client_array *arrays = vbo->mat_currval;
+ struct gl_client_array *arrays =
+ &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT];
GLuint i;
ASSERT(NR_MAT_ATTRIBS == MAT_ATTRIB_MAX);
@@ -160,12 +161,6 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx )
return GL_FALSE;
}
- /* TODO: remove these pointers.
- */
- vbo->legacy_currval = &vbo->currval[VBO_ATTRIB_POS];
- vbo->generic_currval = &vbo->currval[VBO_ATTRIB_GENERIC0];
- vbo->mat_currval = &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT];
-
init_legacy_currval( ctx );
init_generic_currval( ctx );
init_mat_currval( ctx );
diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h
index 1a1cc928b..b9a8affa5 100644
--- a/mesalib/src/mesa/vbo/vbo_context.h
+++ b/mesalib/src/mesa/vbo/vbo_context.h
@@ -61,20 +61,10 @@
struct vbo_context {
struct gl_client_array currval[VBO_ATTRIB_MAX];
- /* These point into the above. TODO: remove.
- */
- struct gl_client_array *legacy_currval;
- struct gl_client_array *generic_currval;
- struct gl_client_array *mat_currval;
-
/** Map VERT_ATTRIB_x to VBO_ATTRIB_y */
GLuint map_vp_none[VERT_ATTRIB_MAX];
GLuint map_vp_arb[VERT_ATTRIB_MAX];
- GLfloat *current[VBO_ATTRIB_MAX]; /* points into ctx->Current, ctx->Light.Material */
- GLfloat CurrentFloatEdgeFlag;
-
-
struct vbo_exec_context exec;
#if FEATURE_dlist
struct vbo_save_context save;
diff --git a/mesalib/src/mesa/vbo/vbo_exec.c b/mesalib/src/mesa/vbo/vbo_exec.c
index 05c3ec1ae..fd5e0f891 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.c
+++ b/mesalib/src/mesa/vbo/vbo_exec.c
@@ -85,6 +85,10 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ if (new_state & (_NEW_PROGRAM|_NEW_ARRAY)) {
+ exec->array.recalculate_inputs = GL_TRUE;
+ }
+
if (new_state & (_NEW_PROGRAM|_NEW_EVAL))
exec->eval.recalculate_maps = 1;
diff --git a/mesalib/src/mesa/vbo/vbo_exec.h b/mesalib/src/mesa/vbo/vbo_exec.h
index f6ede99cd..5cdf5ced9 100644
--- a/mesalib/src/mesa/vbo/vbo_exec.h
+++ b/mesalib/src/mesa/vbo/vbo_exec.h
@@ -141,6 +141,7 @@ struct vbo_exec_context
* programs:
*/
const struct gl_client_array *inputs[VERT_ATTRIB_MAX];
+ GLboolean recalculate_inputs;
} array;
/* Which flags to set in vbo_exec_BeginVertices() */
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index 306199067..3f9541089 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -1089,24 +1089,26 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec )
struct gl_client_array *arrays = exec->vtx.arrays;
unsigned i;
- memcpy(arrays, vbo->legacy_currval,
+ memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS],
VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
struct gl_client_array *array;
array = &arrays[VERT_ATTRIB_FF(i)];
array->BufferObj = NULL;
_mesa_reference_buffer_object(ctx, &arrays->BufferObj,
- vbo->legacy_currval[i].BufferObj);
+ vbo->currval[VBO_ATTRIB_POS+i].BufferObj);
}
- memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval,
+ memcpy(arrays + VERT_ATTRIB_GENERIC(0),
+ &vbo->currval[VBO_ATTRIB_GENERIC0],
VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
+
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
struct gl_client_array *array;
array = &arrays[VERT_ATTRIB_GENERIC(i)];
array->BufferObj = NULL;
_mesa_reference_buffer_object(ctx, &array->BufferObj,
- vbo->generic_currval[i].BufferObj);
+ vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj);
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index b0a4261e7..f95e062fb 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -420,13 +420,14 @@ recalculate_input_bindings(struct gl_context *ctx)
if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
- inputs[i] = &vbo->legacy_currval[i];
+ inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
const_inputs |= VERT_BIT(i);
}
}
for (i = 0; i < MAT_ATTRIB_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->mat_currval[i];
+ inputs[VERT_ATTRIB_GENERIC(i)] =
+ &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
@@ -434,7 +435,7 @@ recalculate_input_bindings(struct gl_context *ctx)
* slots:
*/
for (i = MAT_ATTRIB_MAX; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
@@ -459,7 +460,7 @@ recalculate_input_bindings(struct gl_context *ctx)
else if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
- inputs[i] = &vbo->legacy_currval[i];
+ inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
const_inputs |= VERT_BIT_FF(i);
}
}
@@ -468,7 +469,7 @@ recalculate_input_bindings(struct gl_context *ctx)
* slots:
*/
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
- inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
@@ -488,7 +489,7 @@ recalculate_input_bindings(struct gl_context *ctx)
else if (vertexAttrib[VERT_ATTRIB_POS].Enabled)
inputs[0] = &vertexAttrib[VERT_ATTRIB_POS];
else {
- inputs[0] = &vbo->legacy_currval[0];
+ inputs[0] = &vbo->currval[VBO_ATTRIB_POS];
const_inputs |= VERT_BIT_POS;
}
@@ -496,7 +497,7 @@ recalculate_input_bindings(struct gl_context *ctx)
if (vertexAttrib[VERT_ATTRIB_FF(i)].Enabled)
inputs[i] = &vertexAttrib[VERT_ATTRIB_FF(i)];
else {
- inputs[i] = &vbo->legacy_currval[i];
+ inputs[i] = &vbo->currval[VBO_ATTRIB_POS+i];
const_inputs |= VERT_BIT_FF(i);
}
}
@@ -505,7 +506,7 @@ recalculate_input_bindings(struct gl_context *ctx)
if (vertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled)
inputs[VERT_ATTRIB_GENERIC(i)] = &vertexAttrib[VERT_ATTRIB_GENERIC(i)];
else {
- inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->generic_currval[i];
+ inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i];
const_inputs |= VERT_BIT_GENERIC(i);
}
}
@@ -523,18 +524,31 @@ recalculate_input_bindings(struct gl_context *ctx)
* Examine the enabled vertex arrays to set the exec->array.inputs[] values.
* These will point to the arrays to actually use for drawing. Some will
* be user-provided arrays, other will be zero-stride const-valued arrays.
- * Note that this might set the _NEW_ARRAY dirty flag so state validation
- * must be done after this call.
+ * Note that this might set the _NEW_VARYING_VP_INPUTS dirty flag so state
+ * validation must be done after this call.
*/
void
vbo_bind_arrays(struct gl_context *ctx)
{
- if (!ctx->Array.RebindArrays) {
- return;
- }
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
+
+ vbo_draw_method(exec, DRAW_ARRAYS);
+
+ if (exec->array.recalculate_inputs) {
+ recalculate_input_bindings(ctx);
+
+ /* Again... because we may have changed the bitmask of per-vertex varying
+ * attributes. If we regenerate the fixed-function vertex program now
+ * we may be able to prune down the number of vertex attributes which we
+ * need in the shader.
+ */
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
- recalculate_input_bindings(ctx);
- ctx->Array.RebindArrays = GL_FALSE;
+ exec->array.recalculate_inputs = GL_FALSE;
+ }
}
@@ -554,16 +568,6 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
vbo_bind_arrays(ctx);
- vbo_draw_method(exec, DRAW_ARRAYS);
-
- /* Again... because we may have changed the bitmask of per-vertex varying
- * attributes. If we regenerate the fixed-function vertex program now
- * we may be able to prune down the number of vertex attributes which we
- * need in the shader.
- */
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
/* init most fields to zero */
memset(prim, 0, sizeof(prim));
prim[0].begin = 1;
@@ -641,10 +645,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
FLUSH_CURRENT( ctx, 0 );
- if (!_mesa_valid_to_render(ctx, "glDrawArrays")) {
- return;
- }
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -674,10 +674,6 @@ vbo_exec_DrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
FLUSH_CURRENT( ctx, 0 );
- if (!_mesa_valid_to_render(ctx, "glDrawArraysInstanced")) {
- return;
- }
-
if (0)
check_draw_arrays_data(ctx, start, count);
@@ -767,17 +763,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (!_mesa_valid_to_render(ctx, "glDraw[Range]Elements")) {
- return;
- }
-
- vbo_bind_arrays( ctx );
-
- vbo_draw_method(exec, DRAW_ARRAYS);
-
- /* check for dirty state again */
- if (ctx->NewState)
- _mesa_update_state( ctx );
+ vbo_bind_arrays(ctx);
ib.count = count;
ib.type = type;
@@ -1053,25 +1039,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (!_mesa_valid_to_render(ctx, "glMultiDrawElements")) {
- return;
- }
-
prim = calloc(1, primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
return;
}
- /* Decide if we can do this all as one set of primitives sharing the
- * same index buffer, or if we have to reset the index pointer per
- * primitive.
- */
- vbo_bind_arrays( ctx );
-
- /* check for dirty state again */
- if (ctx->NewState)
- _mesa_update_state( ctx );
+ vbo_bind_arrays(ctx);
min_index_ptr = (uintptr_t)indices[0];
max_index_ptr = 0;
@@ -1217,14 +1191,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
vbo_bind_arrays(ctx);
- /* Again... because we may have changed the bitmask of per-vertex varying
- * attributes. If we regenerate the fixed-function vertex program now
- * we may be able to prune down the number of vertex attributes which we
- * need in the shader.
- */
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
/* init most fields to zero */
memset(prim, 0, sizeof(prim));
prim[0].begin = 1;
@@ -1266,10 +1232,6 @@ vbo_exec_DrawTransformFeedback(GLenum mode, GLuint name)
FLUSH_CURRENT(ctx, 0);
- if (!_mesa_valid_to_render(ctx, "glDrawTransformFeedback")) {
- return;
- }
-
vbo_draw_transform_feedback(ctx, mode, obj, 1);
}
diff --git a/mesalib/src/mesa/vbo/vbo_exec_draw.c b/mesalib/src/mesa/vbo/vbo_exec_draw.c
index dd5363beb..5cc6586b3 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_draw.c
@@ -174,11 +174,12 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
switch (get_program_mode(exec->ctx)) {
case VP_NONE:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
- exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
+ exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
- exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr];
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
map = vbo->map_vp_none;
break;
@@ -189,11 +190,12 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
- exec->vtx.inputs[attr] = &vbo->legacy_currval[attr];
+ exec->vtx.inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
ASSERT(VERT_ATTRIB_GENERIC(attr) < Elements(exec->vtx.inputs));
- exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];
+ exec->vtx.inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
}
map = vbo->map_vp_arb;
@@ -388,7 +390,7 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean keepUnmapped)
if (exec->vtx.copied.nr != exec->vtx.vert_count) {
struct gl_context *ctx = exec->ctx;
- /* Before the update_state() as this may raise _NEW_ARRAY
+ /* Before the update_state() as this may raise _NEW_VARYING_VP_INPUTS
* from _mesa_set_varying_vp_inputs().
*/
vbo_exec_bind_arrays( ctx );
diff --git a/mesalib/src/mesa/vbo/vbo_save.c b/mesalib/src/mesa/vbo/vbo_save.c
index e02706191..040c9b7a9 100644
--- a/mesalib/src/mesa/vbo/vbo_save.c
+++ b/mesalib/src/mesa/vbo/vbo_save.c
@@ -63,24 +63,26 @@ void vbo_save_init( struct gl_context *ctx )
struct gl_client_array *arrays = save->arrays;
unsigned i;
- memcpy(arrays, vbo->legacy_currval,
+ memcpy(arrays, &vbo->currval[VBO_ATTRIB_POS],
VERT_ATTRIB_FF_MAX * sizeof(arrays[0]));
for (i = 0; i < VERT_ATTRIB_FF_MAX; ++i) {
struct gl_client_array *array;
array = &arrays[VERT_ATTRIB_FF(i)];
array->BufferObj = NULL;
_mesa_reference_buffer_object(ctx, &arrays->BufferObj,
- vbo->legacy_currval[i].BufferObj);
+ vbo->currval[VBO_ATTRIB_POS+i].BufferObj);
}
- memcpy(arrays + VERT_ATTRIB_GENERIC(0), vbo->generic_currval,
+ memcpy(arrays + VERT_ATTRIB_GENERIC(0),
+ &vbo->currval[VBO_ATTRIB_GENERIC0],
VERT_ATTRIB_GENERIC_MAX * sizeof(arrays[0]));
+
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; ++i) {
struct gl_client_array *array;
array = &arrays[VERT_ATTRIB_GENERIC(i)];
array->BufferObj = NULL;
_mesa_reference_buffer_object(ctx, &array->BufferObj,
- vbo->generic_currval[i].BufferObj);
+ vbo->currval[VBO_ATTRIB_GENERIC0+i].BufferObj);
}
}
diff --git a/mesalib/src/mesa/vbo/vbo_save_draw.c b/mesalib/src/mesa/vbo/vbo_save_draw.c
index b8e1e7883..57186de64 100644
--- a/mesalib/src/mesa/vbo/vbo_save_draw.c
+++ b/mesalib/src/mesa/vbo/vbo_save_draw.c
@@ -147,10 +147,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
switch (get_program_mode(ctx)) {
case VP_NONE:
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
- save->inputs[attr] = &vbo->legacy_currval[attr];
+ save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
- save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr];
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_MAT_FRONT_AMBIENT+attr];
}
map = vbo->map_vp_none;
break;
@@ -161,10 +162,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
- save->inputs[attr] = &vbo->legacy_currval[attr];
+ save->inputs[attr] = &vbo->currval[VBO_ATTRIB_POS+attr];
}
for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
- save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] =
+ &vbo->currval[VBO_ATTRIB_GENERIC0+attr];
}
map = vbo->map_vp_arb;