Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/ddraw/device.c | 12 ++++++++++--
dlls/ddraw/executebuffer.c | 4 ++++
dlls/ddraw/surface.c | 2 ++
dlls/ddraw/vertexbuffer.c | 1 +
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 725a935022..6cd8948f56 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -3520,6 +3520,7 @@ static HRESULT d3d_device7_DrawPrimitive(IDirect3DDevice7 *iface,
size = vertex_count * stride;
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = d3d_device_prepare_vertex_buffer(device, size);
if (FAILED(hr))
goto done;
@@ -3713,6 +3714,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitive(IDirect3DDevice7 *iface,
/* Set the D3DDevice's FVF */
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = d3d_device_prepare_vertex_buffer(device, vtx_size);
if (FAILED(hr))
goto done;
@@ -4057,6 +4059,7 @@ static HRESULT d3d_device7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, D3DPRIM
}
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = d3d_device_prepare_vertex_buffer(device, dst_size);
if (FAILED(hr))
goto done;
@@ -4173,6 +4176,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface,
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = d3d_device_prepare_vertex_buffer(device, vtx_dst_size);
if (FAILED(hr))
goto done;
@@ -4330,6 +4334,7 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
}
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_set_vertex_declaration(device->wined3d_device, vb_impl->wined3d_declaration);
if (FAILED(hr = wined3d_device_set_stream_source(device->wined3d_device,
0, vb_impl->wined3d_buffer, 0, stride)))
@@ -4452,6 +4457,7 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_set_vertex_declaration(device->wined3d_device, vb_impl->wined3d_declaration);
hr = d3d_device_prepare_index_buffer(device, index_count * sizeof(WORD));
@@ -5251,6 +5257,7 @@ static HRESULT d3d_device7_ValidateDevice(IDirect3DDevice7 *iface, DWORD *pass_c
TRACE("iface %p, pass_count %p.\n", iface, pass_count);
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
hr = wined3d_device_validate_device(device->wined3d_device, pass_count);
wined3d_mutex_unlock();
@@ -5313,7 +5320,7 @@ static HRESULT d3d_device7_Clear(IDirect3DDevice7 *iface, DWORD count,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
- struct d3d_device *This = impl_from_IDirect3DDevice7(iface);
+ struct d3d_device *device = impl_from_IDirect3DDevice7(iface);
HRESULT hr;
TRACE("iface %p, count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %#x.\n",
@@ -5326,7 +5333,8 @@ static HRESULT d3d_device7_Clear(IDirect3DDevice7 *iface, DWORD count,
}
wined3d_mutex_lock();
- hr = wined3d_device_clear(This->wined3d_device, count, (RECT *)rects, flags, &c, z, stencil);
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
+ hr = wined3d_device_clear(device->wined3d_device, count, (RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock();
return hr;
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 9f0fdb85e5..0d1726ed7f 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -74,6 +74,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d
case D3DOP_POINT:
{
const D3DPOINT *p = (D3DPOINT *)instr;
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_set_primitive_type(device->wined3d_device, WINED3D_PT_POINTLIST, 0);
wined3d_device_set_stream_source(device->wined3d_device, 0,
buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
@@ -106,6 +107,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d
primitive_size = 3;
}
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
+
index_count = count * primitive_size;
if (buffer->index_size < index_count)
{
@@ -300,6 +303,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d
{
case D3DPROCESSVERTICES_TRANSFORMLIGHT:
case D3DPROCESSVERTICES_TRANSFORM:
+ wined3d_device_apply_stateblock(device->wined3d_device, device->state);
wined3d_device_set_stream_source(device->wined3d_device, 0,
buffer->src_vertex_buffer, buffer->src_vertex_pos * sizeof(D3DVERTEX), sizeof(D3DVERTEX));
wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_LIGHTING,
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index fda42f2982..03546e17f1 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -1472,6 +1472,7 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *
dst_surface->palette, fill_colour, &colour))
return DDERR_INVALIDPARAMS;
+ wined3d_device_apply_stateblock(wined3d_device, dst_surface->ddraw->state);
return wined3d_device_clear_rendertarget_view(wined3d_device,
ddraw_surface_get_rendertarget_view(dst_surface),
dst_rect, wined3d_flags, &colour, 0.0f, 0);
@@ -1487,6 +1488,7 @@ static HRESULT ddraw_surface_blt(struct ddraw_surface *dst_surface, const RECT *
dst_surface->palette, fill_colour, &colour))
return DDERR_INVALIDPARAMS;
+ wined3d_device_apply_stateblock(wined3d_device, dst_surface->ddraw->state);
return wined3d_device_clear_rendertarget_view(wined3d_device,
ddraw_surface_get_rendertarget_view(dst_surface),
dst_rect, wined3d_flags, NULL, colour.r, 0);
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index 9df386d1a0..1e3d25f6cb 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -277,6 +277,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_ProcessVertices(IDirect3DVertexBuffer7
return DDERR_INVALIDPARAMS;
wined3d_mutex_lock();
+ wined3d_device_apply_stateblock(device_impl->wined3d_device, device_impl->state);
/* WineD3D doesn't know d3d7 vertex operation, it uses
* render states instead. Set the render states according to
--
2.25.0