d3d9: Introduce helpers to convert between d3d9 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:
parent
9a7591fab4
commit
5b70e3321a
|
@ -336,6 +336,11 @@ static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned i
|
|||
}
|
||||
}
|
||||
|
||||
static inline D3DMULTISAMPLE_TYPE d3dmultisample_type_from_wined3d(enum wined3d_multisample_type type)
|
||||
{
|
||||
return (D3DMULTISAMPLE_TYPE)type;
|
||||
}
|
||||
|
||||
static inline unsigned int map_access_from_usage(unsigned int usage)
|
||||
{
|
||||
if (usage & D3DUSAGE_WRITEONLY)
|
||||
|
@ -384,4 +389,9 @@ static inline DWORD wined3dusage_from_d3dusage(unsigned int usage)
|
|||
return usage & WINED3DUSAGE_MASK;
|
||||
}
|
||||
|
||||
static inline enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3DMULTISAMPLE_TYPE type)
|
||||
{
|
||||
return (enum wined3d_multisample_type)type;
|
||||
}
|
||||
|
||||
#endif /* __WINE_D3D9_PRIVATE_H */
|
||||
|
|
|
@ -244,7 +244,7 @@ void present_parameters_from_wined3d_swapchain_desc(D3DPRESENT_PARAMETERS *prese
|
|||
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->MultiSampleQuality = swapchain_desc->multisample_quality;
|
||||
present_parameters->SwapEffect = d3dswapeffect_from_wined3dswapeffect(swapchain_desc->swap_effect);
|
||||
present_parameters->hDeviceWindow = swapchain_desc->device_window;
|
||||
|
@ -335,7 +335,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 = present_parameters->MultiSampleQuality;
|
||||
swapchain_desc->swap_effect = wined3dswapeffect_from_d3dswapeffect(present_parameters->SwapEffect);
|
||||
swapchain_desc->device_window = present_parameters->hDeviceWindow;
|
||||
|
@ -1543,8 +1543,8 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, unsigned i
|
|||
IDirect3DSurface9_AddRef(*surface);
|
||||
|
||||
if (user_mem)
|
||||
wined3d_texture_update_desc(texture, width, height,
|
||||
desc.format, multisample_type, multisample_quality, user_mem, 0);
|
||||
wined3d_texture_update_desc(texture, width, height, desc.format,
|
||||
wined3d_multisample_type_from_d3d(multisample_type), multisample_quality, user_mem, 0);
|
||||
|
||||
wined3d_texture_decref(texture);
|
||||
|
||||
|
@ -1596,8 +1596,9 @@ static HRESULT WINAPI d3d9_device_CreateRenderTarget(IDirect3DDevice9Ex *iface,
|
|||
if (lockable)
|
||||
access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
|
||||
|
||||
return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format), multisample_type,
|
||||
multisample_quality, 0, WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface);
|
||||
return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format),
|
||||
wined3d_multisample_type_from_d3d(multisample_type), multisample_quality, 0,
|
||||
WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex *iface, UINT width, UINT height,
|
||||
|
@ -1628,8 +1629,8 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex *
|
|||
flags |= WINED3D_TEXTURE_CREATE_DISCARD;
|
||||
|
||||
return d3d9_device_create_surface(device, flags, wined3dformat_from_d3dformat(format),
|
||||
multisample_type, multisample_quality, 0, WINED3D_BIND_DEPTH_STENCIL,
|
||||
WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface);
|
||||
wined3d_multisample_type_from_d3d(multisample_type), multisample_quality, 0,
|
||||
WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface);
|
||||
}
|
||||
|
||||
|
||||
|
@ -4276,8 +4277,8 @@ static HRESULT WINAPI d3d9_device_CreateRenderTargetEx(IDirect3DDevice9Ex *iface
|
|||
access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
|
||||
|
||||
return d3d9_device_create_surface(device, 0, wined3dformat_from_d3dformat(format),
|
||||
multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK,
|
||||
WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface);
|
||||
wined3d_multisample_type_from_d3d(multisample_type), multisample_quality,
|
||||
usage & WINED3DUSAGE_MASK, WINED3D_BIND_RENDER_TARGET, access, width, height, NULL, surface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI d3d9_device_CreateOffscreenPlainSurfaceEx(IDirect3DDevice9Ex *iface,
|
||||
|
@ -4316,8 +4317,8 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex
|
|||
|
||||
*surface = NULL;
|
||||
return d3d9_device_create_surface(device, flags, wined3dformat_from_d3dformat(format),
|
||||
multisample_type, multisample_quality, usage & WINED3DUSAGE_MASK, WINED3D_BIND_DEPTH_STENCIL,
|
||||
WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface);
|
||||
wined3d_multisample_type_from_d3d(multisample_type), multisample_quality, usage & WINED3DUSAGE_MASK,
|
||||
WINED3D_BIND_DEPTH_STENCIL, WINED3D_RESOURCE_ACCESS_GPU, width, height, NULL, surface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *iface,
|
||||
|
|
|
@ -368,8 +368,8 @@ static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT
|
|||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
|
||||
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type,
|
||||
wined3dformat_from_d3dformat(format), windowed, multisample_type, levels);
|
||||
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, wined3dformat_from_d3dformat(format),
|
||||
windowed, wined3d_multisample_type_from_d3d(multisample_type), levels);
|
||||
wined3d_mutex_unlock();
|
||||
if (hr == WINED3DERR_NOTAVAILABLE && levels)
|
||||
*levels = 1;
|
||||
|
|
|
@ -224,7 +224,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_
|
|||
desc->Type = D3DRTYPE_SURFACE;
|
||||
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
|
||||
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
|
||||
desc->MultiSampleType = wined3d_desc.multisample_type;
|
||||
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
|
||||
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
|
||||
desc->Width = wined3d_desc.width;
|
||||
desc->Height = wined3d_desc.height;
|
||||
|
|
|
@ -367,7 +367,7 @@ static HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UIN
|
|||
desc->Type = D3DRTYPE_SURFACE;
|
||||
desc->Usage = texture->usage;
|
||||
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
|
||||
desc->MultiSampleType = wined3d_desc.multisample_type;
|
||||
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
|
||||
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
|
||||
desc->Width = wined3d_desc.width;
|
||||
desc->Height = wined3d_desc.height;
|
||||
|
@ -774,7 +774,7 @@ static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *ifac
|
|||
desc->Type = D3DRTYPE_SURFACE;
|
||||
desc->Usage = texture->usage;
|
||||
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
|
||||
desc->MultiSampleType = wined3d_desc.multisample_type;
|
||||
desc->MultiSampleType = d3dmultisample_type_from_wined3d(wined3d_desc.multisample_type);
|
||||
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
|
||||
desc->Width = wined3d_desc.width;
|
||||
desc->Height = wined3d_desc.height;
|
||||
|
|
Loading…
Reference in New Issue