[PATCH 5/5] wined3d: Invalidate all layers locations for render target views.
Józef Kucia
jkucia at codeweavers.com
Tue Apr 18 04:24:14 CDT 2017
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/drawprim.c | 10 +++-------
dlls/wined3d/view.c | 42 ++++++++++++++++++++++++++----------------
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 0b5b5e6..1fde7ea 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -499,16 +499,13 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
for (i = 0; i < gl_info->limits.buffers; ++i)
{
- struct wined3d_texture *rt;
-
if (!(rtv = fb->render_targets[i]) || rtv->format->id == WINED3DFMT_NULL)
continue;
- rt = wined3d_texture_from_resource(rtv->resource);
if (state->render_states[WINED3D_RS_COLORWRITEENABLE])
{
wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding);
- wined3d_texture_invalidate_location(rt, rtv->sub_resource_idx, ~rtv->resource->draw_binding);
+ wined3d_rendertarget_view_invalidate_location(rtv, ~rtv->resource->draw_binding);
}
else
{
@@ -540,11 +537,10 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (dsv && state->render_states[WINED3D_RS_ZWRITEENABLE])
{
- struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv);
- DWORD location = context->render_offscreen ? ds->container->resource.draw_binding : WINED3D_LOCATION_DRAWABLE;
+ DWORD location = context->render_offscreen ? dsv->resource->draw_binding : WINED3D_LOCATION_DRAWABLE;
wined3d_rendertarget_view_validate_location(dsv, location);
- wined3d_texture_invalidate_location(ds->container, dsv->sub_resource_idx, ~location);
+ wined3d_rendertarget_view_invalidate_location(dsv, ~location);
}
stream_info = &context->stream_info;
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 4e1ea6d..cb3578a 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -270,6 +270,26 @@ static void create_buffer_view(struct wined3d_gl_view *view, struct wined3d_cont
create_buffer_texture(view, context, buffer, view_format, offset, size);
}
+static void wined3d_view_invalidate_location(struct wined3d_resource *resource,
+ const struct wined3d_view_desc *desc, DWORD location)
+{
+ unsigned int i, sub_resource_idx, layer_count;
+ struct wined3d_texture *texture;
+
+ if (resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ wined3d_buffer_invalidate_location(buffer_from_resource(resource), location);
+ return;
+ }
+
+ texture = texture_from_resource(resource);
+
+ sub_resource_idx = desc->u.texture.layer_idx * texture->level_count + desc->u.texture.level_idx;
+ layer_count = resource->type != WINED3D_RTYPE_TEXTURE_3D ? desc->u.texture.layer_count : 1;
+ for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
+ wined3d_texture_invalidate_location(texture, sub_resource_idx, location);
+}
+
ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view)
{
ULONG refcount = InterlockedIncrement(&view->refcount);
@@ -454,6 +474,11 @@ void wined3d_rendertarget_view_validate_location(struct wined3d_rendertarget_vie
wined3d_texture_validate_location(texture, sub_resource_idx, location);
}
+void wined3d_rendertarget_view_invalidate_location(struct wined3d_rendertarget_view *view, DWORD location)
+{
+ wined3d_view_invalidate_location(view->resource, &view->desc, location);
+}
+
static void wined3d_render_target_view_cs_init(void *object)
{
struct wined3d_rendertarget_view *view = object;
@@ -819,22 +844,7 @@ void * CDECL wined3d_unordered_access_view_get_parent(const struct wined3d_unord
void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_access_view *view,
DWORD location)
{
- struct wined3d_resource *resource = view->resource;
- unsigned int i, sub_resource_idx, layer_count;
- struct wined3d_texture *texture;
-
- if (resource->type == WINED3D_RTYPE_BUFFER)
- {
- wined3d_buffer_invalidate_location(buffer_from_resource(resource), location);
- return;
- }
-
- texture = texture_from_resource(resource);
-
- sub_resource_idx = view->desc.u.texture.layer_idx * texture->level_count + view->desc.u.texture.level_idx;
- layer_count = (resource->type != WINED3D_RTYPE_TEXTURE_3D) ? view->desc.u.texture.layer_count : 1;
- for (i = 0; i < layer_count; ++i, sub_resource_idx += texture->level_count)
- wined3d_texture_invalidate_location(texture, sub_resource_idx, location);
+ wined3d_view_invalidate_location(view->resource, &view->desc, location);
}
static void wined3d_unordered_access_view_cs_init(void *object)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c49e010..cd90eb8 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3458,6 +3458,8 @@ static inline struct wined3d_surface *wined3d_rendertarget_view_get_surface(
void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarget_view *view,
const struct wined3d_context *context, unsigned int *width, unsigned int *height) DECLSPEC_HIDDEN;
+void wined3d_rendertarget_view_invalidate_location(struct wined3d_rendertarget_view *view,
+ DWORD location) DECLSPEC_HIDDEN;
void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *view,
struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
void wined3d_rendertarget_view_prepare_location(struct wined3d_rendertarget_view *view,
--
2.10.2
More information about the wine-patches
mailing list