summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-03-02 22:36:22 +0100
committerChristoph Bumiller <[email protected]>2011-03-02 22:37:56 +0100
commit0c0e996d59380af2d247336e3e9cfae58a80791a (patch)
tree33df463d3eaf602dadb05d86b27c9922e3aaf7d1 /src
parentfa94f8b209c111f2c3cd9250d9fec6cd03726114 (diff)
nv50: fix IB index buffer path
Add missing VERTEX_END and treat unaligned offsets correctly.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 85cf9bd8a61..4f0a5018459 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -538,7 +538,8 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
if (nouveau_resource_mapped_by_gpu(nv50->idxbuf.buffer)) {
struct nv04_resource *res = nv04_resource(nv50->idxbuf.buffer);
- unsigned offset = res->offset + nv50->idxbuf.offset;
+
+ start += nv50->idxbuf.offset >> (index_size >> 1);
nouveau_buffer_adjust_score(&nv50->base, res, 1);
@@ -552,9 +553,8 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
WAIT_RING (chan, 2);
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U32) | 0x30000, 0);
OUT_RING (chan, count);
- nouveau_pushbuf_submit(chan, res->bo,
- (start << 2) + offset,
- (count << 2));
+ nouveau_pushbuf_submit(chan, res->bo, res->offset + start * 4,
+ count * 4);
}
break;
case 2:
@@ -564,10 +564,11 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U16_SETUP), 1);
OUT_RING (chan, (start << 31) | count);
+ WAIT_RING (chan, 2);
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U16) | 0x30000, 0);
OUT_RING (chan, pb_words);
- nouveau_pushbuf_submit(chan, res->bo,
- (pb_start << 1) + offset, pb_words << 2);
+ nouveau_pushbuf_submit(chan, res->bo, res->offset + pb_start * 2,
+ pb_words * 4);
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U16_SETUP), 1);
OUT_RING (chan, 0);
break;
@@ -579,10 +580,11 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U8_SETUP), 1);
OUT_RING (chan, (start << 30) | count);
+ WAIT_RING (chan, 2);
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U8) | 0x30000, 0);
OUT_RING (chan, pb_words);
- nouveau_pushbuf_submit(chan, res->bo,
- pb_start + offset, pb_words << 2);
+ nouveau_pushbuf_submit(chan, res->bo, res->offset + pb_start,
+ pb_words * 4);
BEGIN_RING(chan, RING_3D(VB_ELEMENT_U8_SETUP), 1);
OUT_RING (chan, 0);
break;
@@ -591,6 +593,8 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
assert(0);
return;
}
+ BEGIN_RING(chan, RING_3D(VERTEX_END_GL), 1);
+ OUT_RING (chan, 0);
nv50_resource_fence(res, NOUVEAU_BO_RD);