Signed-off-by: Paul Gofman pgofman@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 ac2748a141f..ff74cab70e9 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 b828e45046c..0f880778d3c 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_rtv_bind_count_inc(struct wined3d_rendertarget_view *rtv) { ++rtv->resource->rtv_bind_count_device;