wined3d: Reject blits between depth/stencil and colour attachments in the FBO blitter.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2021-05-06 16:59:19 +02:00 committed by Alexandre Julliard
parent 769e2be52f
commit 850f465c67
1 changed files with 11 additions and 0 deletions

View File

@ -269,6 +269,7 @@ static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win
{ {
const struct wined3d_format *src_format = src_resource->format; const struct wined3d_format *src_format = src_resource->format;
const struct wined3d_format *dst_format = dst_resource->format; const struct wined3d_format *dst_format = dst_resource->format;
bool src_ds, dst_ds;
if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer)
return false; return false;
@ -280,6 +281,16 @@ static bool fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct win
if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D) if (src_resource->type != WINED3D_RTYPE_TEXTURE_2D)
return false; return false;
/* We can't copy between depth/stencil and colour attachments. One notable
* way we can end up here is when copying between typeless resources with
* formats like R16_TYPELESS, which can end up using either a
* depth/stencil or a colour format on the OpenGL side, depending on the
* resource's bind flags. */
src_ds = src_format->depth_size || src_format->stencil_size;
dst_ds = dst_format->depth_size || dst_format->stencil_size;
if (src_ds != dst_ds)
return false;
switch (blit_op) switch (blit_op)
{ {
case WINED3D_BLIT_OP_COLOR_BLIT: case WINED3D_BLIT_OP_COLOR_BLIT: