wined3d: Use wined3d_texture_get_sub_resource_target() in fb_copy_to_texture_direct().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c2499e0142
commit
1319deec56
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue