d3d9: Keep previous stream source stride and offset only when setting NULL buffer.
Signed-off-by: Paul Gofman <gofmanp@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
28f7e4615d
commit
467199d593
|
@ -3558,13 +3558,9 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface,
|
|||
iface, stream_idx, buffer, offset, stride);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
if (!stride)
|
||||
{
|
||||
unsigned int cur_offset;
|
||||
|
||||
hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
|
||||
&cur_offset, &stride);
|
||||
}
|
||||
if (!buffer_impl)
|
||||
wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
|
||||
&offset, &stride);
|
||||
|
||||
if (!buffer_impl)
|
||||
wined3d_buffer = NULL;
|
||||
|
|
|
@ -3240,7 +3240,8 @@ cleanup:
|
|||
|
||||
static void test_set_stream_source(void)
|
||||
{
|
||||
IDirect3DVertexBuffer9 *vb;
|
||||
IDirect3DVertexBuffer9 *vb, *current_vb;
|
||||
unsigned int offset, stride;
|
||||
IDirect3DDevice9 *device;
|
||||
IDirect3D9 *d3d9;
|
||||
ULONG refcount;
|
||||
|
@ -3273,7 +3274,24 @@ static void test_set_stream_source(void)
|
|||
hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 3, 32);
|
||||
ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 4, 32);
|
||||
ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(!current_vb, "Got unexpected vb %p.\n", current_vb);
|
||||
ok(offset == 4, "Got unexpected offset %u.\n", offset);
|
||||
ok(stride == 32, "Got unexpected stride %u.\n", stride);
|
||||
|
||||
hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 0, 0);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(current_vb == vb, "Got unexpected vb %p.\n", current_vb);
|
||||
IDirect3DVertexBuffer9_Release(current_vb);
|
||||
ok(!offset, "Got unexpected offset %u.\n", offset);
|
||||
ok(!stride, "Got unexpected stride %u.\n", stride);
|
||||
|
||||
/* Try to set the NULL buffer with an offset and stride 0 */
|
||||
hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue