https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6c95b14e36b35adbedd796792ed4ed830996c2a

commit e6c95b14e36b35adbedd796792ed4ed830996c2a
Author:     Amine Khaldi <[email protected]>
AuthorDate: Sun Jan 21 22:13:33 2018 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Sun Jan 21 22:13:33 2018 +0100

    [D3D8] Sync with Wine 3.0. CORE-14225
---
 dll/directx/wine/d3d8/d3d8_main.c | 80 ++++++++++++++++++++-------------------
 dll/directx/wine/d3d8/device.c    |  7 +++-
 dll/directx/wine/d3d8/directx.c   |  2 +-
 dll/directx/wine/d3d8/texture.c   |  6 +--
 media/doc/README.WINE             |  2 +-
 5 files changed, 51 insertions(+), 46 deletions(-)

diff --git a/dll/directx/wine/d3d8/d3d8_main.c 
b/dll/directx/wine/d3d8/d3d8_main.c
index a8ad29b3b3..144817a545 100644
--- a/dll/directx/wine/d3d8/d3d8_main.c
+++ b/dll/directx/wine/d3d8/d3d8_main.c
@@ -53,73 +53,75 @@ IDirect3D8 * WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT 
sdk_version)
 
 /***********************************************************************
  *              ValidateVertexShader (D3D8.@)
+ *
+ * I've seen reserved1 and reserved2 always passed as 0's
+ * bool seems always passed as 0 or 1, but other values work as well...
+ * toto       result?
  */
-HRESULT WINAPI ValidateVertexShader(DWORD *vertexshader, DWORD *reserved1, 
DWORD *reserved2,
-                                    BOOL return_error, char **errors)
+HRESULT WINAPI ValidateVertexShader(DWORD* vertexshader, DWORD* reserved1, 
DWORD* reserved2, BOOL bool, DWORD* toto)
 {
-    const char *message = "";
-    HRESULT hr = E_FAIL;
+  HRESULT ret;
+  static BOOL warned;
 
-    TRACE("(%p %p %p %d %p): semi-stub\n", vertexshader, reserved1, reserved2, 
return_error, errors);
+  if (TRACE_ON(d3d8) || !warned) {
+      FIXME("(%p %p %p %d %p): stub\n", vertexshader, reserved1, reserved2, 
bool, toto);
+      warned = TRUE;
+  }
 
-    if (!vertexshader)
-    {
-        message = "(Global Validation Error) Version Token: Code pointer 
cannot be NULL.\n";
-        goto done;
-    }
+  if (!vertexshader)
+      return E_FAIL;
 
-    switch (*vertexshader)
-    {
+  if (reserved1 || reserved2)
+      return E_FAIL;
+
+  switch(*vertexshader) {
         case 0xFFFE0101:
         case 0xFFFE0100:
-            hr = S_OK;
+            ret=S_OK;
             break;
-
         default:
             WARN("Invalid shader version token %#x.\n", *vertexshader);
-            message = "(Global Validation Error) Version Token: Unsupported 
vertex shader version.\n";
-    }
+            ret=E_FAIL;
+        }
 
-done:
-    if (!return_error) message = "";
-    if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 
1)))
-        strcpy(*errors, message);
-
-    return hr;
+  return ret;
 }
 
 /***********************************************************************
  *              ValidatePixelShader (D3D8.@)
+ *
+ * PARAMS
+ * toto       result?
  */
-HRESULT WINAPI ValidatePixelShader(DWORD *pixelshader, DWORD *reserved1, BOOL 
return_error, char **errors)
+HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL 
bool, DWORD* toto)
 {
-    const char *message = "";
-    HRESULT hr = E_FAIL;
+  HRESULT ret;
+  static BOOL warned;
+
+  if (TRACE_ON(d3d8) || !warned) {
+      FIXME("(%p %p %d %p): stub\n", pixelshader, reserved1, bool, toto);
+      warned = TRUE;
+  }
 
-    TRACE("(%p %p %d %p): semi-stub\n", pixelshader, reserved1, return_error, 
errors);
+  if (!pixelshader)
+      return E_FAIL;
 
-    if (!pixelshader)
-        return E_FAIL;
+  if (reserved1)
+      return E_FAIL;
 
-   switch (*pixelshader)
-   {
+  switch(*pixelshader) {
         case 0xFFFF0100:
         case 0xFFFF0101:
         case 0xFFFF0102:
         case 0xFFFF0103:
         case 0xFFFF0104:
-            hr = S_OK;
+            ret=S_OK;
             break;
         default:
             WARN("Invalid shader version token %#x.\n", *pixelshader);
-            message = "(Global Validation Error) Version Token: Unsupported 
pixel shader version.\n";
-    }
-
-    if (!return_error) message = "";
-    if (errors && (*errors = HeapAlloc(GetProcessHeap(), 0, strlen(message) + 
1)))
-        strcpy(*errors, message);
-
-    return hr;
+            ret=E_FAIL;
+        }
+  return ret;
 }
 
 void d3d8_resource_cleanup(struct d3d8_resource *resource)
diff --git a/dll/directx/wine/d3d8/device.c b/dll/directx/wine/d3d8/device.c
index 5dbfe174f9..6573baa355 100644
--- a/dll/directx/wine/d3d8/device.c
+++ b/dll/directx/wine/d3d8/device.c
@@ -734,6 +734,8 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 
*iface,
     {
         present_parameters->BackBufferCount = swapchain_desc.backbuffer_count;
         wined3d_device_set_render_state(device->wined3d_device, 
WINED3D_RS_POINTSIZE_MIN, 0);
+        wined3d_device_set_render_state(device->wined3d_device, 
WINED3D_RS_ZENABLE,
+                !!swapchain_desc.enable_auto_depth_stencil);
         device->device_state = D3D8_DEVICE_STATE_OK;
     }
     else
@@ -3258,8 +3260,7 @@ HRESULT device_init(struct d3d8_device *device, struct 
d3d8 *parent, struct wine
         return D3DERR_INVALIDCALL;
     }
 
-    hr = wined3d_device_init_3d(device->wined3d_device, &swapchain_desc);
-    if (FAILED(hr))
+    if (FAILED(hr = wined3d_device_init_3d(device->wined3d_device, 
&swapchain_desc)))
     {
         WARN("Failed to initialize 3D, hr %#x.\n", hr);
         wined3d_device_release_focus_window(device->wined3d_device);
@@ -3269,6 +3270,8 @@ HRESULT device_init(struct d3d8_device *device, struct 
d3d8 *parent, struct wine
         return hr;
     }
 
+    wined3d_device_set_render_state(device->wined3d_device,
+            WINED3D_RS_ZENABLE, !!swapchain_desc.enable_auto_depth_stencil);
     wined3d_device_set_render_state(device->wined3d_device, 
WINED3D_RS_POINTSIZE_MIN, 0);
     wined3d_mutex_unlock();
 
diff --git a/dll/directx/wine/d3d8/directx.c b/dll/directx/wine/d3d8/directx.c
index ccf54565e2..ffb8ddefb4 100644
--- a/dll/directx/wine/d3d8/directx.c
+++ b/dll/directx/wine/d3d8/directx.c
@@ -405,7 +405,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
     DWORD flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING
             | WINED3D_HANDLE_RESTORE | WINED3D_PIXEL_CENTER_INTEGER
             | WINED3D_LEGACY_UNBOUND_RESOURCE_COLOR | 
WINED3D_NO_PRIMITIVE_RESTART
-            | WINED3D_LEGACY_CUBEMAP_FILTERING | WINED3D_LIMIT_VIEWPORT;
+            | WINED3D_LEGACY_CUBEMAP_FILTERING;
 
     d3d8->IDirect3D8_iface.lpVtbl = &d3d8_vtbl;
     d3d8->refcount = 1;
diff --git a/dll/directx/wine/d3d8/texture.c b/dll/directx/wine/d3d8/texture.c
index c0fa7469ae..b860859987 100644
--- a/dll/directx/wine/d3d8/texture.c
+++ b/dll/directx/wine/d3d8/texture.c
@@ -20,17 +20,17 @@
 
 static inline struct d3d8_texture 
*impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface)
 {
-    return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct 
d3d8_texture, IDirect3DBaseTexture8_iface);
+    return CONTAINING_RECORD(iface, struct d3d8_texture, 
IDirect3DBaseTexture8_iface);
 }
 
 static inline struct d3d8_texture 
*impl_from_IDirect3DCubeTexture8(IDirect3DCubeTexture8 *iface)
 {
-    return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct 
d3d8_texture, IDirect3DBaseTexture8_iface);
+    return CONTAINING_RECORD(iface, struct d3d8_texture, 
IDirect3DBaseTexture8_iface);
 }
 
 static inline struct d3d8_texture 
*impl_from_IDirect3DVolumeTexture8(IDirect3DVolumeTexture8 *iface)
 {
-    return CONTAINING_RECORD((IDirect3DBaseTexture8 *)iface, struct 
d3d8_texture, IDirect3DBaseTexture8_iface);
+    return CONTAINING_RECORD(iface, struct d3d8_texture, 
IDirect3DBaseTexture8_iface);
 }
 
 static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, 
REFIID riid, void **out)
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index 5077043221..375b675a93 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -22,7 +22,7 @@ reactos/sdk/tools/wpp                   # Synced to 
WineStaging-2.9
 The following libraries are shared with Wine.
 
 reactos/dll/directx/wine/amstream       # Synced to Wine-3.0
-reactos/dll/directx/wine/d3d8           # Synced to WineStaging-2.16
+reactos/dll/directx/wine/d3d8           # Synced to Wine-3.0
 reactos/dll/directx/wine/d3d9           # Synced to WineStaging-2.16
 reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-2.16
 reactos/dll/directx/wine/d3drm          # Synced to WineStaging-2.16

Reply via email to