wined3d: Pass a struct wined3d_adapter pointer to wined3d_check_device_format().
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
beb4668d58
commit
f2a850c844
|
@ -3351,6 +3351,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
|
|||
{
|
||||
struct d3d_device *device = impl_from_ID3D11Device2(iface);
|
||||
struct wined3d_device_creation_parameters params;
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
enum wined3d_format_id wined3d_format;
|
||||
D3D_FEATURE_LEVEL feature_level;
|
||||
struct wined3d *wined3d;
|
||||
|
@ -3388,9 +3389,10 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
|
|||
feature_level = device->feature_level;
|
||||
wined3d = wined3d_device_get_wined3d(device->wined3d_device);
|
||||
wined3d_device_get_creation_parameters(device->wined3d_device, ¶ms);
|
||||
wined3d_adapter = wined3d_get_adapter(wined3d, params.adapter_idx);
|
||||
for (i = 0; i < ARRAY_SIZE(flag_mapping); ++i)
|
||||
{
|
||||
hr = wined3d_check_device_format(wined3d, params.adapter_idx, params.device_type,
|
||||
hr = wined3d_check_device_format(wined3d, wined3d_adapter, params.device_type,
|
||||
WINED3DFMT_UNKNOWN, 0, flag_mapping[i].bind_flags, flag_mapping[i].rtype, wined3d_format);
|
||||
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DOK_NOMIPGEN)
|
||||
continue;
|
||||
|
|
|
@ -295,19 +295,20 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
|||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d8->wined3d_outputs[output_idx]);
|
||||
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
DWORD levels;
|
||||
|
||||
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);
|
||||
if (SUCCEEDED(hr) && !levels)
|
||||
hr = D3DERR_NOTAVAILABLE;
|
||||
}
|
||||
else
|
||||
hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format),
|
||||
usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
hr = wined3d_check_device_format(d3d8->wined3d, wined3d_adapter, device_type,
|
||||
wined3dformat_from_d3dformat(adapter_format), usage, bind_flags, wined3d_rtype,
|
||||
wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -92,6 +92,7 @@ struct d3d9_device
|
|||
struct wined3d_device_parent device_parent;
|
||||
LONG refcount;
|
||||
struct wined3d_device *wined3d_device;
|
||||
unsigned int adapter_ordinal;
|
||||
struct d3d9 *d3d_parent;
|
||||
|
||||
struct fvf_declaration *fvf_decls;
|
||||
|
|
|
@ -4617,6 +4617,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
|
|||
|
||||
device->IDirect3DDevice9Ex_iface.lpVtbl = &d3d9_device_vtbl;
|
||||
device->device_parent.ops = &d3d9_wined3d_device_parent_ops;
|
||||
device->adapter_ordinal = adapter;
|
||||
device->refcount = 1;
|
||||
|
||||
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
|
||||
|
|
|
@ -319,18 +319,18 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
|||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
|
||||
if (format == D3DFMT_RESZ && resource_type == D3DRTYPE_SURFACE && usage == D3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
DWORD levels;
|
||||
|
||||
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);
|
||||
if (SUCCEEDED(hr) && !levels)
|
||||
hr = D3DERR_NOTAVAILABLE;
|
||||
}
|
||||
else
|
||||
hr = wined3d_check_device_format(d3d9->wined3d, adapter, device_type,
|
||||
hr = wined3d_check_device_format(d3d9->wined3d, wined3d_adapter, device_type,
|
||||
wined3dformat_from_d3dformat(adapter_format), usage, bind_flags,
|
||||
wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -1296,7 +1296,9 @@ static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops =
|
|||
HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
|
||||
UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
|
||||
{
|
||||
struct wined3d_adapter *wined3d_adapter;
|
||||
struct wined3d_resource_desc desc;
|
||||
unsigned int output_idx;
|
||||
DWORD flags = 0;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -1346,7 +1348,9 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_check_device_format(device->d3d_parent->wined3d, WINED3DADAPTER_DEFAULT,
|
||||
output_idx = device->adapter_ordinal;
|
||||
wined3d_adapter = wined3d_output_get_adapter(device->d3d_parent->wined3d_outputs[output_idx]);
|
||||
hr = wined3d_check_device_format(device->d3d_parent->wined3d, wined3d_adapter,
|
||||
WINED3D_DEVICE_TYPE_HAL, WINED3DFMT_B8G8R8A8_UNORM, WINED3DUSAGE_QUERY_GENMIPMAP,
|
||||
WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
|
|
|
@ -1720,7 +1720,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
{
|
||||
if (count < outsize)
|
||||
|
@ -4441,7 +4441,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type,
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter, type,
|
||||
mode.format_id, 0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
{
|
||||
DDPIXELFORMAT pformat;
|
||||
|
@ -4465,7 +4465,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
|
|||
* while others used dwZBufferBitDepth=32. In either case the pitch matches a 32 bits per
|
||||
* pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and
|
||||
* newer enumerate both versions, so we do the same(bug 22434) */
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, ddraw->wined3d_adapter, type, mode.format_id,
|
||||
0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RTYPE_TEXTURE_2D, WINED3DFMT_X8D24_UNORM)))
|
||||
{
|
||||
DDPIXELFORMAT x8d24 =
|
||||
|
|
|
@ -1095,8 +1095,9 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, device->ddraw->wined3d_adapter,
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE,
|
||||
WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
{
|
||||
DDPIXELFORMAT pformat;
|
||||
|
||||
|
@ -1117,7 +1118,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(BumpFormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT,
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, device->ddraw->wined3d_adapter,
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
|
||||
WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, BumpFormatList[i]) == D3D_OK)
|
||||
{
|
||||
|
@ -1223,8 +1224,9 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface,
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, device->ddraw->wined3d_adapter,
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE,
|
||||
WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
{
|
||||
DDSURFACEDESC sdesc;
|
||||
|
||||
|
|
|
@ -6168,7 +6168,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
bind_flags |= WINED3D_BIND_RENDER_TARGET;
|
||||
|
||||
if (!(ddraw->flags & DDRAW_NO3D) && SUCCEEDED(hr = wined3d_check_device_format(ddraw->wined3d,
|
||||
WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, mode.format_id,
|
||||
ddraw->wined3d_adapter, WINED3D_DEVICE_TYPE_HAL, mode.format_id,
|
||||
usage, bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
|
||||
desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
|
||||
else
|
||||
|
|
|
@ -1558,28 +1558,24 @@ static BOOL wined3d_check_surface_format(const struct wined3d_format *format)
|
|||
*
|
||||
* For now lets report this on all formats, but in the future we may want to
|
||||
* restrict it to some should applications need that. */
|
||||
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
|
||||
unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
|
||||
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
|
||||
const struct wined3d_adapter *adapter, enum wined3d_device_type device_type,
|
||||
enum wined3d_format_id adapter_format_id, DWORD usage, unsigned int bind_flags,
|
||||
enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
|
||||
{
|
||||
const struct wined3d_format *adapter_format, *format;
|
||||
enum wined3d_gl_resource_type gl_type, gl_type_end;
|
||||
const struct wined3d_adapter *adapter;
|
||||
BOOL mipmap_gen_supported = TRUE;
|
||||
unsigned int allowed_bind_flags;
|
||||
DWORD format_flags = 0;
|
||||
DWORD allowed_usage;
|
||||
|
||||
TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s, "
|
||||
TRACE("wined3d %p, adapter %p, device_type %s, adapter_format %s, usage %s, %s, "
|
||||
"bind_flags %s, resource_type %s, check_format %s.\n",
|
||||
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id),
|
||||
wined3d, adapter, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id),
|
||||
debug_d3dusage(usage), debug_d3dusagequery(usage), wined3d_debug_bind_flags(bind_flags),
|
||||
debug_d3dresourcetype(resource_type), debug_d3dformat(check_format_id));
|
||||
|
||||
if (adapter_idx >= wined3d->adapter_count)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
adapter = wined3d->adapters[adapter_idx];
|
||||
adapter_format = wined3d_get_format(adapter, adapter_format_id, WINED3D_BIND_RENDER_TARGET);
|
||||
format = wined3d_get_format(adapter, check_format_id, bind_flags);
|
||||
|
||||
|
@ -1873,7 +1869,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d,
|
|||
}
|
||||
|
||||
/* Validate that the back buffer format is usable for render targets. */
|
||||
if (FAILED(wined3d_check_device_format(wined3d, output->adapter->ordinal, device_type,
|
||||
if (FAILED(wined3d_check_device_format(wined3d, output->adapter, device_type,
|
||||
display_format, 0, WINED3D_BIND_RENDER_TARGET, WINED3D_RTYPE_TEXTURE_2D,
|
||||
backbuffer_format)))
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
@ cdecl wined3d_calculate_format_pitch(ptr 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 ptr long long long long long long)
|
||||
@ cdecl wined3d_check_device_format_conversion(ptr long long long)
|
||||
@ cdecl wined3d_check_device_multisample_type(ptr long long long long ptr)
|
||||
@ cdecl wined3d_check_device_type(ptr ptr long long long long)
|
||||
|
|
|
@ -2252,9 +2252,10 @@ UINT __cdecl wined3d_calculate_format_pitch(const struct wined3d *wined3d, UINT
|
|||
HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d_adapter *adapter,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id,
|
||||
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);
|
||||
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
|
||||
unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
|
||||
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d,
|
||||
const struct wined3d_adapter *adapter, enum wined3d_device_type device_type,
|
||||
enum wined3d_format_id adapter_format_id, DWORD usage, unsigned int bind_flags,
|
||||
enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
|
||||
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_format_id target_format_id);
|
||||
|
|
Loading…
Reference in New Issue