From 1319deec563ee017712688ca6b9262bc66a1a77f Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 22 Feb 2018 10:36:55 +0330 Subject: [PATCH] wined3d: Use wined3d_texture_get_sub_resource_target() in fb_copy_to_texture_direct(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/surface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index eafe47fdc0b..dfdcd9cf6f4 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1580,6 +1580,7 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc BOOL upsidedown = FALSE; RECT dst_rect = *dst_rect_in; unsigned int src_height; + GLenum dst_target; /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag * glCopyTexSubImage is a bit picky about the parameters we pass to it @@ -1627,12 +1628,13 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc } src_height = wined3d_texture_get_level_height(src_texture, src_surface->texture_level); + dst_target = wined3d_texture_get_sub_resource_target(dst_texture, dst_sub_resource_idx); if (upsidedown && !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) { /* Upside down copy without stretching is nice, one glCopyTexSubImage call will do. */ - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, + gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_surface->texture_level, dst_rect.left /*xoffset */, dst_rect.top /* y offset */, src_rect->left, src_height - src_rect->bottom, dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); @@ -1657,14 +1659,14 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc for (col = dst_rect.left; col < dst_rect.right; ++col) { - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, + gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_surface->texture_level, dst_rect.left + col /* x offset */, row /* y offset */, src_rect->left + col * xrel, yoffset - (int) (row * yrel), 1, 1); } } else { - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, + gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_surface->texture_level, dst_rect.left /* x offset */, row /* y offset */, src_rect->left, yoffset - (int) (row * yrel), dst_rect.right - dst_rect.left, 1); }