Change the source texture's map_binding to BUFFER, so that the copy is GPU-side only.
Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/cs.c | 4 ++++ dlls/wined3d/texture.c | 12 ++++++++++-- dlls/wined3d/wined3d_private.h | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 51e5055c4ab..0b72284615d 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2582,6 +2582,10 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
context = context_acquire(cs->c.device, NULL, 0);
+ if (src_texture->resource.map_binding != WINED3D_LOCATION_BUFFER + && wined3d_texture_can_use_pbo(src_texture, &context->device->adapter->gl_info)) + wined3d_texture_set_map_binding(src_texture, WINED3D_LOCATION_BUFFER); + if (!wined3d_texture_load_location(src_texture, op->src_sub_resource_idx, context, src_texture->resource.map_binding)) { diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index 2cf1a44a213..e924083301b 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -47,7 +47,7 @@ struct wined3d_rect_f float b; };
-static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) +BOOL wined3d_texture_can_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) { if (gl_info->selected_gl_version && !gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]) return FALSE; @@ -56,6 +56,14 @@ static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const || (texture->flags & (WINED3D_TEXTURE_PIN_SYSMEM | WINED3D_TEXTURE_COND_NP2_EMULATED))) return FALSE;
+ return TRUE; +} + +static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) +{ + if (!wined3d_texture_can_use_pbo(texture, gl_info)) + return FALSE; + /* Use a PBO for dynamic textures and read-only staging textures. */ return (!(texture->resource.access & WINED3D_RESOURCE_ACCESS_CPU) && texture->resource.usage & WINED3DUSAGE_DYNAMIC) @@ -893,7 +901,7 @@ static void wined3d_texture_update_map_binding(struct wined3d_texture *texture) texture->update_map_binding = 0; }
-static void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) +void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) { texture->update_map_binding = map_binding; if (!texture->resource.map_count) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4b7087a3807..97b4bb45215 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4401,6 +4401,9 @@ BOOL wined3d_texture_prepare_location(struct wined3d_texture *texture, unsigned struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; void wined3d_texture_set_swapchain(struct wined3d_texture *texture, struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; +BOOL wined3d_texture_can_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) + DECLSPEC_HIDDEN; +void wined3d_texture_set_map_binding(struct wined3d_texture *texture, DWORD map_binding) DECLSPEC_HIDDEN; void wined3d_texture_sub_resources_destroyed(struct wined3d_texture *texture) DECLSPEC_HIDDEN; void wined3d_texture_translate_drawable_coords(const struct wined3d_texture *texture, HWND window, RECT *rect) DECLSPEC_HIDDEN;