=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Add buffer usage to wined3d_swapchain_desc.

Alexandre Julliard julliard at winehq.org
Thu Jan 25 17:37:40 CST 2018


Module: wine
Branch: master
Commit: 4701425f3c9f5c62a06b631227e7be8717cc9461
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4701425f3c9f5c62a06b631227e7be8717cc9461

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Thu Jan 25 10:33:27 2018 +0100

wined3d: Add buffer usage to wined3d_swapchain_desc.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d8/device.c       | 1 +
 dlls/d3d9/device.c       | 2 +-
 dlls/ddraw/ddraw.c       | 1 +
 dlls/dxgi/factory.c      | 1 +
 dlls/wined3d/device.c    | 3 +++
 dlls/wined3d/swapchain.c | 2 +-
 include/wine/wined3d.h   | 1 +
 7 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 506961a..e7577d7 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -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;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 51b4896..0a76227 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -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");
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 27be401..5d1db80 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -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;
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index f38d67c..0020917 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -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;
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a25b98d..5bd8804 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index dd3655f..f739313 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -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);
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index a519e94..8c27492 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -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;




More information about the wine-cvs mailing list