dxgi: Introduce helper functions for converting wined3d_display_mode.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
87891518b7
commit
9381ad89fb
|
@ -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;
|
||||
void wined3d_sample_desc_from_dxgi(enum wined3d_multisample_type *wined3d_type,
|
||||
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 wined3d_swapchain_flags_from_dxgi(unsigned int flags) DECLSPEC_HIDDEN;
|
||||
HRESULT dxgi_get_private_data(struct wined3d_private_store *store,
|
||||
|
|
|
@ -23,6 +23,17 @@
|
|||
|
||||
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)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, struct dxgi_output, IDXGIOutput_iface);
|
||||
|
@ -154,11 +165,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDesc(IDXGIOutput *iface, DXGI_OU
|
|||
static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *iface,
|
||||
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;
|
||||
unsigned int i, max_count;
|
||||
struct wined3d *wined3d;
|
||||
UINT i;
|
||||
UINT max_count;
|
||||
|
||||
FIXME("iface %p, format %s, flags %#x, mode_count %p, desc %p partial stub!\n",
|
||||
iface, debug_dxgi_format(format), flags, mode_count, desc);
|
||||
|
@ -172,11 +182,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
wined3d = This->adapter->factory->wined3d;
|
||||
wined3d = output->adapter->factory->wined3d;
|
||||
wined3d_format = wined3dformat_from_dxgi_format(format);
|
||||
|
||||
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);
|
||||
|
||||
if (!desc)
|
||||
|
@ -199,7 +209,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
struct wined3d_display_mode mode;
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -208,13 +218,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
|
|||
return hr;
|
||||
}
|
||||
|
||||
desc[i].Width = mode.width;
|
||||
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 */
|
||||
dxgi_mode_from_wined3d(&desc[i], &mode);
|
||||
}
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
|
|
|
@ -351,11 +351,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *ifa
|
|||
if (target_mode_desc->Scaling)
|
||||
FIXME("Ignoring scaling %#x.\n", target_mode_desc->Scaling);
|
||||
|
||||
mode.width = target_mode_desc->Width;
|
||||
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_display_mode_from_dxgi(&mode, target_mode_desc);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
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,
|
|||
}
|
||||
}
|
||||
|
||||
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 flags = 0;
|
||||
|
|
Loading…
Reference in New Issue