d3d9: Implement d3d9_EnumAdapterModesEx().

This commit is contained in:
Henri Verbeet 2012-07-02 14:45:56 +02:00 committed by Alexandre Julliard
parent bb1740a42e
commit e97dc9f33d
6 changed files with 47 additions and 11 deletions

View File

@ -174,7 +174,8 @@ static HRESULT WINAPI d3d8_EnumAdapterModes(IDirect3D8 *iface, UINT adapter, UIN
iface, adapter, mode_idx, mode); iface, adapter, mode_idx, mode);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_enum_adapter_modes(d3d8->wined3d, adapter, WINED3DFMT_UNKNOWN, mode_idx, &wined3d_mode); hr = wined3d_enum_adapter_modes(d3d8->wined3d, adapter, WINED3DFMT_UNKNOWN,
WINED3D_SCANLINE_ORDERING_UNKNOWN, mode_idx, &wined3d_mode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))

View File

@ -186,7 +186,7 @@ static HRESULT WINAPI d3d9_EnumAdapterModes(IDirect3D9Ex *iface, UINT adapter,
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_enum_adapter_modes(d3d9->wined3d, adapter, wined3dformat_from_d3dformat(format), hr = wined3d_enum_adapter_modes(d3d9->wined3d, adapter, wined3dformat_from_d3dformat(format),
mode_idx, &wined3d_mode); WINED3D_SCANLINE_ORDERING_UNKNOWN, mode_idx, &wined3d_mode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -497,10 +497,31 @@ static UINT WINAPI d3d9_GetAdapterModeCountEx(IDirect3D9Ex *iface,
static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface, static HRESULT WINAPI d3d9_EnumAdapterModesEx(IDirect3D9Ex *iface,
UINT adapter, const D3DDISPLAYMODEFILTER *filter, UINT mode_idx, D3DDISPLAYMODEEX *mode) UINT adapter, const D3DDISPLAYMODEFILTER *filter, UINT mode_idx, D3DDISPLAYMODEEX *mode)
{ {
FIXME("iface %p, adapter %u, filter %p, mode_idx %u, mode %p stub!\n", struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
struct wined3d_display_mode wined3d_mode;
HRESULT hr;
TRACE("iface %p, adapter %u, filter %p, mode_idx %u, mode %p.\n",
iface, adapter, filter, mode_idx, mode); iface, adapter, filter, mode_idx, mode);
return E_NOTIMPL; if (filter->Format != D3DFMT_X8R8G8B8 && filter->Format != D3DFMT_R5G6B5)
return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
hr = wined3d_enum_adapter_modes(d3d9->wined3d, adapter, wined3dformat_from_d3dformat(filter->Format),
filter->ScanLineOrdering, mode_idx, &wined3d_mode);
wined3d_mutex_unlock();
if (SUCCEEDED(hr))
{
mode->Width = wined3d_mode.width;
mode->Height = wined3d_mode.height;
mode->RefreshRate = wined3d_mode.refresh_rate;
mode->Format = d3dformat_from_wined3dformat(wined3d_mode.format_id);
mode->ScanLineOrdering = wined3d_mode.scanline_ordering;
}
return hr;
} }
static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, static HRESULT WINAPI d3d9_GetAdapterDisplayModeEx(IDirect3D9Ex *iface,

View File

@ -2221,8 +2221,8 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
for(fmt = 0; fmt < (sizeof(checkFormatList) / sizeof(checkFormatList[0])); fmt++) for(fmt = 0; fmt < (sizeof(checkFormatList) / sizeof(checkFormatList[0])); fmt++)
{ {
modenum = 0; modenum = 0;
while (wined3d_enum_adapter_modes(ddraw->wined3d, WINED3DADAPTER_DEFAULT, while (wined3d_enum_adapter_modes(ddraw->wined3d, WINED3DADAPTER_DEFAULT, checkFormatList[fmt],
checkFormatList[fmt], modenum++, &mode) == WINED3D_OK) WINED3D_SCANLINE_ORDERING_UNKNOWN, modenum++, &mode) == WINED3D_OK)
{ {
PixelFormat_WineD3DtoDD(&pixelformat, mode.format_id); PixelFormat_WineD3DtoDD(&pixelformat, mode.format_id);
if (DDSD) if (DDSD)

View File

@ -164,7 +164,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
struct wined3d_display_mode mode; struct wined3d_display_mode mode;
HRESULT hr; HRESULT hr;
hr = wined3d_enum_adapter_modes(wined3d, This->adapter->ordinal, wined3d_format, i, &mode); hr = wined3d_enum_adapter_modes(wined3d, This->adapter->ordinal, wined3d_format,
WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &mode);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("EnumAdapterModes failed, hr %#x.\n", hr); WARN("EnumAdapterModes failed, hr %#x.\n", hr);

View File

@ -2945,7 +2945,8 @@ UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT ad
/* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */ /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */
HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id, UINT mode_idx, struct wined3d_display_mode *mode) enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering,
UINT mode_idx, struct wined3d_display_mode *mode)
{ {
const struct wined3d_adapter *adapter; const struct wined3d_adapter *adapter;
const struct wined3d_format *format; const struct wined3d_format *format;
@ -2954,8 +2955,8 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada
UINT i = 0; UINT i = 0;
int j = 0; int j = 0;
TRACE("wined3d %p, adapter_idx %u, format %s, mode_idx %u, mode %p.\n", TRACE("wined3d %p, adapter_idx %u, format %s, scanline_ordering %#x, mode_idx %u, mode %p.\n",
wined3d, adapter_idx, debug_d3dformat(format_id), mode_idx, mode); wined3d, adapter_idx, debug_d3dformat(format_id), scanline_ordering, mode_idx, mode);
if (!mode || adapter_idx >= wined3d->adapter_count) if (!mode || adapter_idx >= wined3d->adapter_count)
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
@ -2975,6 +2976,17 @@ HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT ada
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
} }
if (m.dmFields & DM_DISPLAYFLAGS)
{
if (scanline_ordering == WINED3D_SCANLINE_ORDERING_PROGRESSIVE
&& (m.u2.dmDisplayFlags & DM_INTERLACED))
continue;
if (scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED
&& !(m.u2.dmDisplayFlags & DM_INTERLACED))
continue;
}
if (format_id == WINED3DFMT_UNKNOWN) if (format_id == WINED3DFMT_UNKNOWN)
{ {
/* This is for d3d8, do not enumerate P8 here. */ /* This is for d3d8, do not enumerate P8 here. */

View File

@ -2037,7 +2037,8 @@ HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT ad
struct wined3d * __cdecl wined3d_create(UINT version, DWORD flags); struct wined3d * __cdecl wined3d_create(UINT version, DWORD flags);
ULONG __cdecl wined3d_decref(struct wined3d *wined3d); ULONG __cdecl wined3d_decref(struct wined3d *wined3d);
HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_format_id format_id, UINT mode_idx, struct wined3d_display_mode *mode); enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering,
UINT mode_idx, struct wined3d_display_mode *mode);
UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d); UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d);
HRESULT __cdecl wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, HRESULT __cdecl wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx,
struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation); struct wined3d_display_mode *mode, enum wined3d_display_rotation *rotation);