Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/surface.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index b2fddad..9dff68f 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -785,7 +785,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w struct wined3d_texture *texture = surface->container; UINT update_w = src_rect->right - src_rect->left; UINT update_h = src_rect->bottom - src_rect->top; - unsigned int layer; + unsigned int level, layer; GLenum target;
TRACE("surface %p, gl_info %p, format %s, src_rect %s, src_pitch %u, dst_point %s, srgb %#x, data {%#x:%p}.\n", @@ -811,6 +811,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w }
target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx); + level = sub_resource_idx % texture->level_count; layer = sub_resource_idx / texture->level_count;
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) @@ -834,19 +835,19 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
TRACE("Uploading compressed data, target %#x, level %u, layer %u, x %d, y %d, w %u, h %u, " "format %#x, image_size %#x, addr %p.\n", - target, surface->texture_level, layer, dst_point->x, dst_point->y, + target, level, layer, dst_point->x, dst_point->y, update_w, update_h, internal, dst_slice_pitch, addr);
if (dst_row_pitch == src_pitch) { if (target == GL_TEXTURE_2D_ARRAY) { - GL_EXTCALL(glCompressedTexSubImage3D(target, surface->texture_level, dst_point->x, dst_point->y, + GL_EXTCALL(glCompressedTexSubImage3D(target, level, dst_point->x, dst_point->y, layer, update_w, update_h, 1, internal, dst_slice_pitch, addr)); } else { - GL_EXTCALL(glCompressedTexSubImage2D(target, surface->texture_level, dst_point->x, dst_point->y, + GL_EXTCALL(glCompressedTexSubImage2D(target, level, dst_point->x, dst_point->y, update_w, update_h, internal, dst_slice_pitch, addr)); } } @@ -861,12 +862,12 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w { if (target == GL_TEXTURE_2D_ARRAY) { - GL_EXTCALL(glCompressedTexSubImage3D(target, surface->texture_level, dst_point->x, y, + GL_EXTCALL(glCompressedTexSubImage3D(target, level, dst_point->x, y, layer, update_w, format->block_height, 1, internal, dst_row_pitch, addr)); } else { - GL_EXTCALL(glCompressedTexSubImage2D(target, surface->texture_level, dst_point->x, y, + GL_EXTCALL(glCompressedTexSubImage2D(target, level, dst_point->x, y, update_w, format->block_height, internal, dst_row_pitch, addr)); }
@@ -885,18 +886,18 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
TRACE("Uploading data, target %#x, level %u, layer %u, x %d, y %d, w %u, h %u, " "format %#x, type %#x, addr %p.\n", - target, surface->texture_level, layer, dst_point->x, dst_point->y, + target, level, layer, dst_point->x, dst_point->y, update_w, update_h, format->glFormat, format->glType, addr);
gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_pitch / format->byte_count); if (target == GL_TEXTURE_2D_ARRAY) { - GL_EXTCALL(glTexSubImage3D(target, surface->texture_level, dst_point->x, dst_point->y, + GL_EXTCALL(glTexSubImage3D(target, level, dst_point->x, dst_point->y, layer, update_w, update_h, 1, format->glFormat, format->glType, addr)); } else { - gl_info->gl_ops.gl.p_glTexSubImage2D(target, surface->texture_level, dst_point->x, dst_point->y, + gl_info->gl_ops.gl.p_glTexSubImage2D(target, level, dst_point->x, dst_point->y, update_w, update_h, format->glFormat, format->glType, addr); } gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);