Merge branch 'gallium-msaa'
[mesa.git] / src / gallium / drivers / nv50 / nv50_vbo.c
index 932c1e8992392caef0e1ffd0f0435a737e4fdaeb..864cb09352a1d4f89b333ceea280af147816fbdd 100644 (file)
@@ -189,7 +189,7 @@ nv50_draw_arrays_instanced(struct pipe_context *pipe,
                return;
 
        if (nv50->vbo_fifo) {
-               nv50_push_elements_instanced(pipe, NULL, 0, mode, start,
+               nv50_push_elements_instanced(pipe, NULL, 0, 0, mode, start,
                                             count, startInstance,
                                             instanceCount);
                return;
@@ -401,15 +401,18 @@ nv50_draw_elements_instanced(struct pipe_context *pipe,
        if (!nv50_state_validate(nv50, 13 + 16*3))
                return;
 
-       assert(indexBias == 0);
-
        if (nv50->vbo_fifo) {
                nv50_push_elements_instanced(pipe, indexBuffer, indexSize,
-                                            mode, start, count, startInstance,
-                                            instanceCount);
+                                            indexBias, mode, start, count,
+                                            startInstance, instanceCount);
                return;
-       } else
-       if (!(indexBuffer->bind & PIPE_BIND_INDEX_BUFFER) || indexSize == 1) {
+       }
+
+       /* indices are uint32 internally, so large indexBias means negative */
+       BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_BASE, 1);
+       OUT_RING  (chan, indexBias);
+
+       if (!nv50_resource_mapped_by_gpu(indexBuffer) || indexSize == 1) {
                nv50_draw_elements_inline(pipe, indexBuffer, indexSize,
                                          mode, start, count, startInstance,
                                          instanceCount);
@@ -562,7 +565,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
 
        for (i = 0; i < nv50->vtxbuf_nr; i++) {
                if (nv50->vtxbuf[i].stride &&
-                   !(nv50->vtxbuf[i].buffer->bind & PIPE_BIND_VERTEX_BUFFER))
+                   !nv50_resource_mapped_by_gpu(nv50->vtxbuf[i].buffer))
                        nv50->vbo_fifo = 0xffff;
        }