Henri Verbeet : wined3d: Explicitly calculate the sub-resource layer in wined3d_surface_upload_data ().
Alexandre Julliard
julliard at winehq.org
Fri Feb 23 15:10:23 CST 2018
Module: wine
Branch: master
Commit: 34992108bb031c589164111694c860aba25245d6
URL: https://source.winehq.org/git/wine.git/?a=commit;h=34992108bb031c589164111694c860aba25245d6
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Fri Feb 23 10:06:26 2018 +0330
wined3d: Explicitly calculate the sub-resource layer in wined3d_surface_upload_data().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/surface.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 0d09c2f..b2df8f9 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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
{
More information about the wine-cvs
mailing list