static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS9 *caps) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); WINED3DCAPS *wined3d_caps; HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); if (!caps) return D3DERR_INVALIDCALL; if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)))) return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ memset(caps, 0, sizeof(*caps)); wined3d_mutex_lock(); hr = wined3d_get_device_caps(d3d9->wined3d, adapter, device_type, wined3d_caps); wined3d_mutex_unlock(); WINECAPSTOD3D9CAPS(caps, wined3d_caps) HeapFree(GetProcessHeap(), 0, wined3d_caps); /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */ caps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES; filter_caps(caps); return hr; }
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { IDirect3D9Impl *This = (IDirect3D9Impl *)iface; HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; TRACE("(%p) Relay %d %u %p\n", This, Adapter, DeviceType, pCaps); if(NULL == pCaps){ return D3DERR_INVALIDCALL; } pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)); if(pWineCaps == NULL){ return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ } memset(pCaps, 0, sizeof(*pCaps)); EnterCriticalSection(&d3d9_cs); hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); LeaveCriticalSection(&d3d9_cs); WINECAPSTOD3D9CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */ pCaps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES; filter_caps(pCaps); TRACE("(%p) returning %p\n", This, pCaps); return hrc; }
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps) { IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, Adapter, DeviceType, pCaps); if(NULL == pCaps){ return D3DERR_INVALIDCALL; } pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)); if(pWineCaps == NULL){ return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ } memset(pCaps, 0, sizeof(*pCaps)); wined3d_mutex_lock(); hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps); wined3d_mutex_unlock(); WINECAPSTOD3D9CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */ pCaps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES; filter_caps(pCaps); TRACE("(%p) returning %p\n", This, pCaps); return hrc; }
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { IDirect3D9Impl *This = (IDirect3D9Impl *)iface; HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, Adapter, DeviceType, pCaps); if(NULL == pCaps){ return D3DERR_INVALIDCALL; } pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)); if(pWineCaps == NULL){ return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ } memset(pCaps, 0, sizeof(*pCaps)); wined3d_mutex_lock(); hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); wined3d_mutex_unlock(); WINECAPSTOD3D9CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); /* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */ pCaps->DevCaps2 |= D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES; filter_caps(pCaps); /* fixup caps */ #ifdef VBOX_WITH_WDDM /* needed for Windows Media Player to work properly */ pCaps->Caps |= D3DCAPS_READ_SCANLINE; pCaps->Caps2 |= 0x00080000 /*D3DCAPS2_CANRENDERWINDOWED*/; pCaps->Caps2 |= D3DCAPS2_CANSHARERESOURCE; pCaps->DevCaps |= D3DDEVCAPS_FLOATTLVERTEX /* <- must be set according to the docs */ /*| D3DDEVCAPS_HWVERTEXBUFFER | D3DDEVCAPS_HWINDEXBUFFER | D3DDEVCAPS_SUBVOLUMELOCK */; pCaps->PrimitiveMiscCaps |= D3DPMISCCAPS_INDEPENDENTWRITEMASKS | D3DPMISCCAPS_FOGINFVF | D3DPMISCCAPS_SEPARATEALPHABLEND | D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS; pCaps->RasterCaps |= D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_STIPPLE | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_COLORPERSPECTIVE /* keep */; pCaps->TextureCaps |= D3DPTEXTURECAPS_TRANSPARENCY | D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE; pCaps->TextureAddressCaps |= D3DPTADDRESSCAPS_MIRRORONCE; pCaps->VolumeTextureAddressCaps |= D3DPTADDRESSCAPS_MIRRORONCE; pCaps->StencilCaps |= D3DSTENCILCAPS_TWOSIDED; pCaps->DeclTypes |= D3DDTCAPS_FLOAT16_2 | D3DDTCAPS_FLOAT16_4; pCaps->VertexTextureFilterCaps |= D3DPTFILTERCAPS_MINFPOINT | D3DPTFILTERCAPS_MAGFPOINT; pCaps->GuardBandLeft = -8192.; pCaps->GuardBandTop = -8192.; pCaps->GuardBandRight = 8192.; pCaps->GuardBandBottom = 8192.; pCaps->VS20Caps.DynamicFlowControlDepth = 24; pCaps->VS20Caps.NumTemps = D3DVS20_MAX_NUMTEMPS; pCaps->PS20Caps.DynamicFlowControlDepth = 24; pCaps->PS20Caps.NumTemps = D3DVS20_MAX_NUMTEMPS; #endif /* workaround for wine not returning InstructionSlots correctly for shaders v3.0 */ if ((pCaps->VertexShaderVersion & 0xff00) == 0x0300) { pCaps->MaxVertexShader30InstructionSlots = RT_MIN(32768, pCaps->MaxVertexShader30InstructionSlots); pCaps->MaxPixelShader30InstructionSlots = RT_MIN(32768, pCaps->MaxPixelShader30InstructionSlots); } #if defined(DEBUG) if ((pCaps->VertexShaderVersion & 0xff00) == 0x0300) { ASSERT_D3D(pCaps->MaxVertexShader30InstructionSlots >= 512); ASSERT_D3D(pCaps->MaxVertexShader30InstructionSlots <= 32768); ASSERT_D3D(pCaps->MaxPixelShader30InstructionSlots >= 512); ASSERT_D3D(pCaps->MaxPixelShader30InstructionSlots <= 32768); } else if ((pCaps->VertexShaderVersion & 0xff00) == 0x0200) { ASSERT_D3D(pCaps->MaxVertexShader30InstructionSlots == 0); ASSERT_D3D(pCaps->MaxPixelShader30InstructionSlots == 0); } else { ERR_D3D(); } #endif TRACE("(%p) returning %p\n", This, pCaps); ASSERT_D3D(hrc == S_OK); return hrc; }