[PATCH 5/5] wined3d: Move the "draw_binding" field from struct wined3d_surface to struct wined3d_resource.

Henri Verbeet hverbeet at codeweavers.com
Mon Aug 4 05:17:27 CDT 2014


From: Henri Verbeet <hverbeet at freedesktop.org>

---
 dlls/wined3d/arb_program_shader.c |    4 ++--
 dlls/wined3d/context.c            |    6 +++---
 dlls/wined3d/device.c             |   10 +++++-----
 dlls/wined3d/drawprim.c           |    8 ++++----
 dlls/wined3d/surface.c            |   28 ++++++++++++++--------------
 dlls/wined3d/swapchain.c          |    6 +++---
 dlls/wined3d/wined3d_private.h    |    3 ++-
 7 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index d312ecf..9755ffb 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7679,8 +7679,8 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
 
     context_release(context);
 
-    surface_validate_location(dst_surface, dst_surface->draw_binding);
-    surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
+    surface_validate_location(dst_surface, dst_surface->resource.draw_binding);
+    surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding);
 
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index af33f49..9c04cd2 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2245,7 +2245,7 @@ void context_apply_blit_state(struct wined3d_context *context, const struct wine
         {
             wined3d_texture_load(rt->container, context, FALSE);
 
-            context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->draw_binding);
+            context_apply_fbo_state_blit(context, GL_FRAMEBUFFER, rt, NULL, rt->resource.draw_binding);
             if (rt->resource.format->id != WINED3DFMT_NULL)
                 rt_mask = 1;
             else
@@ -2330,7 +2330,7 @@ BOOL context_apply_clear_state(struct wined3d_context *context, const struct win
                     ++i;
                 }
                 context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, fb->depth_stencil,
-                        rt_count ? rts[0]->draw_binding : WINED3D_LOCATION_TEXTURE_RGB);
+                        rt_count ? rts[0]->resource.draw_binding : WINED3D_LOCATION_TEXTURE_RGB);
             }
             else
             {
@@ -2436,7 +2436,7 @@ void context_state_fb(struct wined3d_context *context, const struct wined3d_stat
         else
         {
             context_apply_fbo_state(context, GL_FRAMEBUFFER, fb->render_targets, fb->depth_stencil,
-                    fb->render_targets[0]->draw_binding);
+                    fb->render_targets[0]->resource.draw_binding);
         }
     }
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 66184b2..54273cd 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -310,7 +310,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
         {
             struct wined3d_surface *rt = fb->render_targets[i];
             if (rt)
-                surface_load_location(rt, rt->draw_binding);
+                surface_load_location(rt, rt->resource.draw_binding);
         }
     }
 
@@ -337,7 +337,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
 
     if (flags & WINED3DCLEAR_ZBUFFER)
     {
-        DWORD location = render_offscreen ? fb->depth_stencil->draw_binding : WINED3D_LOCATION_DRAWABLE;
+        DWORD location = render_offscreen ? fb->depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
 
         if (!render_offscreen && fb->depth_stencil != device->onscreen_depth_stencil)
             device_switch_onscreen_ds(device, context, fb->depth_stencil);
@@ -369,7 +369,7 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
 
     if (flags & WINED3DCLEAR_ZBUFFER)
     {
-        DWORD location = render_offscreen ? fb->depth_stencil->draw_binding : WINED3D_LOCATION_DRAWABLE;
+        DWORD location = render_offscreen ? fb->depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
 
         surface_modify_ds_location(fb->depth_stencil, location, ds_rect.right, ds_rect.bottom);
 
@@ -388,8 +388,8 @@ void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, c
 
             if (rt)
             {
-                surface_validate_location(rt, rt->draw_binding);
-                surface_invalidate_location(rt, ~rt->draw_binding);
+                surface_validate_location(rt, rt->resource.draw_binding);
+                surface_invalidate_location(rt, ~rt->resource.draw_binding);
             }
         }
 
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 43c4e17..c1ef633 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -616,8 +616,8 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
             struct wined3d_surface *target = device->fb.render_targets[i];
             if (target)
             {
-                surface_load_location(target, target->draw_binding);
-                surface_invalidate_location(target, ~target->draw_binding);
+                surface_load_location(target, target->resource.draw_binding);
+                surface_invalidate_location(target, ~target->resource.draw_binding);
             }
         }
     }
@@ -639,7 +639,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
          * depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note
          * that we never copy the stencil data.*/
         DWORD location = context->render_offscreen ?
-                device->fb.depth_stencil->draw_binding : WINED3D_LOCATION_DRAWABLE;
+                device->fb.depth_stencil->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
         if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE])
         {
             struct wined3d_surface *ds = device->fb.depth_stencil;
@@ -671,7 +671,7 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
     if (device->fb.depth_stencil && state->render_states[WINED3D_RS_ZWRITEENABLE])
     {
         struct wined3d_surface *ds = device->fb.depth_stencil;
-        DWORD location = context->render_offscreen ? ds->draw_binding : WINED3D_LOCATION_DRAWABLE;
+        DWORD location = context->render_offscreen ? ds->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
 
         surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy);
     }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ef584e0..a8fa477 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -106,11 +106,11 @@ static void surface_cleanup(struct wined3d_surface *surface)
 void surface_update_draw_binding(struct wined3d_surface *surface)
 {
     if (!surface_is_offscreen(surface) || wined3d_settings.offscreen_rendering_mode != ORM_FBO)
-        surface->draw_binding = WINED3D_LOCATION_DRAWABLE;
+        surface->resource.draw_binding = WINED3D_LOCATION_DRAWABLE;
     else if (surface->resource.multisample_type)
-        surface->draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE;
+        surface->resource.draw_binding = WINED3D_LOCATION_RB_MULTISAMPLE;
     else
-        surface->draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
+        surface->resource.draw_binding = WINED3D_LOCATION_TEXTURE_RGB;
 }
 
 void surface_get_drawable_size(const struct wined3d_surface *surface, const struct wined3d_context *context,
@@ -767,7 +767,7 @@ static void surface_unmap(struct wined3d_surface *surface)
     }
 
     if (surface->swapchain && surface->swapchain->front_buffer == surface)
-        surface_load_location(surface, surface->draw_binding);
+        surface_load_location(surface, surface->resource.draw_binding);
     else if (surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
         FIXME("Depth / stencil buffer locking is not implemented.\n");
 }
@@ -4186,8 +4186,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
         src_surface->container->color_key_flags = old_color_key_flags;
         src_surface->container->src_blt_color_key = old_blt_key;
 
-        surface_validate_location(dst_surface, dst_surface->draw_binding);
-        surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
+        surface_validate_location(dst_surface, dst_surface->resource.draw_binding);
+        surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding);
 
         return WINED3D_OK;
     }
@@ -4772,7 +4772,7 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
             context_release(context);
             return WINED3D_OK;
         }
-        else if (location & surface->locations && surface->draw_binding != WINED3D_LOCATION_DRAWABLE)
+        else if (location & surface->locations && surface->resource.draw_binding != WINED3D_LOCATION_DRAWABLE)
         {
             /* Already up to date, nothing to do. */
             return WINED3D_OK;
@@ -5831,8 +5831,8 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
                 return WINED3DERR_INVALIDCALL;
             }
 
-            if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->draw_binding, &src_rect,
-                    dst_surface, dst_surface->draw_binding, &dst_rect)))
+            if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_surface->resource.draw_binding, &src_rect,
+                    dst_surface, dst_surface->resource.draw_binding, &dst_rect)))
                 return WINED3D_OK;
         }
     }
@@ -5882,7 +5882,7 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
                     if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, &src_rect)))
                     {
                         if (!surface_is_offscreen(dst_surface))
-                            surface_load_location(dst_surface, dst_surface->draw_binding);
+                            surface_load_location(dst_surface, dst_surface->resource.draw_binding);
                         return WINED3D_OK;
                     }
                 }
@@ -5918,10 +5918,10 @@ HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const REC
                 TRACE("Using FBO blit.\n");
 
                 surface_blt_fbo(device, filter,
-                        src_surface, src_surface->draw_binding, &src_rect,
-                        dst_surface, dst_surface->draw_binding, &dst_rect);
-                surface_validate_location(dst_surface, dst_surface->draw_binding);
-                surface_invalidate_location(dst_surface, ~dst_surface->draw_binding);
+                        src_surface, src_surface->resource.draw_binding, &src_rect,
+                        dst_surface, dst_surface->resource.draw_binding, &dst_rect);
+                surface_validate_location(dst_surface, dst_surface->resource.draw_binding);
+                surface_invalidate_location(dst_surface, ~dst_surface->resource.draw_binding);
 
                 return WINED3D_OK;
             }
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e24bd08..1648a11 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -513,7 +513,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
     }
     else
     {
-        surface_load_location(back_buffer, back_buffer->draw_binding);
+        surface_load_location(back_buffer, back_buffer->resource.draw_binding);
     }
 
     if (swapchain->render_to_fbo)
@@ -585,8 +585,8 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT
          */
         if (swapchain->desc.swap_effect == WINED3D_SWAP_EFFECT_FLIP)
         {
-            surface_validate_location(back_buffer, back_buffer->draw_binding);
-            surface_invalidate_location(back_buffer, ~back_buffer->draw_binding);
+            surface_validate_location(back_buffer, back_buffer->resource.draw_binding);
+            surface_invalidate_location(back_buffer, ~back_buffer->resource.draw_binding);
         }
     }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ae9ce51..a9d81a5c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2029,6 +2029,7 @@ struct wined3d_resource
     DWORD usage;
     enum wined3d_pool pool;
     DWORD access_flags;
+    DWORD draw_binding;
     UINT width;
     UINT height;
     UINT depth;
@@ -2225,7 +2226,7 @@ struct wined3d_surface
     const struct wined3d_surface_ops *surface_ops;
     struct wined3d_texture *container;
     struct wined3d_swapchain *swapchain;
-    DWORD draw_binding, map_binding;
+    DWORD map_binding;
     void *user_memory;
     DWORD locations;
 
-- 
1.7.10.4




More information about the wine-patches mailing list