wined3d: Explicitly calculate the sub-resource layer in wined3d_surface_upload_data().

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-23 09:48:26 +03:30 committed by Alexandre Julliard
parent cd53e81a80
commit 34992108bb
1 changed files with 8 additions and 6 deletions

View File

@ -783,6 +783,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;
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",
@ -808,6 +809,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
}
target = wined3d_texture_get_sub_resource_target(texture, sub_resource_idx);
layer = sub_resource_idx / texture->level_count;
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED)
{
@ -830,7 +832,7 @@ 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, surface->texture_layer, dst_point->x, dst_point->y,
target, surface->texture_level, layer, dst_point->x, dst_point->y,
update_w, update_h, internal, dst_slice_pitch, addr);
if (dst_row_pitch == src_pitch)
@ -838,7 +840,7 @@ 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, dst_point->y,
surface->texture_layer, update_w, update_h, 1, internal, dst_slice_pitch, addr));
layer, update_w, update_h, 1, internal, dst_slice_pitch, addr));
}
else
{
@ -858,7 +860,7 @@ 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,
surface->texture_layer, update_w, format->block_height, 1, internal, dst_row_pitch, addr));
layer, update_w, format->block_height, 1, internal, dst_row_pitch, addr));
}
else
{
@ -881,14 +883,14 @@ 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, surface->texture_layer,
dst_point->x, dst_point->y, update_w, update_h, format->glFormat, format->glType, addr);
target, surface->texture_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,
surface->texture_layer, update_w, update_h, 1, format->glFormat, format->glType, addr));
layer, update_w, update_h, 1, format->glFormat, format->glType, addr));
}
else
{