Henri Verbeet : wined3d: Explicitly calculate the sub-resource level in fb_copy_to_texture_direct( ).

Alexandre Julliard julliard at winehq.org
Thu Mar 1 13:34:43 CST 2018


Module: wine
Branch: master
Commit: 6be6bf7d708521f6c97f398cd308011b3e5efa64
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6be6bf7d708521f6c97f398cd308011b3e5efa64

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Mar  1 10:04:51 2018 +0330

wined3d: Explicitly calculate the sub-resource level in fb_copy_to_texture_direct().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/surface.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 12370ed..668cfba 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1722,9 +1722,9 @@ static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struc
 static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
         const RECT *src_rect, const RECT *dst_rect_in, enum wined3d_texture_filter_type filter)
 {
+    unsigned int src_width, src_height, src_pow2_width, src_pow2_height, src_level;
     unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
     unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
-    unsigned int src_width, src_height, src_pow2_width, src_pow2_height;
     struct wined3d_texture *src_texture = src_surface->container;
     struct wined3d_texture *dst_texture = dst_surface->container;
     struct wined3d_device *device = dst_texture->resource.device;
@@ -1752,10 +1752,11 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, st
     wined3d_texture_load(dst_texture, context, FALSE);
 
     offscreen_buffer = context_get_offscreen_gl_buffer(context);
-    src_width = wined3d_texture_get_level_width(src_texture, src_surface->texture_level);
-    src_height = wined3d_texture_get_level_height(src_texture, src_surface->texture_level);
-    src_pow2_width = wined3d_texture_get_level_pow2_width(src_texture, src_surface->texture_level);
-    src_pow2_height = wined3d_texture_get_level_pow2_height(src_texture, src_surface->texture_level);
+    src_level = src_sub_resource_idx % src_texture->level_count;
+    src_width = wined3d_texture_get_level_width(src_texture, src_level);
+    src_height = wined3d_texture_get_level_height(src_texture, src_level);
+    src_pow2_width = wined3d_texture_get_level_pow2_width(src_texture, src_level);
+    src_pow2_height = wined3d_texture_get_level_pow2_height(src_texture, src_level);
 
     src_offscreen = wined3d_resource_is_offscreen(&src_texture->resource);
     noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO;




More information about the wine-cvs mailing list