Module: wine Branch: master Commit: 09b09b307a0c909bbc185dcb9348603d84a3b479 URL: http://source.winehq.org/git/wine.git/?a=commit;h=09b09b307a0c909bbc185dcb93...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Fri Aug 26 13:51:19 2016 +0200
wined3d: Use wined3d_format_calculate_pitch() in wined3d_surface_upload_data().
Mostly because wined3d_format_calculate_size() will need to handle WINED3DFMT_FLAG_BROKEN_PITCH, but it also makes more sense conceptually.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wined3d/surface.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index efdea87..522874b 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -973,8 +973,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_COMPRESSED) { - UINT row_length = wined3d_format_calculate_size(format, 1, update_w, 1, 1); - UINT row_count = (update_h + format->block_height - 1) / format->block_height; + unsigned int dst_row_pitch, dst_slice_pitch; const BYTE *addr = data->addr; GLenum internal;
@@ -989,28 +988,31 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w else internal = format->glInternal;
+ wined3d_format_calculate_pitch(format, 1, update_w, update_h, &dst_row_pitch, &dst_slice_pitch); + 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", surface->texture_target, surface->texture_level, surface->texture_layer, - dst_point->x, dst_point->y, update_w, update_h, internal, row_count * row_length, addr); + dst_point->x, dst_point->y, update_w, update_h, internal, dst_slice_pitch, addr);
- if (row_length == src_pitch) + if (dst_row_pitch == src_pitch) { if (surface->texture_target == GL_TEXTURE_2D_ARRAY) { GL_EXTCALL(glCompressedTexSubImage3D(surface->texture_target, surface->texture_level, dst_point->x, dst_point->y, surface->texture_layer, update_w, update_h, 1, - internal, row_count * row_length, addr)); + internal, dst_slice_pitch, addr)); } else { GL_EXTCALL(glCompressedTexSubImage2D(surface->texture_target, surface->texture_level, dst_point->x, dst_point->y, update_w, update_h, - internal, row_count * row_length, addr)); + internal, dst_slice_pitch, addr)); } } else { + UINT row_count = (update_h + format->block_height - 1) / format->block_height; UINT row, y;
/* glCompressedTexSubImage2D() ignores pixel store state, so we @@ -1021,12 +1023,12 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w { GL_EXTCALL(glCompressedTexSubImage3D(surface->texture_target, surface->texture_level, dst_point->x, y, surface->texture_layer, update_w, format->block_height, 1, - internal, row_length, addr)); + internal, dst_row_pitch, addr)); } else { GL_EXTCALL(glCompressedTexSubImage2D(surface->texture_target, surface->texture_level, - dst_point->x, y, update_w, format->block_height, internal, row_length, addr)); + dst_point->x, y, update_w, format->block_height, internal, dst_row_pitch, addr)); }
y += format->block_height;