[PATCH 7/7] d3d8: Handle stateblocks in d3d8_device_SetVertexShader().

Zebediah Figura z.figura12 at gmail.com
Sat Jun 22 10:29:22 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/d3d8/device.c | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index efea4708fda..2839e7c7ee3 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2802,6 +2802,7 @@ static struct d3d8_vertex_declaration *d3d8_device_get_fvf_declaration(struct d3
 static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD shader)
 {
     struct d3d8_device *device = impl_from_IDirect3DDevice8(iface);
+    struct wined3d_vertex_declaration *wined3d_decl;
     struct d3d8_vertex_shader *shader_impl;
 
     TRACE("iface %p, shader %#x.\n", iface, shader);
@@ -2811,9 +2812,17 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD
         TRACE("Setting FVF, %#x\n", shader);
 
         wined3d_mutex_lock();
-        wined3d_device_set_vertex_declaration(device->wined3d_device,
-                d3d8_device_get_fvf_declaration(device, shader)->wined3d_vertex_declaration);
-        wined3d_device_set_vertex_shader(device->wined3d_device, NULL);
+        wined3d_decl = d3d8_device_get_fvf_declaration(device, shader)->wined3d_vertex_declaration;
+        if (device->recording)
+        {
+            wined3d_stateblock_set_vertex_declaration(device->recording, wined3d_decl);
+            wined3d_stateblock_set_vertex_shader(device->recording, NULL);
+        }
+        else
+        {
+            wined3d_device_set_vertex_declaration(device->wined3d_device, wined3d_decl);
+            wined3d_device_set_vertex_shader(device->wined3d_device, NULL);
+        }
         wined3d_mutex_unlock();
 
         return D3D_OK;
@@ -2829,10 +2838,18 @@ static HRESULT WINAPI d3d8_device_SetVertexShader(IDirect3DDevice8 *iface, DWORD
 
         return D3DERR_INVALIDCALL;
     }
+    wined3d_decl = shader_impl->vertex_declaration->wined3d_vertex_declaration;
 
-    wined3d_device_set_vertex_declaration(device->wined3d_device,
-            shader_impl->vertex_declaration->wined3d_vertex_declaration);
-    wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
+    if (device->recording)
+    {
+        wined3d_stateblock_set_vertex_declaration(device->recording, wined3d_decl);
+        wined3d_stateblock_set_vertex_shader(device->recording, shader_impl->wined3d_shader);
+    }
+    else
+    {
+        wined3d_device_set_vertex_declaration(device->wined3d_device, wined3d_decl);
+        wined3d_device_set_vertex_shader(device->wined3d_device, shader_impl->wined3d_shader);
+    }
     wined3d_mutex_unlock();
 
     return D3D_OK;
-- 
2.21.0




More information about the wine-devel mailing list