Commit 467199d5 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

d3d9: Keep previous stream source stride and offset only when setting NULL buffer.

parent 28f7e461
......@@ -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, &current_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, &current_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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment