From 7e04ae74d44105dca8190fc2fdd2ab8581cbe698 Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Mon, 22 May 2017 00:19:01 +0200 Subject: [PATCH] st/nine: Fix a regression and syntax cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A few cleanups and in particular initializing properly the new pipe_draw_info fields. This should fix the regression caused by 330d0607ed60fd3edca192e54b4246310f06652f Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101088 Signed-off-by: Axel Davy Tested-by: Edmondo Tommasina Tested-by: Dieter Nützel --- src/gallium/state_trackers/nine/device9.c | 2 +- .../state_trackers/nine/indexbuffer9.c | 8 ++------ .../state_trackers/nine/indexbuffer9.h | 5 ++--- src/gallium/state_trackers/nine/nine_state.c | 20 ++++++++++--------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index 9f9e104b91a..88df38c43f6 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -2915,7 +2915,7 @@ NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This, ibuf, ibuf ? NULL : (void*)pIndexData, index_offset, - index_size); + index_size); NineAfterDraw(This); pipe_vertex_buffer_unreference(&vbuf); diff --git a/src/gallium/state_trackers/nine/indexbuffer9.c b/src/gallium/state_trackers/nine/indexbuffer9.c index d5f5492563d..e73d29b5bd3 100644 --- a/src/gallium/state_trackers/nine/indexbuffer9.c +++ b/src/gallium/state_trackers/nine/indexbuffer9.c @@ -49,9 +49,6 @@ NineIndexBuffer9_ctor( struct NineIndexBuffer9 *This, if (FAILED(hr)) return hr; - This->buffer = NULL; - This->offset = 0; - switch (pDesc->Format) { case D3DFMT_INDEX16: This->index_size = 2; break; case D3DFMT_INDEX32: This->index_size = 4; break; @@ -73,11 +70,10 @@ NineIndexBuffer9_dtor( struct NineIndexBuffer9 *This ) } struct pipe_resource * -NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This ) +NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This, unsigned *offset ) { /* The resource may change */ - This->buffer = NineBuffer9_GetResource(&This->base, &This->offset); - return This->buffer; + return NineBuffer9_GetResource(&This->base, offset); } HRESULT NINE_WINAPI diff --git a/src/gallium/state_trackers/nine/indexbuffer9.h b/src/gallium/state_trackers/nine/indexbuffer9.h index 0efad7f5f16..e688488da84 100644 --- a/src/gallium/state_trackers/nine/indexbuffer9.h +++ b/src/gallium/state_trackers/nine/indexbuffer9.h @@ -37,8 +37,6 @@ struct NineIndexBuffer9 struct NineBuffer9 base; /* g3d stuff */ - struct pipe_resource *buffer; - unsigned offset; unsigned index_size; D3DINDEXBUFFER_DESC desc; @@ -65,7 +63,8 @@ NineIndexBuffer9_dtor( struct NineIndexBuffer9 *This ); /*** Nine private ***/ struct pipe_resource * -NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This ); +NineIndexBuffer9_GetBuffer( struct NineIndexBuffer9 *This, + unsigned *offset ); /*** Direct3D public ***/ diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 0fc4c8315a7..30935760ae4 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -1575,12 +1575,11 @@ nine_context_set_indices(struct NineDevice9 *device, { struct pipe_resource *res = NULL; UINT IndexSize = 0; - UINT OffsetInBytes = 0; + unsigned OffsetInBytes = 0; if (idxbuf) { - res = NineIndexBuffer9_GetBuffer(idxbuf); + res = NineIndexBuffer9_GetBuffer(idxbuf, &OffsetInBytes); IndexSize = idxbuf->index_size; - OffsetInBytes = idxbuf->offset; } nine_context_set_indices_apply(device, res, IndexSize, OffsetInBytes); @@ -2540,6 +2539,7 @@ init_draw_info(struct pipe_draw_info *info, if (dev->context.stream_instancedata_mask & dev->context.stream_usage_mask) info->instance_count = MAX2(dev->context.stream_freq[0] & 0x7FFFFF, 1); info->primitive_restart = FALSE; + info->has_user_indices = FALSE; info->restart_index = 0; info->count_from_stream_output = NULL; info->indirect = NULL; @@ -2561,17 +2561,18 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_primitive, info.index_bias = 0; info.min_index = info.start; info.max_index = info.count - 1; + info.index.resource = NULL; context->pipe->draw_vbo(context->pipe, &info); } CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive, ARG_VAL(D3DPRIMITIVETYPE, PrimitiveType), - ARG_VAL(INT, BaseVertexIndex), - ARG_VAL(UINT, MinVertexIndex), - ARG_VAL(UINT, NumVertices), - ARG_VAL(UINT, StartIndex), - ARG_VAL(UINT, PrimitiveCount)) + ARG_VAL(INT, BaseVertexIndex), + ARG_VAL(UINT, MinVertexIndex), + ARG_VAL(UINT, NumVertices), + ARG_VAL(UINT, StartIndex), + ARG_VAL(UINT, PrimitiveCount)) { struct nine_context *context = &device->context; struct pipe_draw_info info; @@ -2606,6 +2607,7 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_primitive_from_vtxbuf, info.index_bias = 0; info.min_index = 0; info.max_index = info.count - 1; + info.index.resource = NULL; context->pipe->set_vertex_buffers(context->pipe, 0, 1, vtxbuf); @@ -2621,7 +2623,7 @@ CSMT_ITEM_NO_WAIT(nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf, ARG_BIND_RES(struct pipe_resource, ibuf), ARG_VAL(void *, user_ibuf), ARG_VAL(UINT, index_offset), - ARG_VAL(UINT, index_size)) + ARG_VAL(UINT, index_size)) { struct nine_context *context = &device->context; struct pipe_draw_info info; -- 2.30.2