#include "main/glheader.h"
#include "main/bufferobj.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/glformats.h"
#include "main/macros.h"
#include "main/mtypes.h"
* Dump the parameters/info for a vbo->draw() call.
*/
static void
-dump_draw_info(struct gl_context *ctx,
- const struct tnl_vertex_array *arrays,
+dump_draw_info(const struct tnl_vertex_array *arrays,
const struct _mesa_prim *prims,
GLuint nr_prims,
- const struct _mesa_index_buffer *ib,
- GLuint min_index,
- GLuint max_index)
+ const struct _mesa_index_buffer *ib)
{
GLuint i, j;
copy->dstib.count = copy->dstelt_nr;
#if 0
- dump_draw_info(copy->ctx,
- copy->dstarray,
+ dump_draw_info(copy->dstarray,
copy->dstprim,
copy->dstprim_nr,
- ©->dstib,
- 0,
- copy->dstbuf_nr);
+ ©->dstib);
#else
(void) dump_draw_info;
#endif
0,
copy->dstbuf_nr - 1,
1,
- 0,
- NULL, 0);
+ 0);
/* Reset all pointers:
*/
GLuint k;
GLfloat *f = (GLfloat *) srcptr;
for (k = 0; k < srcarray->Size; k++) {
- assert(!IS_INF_OR_NAN(f[k]));
+ assert(!util_is_inf_or_nan(f[k]));
assert(f[k] <= 1.0e20 && f[k] >= -1.0e20);
}
}
copy->varying[j].size = attrib->Format._ElementSize;
copy->vertex_size += attrib->Format._ElementSize;
- if (_mesa_is_bufferobj(vbo) &&
- !_mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
- ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo,
- MAP_INTERNAL);
+ if (vbo) {
+ if (!_mesa_bufferobj_mapped(vbo, MAP_INTERNAL)) {
+ ctx->Driver.MapBufferRange(ctx, 0, vbo->Size, GL_MAP_READ_BIT, vbo,
+ MAP_INTERNAL);
+ }
- copy->varying[j].src_ptr =
- ADD_POINTERS(vbo->Mappings[MAP_INTERNAL].Pointer, ptr);
+ copy->varying[j].src_ptr =
+ ADD_POINTERS(vbo->Mappings[MAP_INTERNAL].Pointer, ptr);
+ } else {
+ copy->varying[j].src_ptr = ptr;
+ }
copy->dstarray[i].VertexAttrib = ©->varying[j].dstattribs;
copy->dstarray[i].BufferBinding = ©->varying[j].dstbinding;
* caller convert non-indexed prims to indexed. Could alternately
* do it internally.
*/
- if (_mesa_is_bufferobj(copy->ib->obj) &&
- !_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
- ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
- copy->ib->obj, MAP_INTERNAL);
+ if (copy->ib->obj) {
+ if (!_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL))
+ ctx->Driver.MapBufferRange(ctx, 0, copy->ib->obj->Size, GL_MAP_READ_BIT,
+ copy->ib->obj, MAP_INTERNAL);
- srcptr = (const GLubyte *)
- ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
- copy->ib->ptr);
+ srcptr = (const GLubyte *)
+ ADD_POINTERS(copy->ib->obj->Mappings[MAP_INTERNAL].Pointer,
+ copy->ib->ptr);
+ } else
+ srcptr = copy->ib->ptr;
switch (copy->ib->index_size_shift) {
case 0:
dstattr->Format = srcattr->Format;
dstattr->Ptr = copy->dstbuf + offset;
dstbind->Stride = copy->vertex_size;
- dstbind->BufferObj = ctx->Shared->NullBufferObj;
+ dstbind->BufferObj = NULL;
dst->BufferBinding = dstbind;
dst->VertexAttrib = dstattr;
*/
copy->dstib.count = 0; /* duplicates dstelt_nr */
copy->dstib.index_size_shift = 2;
- copy->dstib.obj = ctx->Shared->NullBufferObj;
+ copy->dstib.obj = NULL;
copy->dstib.ptr = copy->dstelt;
}
for (i = 0; i < copy->nr_varying; i++) {
struct gl_buffer_object *vbo =
copy->varying[i].array->BufferBinding->BufferObj;
- if (_mesa_is_bufferobj(vbo) && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
+ if (vbo && _mesa_bufferobj_mapped(vbo, MAP_INTERNAL))
ctx->Driver.UnmapBuffer(ctx, vbo, MAP_INTERNAL);
}
/* Unmap index buffer */
- if (_mesa_is_bufferobj(copy->ib->obj) &&
+ if (copy->ib->obj &&
_mesa_bufferobj_mapped(copy->ib->obj, MAP_INTERNAL)) {
ctx->Driver.UnmapBuffer(ctx, copy->ib->obj, MAP_INTERNAL);
}