wined3d: Explicitly calculate the sub-resource level in surface_load_fb_texture().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-02-28 09:56:57 +03:30 committed by Alexandre Julliard
parent 64ba3ee4a0
commit 8e7540b602
1 changed files with 5 additions and 3 deletions

View File

@ -1563,6 +1563,7 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_context *context = old_ctx; struct wined3d_context *context = old_ctx;
struct wined3d_surface *restore_rt = NULL; struct wined3d_surface *restore_rt = NULL;
unsigned int level;
GLenum target; GLenum target;
restore_rt = context_get_rt_surface(old_ctx); restore_rt = context_get_rt_surface(old_ctx);
@ -1585,10 +1586,11 @@ void surface_load_fb_texture(struct wined3d_surface *surface, BOOL srgb, struct
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(texture)); gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(texture));
checkGLcall("glReadBuffer"); checkGLcall("glReadBuffer");
level = sub_resource_idx % texture->level_count;
target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx); target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
gl_info->gl_ops.gl.p_glCopyTexSubImage2D(target, surface->texture_level, gl_info->gl_ops.gl.p_glCopyTexSubImage2D(target, level, 0, 0, 0, 0,
0, 0, 0, 0, wined3d_texture_get_level_width(texture, surface->texture_level), wined3d_texture_get_level_width(texture, level),
wined3d_texture_get_level_height(texture, surface->texture_level)); wined3d_texture_get_level_height(texture, level));
checkGLcall("glCopyTexSubImage2D"); checkGLcall("glCopyTexSubImage2D");
if (restore_rt) if (restore_rt)