wined3d-mesa_texture_download: Add patch.

This commit is contained in:
Zebediah Figura 2018-10-08 16:19:25 -05:00
parent 15e36c54fc
commit 8dced4d4ac
3 changed files with 82 additions and 0 deletions

View File

@ -364,6 +364,7 @@ patch_enable_all ()
enable_wined3d_UAV_Counters="$1"
enable_wined3d_WINED3DFMT_B8G8R8X8_UNORM="$1"
enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$1"
enable_wined3d_mesa_texture_download="$1"
enable_wined3d_wined3d_guess_gl_vendor="$1"
enable_winedbg_Process_Arguments="$1"
enable_winedevice_Default_Drivers="$1"
@ -1258,6 +1259,9 @@ patch_enable ()
wined3d-WINED3D_RS_COLORWRITEENABLE)
enable_wined3d_WINED3D_RS_COLORWRITEENABLE="$2"
;;
wined3d-mesa_texture_download)
enable_wined3d_mesa_texture_download="$2"
;;
wined3d-wined3d_guess_gl_vendor)
enable_wined3d_wined3d_guess_gl_vendor="$2"
;;
@ -7485,6 +7489,21 @@ if test "$enable_wined3d_Indexed_Vertex_Blending" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-mesa_texture_download
# |
# | This patchset fixes the following Wine bugs:
# | * [#45901] Avoid GPU synchronization due to GPU-CPU transfer (Overwatch)
# |
# | Modified files:
# | * dlls/wined3d/texture.c
# |
if test "$enable_wined3d_mesa_texture_download" -eq 1; then
patch_apply wined3d-mesa_texture_download/0001-wined3d-Use-glReadPixels-for-RT-texture-download.patch
(
printf '%s\n' '+ { "Andrew Wesie", "wined3d: Use glReadPixels for RT texture download.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-wined3d_guess_gl_vendor
# |
# | This patchset fixes the following Wine bugs:
@ -7601,6 +7620,10 @@ fi
# Patchset winepulse-PulseAudio_Support
# |
# | This patchset fixes the following Wine bugs:
# | * [#37042] Implement exclusive mode in PulseAudio backend
# | * [#28282] Sound constantly crackling in a lot of games
# |
# | Modified files:
# | * dlls/winepulse.drv/Makefile.in, dlls/winepulse.drv/mmdevdrv.c
# |

View File

@ -0,0 +1,58 @@
From: Andrew Wesie <awesie@gmail.com>
Subject: [PATCH 4/4] wined3d: Use glReadPixels for RT texture download.
Message-Id: <1538326920-5825-4-git-send-email-awesie@gmail.com>
Date: Sun, 30 Sep 2018 12:02:00 -0500
In-Reply-To: <1538326920-5825-1-git-send-email-awesie@gmail.com>
References: <1538326920-5825-1-git-send-email-awesie@gmail.com>
Signed-off-by: Andrew Wesie <awesie@gmail.com>
---
dlls/wined3d/texture.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 78e9364..3efd675 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -2371,11 +2371,13 @@ void wined3d_texture_download_data(struct wined3d_texture *texture, unsigned int
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_format_gl *format_gl;
+ struct wined3d_texture_sub_resource *sub_resource;
unsigned int level;
GLenum target;
format_gl = wined3d_format_gl(texture->resource.format);
target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
+ sub_resource = &texture->sub_resources[sub_resource_idx];
level = sub_resource_idx % texture->level_count;
if (texture->resource.type == WINED3D_RTYPE_TEXTURE_2D
@@ -2409,6 +2411,23 @@ void wined3d_texture_download_data(struct wined3d_texture *texture, unsigned int
GL_EXTCALL(glGetCompressedTexImage(target, level, data->addr));
checkGLcall("glGetCompressedTexImage");
}
+ else if (data->buffer_object && texture->resource.usage & WINED3DUSAGE_RENDERTARGET)
+ {
+ /* PBO texture download is not accelerated on Mesa. Use glReadPixels if possible. */
+ TRACE("Downloading (glReadPixels) texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
+ texture, sub_resource_idx, level, format_gl->format, format_gl->type, data->addr);
+
+ context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, &texture->resource, sub_resource_idx, NULL,
+ 0, sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB));
+ context_check_fbo_status(context, GL_READ_FRAMEBUFFER);
+ context_invalidate_state(context, STATE_FRAMEBUFFER);
+ gl_info->gl_ops.gl.p_glReadBuffer(GL_COLOR_ATTACHMENT0);
+ checkGLcall("glReadBuffer()");
+
+ gl_info->gl_ops.gl.p_glReadPixels(0, 0, wined3d_texture_get_level_width(texture, level),
+ wined3d_texture_get_level_height(texture, level), format_gl->format, format_gl->type, data->addr);
+ checkGLcall("glReadPixels");
+ }
else
{
TRACE("Downloading texture %p, %u, level %u, format %#x, type %#x, data %p.\n",
--
2.7.4

View File

@ -0,0 +1 @@
Fixes: [45901] Avoid GPU synchronization due to GPU-CPU transfer (Overwatch)