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

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-09-24 15:15:11 +03:00 committed by Alexandre Julliard
parent 1b8ccaab47
commit 774e4b2ea3
3 changed files with 6 additions and 15 deletions

View File

@ -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]));

View File

@ -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;

View File

@ -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;