/* Miscellaneous */
ctx->NewState = _NEW_ALL;
+ ctx->NewDriverState = ~0;
ctx->ErrorValue = (GLenum) GL_NO_ERROR;
ctx->ResetStatus = (GLenum) GL_NO_ERROR;
ctx->varying_vp_inputs = VERT_BIT_ALL;
/* XXX FIXME: Call callbacks?
*/
dst->NewState = _NEW_ALL;
+ dst->NewDriverState = ~0;
}
#endif
API_OPENGLES2
} gl_api;
+/**
+ * Driver-specific state flags.
+ *
+ * These are or'd with gl_context::NewDriverState to notify a driver about
+ * a state change. The driver sets the flags at context creation and
+ * the meaning of the bits set is opaque to core Mesa.
+ */
+struct gl_driver_flags
+{
+ GLbitfield NewArray; /**< Vertex array state */
+};
/**
* Mesa rendering context.
GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */
GLbitfield NewState; /**< bitwise-or of _NEW_* flags */
+ GLbitfield NewDriverState;/**< bitwise-or of flags from DriverFlags */
+
+ struct gl_driver_flags DriverFlags;
GLboolean ViewportInitialized; /**< has viewport size been initialized? */
*/
rs->array[0].Ptr = (GLubyte *) v;
- /* draw the point */
+ /* Draw the point.
+ *
+ * Don't set DriverFlags.NewArray.
+ * st_feedback_draw_vbo doesn't check for that flag. */
ctx->Array._DrawArrays = rs->arrays;
st_feedback_draw_vbo(ctx, &rs->prim, 1, NULL, GL_TRUE, 0, 1,
NULL);
return st;
}
+static void st_init_driver_flags(struct gl_driver_flags *f)
+{
+ f->NewArray = ST_NEW_VERTEX_ARRAYS;
+}
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
return NULL;
}
+ st_init_driver_flags(&ctx->DriverFlags);
+
/* XXX: need a capability bit in gallium to query if the pipe
* driver prefers DP4 or MUL/MAD for vertex transformation.
*/
#define ST_NEW_FRAMEBUFFER (1 << 3)
#define ST_NEW_EDGEFLAGS_DATA (1 << 4)
#define ST_NEW_GEOMETRY_PROGRAM (1 << 5)
+#define ST_NEW_VERTEX_ARRAYS (1 << 6)
struct st_state_flags {
const struct gl_client_array **arrays = ctx->Array._DrawArrays;
unsigned i, num_instances = 1;
unsigned max_index_plus_base;
- GLboolean new_array =
- st->dirty.st &&
- (st->dirty.mesa & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0;
+ GLboolean new_array;
/* Mesa core state should have been validated already */
assert(ctx->NewState == 0x0);
+ /* Get Mesa driver state. */
+ st->dirty.st |= ctx->NewDriverState;
+ ctx->NewDriverState = 0;
+
+ new_array =
+ (st->dirty.st & (ST_NEW_VERTEX_ARRAYS | ST_NEW_VERTEX_PROGRAM)) ||
+ (st->dirty.mesa & (_NEW_PROGRAM | _NEW_BUFFER_OBJECT)) != 0;
+
if (ib) {
int max_base_vertex = 0;
ASSERT(0);
}
- ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
vbo->last_draw_method = method;
}
}
}
_mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) );
- ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
}
}
_mesa_set_varying_vp_inputs( ctx, varying_inputs );
- ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
}
/* Re-issue the draw call.
*/
ctx->Array._DrawArrays = tmp_array_pointers;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
draw( ctx,
prim,
NULL );
ctx->Array._DrawArrays = saved_arrays;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
if (tmp_indices)
free(tmp_indices);
}
_mesa_set_varying_vp_inputs( ctx, varying_inputs );
- ctx->Driver.UpdateState(ctx, _NEW_ARRAY);
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
}
#endif
ctx->Array._DrawArrays = copy->dstarray_ptr;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
copy->draw( ctx,
copy->dstprim,
NULL );
ctx->Array._DrawArrays = saved_arrays;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
/* Reset all pointers:
*/
assert(split->max_index >= split->min_index);
ctx->Array._DrawArrays = split->array;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
split->draw(ctx,
split->dstprim,
NULL);
ctx->Array._DrawArrays = saved_arrays;
+ ctx->NewDriverState |= ctx->DriverFlags.NewArray;
split->dstprim_nr = 0;
split->min_index = ~0;