wined3d: Pass a struct wined3d_adapter pointer to wined3d_check_device_multisample_type().
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
591068cec0
commit
beb4668d58
|
@ -3432,6 +3432,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckMultisampleQualityLevels(ID3D
|
||||||
{
|
{
|
||||||
struct d3d_device *device = impl_from_ID3D11Device2(iface);
|
struct d3d_device *device = impl_from_ID3D11Device2(iface);
|
||||||
struct wined3d_device_creation_parameters params;
|
struct wined3d_device_creation_parameters params;
|
||||||
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
struct wined3d *wined3d;
|
struct wined3d *wined3d;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -3456,7 +3457,8 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckMultisampleQualityLevels(ID3D
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
wined3d = wined3d_device_get_wined3d(device->wined3d_device);
|
wined3d = wined3d_device_get_wined3d(device->wined3d_device);
|
||||||
wined3d_device_get_creation_parameters(device->wined3d_device, ¶ms);
|
wined3d_device_get_creation_parameters(device->wined3d_device, ¶ms);
|
||||||
hr = wined3d_check_device_multisample_type(wined3d, params.adapter_idx, params.device_type,
|
wined3d_adapter = wined3d_get_adapter(wined3d, params.adapter_idx);
|
||||||
|
hr = wined3d_check_device_multisample_type(wined3d_adapter, params.device_type,
|
||||||
wined3dformat_from_dxgi_format(format), TRUE, sample_count, quality_level_count);
|
wined3dformat_from_dxgi_format(format), TRUE, sample_count, quality_level_count);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
|
|
|
@ -247,12 +247,18 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
||||||
{
|
{
|
||||||
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
||||||
enum wined3d_resource_type wined3d_rtype;
|
enum wined3d_resource_type wined3d_rtype;
|
||||||
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
unsigned int bind_flags;
|
unsigned int bind_flags;
|
||||||
|
unsigned int output_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
||||||
iface, adapter, device_type, adapter_format, usage, resource_type, format);
|
iface, adapter, device_type, adapter_format, usage, resource_type, format);
|
||||||
|
|
||||||
|
output_idx = adapter;
|
||||||
|
if (output_idx >= d3d8->wined3d_output_count)
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (adapter_format != D3DFMT_X8R8G8B8 && adapter_format != D3DFMT_R5G6B5
|
if (adapter_format != D3DFMT_X8R8G8B8 && adapter_format != D3DFMT_R5G6B5
|
||||||
&& adapter_format != D3DFMT_X1R5G5B5)
|
&& adapter_format != D3DFMT_X1R5G5B5)
|
||||||
{
|
{
|
||||||
|
@ -292,7 +298,9 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
||||||
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
||||||
{
|
{
|
||||||
DWORD levels;
|
DWORD levels;
|
||||||
hr = wined3d_check_device_multisample_type(d3d8->wined3d, adapter, device_type,
|
|
||||||
|
wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]);
|
||||||
|
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type,
|
||||||
WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels);
|
WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels);
|
||||||
if (SUCCEEDED(hr) && !levels)
|
if (SUCCEEDED(hr) && !levels)
|
||||||
hr = D3DERR_NOTAVAILABLE;
|
hr = D3DERR_NOTAVAILABLE;
|
||||||
|
@ -309,16 +317,23 @@ static HRESULT WINAPI d3d8_CheckDeviceMultiSampleType(IDirect3D8 *iface, UINT ad
|
||||||
D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type)
|
D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type)
|
||||||
{
|
{
|
||||||
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
||||||
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
|
unsigned int output_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x.\n",
|
TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x.\n",
|
||||||
iface, adapter, device_type, format, windowed, multisample_type);
|
iface, adapter, device_type, format, windowed, multisample_type);
|
||||||
|
|
||||||
|
output_idx = adapter;
|
||||||
|
if (output_idx >= d3d8->wined3d_output_count)
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (multisample_type > D3DMULTISAMPLE_16_SAMPLES)
|
if (multisample_type > D3DMULTISAMPLE_16_SAMPLES)
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_check_device_multisample_type(d3d8->wined3d, adapter, device_type,
|
wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]);
|
||||||
|
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type,
|
||||||
wined3dformat_from_d3dformat(format), windowed,
|
wined3dformat_from_d3dformat(format), windowed,
|
||||||
(enum wined3d_multisample_type)multisample_type, NULL);
|
(enum wined3d_multisample_type)multisample_type, NULL);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
|
@ -271,12 +271,18 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
||||||
{
|
{
|
||||||
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
||||||
enum wined3d_resource_type wined3d_rtype;
|
enum wined3d_resource_type wined3d_rtype;
|
||||||
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
unsigned int bind_flags;
|
unsigned int bind_flags;
|
||||||
|
unsigned int output_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
||||||
iface, adapter, device_type, adapter_format, usage, resource_type, format);
|
iface, adapter, device_type, adapter_format, usage, resource_type, format);
|
||||||
|
|
||||||
|
output_idx = adapter;
|
||||||
|
if (output_idx >= d3d9->wined3d_output_count)
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (adapter_format != D3DFMT_X8R8G8B8 && adapter_format != D3DFMT_R5G6B5
|
if (adapter_format != D3DFMT_X8R8G8B8 && adapter_format != D3DFMT_R5G6B5
|
||||||
&& adapter_format != D3DFMT_X1R5G5B5)
|
&& adapter_format != D3DFMT_X1R5G5B5)
|
||||||
{
|
{
|
||||||
|
@ -316,7 +322,9 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
||||||
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
||||||
{
|
{
|
||||||
DWORD levels;
|
DWORD levels;
|
||||||
hr = wined3d_check_device_multisample_type(d3d9->wined3d, adapter, device_type,
|
|
||||||
|
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
|
||||||
|
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type,
|
||||||
WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels);
|
WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels);
|
||||||
if (SUCCEEDED(hr) && !levels)
|
if (SUCCEEDED(hr) && !levels)
|
||||||
hr = D3DERR_NOTAVAILABLE;
|
hr = D3DERR_NOTAVAILABLE;
|
||||||
|
@ -334,16 +342,23 @@ static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT
|
||||||
D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type, DWORD *levels)
|
D3DFORMAT format, BOOL windowed, D3DMULTISAMPLE_TYPE multisample_type, DWORD *levels)
|
||||||
{
|
{
|
||||||
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
||||||
|
struct wined3d_adapter *wined3d_adapter;
|
||||||
|
unsigned int output_idx;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
|
TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n",
|
||||||
iface, adapter, device_type, format, windowed, multisample_type, levels);
|
iface, adapter, device_type, format, windowed, multisample_type, levels);
|
||||||
|
|
||||||
|
output_idx = adapter;
|
||||||
|
if (output_idx >= d3d9->wined3d_output_count)
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
if (multisample_type > D3DMULTISAMPLE_16_SAMPLES)
|
if (multisample_type > D3DMULTISAMPLE_16_SAMPLES)
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_check_device_multisample_type(d3d9->wined3d, adapter, device_type,
|
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);
|
wined3dformat_from_d3dformat(format), windowed, multisample_type, levels);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
if (hr == WINED3DERR_NOTAVAILABLE && levels)
|
if (hr == WINED3DERR_NOTAVAILABLE && levels)
|
||||||
|
|
|
@ -1475,21 +1475,18 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d_adapter *ad
|
||||||
return WINED3DERR_NOTAVAILABLE;
|
return WINED3DERR_NOTAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
|
HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d_adapter *adapter,
|
||||||
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
|
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
|
||||||
enum wined3d_multisample_type multisample_type, DWORD *quality_levels)
|
enum wined3d_multisample_type multisample_type, DWORD *quality_levels)
|
||||||
{
|
{
|
||||||
const struct wined3d_adapter *adapter;
|
|
||||||
const struct wined3d_format *format;
|
const struct wined3d_format *format;
|
||||||
HRESULT hr = WINED3D_OK;
|
HRESULT hr = WINED3D_OK;
|
||||||
|
|
||||||
TRACE("wined3d %p, adapter_idx %u, device_type %s, surface_format %s, "
|
TRACE("adapter %p, device_type %s, surface_format %s, "
|
||||||
"windowed %#x, multisample_type %#x, quality_levels %p.\n",
|
"windowed %#x, multisample_type %#x, quality_levels %p.\n",
|
||||||
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(surface_format_id),
|
adapter, debug_d3ddevicetype(device_type), debug_d3dformat(surface_format_id),
|
||||||
windowed, multisample_type, quality_levels);
|
windowed, multisample_type, quality_levels);
|
||||||
|
|
||||||
if (adapter_idx >= wined3d->adapter_count)
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
if (surface_format_id == WINED3DFMT_UNKNOWN)
|
if (surface_format_id == WINED3DFMT_UNKNOWN)
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
if (multisample_type < WINED3D_MULTISAMPLE_NONE)
|
if (multisample_type < WINED3D_MULTISAMPLE_NONE)
|
||||||
|
@ -1500,7 +1497,6 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
|
||||||
return WINED3DERR_NOTAVAILABLE;
|
return WINED3DERR_NOTAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
adapter = wined3d->adapters[adapter_idx];
|
|
||||||
format = wined3d_get_format(adapter, surface_format_id, 0);
|
format = wined3d_get_format(adapter, surface_format_id, 0);
|
||||||
|
|
||||||
if (multisample_type && !(format->multisample_types & 1u << (multisample_type - 1)))
|
if (multisample_type && !(format->multisample_types & 1u << (multisample_type - 1)))
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long)
|
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long)
|
||||||
@ cdecl wined3d_check_device_format(ptr long long long long long long long)
|
@ cdecl wined3d_check_device_format(ptr long long long long long long long)
|
||||||
@ cdecl wined3d_check_device_format_conversion(ptr long long long)
|
@ cdecl wined3d_check_device_format_conversion(ptr long long long)
|
||||||
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
|
@ cdecl wined3d_check_device_multisample_type(ptr long long long long ptr)
|
||||||
@ cdecl wined3d_check_device_type(ptr ptr long long long long)
|
@ cdecl wined3d_check_device_type(ptr ptr long long long long)
|
||||||
@ cdecl wined3d_create(long)
|
@ cdecl wined3d_create(long)
|
||||||
@ cdecl wined3d_decref(ptr)
|
@ cdecl wined3d_decref(ptr)
|
||||||
|
|
|
@ -2258,7 +2258,7 @@ HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT
|
||||||
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d_output *output,
|
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d_output *output,
|
||||||
enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
|
enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
|
||||||
enum wined3d_format_id target_format_id);
|
enum wined3d_format_id target_format_id);
|
||||||
HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx,
|
HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d_adapter *adapter,
|
||||||
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
|
enum wined3d_device_type device_type, enum wined3d_format_id surface_format_id, BOOL windowed,
|
||||||
enum wined3d_multisample_type multisample_type, DWORD *quality_levels);
|
enum wined3d_multisample_type multisample_type, DWORD *quality_levels);
|
||||||
HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d,
|
HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d,
|
||||||
|
|
Loading…
Reference in New Issue