wined3d: Add buffer usage to wined3d_swapchain_desc.

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-25 10:33:27 +01:00 committed by Alexandre Julliard
parent 89a50c8e0e
commit 4701425f3c
7 changed files with 9 additions and 2 deletions

View File

@ -207,6 +207,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
swapchain_desc->multisample_type = present_parameters->MultiSampleType;
swapchain_desc->multisample_quality = 0; /* d3d9 only */
swapchain_desc->swap_effect = present_parameters->SwapEffect;

View File

@ -229,6 +229,7 @@ static BOOL wined3d_swapchain_desc_from_present_parameters(struct wined3d_swapch
swapchain_desc->backbuffer_height = present_parameters->BackBufferHeight;
swapchain_desc->backbuffer_format = wined3dformat_from_d3dformat(present_parameters->BackBufferFormat);
swapchain_desc->backbuffer_count = max(1, present_parameters->BackBufferCount);
swapchain_desc->backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
swapchain_desc->multisample_type = present_parameters->MultiSampleType;
swapchain_desc->multisample_quality = present_parameters->MultiSampleQuality;
swapchain_desc->swap_effect = present_parameters->SwapEffect;
@ -817,7 +818,6 @@ static HRESULT d3d9_device_reset(struct d3d9_device *device,
struct wined3d_display_mode wined3d_mode;
HRESULT hr;
if (!extended && device->device_state == D3D9_DEVICE_STATE_LOST)
{
WARN("App not active, returning D3DERR_DEVICELOST.\n");

View File

@ -630,6 +630,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
swapchain_desc.backbuffer_width = mode.width;
swapchain_desc.backbuffer_height = mode.height;
swapchain_desc.backbuffer_format = mode.format_id;
swapchain_desc.backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
swapchain_desc.swap_effect = WINED3D_SWAP_EFFECT_COPY;
swapchain_desc.device_window = window;
swapchain_desc.windowed = windowed;

View File

@ -313,6 +313,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChainForHwnd(IDXGIFactor
wined3d_desc.backbuffer_height = swapchain_desc->Height;
wined3d_desc.backbuffer_format = wined3dformat_from_dxgi_format(swapchain_desc->Format);
wined3d_desc.backbuffer_count = swapchain_desc->BufferCount;
wined3d_desc.backbuffer_usage = WINED3DUSAGE_RENDERTARGET;
wined3d_sample_desc_from_dxgi(&wined3d_desc.multisample_type,
&wined3d_desc.multisample_quality, &swapchain_desc->SampleDesc);
wined3d_desc.swap_effect = WINED3D_SWAP_EFFECT_DISCARD;

View File

@ -4732,6 +4732,9 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
TRACE("swap_interval %u\n", swapchain_desc->swap_interval);
TRACE("auto_restore_display_mode %#x\n", swapchain_desc->auto_restore_display_mode);
if (swapchain_desc->backbuffer_usage != WINED3DUSAGE_RENDERTARGET)
FIXME("Got unexpected backbuffer usage %#x.\n", swapchain_desc->backbuffer_usage);
/* No special treatment of these parameters. Just store them */
swapchain->desc.swap_effect = swapchain_desc->swap_effect;
swapchain->desc.enable_auto_depth_stencil = swapchain_desc->enable_auto_depth_stencil;

View File

@ -920,7 +920,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
goto err;
}
texture_desc.usage |= WINED3DUSAGE_RENDERTARGET;
texture_desc.usage = swapchain->desc.backbuffer_usage;
for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{
TRACE("Creating back buffer %u.\n", i);

View File

@ -1712,6 +1712,7 @@ struct wined3d_swapchain_desc
UINT backbuffer_height;
enum wined3d_format_id backbuffer_format;
UINT backbuffer_count;
DWORD backbuffer_usage;
enum wined3d_multisample_type multisample_type;
DWORD multisample_quality;
enum wined3d_swap_effect swap_effect;