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
330d0607ed

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101088

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
This commit is contained in:
Axel Davy 2017-05-22 00:19:01 +02:00
parent 7009955281
commit 7e04ae74d4
4 changed files with 16 additions and 19 deletions

View file

@ -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);

View file

@ -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

View file

@ -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 ***/

View file

@ -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;