dxgi: Implement dxgi_swapchain_GetDesc1().

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:
Józef Kucia 2018-01-22 14:11:54 +01:00 committed by Alexandre Julliard
parent 90db63ab2d
commit 0e4250c595
2 changed files with 40 additions and 2 deletions

View File

@ -429,9 +429,37 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetLastPresentCount(IDXGISwapCha
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc1(IDXGISwapChain1 *iface, DXGI_SWAP_CHAIN_DESC1 *desc) static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc1(IDXGISwapChain1 *iface, DXGI_SWAP_CHAIN_DESC1 *desc)
{ {
FIXME("iface %p, desc %p stub!\n", iface, desc); struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain1(iface);
struct wined3d_swapchain_desc wined3d_desc;
return E_NOTIMPL; TRACE("iface %p, desc %p.\n", iface, desc);
if (!desc)
{
WARN("Invalid pointer.\n");
return E_INVALIDARG;
}
wined3d_mutex_lock();
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
wined3d_mutex_unlock();
FIXME("Ignoring Stereo, BufferUsage, Scaling, SwapEffect and AlphaMode.\n");
desc->Width = wined3d_desc.backbuffer_width;
desc->Height = wined3d_desc.backbuffer_height;
desc->Format = dxgi_format_from_wined3dformat(wined3d_desc.backbuffer_format);
desc->Stereo = FALSE;
dxgi_sample_desc_from_wined3d(&desc->SampleDesc,
wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
desc->BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc->BufferCount = wined3d_desc.backbuffer_count;
desc->Scaling = DXGI_SCALING_STRETCH;
desc->SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
desc->AlphaMode = DXGI_ALPHA_MODE_IGNORE;
desc->Flags = dxgi_swapchain_flags_from_wined3d(wined3d_desc.flags);
return S_OK;
} }
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetFullscreenDesc(IDXGISwapChain1 *iface, static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetFullscreenDesc(IDXGISwapChain1 *iface,

View File

@ -868,6 +868,7 @@ static void test_create_swapchain(void)
struct swapchain_fullscreen_state initial_state, expected_state; struct swapchain_fullscreen_state initial_state, expected_state;
unsigned int i, expected_width, expected_height; unsigned int i, expected_width, expected_height;
DXGI_SWAP_CHAIN_DESC creation_desc, result_desc; DXGI_SWAP_CHAIN_DESC creation_desc, result_desc;
DXGI_SWAP_CHAIN_DESC1 swapchain_desc;
IDXGIDevice *device, *bgra_device; IDXGIDevice *device, *bgra_device;
ULONG refcount, expected_refcount; ULONG refcount, expected_refcount;
IUnknown *obj, *obj2, *parent; IUnknown *obj, *obj2, *parent;
@ -968,6 +969,15 @@ static void test_create_swapchain(void)
"Failed to query IDXGISwapChain1 interface, hr %#x.\n", hr); "Failed to query IDXGISwapChain1 interface, hr %#x.\n", hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = IDXGISwapChain1_GetDesc1(swapchain1, NULL);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
hr = IDXGISwapChain1_GetDesc1(swapchain1, &swapchain_desc);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(!swapchain_desc.Stereo, "Got unexpected stereo %#x.\n", swapchain_desc.Stereo);
ok(swapchain_desc.Scaling == DXGI_SCALING_STRETCH,
"Got unexpected scaling %#x.\n", swapchain_desc.Scaling);
ok(swapchain_desc.AlphaMode == DXGI_ALPHA_MODE_IGNORE,
"Got unexpected alpha mode %#x.\n", swapchain_desc.AlphaMode);
hr = IDXGISwapChain1_GetHwnd(swapchain1, &window); hr = IDXGISwapChain1_GetHwnd(swapchain1, &window);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
ok(window == creation_desc.OutputWindow, "Got unexpected window %p.\n", window); ok(window == creation_desc.OutputWindow, "Got unexpected window %p.\n", window);