diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index b21eb6cf1e0..e9bc3acb272 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -169,6 +169,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface 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 c3d06798dce..8b6ff6cf967 100644 --- a/dlls/d3d8/directx.c +++ b/dlls/d3d8/directx.c @@ -176,6 +176,15 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada 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 02141174c35..b3c4c643788 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();