[PATCH 4/5] wined3d: Validate all layers locations for render target views.

Józef Kucia jkucia at codeweavers.com
Tue Apr 18 04:24:13 CDT 2017


Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 dlls/wined3d/drawprim.c        |  2 +-
 dlls/wined3d/view.c            | 18 ++++++++++++++++++
 dlls/wined3d/wined3d_private.h |  2 ++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 15b3791..0b5b5e6 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -543,7 +543,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
         struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv);
         DWORD location = context->render_offscreen ? ds->container->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
 
-        wined3d_texture_validate_location(ds->container, dsv->sub_resource_idx, location);
+        wined3d_rendertarget_view_validate_location(dsv, location);
         wined3d_texture_invalidate_location(ds->container, dsv->sub_resource_idx, ~location);
     }
 
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index e1e1956..4e1ea6d 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -436,6 +436,24 @@ void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *v
         wined3d_texture_load_location(texture, sub_resource_idx, context, location);
 }
 
+void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view, DWORD location)
+{
+    struct wined3d_resource *resource = view->resource;
+    unsigned int i, sub_resource_idx;
+    struct wined3d_texture *texture;
+
+    if (resource->type == WINED3D_RTYPE_BUFFER)
+    {
+        FIXME("Not implemented for resources %s.\n", debug_d3dresourcetype(resource->type));
+        return;
+    }
+
+    texture = texture_from_resource(resource);
+    sub_resource_idx = view->sub_resource_idx;
+    for (i = 0; i < view->layer_count; ++i, sub_resource_idx += texture->level_count)
+        wined3d_texture_validate_location(texture, sub_resource_idx, location);
+}
+
 static void wined3d_render_target_view_cs_init(void *object)
 {
     struct wined3d_rendertarget_view *view = object;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ff5b242..c49e010 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3462,6 +3462,8 @@ void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *v
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
 void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view *view,
         struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
+void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_view *view,
+        DWORD location) DECLSPEC_HIDDEN;
 
 struct wined3d_shader_resource_view
 {
-- 
2.10.2




More information about the wine-patches mailing list