#include "main/bufferobj.h"
#include "main/context.h"
#include "main/imports.h"
+#include "main/mfeatures.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/light.h"
else
offset = node->buffer_offset;
- ctx->Driver.GetBufferSubData( ctx, 0, offset,
+ ctx->Driver.GetBufferSubData( ctx, offset,
node->vertex_size * sizeof(GLfloat),
data, node->vertex_store->bufferobj );
memcpy(current, tmp, 4 * sizeof(GLfloat));
vbo->currval[i].Size = node->attrsz[i];
+ assert(vbo->currval[i].Type == GL_FLOAT);
+ vbo->currval[i]._ElementSize = vbo->currval[i].Size * sizeof(GLfloat);
if (i >= VBO_ATTRIB_FIRST_MATERIAL &&
i <= VBO_ATTRIB_LAST_MATERIAL)
const GLuint *map;
GLuint attr;
GLubyte node_attrsz[VBO_ATTRIB_MAX]; /* copy of node->attrsz[] */
- GLbitfield varying_inputs = 0x0;
+ GLbitfield64 varying_inputs = 0x0;
memcpy(node_attrsz, node->attrsz, sizeof(node->attrsz));
*/
switch (get_program_mode(ctx)) {
case VP_NONE:
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->legacy_currval[attr];
}
for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) {
- save->inputs[attr + 16] = &vbo->mat_currval[attr];
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->mat_currval[attr];
}
map = vbo->map_vp_none;
break;
* occurred. NV vertex programs cannot access material values,
* nor attributes greater than VERT_ATTRIB_TEX7.
*/
- for (attr = 0; attr < 16; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_FF_MAX; attr++) {
save->inputs[attr] = &vbo->legacy_currval[attr];
- save->inputs[attr + 16] = &vbo->generic_currval[attr];
+ }
+ for (attr = 0; attr < VERT_ATTRIB_GENERIC_MAX; attr++) {
+ save->inputs[VERT_ATTRIB_GENERIC(attr)] = &vbo->generic_currval[attr];
}
map = vbo->map_vp_arb;
*/
if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
- save->inputs[16] = save->inputs[0];
- node_attrsz[16] = node_attrsz[0];
+ save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
+ node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
node_attrsz[0] = 0;
}
break;
arrays[attr].Type = GL_FLOAT;
arrays[attr].Format = GL_RGBA;
arrays[attr].Enabled = 1;
+ arrays[attr]._ElementSize = arrays[attr].Size * sizeof(GLfloat);
_mesa_reference_buffer_object(ctx,
&arrays[attr].BufferObj,
node->vertex_store->bufferobj);
assert(arrays[attr].BufferObj->Name);
buffer_offset += node->attrsz[src] * sizeof(GLfloat);
- varying_inputs |= 1<<attr;
+ varying_inputs |= VERT_BIT(attr);
+ ctx->NewState |= _NEW_ARRAY;
}
}
vbo_save_loopback_vertex_list(struct gl_context *ctx,
const struct vbo_save_vertex_list *list)
{
- const char *buffer = ctx->Driver.MapBuffer(ctx,
- GL_ARRAY_BUFFER_ARB,
- GL_READ_ONLY, /* ? */
- list->vertex_store->bufferobj);
+ const char *buffer =
+ ctx->Driver.MapBufferRange(ctx, 0,
+ list->vertex_store->bufferobj->Size,
+ GL_MAP_READ_BIT, /* ? */
+ list->vertex_store->bufferobj);
vbo_loopback_vertex_list(ctx,
(const GLfloat *)(buffer + list->buffer_offset),
list->wrap_count,
list->vertex_size);
- ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB,
- list->vertex_store->bufferobj);
+ ctx->Driver.UnmapBuffer(ctx, list->vertex_store->bufferobj);
}
const struct vbo_save_vertex_list *node =
(const struct vbo_save_vertex_list *) data;
struct vbo_save_context *save = &vbo_context(ctx)->save;
+ struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
FLUSH_CURRENT(ctx, 0);
- if (node->prim_count > 0 && node->count > 0) {
+ if (node->prim_count > 0) {
if (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END &&
node->prim[0].begin) {
vbo_bind_vertex_list( ctx, node );
+ vbo_draw_method(exec, DRAW_DISPLAY_LIST);
+
/* Again...
*/
if (ctx->NewState)
_mesa_update_state( ctx );
- vbo_context(ctx)->draw_prims(ctx,
- save->inputs,
- node->prim,
- node->prim_count,
- NULL,
- GL_TRUE,
- 0, /* Node is a VBO, so this is ok */
- node->count - 1);
+ if (node->count > 0) {
+ vbo_context(ctx)->draw_prims(ctx,
+ save->inputs,
+ node->prim,
+ node->prim_count,
+ NULL,
+ GL_TRUE,
+ 0, /* Node is a VBO, so this is ok */
+ node->count - 1,
+ NULL);
+ }
}
/* Copy to current?