else {
vbuffer->buffer = NULL;
pipe_buffer_reference(&vbuffer->buffer, stobj->buffer);
- vbuffer->buffer_offset = (unsigned) low;
+ vbuffer->buffer_offset = pointer_to_offset(low);
}
vbuffer->stride = stride; /* in bytes */
vbuffer->max_index = max_index;
vbuffer[attr].buffer = NULL;
pipe_buffer_reference(&vbuffer[attr].buffer, stobj->buffer);
- vbuffer[attr].buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
+ vbuffer[attr].buffer_offset = pointer_to_offset(arrays[mesaAttr]->Ptr);
velements[attr].src_offset = 0;
}
else {
/* elements/indexes are in a real VBO */
struct st_buffer_object *stobj = st_buffer_object(bufobj);
pipe_buffer_reference(&indexBuf, stobj->buffer);
- indexOffset = (unsigned) ib->ptr / indexSize;
+ indexOffset = pointer_to_offset(ib->ptr) / indexSize;
}
else {
/* element/indicies are in user space memory */
extern GLuint
st_pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized);
+
+/**
+ * When drawing with VBOs, the addresses specified with
+ * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
+ * addresses. At some point we need to convert those pointers to offsets.
+ * This function is basically a cast wrapper to avoid warnings when building
+ * in 64-bit mode.
+ */
+static INLINE unsigned
+pointer_to_offset(const void *ptr)
+{
+ return (unsigned) (((unsigned long) ptr) & 0xffffffffUL);
+}
+
+
#endif
vbuffers[attr].buffer = NULL;
pipe_buffer_reference(&vbuffers[attr].buffer, stobj->buffer);
- vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
+ vbuffers[attr].buffer_offset = pointer_to_offset(arrays[0]->Ptr);
velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
}
else {