Commit d575b5fe authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8: Explicitly convert between D3DFORMAT and WINED3DFORMAT values.

parent 14f0e8ba
......@@ -209,6 +209,9 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -622,6 +622,8 @@ typedef struct IDirect3DPixelShader8Impl {
*
* to see how not defined it here
*/
D3DFORMAT d3dformat_from_wined3dformat(WINED3DFORMAT format);
WINED3DFORMAT wined3dformat_from_d3dformat(D3DFORMAT format);
void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wined3d_vertex_shader);
UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements);
size_t parse_token(const DWORD* pToken);
......
......@@ -147,6 +147,9 @@ static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT A
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
......@@ -158,6 +161,9 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, U
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
......@@ -169,8 +175,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 i
TRACE("(%p)->(%d, %d, %d, %d, %s)\n", This, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed ? "true" : "false");
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, DisplayFormat,
BackBufferFormat, Windowed);
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
wined3dformat_from_d3dformat(BackBufferFormat), Windowed);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -183,8 +189,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 i
TRACE("(%p)->(%d, %d, %d, %08x, %d, %d)\n", This, Adapter, DeviceType, AdapterFormat, Usage, RType, CheckFormat);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat,
Usage, RType, CheckFormat, SURFACE_OPENGL);
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
Usage, RType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -197,8 +203,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 if
TRACE("(%p)-<(%d, %d, %d, %s, %d)\n", This, Adapter, DeviceType, SurfaceFormat, Windowed ? "true" : "false", MultiSampleType);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, SurfaceFormat,
Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL);
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -211,8 +217,9 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface,
TRACE("(%p)-<(%d, %d, %d, %d, %d)\n", This, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, AdapterFormat,
RenderTargetFormat, DepthStencilFormat);
hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat),
wined3dformat_from_d3dformat(DepthStencilFormat));
LeaveCriticalSection(&d3d8_cs);
return hr;
}
......@@ -336,7 +343,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferFormat = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat);
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = 0; /* d3d9 only */
......@@ -344,7 +351,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.AutoDepthStencilFormat = wined3dformat_from_d3dformat(pPresentationParameters->AutoDepthStencilFormat);
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
......@@ -359,14 +366,14 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferFormat = d3dformat_from_wined3dformat(localParameters.BackBufferFormat);
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(localParameters.AutoDepthStencilFormat);
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->FullScreen_PresentationInterval = localParameters.PresentationInterval;
......
......@@ -183,6 +183,9 @@ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 i
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -167,6 +167,9 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -208,6 +208,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -185,6 +185,9 @@ static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -167,6 +167,9 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DV
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -209,6 +209,9 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMET
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment