From 83d3e14da1771d8402abb86346e1154d5703c408 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 15 Jun 2022 16:46:21 -0500 Subject: [PATCH] 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(). 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 6f8d1edad6e..85405eaa6b5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1974,6 +1974,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)) @@ -1981,8 +1982,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 @@ -1996,7 +1995,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; @@ -2095,10 +2093,15 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, for (; gl_type <= gl_type_end; ++gl_type) { - if ((format->caps[gl_type] & format_caps) != format_caps) + 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 ((caps & format_caps) != format_caps) { TRACE("Requested format caps %#x, but format %s only has %#x.\n", - format_caps, debug_d3dformat(check_format_id), format->caps[gl_type]); + format_caps, debug_d3dformat(check_format_id), caps); return WINED3DERR_NOTAVAILABLE; } @@ -2129,7 +2132,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, return WINED3DERR_NOTAVAILABLE; } - if (!(format->caps[gl_type] & WINED3D_FORMAT_CAP_GEN_MIPMAP)) + if (!(caps & WINED3D_FORMAT_CAP_GEN_MIPMAP)) mipmap_gen_supported = FALSE; }