d3d8: Explicitly convert between D3DFORMAT and WINED3DFORMAT values.

This commit is contained in:
Henri Verbeet 2009-02-19 16:59:41 +01:00 committed by Alexandre Julliard
parent 14f0e8ba4b
commit d575b5fecb
10 changed files with 177 additions and 37 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -36,6 +36,106 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
D3DFORMAT d3dformat_from_wined3dformat(WINED3DFORMAT format)
{
BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */
if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format;
switch(format)
{
case WINED3DFMT_UNKNOWN: return D3DFMT_UNKNOWN;
case WINED3DFMT_R8G8B8: return D3DFMT_R8G8B8;
case WINED3DFMT_A8R8G8B8: return D3DFMT_A8R8G8B8;
case WINED3DFMT_X8R8G8B8: return D3DFMT_X8R8G8B8;
case WINED3DFMT_R5G6B5: return D3DFMT_R5G6B5;
case WINED3DFMT_X1R5G5B5: return D3DFMT_X1R5G5B5;
case WINED3DFMT_A1R5G5B5: return D3DFMT_A1R5G5B5;
case WINED3DFMT_A4R4G4B4: return D3DFMT_A4R4G4B4;
case WINED3DFMT_R3G3B2: return D3DFMT_R3G3B2;
case WINED3DFMT_A8: return D3DFMT_A8;
case WINED3DFMT_A8R3G3B2: return D3DFMT_A8R3G3B2;
case WINED3DFMT_X4R4G4B4: return D3DFMT_X4R4G4B4;
case WINED3DFMT_A2B10G10R10: return D3DFMT_A2B10G10R10;
case WINED3DFMT_G16R16: return D3DFMT_G16R16;
case WINED3DFMT_A8P8: return D3DFMT_A8P8;
case WINED3DFMT_P8: return D3DFMT_P8;
case WINED3DFMT_L8: return D3DFMT_L8;
case WINED3DFMT_A8L8: return D3DFMT_A8L8;
case WINED3DFMT_A4L4: return D3DFMT_A4L4;
case WINED3DFMT_V8U8: return D3DFMT_V8U8;
case WINED3DFMT_L6V5U5: return D3DFMT_L6V5U5;
case WINED3DFMT_X8L8V8U8: return D3DFMT_X8L8V8U8;
case WINED3DFMT_Q8W8V8U8: return D3DFMT_Q8W8V8U8;
case WINED3DFMT_V16U16: return D3DFMT_V16U16;
case WINED3DFMT_A2W10V10U10: return D3DFMT_A2W10V10U10;
case WINED3DFMT_D16_LOCKABLE: return D3DFMT_D16_LOCKABLE;
case WINED3DFMT_D32: return D3DFMT_D32;
case WINED3DFMT_D15S1: return D3DFMT_D15S1;
case WINED3DFMT_D24S8: return D3DFMT_D24S8;
case WINED3DFMT_D24X8: return D3DFMT_D24X8;
case WINED3DFMT_D24X4S4: return D3DFMT_D24X4S4;
case WINED3DFMT_D16: return D3DFMT_D16;
case WINED3DFMT_VERTEXDATA: return D3DFMT_VERTEXDATA;
case WINED3DFMT_INDEX16: return D3DFMT_INDEX16;
case WINED3DFMT_INDEX32: return D3DFMT_INDEX32;
default:
FIXME("Unhandled WINED3DFORMAT %#x\n", format);
return D3DFMT_UNKNOWN;
}
}
WINED3DFORMAT wined3dformat_from_d3dformat(D3DFORMAT format)
{
BYTE *c = (BYTE *)&format;
/* Don't translate FOURCC formats */
if (isprint(c[0]) && isprint(c[1]) && isprint(c[2]) && isprint(c[3])) return format;
switch(format)
{
case D3DFMT_UNKNOWN: return WINED3DFMT_UNKNOWN;
case D3DFMT_R8G8B8: return WINED3DFMT_R8G8B8;
case D3DFMT_A8R8G8B8: return WINED3DFMT_A8R8G8B8;
case D3DFMT_X8R8G8B8: return WINED3DFMT_X8R8G8B8;
case D3DFMT_R5G6B5: return WINED3DFMT_R5G6B5;
case D3DFMT_X1R5G5B5: return WINED3DFMT_X1R5G5B5;
case D3DFMT_A1R5G5B5: return WINED3DFMT_A1R5G5B5;
case D3DFMT_A4R4G4B4: return WINED3DFMT_A4R4G4B4;
case D3DFMT_R3G3B2: return WINED3DFMT_R3G3B2;
case D3DFMT_A8: return WINED3DFMT_A8;
case D3DFMT_A8R3G3B2: return WINED3DFMT_A8R3G3B2;
case D3DFMT_X4R4G4B4: return WINED3DFMT_X4R4G4B4;
case D3DFMT_A2B10G10R10: return WINED3DFMT_A2B10G10R10;
case D3DFMT_G16R16: return WINED3DFMT_G16R16;
case D3DFMT_A8P8: return WINED3DFMT_A8P8;
case D3DFMT_P8: return WINED3DFMT_P8;
case D3DFMT_L8: return WINED3DFMT_L8;
case D3DFMT_A8L8: return WINED3DFMT_A8L8;
case D3DFMT_A4L4: return WINED3DFMT_A4L4;
case D3DFMT_V8U8: return WINED3DFMT_V8U8;
case D3DFMT_L6V5U5: return WINED3DFMT_L6V5U5;
case D3DFMT_X8L8V8U8: return WINED3DFMT_X8L8V8U8;
case D3DFMT_Q8W8V8U8: return WINED3DFMT_Q8W8V8U8;
case D3DFMT_V16U16: return WINED3DFMT_V16U16;
case D3DFMT_A2W10V10U10: return WINED3DFMT_A2W10V10U10;
case D3DFMT_D16_LOCKABLE: return WINED3DFMT_D16_LOCKABLE;
case D3DFMT_D32: return WINED3DFMT_D32;
case D3DFMT_D15S1: return WINED3DFMT_D15S1;
case D3DFMT_D24S8: return WINED3DFMT_D24S8;
case D3DFMT_D24X8: return WINED3DFMT_D24X8;
case D3DFMT_D24X4S4: return WINED3DFMT_D24X4S4;
case D3DFMT_D16: return WINED3DFMT_D16;
case D3DFMT_VERTEXDATA: return WINED3DFMT_VERTEXDATA;
case D3DFMT_INDEX16: return WINED3DFMT_INDEX16;
case D3DFMT_INDEX32: return WINED3DFMT_INDEX32;
default:
FIXME("Unhandled D3DFORMAT %#x\n", format);
return WINED3DFMT_UNKNOWN;
}
}
/* Shader handle functions */
static shader_handle *alloc_shader_handle(IDirect3DDevice8Impl *This) {
if (This->free_shader_handles) {
@ -225,6 +325,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(LPDIRECT3DDEVICE8 ifac
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, 0, (WINED3DDISPLAYMODE *) pMode);
LeaveCriticalSection(&d3d8_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
@ -300,7 +403,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
/* 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 = 0; /* d3d9 only */
@ -308,7 +411,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
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;
@ -321,14 +424,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
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;
@ -355,7 +458,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRE
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 */
@ -363,7 +466,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRE
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;
@ -375,14 +478,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRE
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;
@ -470,7 +573,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface
object->ref = 1;
EnterCriticalSection(&d3d8_cs);
hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK,
Format, Pool, &object->wineD3DTexture, NULL, (IUnknown *)object);
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DTexture, NULL, (IUnknown *)object);
LeaveCriticalSection(&d3d8_cs);
if (FAILED(hrc)) {
@ -510,7 +613,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8
object->ref = 1;
EnterCriticalSection(&d3d8_cs);
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
Usage & WINED3DUSAGE_MASK, Format, Pool, &object->wineD3DVolumeTexture, NULL, (IUnknown *)object);
Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format), Pool,
&object->wineD3DVolumeTexture, NULL, (IUnknown *)object);
LeaveCriticalSection(&d3d8_cs);
if (hrc != D3D_OK) {
@ -550,7 +654,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 i
object->ref = 1;
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage & WINED3DUSAGE_MASK,
Format, Pool, &object->wineD3DCubeTexture, NULL, (IUnknown *)object);
wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DCubeTexture, NULL, (IUnknown *)object);
LeaveCriticalSection(&d3d8_cs);
if (hr != D3D_OK){
@ -621,7 +725,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(LPDIRECT3DDEVICE8 i
object->ref = 1;
TRACE("Calling wined3d create index buffer\n");
EnterCriticalSection(&d3d8_cs);
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK, Format, (WINED3DPOOL) Pool, &object->wineD3DIndexBuffer, NULL, (IUnknown *)object);
hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK,
wined3dformat_from_d3dformat(Format), (WINED3DPOOL) Pool, &object->wineD3DIndexBuffer,
NULL, (IUnknown *)object);
LeaveCriticalSection(&d3d8_cs);
if (D3D_OK != hrc) {
@ -668,7 +774,9 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT
TRACE("(%p) : w(%d) h(%d) fmt(%d) surf@%p\n", This, Width, Height, Format, *ppSurface);
/* Not called from the VTable, no locking needed */
hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, Format, Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage & WINED3DUSAGE_MASK, (WINED3DPOOL) Pool,MultiSample,MultisampleQuality, NULL, SURFACE_OPENGL, (IUnknown *)object);
hrc = IWineD3DDevice_CreateSurface(This->WineD3DDevice, Width, Height, wined3dformat_from_d3dformat(Format),
Lockable, Discard, Level, &object->wineD3DSurface, Type, Usage & WINED3DUSAGE_MASK,
(WINED3DPOOL)Pool, MultiSample,MultisampleQuality, NULL, SURFACE_OPENGL, (IUnknown *)object);
if (hrc != D3D_OK || NULL == object->wineD3DSurface) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateSurface failed\n", This);
@ -1441,8 +1549,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d8_cs);
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount,
pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex,
NumVertexIndices, PrimitiveCount, pIndexData, wined3dformat_from_d3dformat(IndexDataFormat),
pVertexStreamZeroData, VertexStreamZeroStride);
LeaveCriticalSection(&d3d8_cs);
return hr;
}
@ -2302,8 +2411,9 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen
if (pool == WINED3DPOOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC)) lockable = FALSE;
hr = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)This, width, height,
format, lockable, FALSE /* Discard */, level, (IDirect3DSurface8 **)&d3d_surface,
D3DRTYPE_SURFACE, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level,
(IDirect3DSurface8 **)&d3d_surface, D3DRTYPE_SURFACE, usage, pool,
D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
if (FAILED(hr))
{
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
@ -2331,8 +2441,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice
"\tmultisample_quality %u, lockable %u, surface %p\n",
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
hr = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)This, width, height, format,
multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
hr = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)This, width, height,
d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
if (FAILED(hr))
{
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
@ -2360,8 +2470,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3
"\tmultisample_quality %u, discard %u, surface %p\n",
iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
hr = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)This, width, height, format,
multisample_type, (IDirect3DSurface8 **)&d3d_surface);
hr = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)This, width, height,
d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface);
if (FAILED(hr))
{
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
@ -2431,14 +2541,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
/* Copy the presentation parameters */
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
local_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
local_parameters.BackBufferFormat = present_parameters->BackBufferFormat;
local_parameters.BackBufferFormat = d3dformat_from_wined3dformat(present_parameters->BackBufferFormat);
local_parameters.BackBufferCount = present_parameters->BackBufferCount;
local_parameters.MultiSampleType = present_parameters->MultiSampleType;
local_parameters.SwapEffect = present_parameters->SwapEffect;
local_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
local_parameters.Windowed = present_parameters->Windowed;
local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
local_parameters.AutoDepthStencilFormat = present_parameters->AutoDepthStencilFormat;
local_parameters.AutoDepthStencilFormat = d3dformat_from_wined3dformat(present_parameters->AutoDepthStencilFormat);
local_parameters.Flags = present_parameters->Flags;
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
@ -2459,14 +2569,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
/* Copy back the presentation parameters */
present_parameters->BackBufferWidth = local_parameters.BackBufferWidth;
present_parameters->BackBufferHeight = local_parameters.BackBufferHeight;
present_parameters->BackBufferFormat = local_parameters.BackBufferFormat;
present_parameters->BackBufferFormat = wined3dformat_from_d3dformat(local_parameters.BackBufferFormat);
present_parameters->BackBufferCount = local_parameters.BackBufferCount;
present_parameters->MultiSampleType = local_parameters.MultiSampleType;
present_parameters->SwapEffect = local_parameters.SwapEffect;
present_parameters->hDeviceWindow = local_parameters.hDeviceWindow;
present_parameters->Windowed = local_parameters.Windowed;
present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil;
present_parameters->AutoDepthStencilFormat = local_parameters.AutoDepthStencilFormat;
present_parameters->AutoDepthStencilFormat = wined3dformat_from_d3dformat(local_parameters.AutoDepthStencilFormat);
present_parameters->Flags = local_parameters.Flags;
present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz;
present_parameters->PresentationInterval = local_parameters.FullScreen_PresentationInterval;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}