Henri Verbeet : wined3d: Do not create DCs for all textures on WINED3D_NO3D adapters.

Alexandre Julliard julliard at winehq.org
Thu Sep 27 18:25:14 CDT 2018


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Sep 27 19:18:33 2018 +0330

wined3d: Do not create DCs for all textures on WINED3D_NO3D adapters.

WINED3DFMT_D16_UNORM for example doesn't have a corresponding ddi_format.

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/resource.c  | 3 ++-
 dlls/wined3d/swapchain.c | 4 ++++
 dlls/wined3d/texture.c   | 4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 6cb1ac4..9df0a09 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -39,7 +39,8 @@ static void resource_check_usage(DWORD usage)
             | WINED3DUSAGE_SCRATCH
             | WINED3DUSAGE_PRIVATE
             | WINED3DUSAGE_LEGACY_CUBEMAP
-            | WINED3DUSAGE_TEXTURE;
+            | WINED3DUSAGE_TEXTURE
+            | ~WINED3DUSAGE_MASK;
 
     /* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings
      * being returned. OpenGL doesn't give us explicit control over that, but
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 8200bdd..b068cf1 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -834,6 +834,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
     texture_desc.multisample_type = swapchain->desc.multisample_type;
     texture_desc.multisample_quality = swapchain->desc.multisample_quality;
     texture_desc.usage = 0;
+    if (device->wined3d->flags & WINED3D_NO3D)
+        texture_desc.usage |= WINED3DUSAGE_OWNDC;
     texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
     texture_desc.width = swapchain->desc.backbuffer_width;
     texture_desc.height = swapchain->desc.backbuffer_height;
@@ -915,6 +917,8 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
         }
 
         texture_desc.usage = swapchain->desc.backbuffer_usage;
+        if (device->wined3d->flags & WINED3D_NO3D)
+            texture_desc.usage |= WINED3DUSAGE_OWNDC;
         for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
         {
             TRACE("Creating back buffer %u.\n", i);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c0bdddc..9589e49 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2896,7 +2896,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
         TRACE("Created sub-resource %u (level %u, layer %u).\n",
                 i, i % texture->level_count, i / texture->level_count);
 
-        if ((desc->usage & WINED3DUSAGE_OWNDC) || (device->wined3d->flags & WINED3D_NO3D))
+        if (desc->usage & WINED3DUSAGE_OWNDC)
         {
             struct wined3d_texture_idx texture_idx = {texture, i};
 
@@ -3515,7 +3515,7 @@ HRESULT CDECL wined3d_texture_release_dc(struct wined3d_texture *texture, unsign
         return WINED3DERR_INVALIDCALL;
     }
 
-    if (!(texture->resource.usage & WINED3DUSAGE_OWNDC) && !(device->wined3d->flags & WINED3D_NO3D))
+    if (!(texture->resource.usage & WINED3DUSAGE_OWNDC))
     {
         struct wined3d_texture_idx texture_idx = {texture, sub_resource_idx};
 




More information about the wine-cvs mailing list