[PATCH v2 4/5] wined3d: Retrieve caps from both WINED3D_GL_RES_TYPE_TEX_2D and WINED3D_GL_RES_TYPE_RB for 2D textures in wined3d_check_device_format().

Zebediah Figura wine at gitlab.winehq.org
Thu Jun 16 14:12:22 CDT 2022


From: Zebediah Figura <zfigura at codeweavers.com>

WINED3D_GL_RES_TYPE_RB is not used by the Vulkan backend.

We could alternatively solve this by filling WINED3D_GL_RES_TYPE_RB for the
Vulkan backend, but this makes less sense. Checking both formats is more in line
with what is done elsewhere, e.g. wined3d_check_surface_format().
---
 dlls/wined3d/directx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 925b2df0401..92ebbc2ba23 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -1971,6 +1971,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
             allowed_bind_flags = WINED3D_BIND_RENDER_TARGET
                     | WINED3D_BIND_DEPTH_STENCIL
                     | WINED3D_BIND_UNORDERED_ACCESS;
+            gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_2D;
             if (!(bind_flags & WINED3D_BIND_SHADER_RESOURCE))
             {
                 if (!wined3d_check_surface_format(format))
@@ -1978,8 +1979,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
                     TRACE("%s is not supported for plain surfaces.\n", debug_d3dformat(format->id));
                     return WINED3DERR_NOTAVAILABLE;
                 }
-
-                gl_type = gl_type_end = WINED3D_GL_RES_TYPE_RB;
                 break;
             }
             allowed_usage |= WINED3DUSAGE_DYNAMIC
@@ -1993,7 +1992,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
                     | WINED3DUSAGE_QUERY_VERTEXTEXTURE
                     | WINED3DUSAGE_QUERY_WRAPANDMIP;
             allowed_bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
-            gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_2D;
             if (usage & WINED3DUSAGE_LEGACY_CUBEMAP)
             {
                 allowed_usage &= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP;
@@ -2092,6 +2090,11 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
 
     for (; gl_type <= gl_type_end; ++gl_type)
     {
+        unsigned int caps = format->caps[gl_type];
+
+        if (gl_type == WINED3D_GL_RES_TYPE_TEX_2D && !(bind_flags & WINED3D_BIND_SHADER_RESOURCE))
+            caps |= format->caps[WINED3D_GL_RES_TYPE_RB];
+
         if ((format->caps[gl_type] & format_caps) != format_caps)
         {
             TRACE("Requested format caps %#x, but format %s only has %#x.\n",
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/255



More information about the wine-devel mailing list