[PATCH 2/3] wined3d: Don't check for readonly depth / stencil in context_preload_texture().

Paul Gofman pgofman at codeweavers.com
Tue Sep 22 14:11:21 CDT 2020


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 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 3a263e1f6bd..08c6e27922c 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 036ff8f81c6..8327ef17dc8 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 147832ad771..05ac6949ca3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -5997,19 +5997,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_inc_rtv_bind_count(struct wined3d_rendertarget_view *rt)
 {
     ++rt->resource->rtv_bind_count_device;
-- 
2.26.2




More information about the wine-devel mailing list