Commit 61a9efc4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Explicitly convert between D3DFORMAT and WINED3DFORMAT values.

parent d575b5fe
......@@ -228,12 +228,13 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr;
TRACE("(%p) Relay\n", This);
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
wined3ddesc.Format = (WINED3DFORMAT *)&pDesc->Format;
wined3ddesc.Format = &format;
wined3ddesc.Type = (WINED3DRESOURCETYPE *) &pDesc->Type;
wined3ddesc.Usage = &pDesc->Usage;
wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
......@@ -246,6 +247,9 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
}
......@@ -355,7 +359,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX ifac
object->ref = 1;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage,
Format, Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object);
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DCubeTexture,
pSharedHandle, (IUnknown*)object);
LeaveCriticalSection(&d3d9_cs);
if (hr != D3D_OK){
......
......@@ -45,6 +45,8 @@ extern HRESULT vdecl_convert_fvf(
DWORD FVF,
D3DVERTEXELEMENT9** ppVertexElements);
extern CRITICAL_SECTION d3d9_cs;
D3DFORMAT d3dformat_from_wined3dformat(WINED3DFORMAT format);
WINED3DFORMAT wined3dformat_from_d3dformat(D3DFORMAT format);
/* ===========================================================================
Macros
......
......@@ -137,7 +137,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT
}
EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, Format);
hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format));
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -148,18 +148,27 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT
TRACE("(%p)->(%d, %d, %d, %p)\n", This, Adapter, Format, Mode, pMode);
/* We can't pass this to WineD3D, otherwise it'll think it came from D3D8 or DDraw.
It's supposed to fail anyway, so no harm returning failure. */
if(Format != WINED3DFMT_X8R8G8B8 && Format != WINED3DFMT_R5G6B5)
if(Format != D3DFMT_X8R8G8B8 && Format != D3DFMT_R5G6B5)
return D3DERR_INVALIDCALL;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, Format, Mode, (WINED3DDISPLAYMODE *) pMode);
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format),
Mode, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
return IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
HRESULT hr;
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9EX iface,
......@@ -171,8 +180,8 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9EX iface,
BackBufferFormat, Windowed ? "true" : "false");
EnterCriticalSection(&d3d9_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(&d3d9_cs);
return hr;
}
......@@ -185,8 +194,8 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9EX iface,
TRACE("%p\n", This);
EnterCriticalSection(&d3d9_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(&d3d9_cs);
return hr;
}
......@@ -199,8 +208,8 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9EX if
TRACE("%p\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, SurfaceFormat,
Windowed, MultiSampleType, pQualityLevels);
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels);
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -213,8 +222,9 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9EX iface,
TRACE("%p\n", This);
EnterCriticalSection(&d3d9_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(&d3d9_cs);
return hr;
}
......@@ -225,8 +235,8 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX i
TRACE("%p\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, SourceFormat,
TargetFormat);
hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat));
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......@@ -404,7 +414,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
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 = pPresentationParameters->MultiSampleQuality;
......@@ -412,7 +422,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
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->PresentationInterval;
......@@ -426,7 +436,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
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->MultiSampleQuality = localParameters.MultiSampleQuality;
......@@ -434,7 +444,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
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->PresentationInterval = localParameters.PresentationInterval;
......
......@@ -184,6 +184,9 @@ static HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDesc(LPDIRECT3DINDEXB
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......@@ -230,7 +233,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface,
object->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
object->ref = 1;
TRACE("Calling wined3d create index buffer\n");
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK, Format, (WINED3DPOOL) Pool, &object->wineD3DIndexBuffer, pSharedHandle, (IUnknown *)object);
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK,
wined3dformat_from_d3dformat(Format), (WINED3DPOOL)Pool, &object->wineD3DIndexBuffer,
pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
......
......@@ -201,11 +201,12 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr;
TRACE("(%p) Relay\n", This);
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
wined3ddesc.Format = (WINED3DFORMAT *)&pDesc->Format;
wined3ddesc.Format = &format;
wined3ddesc.Type = (WINED3DRESOURCETYPE *)&pDesc->Type;
wined3ddesc.Usage = &pDesc->Usage;
wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
......@@ -218,6 +219,9 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
}
......
......@@ -126,6 +126,9 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
......@@ -159,7 +162,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWA
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = winePresentParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = winePresentParameters.BackBufferFormat;
pPresentationParameters->BackBufferFormat = d3dformat_from_wined3dformat(winePresentParameters.BackBufferFormat);
pPresentationParameters->BackBufferCount = winePresentParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = winePresentParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = winePresentParameters.MultiSampleQuality;
......@@ -167,7 +170,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWA
pPresentationParameters->hDeviceWindow = winePresentParameters.hDeviceWindow;
pPresentationParameters->Windowed = winePresentParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = winePresentParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = winePresentParameters.AutoDepthStencilFormat;
pPresentationParameters->AutoDepthStencilFormat = d3dformat_from_wined3dformat(winePresentParameters.AutoDepthStencilFormat);
pPresentationParameters->Flags = winePresentParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = winePresentParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = winePresentParameters.PresentationInterval;
......@@ -216,7 +219,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
/* Allocate an associated WineD3DDevice object */
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 = pPresentationParameters->MultiSampleQuality;
......@@ -224,7 +227,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
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->PresentationInterval;
......@@ -237,7 +240,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
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->MultiSampleQuality = localParameters.MultiSampleQuality;
......@@ -245,7 +248,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
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->PresentationInterval = localParameters.PresentationInterval;
......
......@@ -227,10 +227,12 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac
WINED3DSURFACE_DESC wined3ddesc;
UINT tmpInt = -1;
HRESULT hr;
WINED3DFORMAT format;
TRACE("(%p) Relay\n", This);
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
wined3ddesc.Format = (WINED3DFORMAT *)&pDesc->Format;
wined3ddesc.Format = &format;
wined3ddesc.Type = (WINED3DRESOURCETYPE *)&pDesc->Type;
wined3ddesc.Usage = &pDesc->Usage;
wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
......@@ -243,6 +245,9 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
}
......@@ -347,7 +352,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, U
object->ref = 1;
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK,
Format, Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object);
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (FAILED(hrc)) {
......
......@@ -181,6 +181,9 @@ static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDesc(LPDIRECT3DVERTEXBUFFER9
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, (WINED3DVERTEXBUFFER_DESC *) pDesc);
LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(pDesc->Format);
return hr;
}
......
......@@ -132,11 +132,13 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DV
IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface;
WINED3DVOLUME_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr;
TRACE("(%p) Relay\n", This);
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
wined3ddesc.Format = (WINED3DFORMAT *)&pDesc->Format;
wined3ddesc.Format = &format;
wined3ddesc.Type = (WINED3DRESOURCETYPE *)&pDesc->Type;
wined3ddesc.Usage = &pDesc->Usage;
wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
......@@ -145,7 +147,11 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DV
wined3ddesc.Height = &pDesc->Height;
wined3ddesc.Depth = &pDesc->Depth;
return IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
hr = IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
}
static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
......
......@@ -156,11 +156,13 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
WINED3DVOLUME_DESC wined3ddesc;
UINT tmpInt = -1;
WINED3DFORMAT format;
HRESULT hr;
TRACE("(%p) Relay\n", This);
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
wined3ddesc.Format = (WINED3DFORMAT *)&pDesc->Format;
wined3ddesc.Format = &format;
wined3ddesc.Type = (WINED3DRESOURCETYPE *)&pDesc->Type;
wined3ddesc.Usage = &pDesc->Usage;
wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
......@@ -169,7 +171,11 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
wined3ddesc.Height = &pDesc->Height;
wined3ddesc.Depth = &pDesc->Depth;
return IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) {
......@@ -259,7 +265,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX if
object->lpVtbl = &Direct3DVolumeTexture9_Vtbl;
object->ref = 1;
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
Usage & WINED3DUSAGE_MASK, Format, Pool, &object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object);
Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format), Pool,
&object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
......
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