Commit fca2d194 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Implement dxgi_swapchain_ResizeBuffers().

parent 2735947d
......@@ -218,10 +218,40 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetDesc(IDXGISwapChain *iface, D
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeBuffers(IDXGISwapChain *iface,
UINT buffer_count, UINT width, UINT height, DXGI_FORMAT format, UINT flags)
{
FIXME("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x stub!\n",
struct dxgi_swapchain *swapchain = impl_from_IDXGISwapChain(iface);
struct wined3d_swapchain_desc wined3d_desc;
struct wined3d_surface *surface;
IUnknown *parent;
unsigned int i;
HRESULT hr;
TRACE("iface %p, buffer_count %u, width %u, height %u, format %s, flags %#x stub!\n",
iface, buffer_count, width, height, debug_dxgi_format(format), flags);
return E_NOTIMPL;
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
EnterCriticalSection(&dxgi_cs);
wined3d_swapchain_get_desc(swapchain->wined3d_swapchain, &wined3d_desc);
for (i = 0; i < wined3d_desc.backbuffer_count; ++i)
{
surface = wined3d_swapchain_get_back_buffer(swapchain->wined3d_swapchain,
i, WINED3D_BACKBUFFER_TYPE_MONO);
parent = wined3d_surface_get_parent(surface);
IUnknown_AddRef(parent);
if (IUnknown_Release(parent))
{
LeaveCriticalSection(&dxgi_cs);
return DXGI_ERROR_INVALID_CALL;
}
}
if (format != DXGI_FORMAT_UNKNOWN)
wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(format);
hr = wined3d_swapchain_resize_buffers(swapchain->wined3d_swapchain, buffer_count, width, height,
wined3d_desc.backbuffer_format, wined3d_desc.multisample_type, wined3d_desc.multisample_quality);
LeaveCriticalSection(&dxgi_cs);
return hr;
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_ResizeTarget(IDXGISwapChain *iface,
......
......@@ -720,6 +720,310 @@ static void test_private_data(void)
ok(!refcount, "Test object has %u references left.\n", refcount);
}
static void test_swapchain_resize(void)
{
DXGI_SWAP_CHAIN_DESC swapchain_desc;
D3D10_TEXTURE2D_DESC texture_desc;
DXGI_SURFACE_DESC surface_desc;
IDXGISwapChain *swapchain;
ID3D10Texture2D *texture;
IDXGISurface *surface;
IDXGIAdapter *adapter;
IDXGIFactory *factory;
IDXGIDevice *device;
RECT client_rect, r;
ULONG refcount;
HWND window;
HRESULT hr;
BOOL ret;
if (!(device = create_device()))
{
skip("Failed to create device, skipping tests.\n");
return;
}
window = CreateWindowA("static", "dxgi_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, 640, 480, NULL, NULL, NULL, NULL);
ret = GetClientRect(window, &client_rect);
ok(ret, "Failed to get client rect.\n");
hr = IDXGIDevice_GetAdapter(device, &adapter);
ok(SUCCEEDED(hr), "Failed to get adapter, hr %#x.\n", hr);
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
ok(SUCCEEDED(hr), "Failed to get factory, hr %#x.\n", hr);
IDXGIAdapter_Release(adapter);
swapchain_desc.BufferDesc.Width = 640;
swapchain_desc.BufferDesc.Height = 480;
swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
swapchain_desc.BufferDesc.RefreshRate.Denominator = 1;
swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swapchain_desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
swapchain_desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
swapchain_desc.SampleDesc.Count = 1;
swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 1;
swapchain_desc.OutputWindow = window;
swapchain_desc.Windowed = TRUE;
swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0;
hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain);
ok(SUCCEEDED(hr), "Failed to create swapchain, hr %#x.\n", hr);
IDXGIFactory_Release(factory);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&texture);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
ret = GetClientRect(window, &r);
ok(ret, "Failed to get client rect.\n");
ok(EqualRect(&r, &client_rect), "Got unexpected rect {%d, %d, %d, %d}, expected {%d, %d, %d, %d}.\n",
r.left, r.top, r.right, r.bottom,
client_rect.left, client_rect.top, client_rect.right, client_rect.bottom);
hr = IDXGISwapChain_GetDesc(swapchain, &swapchain_desc);
ok(SUCCEEDED(hr), "Failed to get swapchain desc, hr %#x.\n", hr);
ok(swapchain_desc.BufferDesc.Width == 640,
"Got unexpected BufferDesc.Width %u.\n", swapchain_desc.BufferDesc.Width);
ok(swapchain_desc.BufferDesc.Height == 480,
"Got unexpected bufferDesc.Height %u.\n", swapchain_desc.BufferDesc.Height);
ok(swapchain_desc.BufferDesc.RefreshRate.Numerator == 60,
"Got unexpected BufferDesc.RefreshRate.Numerator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Numerator);
ok(swapchain_desc.BufferDesc.RefreshRate.Denominator == 1,
"Got unexpected BufferDesc.RefreshRate.Denominator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Denominator);
ok(swapchain_desc.BufferDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM,
"Got unexpected BufferDesc.Format %#x.\n", swapchain_desc.BufferDesc.Format);
ok(swapchain_desc.BufferDesc.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED,
"Got unexpected BufferDesc.ScanlineOrdering %#x.\n", swapchain_desc.BufferDesc.ScanlineOrdering);
ok(swapchain_desc.BufferDesc.Scaling == DXGI_MODE_SCALING_UNSPECIFIED,
"Got unexpected BufferDesc.Scaling %#x.\n", swapchain_desc.BufferDesc.Scaling);
ok(swapchain_desc.SampleDesc.Count == 1,
"Got unexpected SampleDesc.Count %u.\n", swapchain_desc.SampleDesc.Count);
ok(!swapchain_desc.SampleDesc.Quality,
"Got unexpected SampleDesc.Quality %u.\n", swapchain_desc.SampleDesc.Quality);
ok(swapchain_desc.BufferUsage == DXGI_USAGE_RENDER_TARGET_OUTPUT,
"Got unexpected BufferUsage %#x.\n", swapchain_desc.BufferUsage);
ok(swapchain_desc.BufferCount == 1,
"Got unexpected BufferCount %u.\n", swapchain_desc.BufferCount);
ok(swapchain_desc.OutputWindow == window,
"Got unexpected OutputWindow %p, expected %p.\n", swapchain_desc.OutputWindow, window);
ok(swapchain_desc.Windowed,
"Got unexpected Windowed %#x.\n", swapchain_desc.Windowed);
ok(swapchain_desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD,
"Got unexpected SwapEffect %#x.\n", swapchain_desc.SwapEffect);
ok(!swapchain_desc.Flags,
"Got unexpected Flags %#x.\n", swapchain_desc.Flags);
hr = IDXGISurface_GetDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(surface_desc.Width == 640, "Got unexpected Width %u.\n", surface_desc.Width);
ok(surface_desc.Height == 480, "Got unexpected Height %u.\n", surface_desc.Height);
ok(surface_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", surface_desc.Format);
ok(surface_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", surface_desc.SampleDesc.Count);
ok(!surface_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", surface_desc.SampleDesc.Quality);
ID3D10Texture2D_GetDesc(texture, &texture_desc);
ok(texture_desc.Width == 640, "Got unexpected Width %u.\n", texture_desc.Width);
ok(texture_desc.Height == 480, "Got unexpected Height %u.\n", texture_desc.Height);
ok(texture_desc.MipLevels == 1, "Got unexpected MipLevels %u.\n", texture_desc.MipLevels);
ok(texture_desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", texture_desc.ArraySize);
ok(texture_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", texture_desc.Format);
ok(texture_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", texture_desc.SampleDesc.Count);
ok(!texture_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", texture_desc.SampleDesc.Quality);
ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected Usage %#x.\n", texture_desc.Usage);
ok(texture_desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %#x.\n", texture_desc.BindFlags);
ok(!texture_desc.CPUAccessFlags, "Got unexpected CPUAccessFlags %#x.\n", texture_desc.CPUAccessFlags);
ok(!texture_desc.MiscFlags, "Got unexpected MiscFlags %#x.\n", texture_desc.MiscFlags);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 1, 320, 240, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 0);
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
ret = GetClientRect(window, &r);
ok(ret, "Failed to get client rect.\n");
ok(EqualRect(&r, &client_rect), "Got unexpected rect {%d, %d, %d, %d}, expected {%d, %d, %d, %d}.\n",
r.left, r.top, r.right, r.bottom,
client_rect.left, client_rect.top, client_rect.right, client_rect.bottom);
hr = IDXGISwapChain_GetDesc(swapchain, &swapchain_desc);
ok(SUCCEEDED(hr), "Failed to get swapchain desc, hr %#x.\n", hr);
ok(swapchain_desc.BufferDesc.Width == 640,
"Got unexpected BufferDesc.Width %u.\n", swapchain_desc.BufferDesc.Width);
ok(swapchain_desc.BufferDesc.Height == 480,
"Got unexpected bufferDesc.Height %u.\n", swapchain_desc.BufferDesc.Height);
ok(swapchain_desc.BufferDesc.RefreshRate.Numerator == 60,
"Got unexpected BufferDesc.RefreshRate.Numerator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Numerator);
ok(swapchain_desc.BufferDesc.RefreshRate.Denominator == 1,
"Got unexpected BufferDesc.RefreshRate.Denominator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Denominator);
ok(swapchain_desc.BufferDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM,
"Got unexpected BufferDesc.Format %#x.\n", swapchain_desc.BufferDesc.Format);
ok(swapchain_desc.BufferDesc.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED,
"Got unexpected BufferDesc.ScanlineOrdering %#x.\n", swapchain_desc.BufferDesc.ScanlineOrdering);
ok(swapchain_desc.BufferDesc.Scaling == DXGI_MODE_SCALING_UNSPECIFIED,
"Got unexpected BufferDesc.Scaling %#x.\n", swapchain_desc.BufferDesc.Scaling);
ok(swapchain_desc.SampleDesc.Count == 1,
"Got unexpected SampleDesc.Count %u.\n", swapchain_desc.SampleDesc.Count);
ok(!swapchain_desc.SampleDesc.Quality,
"Got unexpected SampleDesc.Quality %u.\n", swapchain_desc.SampleDesc.Quality);
ok(swapchain_desc.BufferUsage == DXGI_USAGE_RENDER_TARGET_OUTPUT,
"Got unexpected BufferUsage %#x.\n", swapchain_desc.BufferUsage);
ok(swapchain_desc.BufferCount == 1,
"Got unexpected BufferCount %u.\n", swapchain_desc.BufferCount);
ok(swapchain_desc.OutputWindow == window,
"Got unexpected OutputWindow %p, expected %p.\n", swapchain_desc.OutputWindow, window);
ok(swapchain_desc.Windowed,
"Got unexpected Windowed %#x.\n", swapchain_desc.Windowed);
ok(swapchain_desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD,
"Got unexpected SwapEffect %#x.\n", swapchain_desc.SwapEffect);
ok(!swapchain_desc.Flags,
"Got unexpected Flags %#x.\n", swapchain_desc.Flags);
hr = IDXGISurface_GetDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(surface_desc.Width == 640, "Got unexpected Width %u.\n", surface_desc.Width);
ok(surface_desc.Height == 480, "Got unexpected Height %u.\n", surface_desc.Height);
ok(surface_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", surface_desc.Format);
ok(surface_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", surface_desc.SampleDesc.Count);
ok(!surface_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", surface_desc.SampleDesc.Quality);
ID3D10Texture2D_GetDesc(texture, &texture_desc);
ok(texture_desc.Width == 640, "Got unexpected Width %u.\n", texture_desc.Width);
ok(texture_desc.Height == 480, "Got unexpected Height %u.\n", texture_desc.Height);
ok(texture_desc.MipLevels == 1, "Got unexpected MipLevels %u.\n", texture_desc.MipLevels);
ok(texture_desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", texture_desc.ArraySize);
ok(texture_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM, "Got unexpected Format %#x.\n", texture_desc.Format);
ok(texture_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", texture_desc.SampleDesc.Count);
ok(!texture_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", texture_desc.SampleDesc.Quality);
ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected Usage %#x.\n", texture_desc.Usage);
ok(texture_desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %#x.\n", texture_desc.BindFlags);
ok(!texture_desc.CPUAccessFlags, "Got unexpected CPUAccessFlags %#x.\n", texture_desc.CPUAccessFlags);
ok(!texture_desc.MiscFlags, "Got unexpected MiscFlags %#x.\n", texture_desc.MiscFlags);
ID3D10Texture2D_Release(texture);
IDXGISurface_Release(surface);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 1, 320, 240, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 0);
ok(SUCCEEDED(hr), "Failed to resize buffers, hr %#x.\n", hr);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_IDXGISurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&texture);
ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr);
ret = GetClientRect(window, &r);
ok(ret, "Failed to get client rect.\n");
ok(EqualRect(&r, &client_rect), "Got unexpected rect {%d, %d, %d, %d}, expected {%d, %d, %d, %d}.\n",
r.left, r.top, r.right, r.bottom,
client_rect.left, client_rect.top, client_rect.right, client_rect.bottom);
hr = IDXGISwapChain_GetDesc(swapchain, &swapchain_desc);
ok(SUCCEEDED(hr), "Failed to get swapchain desc, hr %#x.\n", hr);
ok(swapchain_desc.BufferDesc.Width == 320,
"Got unexpected BufferDesc.Width %u.\n", swapchain_desc.BufferDesc.Width);
ok(swapchain_desc.BufferDesc.Height == 240,
"Got unexpected bufferDesc.Height %u.\n", swapchain_desc.BufferDesc.Height);
ok(swapchain_desc.BufferDesc.RefreshRate.Numerator == 60,
"Got unexpected BufferDesc.RefreshRate.Numerator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Numerator);
ok(swapchain_desc.BufferDesc.RefreshRate.Denominator == 1,
"Got unexpected BufferDesc.RefreshRate.Denominator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Denominator);
ok(swapchain_desc.BufferDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
"Got unexpected BufferDesc.Format %#x.\n", swapchain_desc.BufferDesc.Format);
ok(swapchain_desc.BufferDesc.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED,
"Got unexpected BufferDesc.ScanlineOrdering %#x.\n", swapchain_desc.BufferDesc.ScanlineOrdering);
ok(swapchain_desc.BufferDesc.Scaling == DXGI_MODE_SCALING_UNSPECIFIED,
"Got unexpected BufferDesc.Scaling %#x.\n", swapchain_desc.BufferDesc.Scaling);
ok(swapchain_desc.SampleDesc.Count == 1,
"Got unexpected SampleDesc.Count %u.\n", swapchain_desc.SampleDesc.Count);
ok(!swapchain_desc.SampleDesc.Quality,
"Got unexpected SampleDesc.Quality %u.\n", swapchain_desc.SampleDesc.Quality);
ok(swapchain_desc.BufferUsage == DXGI_USAGE_RENDER_TARGET_OUTPUT,
"Got unexpected BufferUsage %#x.\n", swapchain_desc.BufferUsage);
ok(swapchain_desc.BufferCount == 1,
"Got unexpected BufferCount %u.\n", swapchain_desc.BufferCount);
ok(swapchain_desc.OutputWindow == window,
"Got unexpected OutputWindow %p, expected %p.\n", swapchain_desc.OutputWindow, window);
ok(swapchain_desc.Windowed,
"Got unexpected Windowed %#x.\n", swapchain_desc.Windowed);
ok(swapchain_desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD,
"Got unexpected SwapEffect %#x.\n", swapchain_desc.SwapEffect);
ok(!swapchain_desc.Flags,
"Got unexpected Flags %#x.\n", swapchain_desc.Flags);
hr = IDXGISurface_GetDesc(surface, &surface_desc);
ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr);
ok(surface_desc.Width == 320, "Got unexpected Width %u.\n", surface_desc.Width);
ok(surface_desc.Height == 240, "Got unexpected Height %u.\n", surface_desc.Height);
ok(surface_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, "Got unexpected Format %#x.\n", surface_desc.Format);
ok(surface_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", surface_desc.SampleDesc.Count);
ok(!surface_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", surface_desc.SampleDesc.Quality);
ID3D10Texture2D_GetDesc(texture, &texture_desc);
ok(texture_desc.Width == 320, "Got unexpected Width %u.\n", texture_desc.Width);
ok(texture_desc.Height == 240, "Got unexpected Height %u.\n", texture_desc.Height);
ok(texture_desc.MipLevels == 1, "Got unexpected MipLevels %u.\n", texture_desc.MipLevels);
ok(texture_desc.ArraySize == 1, "Got unexpected ArraySize %u.\n", texture_desc.ArraySize);
ok(texture_desc.Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, "Got unexpected Format %#x.\n", texture_desc.Format);
ok(texture_desc.SampleDesc.Count == 1, "Got unexpected SampleDesc.Count %u.\n", texture_desc.SampleDesc.Count);
ok(!texture_desc.SampleDesc.Quality, "Got unexpected SampleDesc.Quality %u.\n", texture_desc.SampleDesc.Quality);
ok(texture_desc.Usage == D3D10_USAGE_DEFAULT, "Got unexpected Usage %#x.\n", texture_desc.Usage);
ok(texture_desc.BindFlags == D3D10_BIND_RENDER_TARGET, "Got unexpected BindFlags %#x.\n", texture_desc.BindFlags);
ok(!texture_desc.CPUAccessFlags, "Got unexpected CPUAccessFlags %#x.\n", texture_desc.CPUAccessFlags);
ok(!texture_desc.MiscFlags, "Got unexpected MiscFlags %#x.\n", texture_desc.MiscFlags);
ID3D10Texture2D_Release(texture);
IDXGISurface_Release(surface);
hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
ok(SUCCEEDED(hr), "Failed to resize buffers, hr %#x.\n", hr);
hr = IDXGISwapChain_GetDesc(swapchain, &swapchain_desc);
ok(SUCCEEDED(hr), "Failed to get swapchain desc, hr %#x.\n", hr);
ok(swapchain_desc.BufferDesc.Width == client_rect.right - client_rect.left,
"Got unexpected BufferDesc.Width %u, expected %u.\n",
swapchain_desc.BufferDesc.Width, client_rect.right - client_rect.left);
ok(swapchain_desc.BufferDesc.Height == client_rect.bottom - client_rect.top,
"Got unexpected bufferDesc.Height %u, expected %u.\n",
swapchain_desc.BufferDesc.Height, client_rect.bottom - client_rect.top);
ok(swapchain_desc.BufferDesc.RefreshRate.Numerator == 60,
"Got unexpected BufferDesc.RefreshRate.Numerator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Numerator);
ok(swapchain_desc.BufferDesc.RefreshRate.Denominator == 1,
"Got unexpected BufferDesc.RefreshRate.Denominator %u.\n",
swapchain_desc.BufferDesc.RefreshRate.Denominator);
ok(swapchain_desc.BufferDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
"Got unexpected BufferDesc.Format %#x.\n", swapchain_desc.BufferDesc.Format);
ok(swapchain_desc.BufferDesc.ScanlineOrdering == DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED,
"Got unexpected BufferDesc.ScanlineOrdering %#x.\n", swapchain_desc.BufferDesc.ScanlineOrdering);
ok(swapchain_desc.BufferDesc.Scaling == DXGI_MODE_SCALING_UNSPECIFIED,
"Got unexpected BufferDesc.Scaling %#x.\n", swapchain_desc.BufferDesc.Scaling);
ok(swapchain_desc.SampleDesc.Count == 1,
"Got unexpected SampleDesc.Count %u.\n", swapchain_desc.SampleDesc.Count);
ok(!swapchain_desc.SampleDesc.Quality,
"Got unexpected SampleDesc.Quality %u.\n", swapchain_desc.SampleDesc.Quality);
ok(swapchain_desc.BufferUsage == DXGI_USAGE_RENDER_TARGET_OUTPUT,
"Got unexpected BufferUsage %#x.\n", swapchain_desc.BufferUsage);
ok(swapchain_desc.BufferCount == 1,
"Got unexpected BufferCount %u.\n", swapchain_desc.BufferCount);
ok(swapchain_desc.OutputWindow == window,
"Got unexpected OutputWindow %p, expected %p.\n", swapchain_desc.OutputWindow, window);
ok(swapchain_desc.Windowed,
"Got unexpected Windowed %#x.\n", swapchain_desc.Windowed);
ok(swapchain_desc.SwapEffect == DXGI_SWAP_EFFECT_DISCARD,
"Got unexpected SwapEffect %#x.\n", swapchain_desc.SwapEffect);
ok(!swapchain_desc.Flags,
"Got unexpected Flags %#x.\n", swapchain_desc.Flags);
IDXGISwapChain_Release(swapchain);
refcount = IDXGIDevice_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
DestroyWindow(window);
}
START_TEST(device)
{
pCreateDXGIFactory1 = (void *)GetProcAddress(GetModuleHandleA("dxgi.dll"), "CreateDXGIFactory1");
......@@ -732,4 +1036,5 @@ START_TEST(device)
test_createswapchain();
test_create_factory();
test_private_data();
test_swapchain_resize();
}
......@@ -1225,7 +1225,7 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
device->filter_messages = filter_messages;
}
HRESULT wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
HRESULT CDECL wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality)
{
......
......@@ -255,6 +255,7 @@
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long)
@ cdecl wined3d_swapchain_resize_buffers(ptr long long long long long long)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_palette(ptr ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
......
......@@ -2812,9 +2812,6 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HRESULT wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality) DECLSPEC_HIDDEN;
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
/*****************************************************************************
......
......@@ -2530,6 +2530,9 @@ ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags);
HRESULT __cdecl wined3d_swapchain_resize_buffers(struct wined3d_swapchain *swapchain, unsigned int buffer_count,
unsigned int width, unsigned int height, enum wined3d_format_id format_id,
enum wined3d_multisample_type multisample_type, unsigned int multisample_quality);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
DWORD flags, const struct wined3d_gamma_ramp *ramp);
void __cdecl wined3d_swapchain_set_palette(struct wined3d_swapchain *swapchain, struct wined3d_palette *palette);
......
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