Henri Verbeet : wined3d: Pass a texture instead of a surface to context_create().

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 24 11:04:00 CDT 2016


Module: wine
Branch: master
Commit: 7bf2a3452880dd5d47287d00d1836d29abfcb9ff
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7bf2a3452880dd5d47287d00d1836d29abfcb9ff

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Mar 23 17:58:22 2016 +0100

wined3d: Pass a texture instead of a surface to context_create().

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

---

 dlls/wined3d/context.c         | 8 ++++----
 dlls/wined3d/device.c          | 6 ++----
 dlls/wined3d/swapchain.c       | 6 ++----
 dlls/wined3d/wined3d_private.h | 2 +-
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 31fd22a..0d6ba69 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1559,7 +1559,7 @@ HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc,
 }
 
 struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
-        struct wined3d_surface *target, const struct wined3d_format *ds_format)
+        struct wined3d_texture *target, const struct wined3d_format *ds_format)
 {
     struct wined3d_device *device = swapchain->device;
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -1659,7 +1659,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
         }
     }
 
-    color_format = target->container->resource.format;
+    color_format = target->resource.format;
 
     /* In case of ORM_BACKBUFFER, make sure to request an alpha component for
      * X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
@@ -1771,10 +1771,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     }
 
     ret->swapchain = swapchain;
-    ret->current_rt = target;
+    ret->current_rt = target->sub_resources[0].u.surface;
     ret->tid = GetCurrentThreadId();
 
-    ret->render_offscreen = wined3d_resource_is_offscreen(&target->container->resource);
+    ret->render_offscreen = wined3d_resource_is_offscreen(&target->resource);
     ret->draw_buffers_mask = context_generate_rt_mask(GL_BACK);
     ret->valid = 1;
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5a523d3..dbfa86c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4554,7 +4554,7 @@ static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d
 static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain)
 {
     struct wined3d_context *context;
-    struct wined3d_surface *target;
+    struct wined3d_texture *target;
     HRESULT hr;
 
     if (FAILED(hr = device->shader_backend->shader_alloc_private(device,
@@ -4581,9 +4581,7 @@ static HRESULT create_primary_opengl_context(struct wined3d_device *device, stru
         return E_OUTOFMEMORY;
     }
 
-    target = swapchain->back_buffers
-            ? surface_from_resource(wined3d_texture_get_sub_resource(swapchain->back_buffers[0], 0))
-            : surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0));
+    target = swapchain->back_buffers ? swapchain->back_buffers[0] : swapchain->front_buffer;
     if (!(context = context_create(swapchain, target, swapchain->ds_format)))
     {
         WARN("Failed to create context.\n");
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 7d02375..c2883bb 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -983,7 +983,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
         for (i = 0; i < (sizeof(formats) / sizeof(*formats)); i++)
         {
             swapchain->ds_format = wined3d_get_format(gl_info, formats[i]);
-            swapchain->context[0] = context_create(swapchain, front_buffer, swapchain->ds_format);
+            swapchain->context[0] = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format);
             if (swapchain->context[0]) break;
             TRACE("Depth stencil format %s is not supported, trying next format\n",
                   debug_d3dformat(formats[i]));
@@ -1145,9 +1145,7 @@ static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain
 
     TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId());
 
-    if (!(ctx = context_create(swapchain,
-            surface_from_resource(wined3d_texture_get_sub_resource(swapchain->front_buffer, 0)),
-            swapchain->ds_format)))
+    if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format)))
     {
         ERR("Failed to create a new context for the swapchain\n");
         return NULL;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9e83e6a..c638c45 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1515,7 +1515,7 @@ void context_active_texture(struct wined3d_context *context, const struct wined3
         unsigned int unit) DECLSPEC_HIDDEN;
 void context_bind_texture(struct wined3d_context *context, GLenum target, GLuint name) DECLSPEC_HIDDEN;
 void context_check_fbo_status(const struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN;
-struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_surface *target,
+struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_texture *target,
         const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
 HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx) DECLSPEC_HIDDEN;
 void context_destroy(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list