dxgi: Implement IDXGISwapChain_ResizeTarget().
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
28f24b9ddf
commit
537bd43ea8
|
@ -79,10 +79,14 @@ struct dxgi_device_layer
|
|||
|
||||
/* TRACE helper functions */
|
||||
const char *debug_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
||||
const char *debug_dxgi_mode(const DXGI_MODE_DESC *desc) DECLSPEC_HIDDEN;
|
||||
void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count) DECLSPEC_HIDDEN;
|
||||
|
||||
DXGI_FORMAT dxgi_format_from_wined3dformat(enum wined3d_format_id format) DECLSPEC_HIDDEN;
|
||||
enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format) DECLSPEC_HIDDEN;
|
||||
UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational) DECLSPEC_HIDDEN;
|
||||
enum wined3d_scanline_ordering wined3d_scanline_ordering_from_dxgi(
|
||||
DXGI_MODE_SCANLINE_ORDER scanline_order) DECLSPEC_HIDDEN;
|
||||
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,
|
||||
|
|
|
@ -180,14 +180,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetWindowAssociation(IDXGIFactory1
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
|
||||
{
|
||||
if (rational->Denominator)
|
||||
return rational->Numerator / rational->Denominator;
|
||||
else
|
||||
return rational->Numerator;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IDXGIFactory1 *iface,
|
||||
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
|
||||
{
|
||||
|
|
|
@ -337,9 +337,31 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeBuffers(IDXGISwapChain *if
|
|||
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *iface,
|
||||
const DXGI_MODE_DESC *target_mode_desc)
|
||||
{
|
||||
FIXME("iface %p, target_mode_desc %p stub!\n", iface, target_mode_desc);
|
||||
struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
|
||||
struct wined3d_display_mode mode;
|
||||
HRESULT hr;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("iface %p, target_mode_desc %p.\n", iface, target_mode_desc);
|
||||
|
||||
if (!target_mode_desc)
|
||||
return DXGI_ERROR_INVALID_CALL;
|
||||
|
||||
TRACE("Mode: %s.\n", debug_dxgi_mode(target_mode_desc));
|
||||
|
||||
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_mutex_lock();
|
||||
hr = wined3d_swapchain_resize_target(swapchain->wined3d_swapchain, &mode);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetContainingOutput(IDXGISwapChain *iface, IDXGIOutput **output)
|
||||
|
|
|
@ -364,6 +364,14 @@ enum wined3d_format_id wined3dformat_from_dxgi_format(DXGI_FORMAT format)
|
|||
}
|
||||
}
|
||||
|
||||
const char *debug_dxgi_mode(const DXGI_MODE_DESC *desc)
|
||||
{
|
||||
return wine_dbg_sprintf("resolution %ux%u, refresh rate %u / %u, "
|
||||
"format %s, scanline ordering %#x, scaling %#x",
|
||||
desc->Width, desc->Height, desc->RefreshRate.Numerator, desc->RefreshRate.Denominator,
|
||||
debug_dxgi_format(desc->Format), desc->ScanlineOrdering, desc->Scaling);
|
||||
}
|
||||
|
||||
void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -379,6 +387,28 @@ void dump_feature_levels(const D3D_FEATURE_LEVEL *feature_levels, unsigned int l
|
|||
TRACE(" [%u] = %s.\n", i, debug_feature_level(feature_levels[i]));
|
||||
}
|
||||
|
||||
UINT dxgi_rational_to_uint(const DXGI_RATIONAL *rational)
|
||||
{
|
||||
if (rational->Denominator)
|
||||
return rational->Numerator / rational->Denominator;
|
||||
else
|
||||
return rational->Numerator;
|
||||
}
|
||||
|
||||
enum wined3d_scanline_ordering wined3d_scanline_ordering_from_dxgi(DXGI_MODE_SCANLINE_ORDER scanline_order)
|
||||
{
|
||||
switch (scanline_order)
|
||||
{
|
||||
case DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED:
|
||||
return WINED3D_SCANLINE_ORDERING_UNKNOWN;
|
||||
case DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE:
|
||||
return WINED3D_SCANLINE_ORDERING_PROGRESSIVE;
|
||||
default:
|
||||
FIXME("Unhandled scanline ordering %#x.\n", scanline_order);
|
||||
return WINED3D_SCANLINE_ORDERING_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void dxgi_sample_desc_from_wined3d(DXGI_SAMPLE_DESC *desc,
|
||||
enum wined3d_multisample_type wined3d_type, unsigned int wined3d_quality)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue