Chris Robinson : d3d8: Don't report Shader Model 2.0 or higher.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 29 06:47:16 CST 2006


Module: wine
Branch: master
Commit: b66a52856c6767fd4b345ea04fe0277bf24117b6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b66a52856c6767fd4b345ea04fe0277bf24117b6

Author: Chris Robinson <chris.kcat at gmail.com>
Date:   Sat Dec 23 05:41:53 2006 -0800

d3d8: Don't report Shader Model 2.0 or higher.

---

 dlls/d3d8/device.c       |    9 +++++++++
 dlls/d3d8/directx.c      |    9 +++++++++
 dlls/d3d8/tests/device.c |   21 +++++++++++++++++++++
 3 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index b21eb6c..e9bc3ac 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -169,6 +169,15 @@ static HRESULT WINAPI IDirect3DDevice8Im
     D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
     hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps);
     HeapFree(GetProcessHeap(), 0, pWineCaps);
+
+    /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
+    if(pCaps->PixelShaderVersion > D3DPS_VERSION(1,4)){
+        pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
+    }
+    if(pCaps->VertexShaderVersion > D3DVS_VERSION(1,1)){
+        pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
+    }
+
     TRACE("Returning %p %p\n", This, pCaps);
     return hrc;
 }
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index c3d0679..8b6ff6c 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -176,6 +176,15 @@ static HRESULT  WINAPI  IDirect3D8Impl_G
     D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
     hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
     HeapFree(GetProcessHeap(), 0, pWineCaps);
+
+    /* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
+    if(pCaps->PixelShaderVersion > D3DPS_VERSION(1,4)){
+        pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
+    }
+    if(pCaps->VertexShaderVersion > D3DVS_VERSION(1,1)){
+        pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
+    }
+
     TRACE("(%p) returning %p\n", This, pCaps);
     return hrc;
 }
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 0214117..b3c4c64 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -696,6 +696,26 @@ cleanup:
     if(pDevice) IDirect3D8_Release(pDevice);
 }
 
+static void test_shader_versions(void)
+{
+    HRESULT                      hr;
+    IDirect3D8                  *pD3d               = NULL;
+    D3DCAPS8                     d3dcaps;
+
+    pD3d = pDirect3DCreate8( D3D_SDK_VERSION );
+    ok(pD3d != NULL, "Failed to create IDirect3D8 object\n");
+    if (pD3d != NULL) {
+        hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps);
+        ok(SUCCEEDED(hr), "Failed to get D3D8 caps (%s)\n", DXGetErrorString8(hr));
+        if (SUCCEEDED(hr)) {
+            ok(d3dcaps.VertexShaderVersion <= D3DVS_VERSION(1,1), "Unexpected VertexShaderVersion (%#x > %#x)\n", d3dcaps.VertexShaderVersion, D3DVS_VERSION(1,1));
+            ok(d3dcaps.PixelShaderVersion <= D3DPS_VERSION(1,4), "Unexpected PixelShaderVersion (%#x > %#x)\n", d3dcaps.PixelShaderVersion, D3DPS_VERSION(1,4));
+        }
+        IDirect3D8_Release(pD3d);
+    }
+}
+
+
 /* Test adapter display modes */
 static void test_display_modes(void)
 {
@@ -733,6 +753,7 @@ START_TEST(device)
     if (pDirect3DCreate8)
     {
         test_display_modes();
+        test_shader_versions();
         test_swapchain();
         test_refcount();
         test_mipmap_levels();




More information about the wine-cvs mailing list