[Mesa-dev] [PATCH 3/4] gallium: remove pipe_index_buffer and set_index_buffer

Marek Olšák maraeo at gmail.com
Tue May 2 16:12:03 UTC 2017


Thanks. I'm amending this:

diff --git a/src/gallium/state_trackers/nine/device9.c
b/src/gallium/state_trackers/nine/device9.c
index 5dc24d6..f26552c 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2913,6 +2913,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct
NineDevice9 *This,
                                                            PrimitiveCount,
                                                            &vbuf,
                                                            ibuf,
+                                                           ibuf ? NULL :
pIndexData,
                                                            index_offset,
                                                           index_size);
     NineAfterDraw(This);
diff --git a/src/gallium/state_trackers/nine/nine_state.c
b/src/gallium/state_trackers/nine/nine_state.c
index 8bfa7fc..0fc4c83 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -2580,7 +2580,7 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive,

     init_draw_info(&info, device, PrimitiveType, PrimitiveCount);
     info.index_size = context->index_size;
-    info.start = StartIndex;
+    info.start = context->index_offset / context->index_size + StartIndex;
     info.index_bias = BaseVertexIndex;
     /* These don't include index bias: */
     info.min_index = MinVertexIndex;
@@ -2619,6 +2619,7 @@
CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf,
                   ARG_VAL(UINT, PrimitiveCount),
                   ARG_BIND_VBUF(struct pipe_vertex_buffer, vbuf),
                   ARG_BIND_RES(struct pipe_resource, ibuf),
+                  ARG_VAL(void *, user_ibuf),
                   ARG_VAL(UINT, index_offset),
                  ARG_VAL(UINT, index_size))
 {
@@ -2633,8 +2634,12 @@
CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf,
     info.index_bias = 0;
     info.min_index = MinVertexIndex;
     info.max_index = MinVertexIndex + NumVertices - 1;
-    info.has_user_indices = false;
-    info.index.resource = ibuf;
+    info.has_user_indices = ibuf == NULL;
+    if (ibuf)
+        info.index.resource = ibuf;
+    else
+        info.index.user = user_ibuf;
+
     context->pipe->set_vertex_buffers(context->pipe, 0, 1, vbuf);

     context->pipe->draw_vbo(context->pipe, &info);
diff --git a/src/gallium/state_trackers/nine/nine_state.h
b/src/gallium/state_trackers/nine/nine_state.h
index 9eb04f6..f5fd1ef 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -518,6 +518,7 @@
nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(struct NineDevice9
*devic
                                                        UINT PrimitiveCount,
                                                        struct
pipe_vertex_buffer *vbuf,
                                                        struct
pipe_resource *ibuf,
+                                                       void *user_ibuf,
                                                        unsigned
index_offset,
                                                       unsigned index_size);


Marek

On Sun, Apr 30, 2017 at 10:23 AM, Axel Davy <axel.davy at normalesup.org>
wrote:

> Hi Marek,
>
> Here is probably the second mistake:
> I guess you should change info.start to take into account the offset of
> the index buffer.
>
> Yours,
>
> Axel Davy
>
> On 29/04/2017 01:12, Marek Olšák wrote:
>
>> CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive,
>>                     ARG_VAL(D3DPRIMITIVETYPE, PrimitiveType),
>> @@ -2588,73 +2572,77 @@ CSMT_ITEM_NO_WAIT(nine_context
>> _draw_indexed_primitive,
>>                      ARG_VAL(UINT, NumVertices),
>>                      ARG_VAL(UINT, StartIndex),
>>                      ARG_VAL(UINT, PrimitiveCount))
>>   {
>>       struct nine_context *context = &device->context;
>>       struct pipe_draw_info info;
>>         nine_update_state(device);
>>         init_draw_info(&info, device, PrimitiveType, PrimitiveCount);
>> -    info.indexed = TRUE;
>> +    info.index_size = context->index_size;
>>       info.start = StartIndex;
>>       info.index_bias = BaseVertexIndex;
>>       /* These don't include index bias: */
>>       info.min_index = MinVertexIndex;
>>       info.max_index = MinVertexIndex + NumVertices - 1;
>> +    info.index.resource = context->idxbuf;
>>         context->pipe->draw_vbo(context->pipe, &info);
>>   }
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170502/ce05f432/attachment-0001.html>


More information about the mesa-dev mailing list