d3d8: Introduce helpers to convert between d3d8 and wined3d multisample types.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Chip Davis 2020-03-31 19:39:16 +04:30 committed by Alexandre Julliard
parent 7dce36c8f5
commit 43104e37ad
4 changed files with 18 additions and 7 deletions

View File

@ -369,4 +369,9 @@ static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage)
return bind_flags;
}
static inline D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type)
{
return (D3DMULTISAMPLE_TYPE)type;
}
#endif /* __WINE_D3DX8_PRIVATE_H */

View File

@ -204,7 +204,7 @@ static void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS
present_parameters->BackBufferHeight = swapchain_desc->backbuffer_height;
present_parameters->BackBufferFormat = d3dformat_from_wined3dformat(swapchain_desc->backbuffer_format);
present_parameters->BackBufferCount = swapchain_desc->backbuffer_count;
present_parameters->MultiSampleType = swapchain_desc->multisample_type;
present_parameters->MultiSampleType = d3dmultisample_type_from_wined3d(swapchain_desc->multisample_type);
present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
present_parameters->hDeviceWindow = swapchain_desc->device_window;
present_parameters->Windowed = swapchain_desc->windowed;
@ -255,6 +255,11 @@ static enum wined3d_swap_interval wined3dswapinterval_from_d3d(DWORD interval)
}
}
static enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type)
{
return (enum wined3d_multisample_type)type;
}
static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapchain_desc *swapchain_desc,
const D3DPRESENT_PARAMETERS *present_parameters)
{
@ -291,7 +296,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
swapchain_desc->backbuffer_bind_flags = WINED3D_BIND_RENDER_TARGET;
swapchain_desc->multisample_type = present_parameters->MultiSampleType;
swapchain_desc->multisample_type = wined3d_multisample_type_from_d3d(present_parameters->MultiSampleType);
swapchain_desc->multisample_quality = 0; /* d3d9 only */
swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
swapchain_desc->device_window = present_parameters->hDeviceWindow;
@ -1263,7 +1268,8 @@ static HRESULT WINAPI d3d8_device_CreateRenderTarget(IDirect3DDevice8 *iface, UI
access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format),
multisample_type, WINED3D_BIND_RENDER_TARGET, access, width, height, surface);
wined3d_multisample_type_from_d3d(multisample_type),
WINED3D_BIND_RENDER_TARGET, access, width, height, surface);
}
static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *iface,
@ -1281,7 +1287,7 @@ static HRESULT WINAPI d3d8_device_CreateDepthStencilSurface(IDirect3DDevice8 *if
*surface = NULL;
return d3d8_device_create_surface(device, wined3dformat_from_d3dformat(format),
multisample_type, WINED3D_BIND_DEPTH_STENCIL,
wined3d_multisample_type_from_d3d(multisample_type), WINED3D_BIND_DEPTH_STENCIL,
WINED3D_RESOURCE_ACCESS_GPU, width, height, surface);
}

View File

@ -193,7 +193,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;

View File

@ -255,7 +255,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
}
@ -602,7 +602,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
}