d3d9: Retrieve state from the stateblock in d3d9_stateblock_Apply().

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2020-03-06 12:33:13 +01:00 committed by Alexandre Julliard
parent a9125eed37
commit acaf1204e0
1 changed files with 4 additions and 7 deletions

View File

@ -118,11 +118,9 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface)
struct wined3d_texture *wined3d_texture;
struct wined3d_buffer *wined3d_buffer;
struct d3d9_vertexbuffer *buffer;
unsigned int i, offset, stride;
enum wined3d_format_id format;
struct d3d9_texture *texture;
struct d3d9_device *device;
HRESULT hr;
unsigned int i;
TRACE("iface %p.\n", iface);
@ -138,15 +136,14 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface)
device->sysmem_vb = 0;
for (i = 0; i < D3D9_MAX_STREAMS; ++i)
{
if (FAILED(hr = wined3d_device_get_stream_source(device->wined3d_device,
i, &wined3d_buffer, &offset, &stride)))
if (!(wined3d_buffer = device->stateblock_state->streams[i].buffer))
continue;
if (!wined3d_buffer || !(buffer = wined3d_buffer_get_parent(wined3d_buffer)))
if (!(buffer = wined3d_buffer_get_parent(wined3d_buffer)))
continue;
if (buffer->draw_buffer)
device->sysmem_vb |= 1u << i;
}
device->sysmem_ib = (wined3d_buffer = wined3d_device_get_index_buffer(device->wined3d_device, &format, &offset))
device->sysmem_ib = (wined3d_buffer = device->stateblock_state->index_buffer)
&& (buffer = wined3d_buffer_get_parent(wined3d_buffer)) && buffer->draw_buffer;
device->auto_mipmaps = 0;
for (i = 0; i < D3D9_MAX_TEXTURE_UNITS; ++i)