Commit 34992108 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent cd53e81a
...@@ -783,6 +783,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w ...@@ -783,6 +783,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
struct wined3d_texture *texture = surface->container; struct wined3d_texture *texture = surface->container;
UINT update_w = src_rect->right - src_rect->left; UINT update_w = src_rect->right - src_rect->left;
UINT update_h = src_rect->bottom - src_rect->top; UINT update_h = src_rect->bottom - src_rect->top;
unsigned int layer;
GLenum target; 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", 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 ...@@ -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); 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) 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 ...@@ -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, " 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", "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); update_w, update_h, internal, dst_slice_pitch, addr);
if (dst_row_pitch == src_pitch) if (dst_row_pitch == src_pitch)
...@@ -838,7 +840,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w ...@@ -838,7 +840,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
if (target == GL_TEXTURE_2D_ARRAY) if (target == GL_TEXTURE_2D_ARRAY)
{ {
GL_EXTCALL(glCompressedTexSubImage3D(target, surface->texture_level, dst_point->x, dst_point->y, 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 else
{ {
...@@ -858,7 +860,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w ...@@ -858,7 +860,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
if (target == GL_TEXTURE_2D_ARRAY) if (target == GL_TEXTURE_2D_ARRAY)
{ {
GL_EXTCALL(glCompressedTexSubImage3D(target, surface->texture_level, dst_point->x, y, 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 else
{ {
...@@ -881,14 +883,14 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w ...@@ -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, " TRACE("Uploading data, target %#x, level %u, layer %u, x %d, y %d, w %u, h %u, "
"format %#x, type %#x, addr %p.\n", "format %#x, type %#x, addr %p.\n",
target, surface->texture_level, surface->texture_layer, target, surface->texture_level, layer, dst_point->x, dst_point->y,
dst_point->x, dst_point->y, update_w, update_h, format->glFormat, format->glType, addr); 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); gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, src_pitch / format->byte_count);
if (target == GL_TEXTURE_2D_ARRAY) if (target == GL_TEXTURE_2D_ARRAY)
{ {
GL_EXTCALL(glTexSubImage3D(target, surface->texture_level, dst_point->x, dst_point->y, 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 else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment