Henri Verbeet : wined3d: Pass a texture and sub-resource index to wined3d_surface_upload_data().

Alexandre Julliard julliard at winehq.org
Mon Mar 5 16:14:32 CST 2018


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Mar  5 11:24:35 2018 +0330

wined3d: Pass a texture and sub-resource index to 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         | 28 ++++++++++++++--------------
 dlls/wined3d/texture.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  7 ++++---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 38924a8..8d6712b 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -777,24 +777,23 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
 /* This call just uploads data, the caller is responsible for binding the
  * correct texture. */
 /* Context activation is done by the caller. */
-void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
-        const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point,
-        BOOL srgb, const struct wined3d_const_bo_address *data)
+void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect,
+        unsigned int src_pitch, const POINT *dst_point, BOOL srgb, const struct wined3d_const_bo_address *data)
 {
-    unsigned int sub_resource_idx = surface_get_sub_resource_idx(surface);
-    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 level, 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",
-            surface, gl_info, debug_d3dformat(format->id), wine_dbgstr_rect(src_rect), src_pitch,
-            wine_dbgstr_point(dst_point), srgb, data->buffer_object, data->addr);
+    TRACE("texure %p, sub_resource_idx %u, gl_info %p, format %s, src_rect %s, "
+            "src_pitch %u, dst_point %s, srgb %#x, data {%#x:%p}.\n",
+            texture, sub_resource_idx, gl_info, debug_d3dformat(format->id), wine_dbgstr_rect(src_rect),
+            src_pitch, wine_dbgstr_point(dst_point), srgb, data->buffer_object, data->addr);
 
     if (texture->sub_resources[sub_resource_idx].map_count)
     {
-        WARN("Uploading a surface that is currently mapped, setting WINED3D_TEXTURE_PIN_SYSMEM.\n");
+        WARN("Uploading a texture that is currently mapped, setting WINED3D_TEXTURE_PIN_SYSMEM.\n");
         texture->flags |= WINED3D_TEXTURE_PIN_SYSMEM;
     }
 
@@ -875,7 +874,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
                 addr += src_pitch;
             }
         }
-        checkGLcall("Upload compressed surface data");
+        checkGLcall("Upload compressed texture data");
     }
     else
     {
@@ -901,7 +900,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
                     update_w, update_h, format->glFormat, format->glType, addr);
         }
         gl_info->gl_ops.gl.p_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
-        checkGLcall("Upload surface data");
+        checkGLcall("Upload texture data");
     }
 
     if (data->buffer_object)
@@ -915,6 +914,7 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
 
     if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE)
     {
+        struct wined3d_surface *surface = texture->sub_resources[sub_resource_idx].u.surface;
         struct wined3d_device *device = texture->resource.device;
         unsigned int i;
 
@@ -964,7 +964,7 @@ static HRESULT surface_upload_from_surface(struct wined3d_surface *dst_surface,
             src_texture->sub_resources[src_sub_resource_idx].locations);
     wined3d_texture_get_pitch(src_texture, src_level, &src_row_pitch, &src_slice_pitch);
 
-    wined3d_surface_upload_data(dst_surface, gl_info, src_texture->resource.format, src_rect,
+    wined3d_surface_upload_data(dst_texture, dst_sub_resource_idx, gl_info, src_texture->resource.format, src_rect,
             src_row_pitch, dst_point, FALSE, wined3d_const_bo_address(&data));
 
     context_release(context);
@@ -1410,7 +1410,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
 
         wined3d_texture_prepare_texture(dst_texture, context, FALSE);
         wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
-        wined3d_surface_upload_data(dst_texture->sub_resources[0].u.surface, gl_info, src_format,
+        wined3d_surface_upload_data(dst_texture, 0, gl_info, src_format,
                 &src_rect, src_row_pitch, &dst_point, FALSE, wined3d_const_bo_address(&src_data));
 
         wined3d_texture_validate_location(dst_texture, 0, WINED3D_LOCATION_TEXTURE_RGB);
@@ -2401,7 +2401,7 @@ static BOOL surface_load_texture(struct wined3d_surface *surface,
         data.addr = dst_mem;
     }
 
-    wined3d_surface_upload_data(surface, gl_info, &format, &src_rect,
+    wined3d_surface_upload_data(texture, sub_resource_idx, gl_info, &format, &src_rect,
             src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data));
 
     heap_free(dst_mem);
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 72ab961..0c0e434 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1683,7 +1683,7 @@ static void texture2d_upload_data(struct wined3d_texture *texture, unsigned int
         src_rect.bottom = wined3d_texture_get_level_height(texture, texture_level);
     }
 
-    wined3d_surface_upload_data(texture->sub_resources[sub_resource_idx].u.surface, context->gl_info,
+    wined3d_surface_upload_data(texture, sub_resource_idx, context->gl_info,
             texture->resource.format, &src_rect, row_pitch, &dst_point, FALSE, data);
 }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 4b33432..a78055a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3340,9 +3340,10 @@ BOOL surface_load_location(struct wined3d_surface *surface,
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
 void surface_set_compatible_renderbuffer(struct wined3d_surface *surface,
         const struct wined3d_rendertarget_info *rt) DECLSPEC_HIDDEN;
-void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info,
-        const struct wined3d_format *format, const RECT *src_rect, UINT src_pitch, const POINT *dst_point,
-        BOOL srgb, const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN;
+void wined3d_surface_upload_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
+        const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, const RECT *src_rect,
+        unsigned int src_pitch, const POINT *dst_point, BOOL srgb,
+        const struct wined3d_const_bo_address *data) DECLSPEC_HIDDEN;
 
 void draw_textured_quad(struct wined3d_texture *texture, unsigned int sub_resource_idx,
         struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect,




More information about the wine-cvs mailing list