aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2017-05-22 00:19:01 +0200
committerAxel Davy <[email protected]>2017-05-24 00:40:43 +0200
commit7e04ae74d44105dca8190fc2fdd2ab8581cbe698 (patch)
tree6444ec026865af999f6612dec2159e8597d43002 /src/gallium/state_trackers
parent7009955281260fbb488736706679eb9fa73493d4 (diff)
st/nine: Fix a regression and syntax cleanup
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 <[email protected]> Tested-by: Edmondo Tommasina <[email protected]> Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/nine/device9.c2
-rw-r--r--src/gallium/state_trackers/nine/indexbuffer9.c8
-rw-r--r--src/gallium/state_trackers/nine/indexbuffer9.h5
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c20
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;