Setting this value to nonzero enables blitting of incompatible formats in raw_blitter_blit().
Games may blit between a depth/stencil format and a colour format, even though it's invalid in D3D10/11. In some situations glCopyImageSubData() handles this well enough, with much higher performance than the FBO path.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51935 Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_main.c | 5 +++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 851c3c36b..9bae19495 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -6189,7 +6189,7 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit * * We also can't copy between depth/stencil and colour resources, since * the formats are considered incompatible in OpenGL. */ - if (op != WINED3D_BLIT_OP_RAW_BLIT || (src_ds != dst_ds) + if (op != WINED3D_BLIT_OP_RAW_BLIT || (src_ds != dst_ds && !wined3d_settings.enable_gl_incompatible_raw_blits) || (src_texture->resource.format->id == dst_texture->resource.format->id && (!(src_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB)) || !(dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))))) diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c index 699794558..24897f582 100644 --- a/dlls/wined3d/wined3d_main.c +++ b/dlls/wined3d/wined3d_main.c @@ -398,6 +398,11 @@ static BOOL wined3d_dll_init(HINSTANCE hInstDLL) TRACE("Forcing all constant buffers to be write-mappable.\n"); wined3d_settings.cb_access_map_w = TRUE; } + if (!get_config_key_dword(hkey, appkey, "GLIncompatibleRawBlits", &tmpvalue) && tmpvalue) + { + TRACE("Enabling GL raw blits for incompatible formats.\n"); + wined3d_settings.enable_gl_incompatible_raw_blits = TRUE; + } }
if (appkey) RegCloseKey( appkey ); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 5fa51a844..7e75bd04e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -497,6 +497,7 @@ struct wined3d_settings enum wined3d_renderer renderer; enum wined3d_shader_backend shader_backend; BOOL cb_access_map_w; + BOOL enable_gl_incompatible_raw_blits; };
extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN;
On Fri, 17 Dec 2021 at 07:13, Conor McCarthy cmccarthy@codeweavers.com wrote:
Setting this value to nonzero enables blitting of incompatible formats in raw_blitter_blit().
Games may blit between a depth/stencil format and a colour format, even though it's invalid in D3D10/11. In some situations glCopyImageSubData() handles this well enough, with much higher performance than the FBO path.
Is that invalid in the sense that it doesn't work, or in the sense that the documentation claims it's not allowed? If this is something that works in practice, we'd want tests to go along with the fix.
On the OpenGL side, if this does indeed work reliably with ARB_copy_image, we could just detect that during adapter initialisation and set a quirk bit; we wouldn't need a registry setting. Still, it this point, the most interesting question is probably why it's so slow with FBO blits.