Commit 9381ad89 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

dxgi: Introduce helper functions for converting wined3d_display_mode.

parent 87891518
...@@ -91,6 +91,8 @@ void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc, ...@@ -91,6 +91,8 @@ void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc,
enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality) DECLSPEC_HIDDEN; enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality) DECLSPEC_HIDDEN;
void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type, void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
unsigned int *wined3d_quality, const DXGI_SAMPLE_DESC *dxgi_desc) DECLSPEC_HIDDEN; unsigned int *wined3d_quality, const DXGI_SAMPLE_DESC *dxgi_desc) DECLSPEC_HIDDEN;
void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode,
const DXGI_MODE_DESC *mode) DECLSPEC_HIDDEN;
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN; unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) DECLSPEC_HIDDEN;
unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags) DECLSPEC_HIDDEN; unsigned int wined3d_swapchain_flags_from_dxgi(unsigned int flags) DECLSPEC_HIDDEN;
HRESULT dxgi_get_private_data(struct wined3d_private_store *store, HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
......
...@@ -23,6 +23,17 @@ ...@@ -23,6 +23,17 @@
WINE_DEFAULT_DEBUG_CHANNEL(dxgi); WINE_DEFAULT_DEBUG_CHANNEL(dxgi);
static void dxgi_mode_from_wined3d(DXGI_MODE_DESC *mode, const struct wined3d_display_mode *wined3d_mode)
{
mode->Width = wined3d_mode->width;
mode->Height = wined3d_mode->height;
mode->RefreshRate.Numerator = wined3d_mode->refresh_rate;
mode->RefreshRate.Denominator = 1;
mode->Format = dxgi_format_from_wined3dformat(wined3d_mode->format_id);
mode->ScanlineOrdering = wined3d_mode->scanline_ordering;
mode->Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
}
static inline struct dxgi_output *impl_from_IDXGIOutput(IDXGIOutput *iface) static inline struct dxgi_output *impl_from_IDXGIOutput(IDXGIOutput *iface)
{ {
return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput_iface); return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput_iface);
...@@ -154,11 +165,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OU ...@@ -154,11 +165,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OU
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface, static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface,
DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *desc) DXGI_FORMAT format, UINT flags, UINT *mode_count, DXGI_MODE_DESC *desc)
{ {
struct dxgi_output *This = impl_from_IDXGIOutput(iface); struct dxgi_output *output = impl_from_IDXGIOutput(iface);
enum wined3d_format_id wined3d_format; enum wined3d_format_id wined3d_format;
unsigned int i, max_count;
struct wined3d *wined3d; struct wined3d *wined3d;
UINT i;
UINT max_count;
FIXME("iface %p, format %s, flags %#x, mode_count %p, desc %p partial stub!\n", FIXME("iface %p, format %s, flags %#x, mode_count %p, desc %p partial stub!\n",
iface, debug_dxgi_format(format), flags, mode_count, desc); iface, debug_dxgi_format(format), flags, mode_count, desc);
...@@ -172,11 +182,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -172,11 +182,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
return S_OK; return S_OK;
} }
wined3d = This->adapter->factory->wined3d; wined3d = output->adapter->factory->wined3d;
wined3d_format = wined3dformat_from_dxgi_format(format); wined3d_format = wined3dformat_from_dxgi_format(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
max_count = wined3d_get_adapter_mode_count(wined3d, This->adapter->ordinal, max_count = wined3d_get_adapter_mode_count(wined3d, output->adapter->ordinal,
wined3d_format, WINED3D_SCANLINE_ORDERING_UNKNOWN); wined3d_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
if (!desc) if (!desc)
...@@ -199,7 +209,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -199,7 +209,7 @@ 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, hr = wined3d_enum_adapter_modes(wined3d, output->adapter->ordinal, wined3d_format,
WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &mode); WINED3D_SCANLINE_ORDERING_UNKNOWN, i, &mode);
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -208,13 +218,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa ...@@ -208,13 +218,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
return hr; return hr;
} }
desc[i].Width = mode.width; dxgi_mode_from_wined3d(&desc[i], &mode);
desc[i].Height = mode.height;
desc[i].RefreshRate.Numerator = mode.refresh_rate;
desc[i].RefreshRate.Denominator = 1;
desc[i].Format = format;
desc[i].ScanlineOrdering = mode.scanline_ordering;
desc[i].Scaling = DXGI_MODE_SCALING_UNSPECIFIED; /* FIXME */
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
......
...@@ -351,11 +351,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *ifa ...@@ -351,11 +351,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *ifa
if (target_mode_desc->Scaling) if (target_mode_desc->Scaling)
FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling); FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
mode.width = target_mode_desc->Width; wined3d_display_mode_from_dxgi(&mode, target_mode_desc);
mode.height = target_mode_desc->Height;
mode.refresh_rate = dxgi_rational_to_uint(&target_mode_desc->RefreshRate);
mode.format_id = wined3dformat_from_dxgi_format(target_mode_desc->Format);
mode.scanline_ordering = wined3d_scanline_ordering_from_dxgi(target_mode_desc->ScanlineOrdering);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode); hr = wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode);
......
...@@ -443,6 +443,16 @@ void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type, ...@@ -443,6 +443,16 @@ void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
} }
} }
void wined3d_display_mode_from_dxgi(struct wined3d_display_mode *wined3d_mode,
const DXGI_MODE_DESC *mode)
{
wined3d_mode->width = mode->Width;
wined3d_mode->height = mode->Height;
wined3d_mode->refresh_rate = dxgi_rational_to_uint(&mode->RefreshRate);
wined3d_mode->format_id = wined3dformat_from_dxgi_format(mode->Format);
wined3d_mode->scanline_ordering = wined3d_scanline_ordering_from_dxgi(mode->ScanlineOrdering);
}
unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags) unsigned int dxgi_swapchain_flags_from_wined3d(unsigned int wined3d_flags)
{ {
unsigned int flags = 0; unsigned int flags = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment