Commit 83d3e14d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Retrieve caps from both WINED3D_GL_RES_TYPE_TEX_2D and…

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().
parent 154d7164
...@@ -1974,6 +1974,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, ...@@ -1974,6 +1974,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
allowed_bind_flags = WINED3D_BIND_RENDER_TARGET allowed_bind_flags = WINED3D_BIND_RENDER_TARGET
| WINED3D_BIND_DEPTH_STENCIL | WINED3D_BIND_DEPTH_STENCIL
| WINED3D_BIND_UNORDERED_ACCESS; | WINED3D_BIND_UNORDERED_ACCESS;
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_2D;
if (!(bind_flags & WINED3D_BIND_SHADER_RESOURCE)) if (!(bind_flags & WINED3D_BIND_SHADER_RESOURCE))
{ {
if (!wined3d_check_surface_format(format)) if (!wined3d_check_surface_format(format))
...@@ -1981,8 +1982,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, ...@@ -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)); TRACE("%s is not supported for plain surfaces.\n", debug_d3dformat(format->id));
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_RB;
break; break;
} }
allowed_usage |= WINED3DUSAGE_DYNAMIC allowed_usage |= WINED3DUSAGE_DYNAMIC
...@@ -1996,7 +1995,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, ...@@ -1996,7 +1995,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
| WINED3DUSAGE_QUERY_VERTEXTEXTURE | WINED3DUSAGE_QUERY_VERTEXTEXTURE
| WINED3DUSAGE_QUERY_WRAPANDMIP; | WINED3DUSAGE_QUERY_WRAPANDMIP;
allowed_bind_flags |= WINED3D_BIND_SHADER_RESOURCE; allowed_bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_2D;
if (usage & WINED3DUSAGE_LEGACY_CUBEMAP) if (usage & WINED3DUSAGE_LEGACY_CUBEMAP)
{ {
allowed_usage &= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP; allowed_usage &= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP;
...@@ -2095,10 +2093,15 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, ...@@ -2095,10 +2093,15 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
for (; gl_type <= gl_type_end; ++gl_type) 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", 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; return WINED3DERR_NOTAVAILABLE;
} }
...@@ -2129,7 +2132,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, ...@@ -2129,7 +2132,7 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d,
return WINED3DERR_NOTAVAILABLE; return WINED3DERR_NOTAVAILABLE;
} }
if (!(format->caps[gl_type] & WINED3D_FORMAT_CAP_GEN_MIPMAP)) if (!(caps & WINED3D_FORMAT_CAP_GEN_MIPMAP))
mipmap_gen_supported = FALSE; mipmap_gen_supported = FALSE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment