Paul Gofman : wined3d: Don't check for readonly depth / stencil in context_preload_texture().

Alexandre Julliard julliard at winehq.org
Thu Sep 24 15:49:05 CDT 2020


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Thu Sep 24 15:15:11 2020 +0300

wined3d: Don't check for readonly depth / stencil in context_preload_texture().

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

---

 dlls/wined3d/context.c         |  3 ++-
 dlls/wined3d/device.c          |  5 ++++-
 dlls/wined3d/wined3d_private.h | 13 -------------
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 3a263e1f6b..08c6e27922 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -347,7 +347,8 @@ static void context_preload_texture(struct wined3d_context *context,
     if (!(texture = state->textures[idx]))
         return;
 
-    if (wined3d_resource_check_fbo_attached(state, &texture->resource, NULL))
+    if (texture->resource.rtv_bind_count_device || (state->fb.depth_stencil
+            && state->fb.depth_stencil->resource == &texture->resource))
         context->uses_fbo_attached_resources = 1;
 
     wined3d_texture_load(texture, context, is_srgb_enabled(state->sampler_states[idx]));
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3c6affe594..8a69132784 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1952,6 +1952,7 @@ struct wined3d_buffer * CDECL wined3d_device_get_constant_buffer(const struct wi
 static void wined3d_device_set_shader_resource_view(struct wined3d_device *device,
         enum wined3d_shader_type type, UINT idx, struct wined3d_shader_resource_view *view)
 {
+    const struct wined3d_rendertarget_view *dsv;
     struct wined3d_shader_resource_view *prev;
 
     if (idx >= MAX_SHADER_RESOURCE_VIEWS)
@@ -1964,7 +1965,9 @@ static void wined3d_device_set_shader_resource_view(struct wined3d_device *devic
     if (view == prev)
         return;
 
-    if (view && wined3d_resource_check_fbo_attached(&device->state, view->resource, view->format))
+    if (view && (view->resource->rtv_bind_count_device
+            || ((dsv = device->state.fb.depth_stencil)
+            && dsv->resource == view->resource && wined3d_dsv_srv_conflict(dsv, view->format))))
     {
         WARN("Application is trying to bind resource which is attached as render target.\n");
         view = NULL;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 45ed232099..61bde16501 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -5973,19 +5973,6 @@ static inline BOOL wined3d_dsv_srv_conflict(const struct wined3d_rendertarget_vi
             || (srv_format->green_size && !(dsv->desc.flags & WINED3D_VIEW_READ_ONLY_STENCIL));
 }
 
-static inline BOOL wined3d_resource_check_fbo_attached(const struct wined3d_state *state,
-        const struct wined3d_resource *resource, const struct wined3d_format *srv_format)
-{
-    const struct wined3d_rendertarget_view *dsv;
-
-    if ((resource->bind_flags & WINED3D_BIND_DEPTH_STENCIL)
-            && (dsv = state->fb.depth_stencil) && dsv->resource == resource
-            && wined3d_dsv_srv_conflict(dsv, srv_format))
-        return TRUE;
-
-    return resource->rtv_bind_count_device;
-}
-
 static inline void wined3d_rtv_bind_count_inc(struct wined3d_rendertarget_view *rtv)
 {
     ++rtv->resource->rtv_bind_count_device;




More information about the wine-cvs mailing list