#include "svga_draw.h"
#include "svga_draw_private.h"
#include "svga_context.h"
-#include "svga_resource_buffer.h"
#define DBG 0
SVGA3dPrimitiveRange range;
unsigned hw_prim;
unsigned hw_count;
- unsigned i;
- unsigned src_offs;
hw_prim = svga_translate_prim(prim, count, &hw_count);
if (hw_count == 0)
* looking at those numbers knows to adjust them by
* range.indexBias.
*/
-
- for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
- struct pipe_resource *vb = hwtnl->cmd.vdecl_vb[i];
- struct svga_buffer *sbuf = svga_buffer(vb);
- unsigned stride = hwtnl->cmd.vdecl[i].array.stride;
- unsigned tmp_src_offs = sbuf->source_offset;
-
- if (stride)
- tmp_src_offs /= stride;
- assert(i == 0 || tmp_src_offs == src_offs);
- src_offs = tmp_src_offs;
- }
-
- range.indexBias = start - src_offs;
- assert(range.indexBias >= 0);
-
return svga_hwtnl_prim( hwtnl, &range, 0, count - 1, NULL );
}
unsigned hw_count;
unsigned index_offset = start * index_size;
int ret = PIPE_OK;
- unsigned i, src_offs;
hw_prim = svga_translate_prim(prim, count, &hw_count);
if (hw_count == 0)
index_buffer = upload_buffer;
}
- for (i = 0; i < hwtnl->cmd.vdecl_count; i++) {
- struct pipe_resource *vb = hwtnl->cmd.vdecl_vb[i];
- struct svga_buffer *sbuf = svga_buffer(vb);
- unsigned stride = hwtnl->cmd.vdecl[i].array.stride;
- unsigned tmp_src_offs = sbuf->source_offset;
-
- if (stride)
- tmp_src_offs /= stride;
- assert(i == 0 || tmp_src_offs == src_offs);
- src_offs = tmp_src_offs;
- }
-
- index_bias -= src_offs;
- assert(index_bias >= 0);
-
range.primType = hw_prim;
range.primitiveCount = hw_count;
range.indexArray.offset = index_offset;
unsigned offset;
} uploaded;
- /**
- * The offset in the source user buffer that matches the
- * uploaded offset
- */
- unsigned source_offset;
-
/**
* DMA'ble memory.
*
sbuf->key.size.width = sbuf->b.b.width0 = offset + size;
}
- sbuf->source_offset = offset;
pipe_mutex_unlock(ss->swc_mutex);
svga->curr.any_user_vertex_buffers = TRUE;
if (!buffer->uploaded.buffer) {
boolean flushed;
ret = u_upload_buffer( svga->upload_vb,
- 0, buffer->source_offset,
- buffer->b.b.width0 - buffer->source_offset,
+ 0, 0,
+ buffer->b.b.width0,
&buffer->b.b,
&buffer->uploaded.offset,
&buffer->uploaded.buffer,
return ret;
if (0)
- debug_printf("%s: %d: orig buf %p upl buf %p ofs %d sofs %d"
- " sz %d\n",
+ debug_printf("%s: %d: orig buf %p upl buf %p ofs %d sz %d\n",
__FUNCTION__,
i,
buffer,
buffer->uploaded.buffer,
buffer->uploaded.offset,
- buffer->source_offset,
buffer->b.b.width0);
}
svga->curr.vb[i].buffer_offset = buffer->uploaded.offset;
- svga_buffer(buffer->uploaded.buffer)->source_offset = buffer->source_offset;
}
}