[PATCH 2/5] wined3d: Load all layers for render target views.
Józef Kucia
jkucia at codeweavers.com
Tue Apr 18 04:24:11 CDT 2017
For layered rendering to array textures.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/wined3d/drawprim.c | 4 ++--
dlls/wined3d/view.c | 19 +++++++++++++++++++
dlls/wined3d/wined3d_private.h | 2 ++
3 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index c6d3450..1c324a6 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -507,7 +507,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
rt = wined3d_texture_from_resource(rtv->resource);
if (state->render_states[WINED3D_RS_COLORWRITEENABLE])
{
- wined3d_texture_load_location(rt, rtv->sub_resource_idx, context, rtv->resource->draw_binding);
+ wined3d_rendertarget_view_load_location(rtv, context, rtv->resource->draw_binding);
wined3d_texture_invalidate_location(rt, rtv->sub_resource_idx, ~rtv->resource->draw_binding);
}
else
@@ -527,7 +527,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
struct wined3d_surface *ds = wined3d_rendertarget_view_get_surface(dsv);
if (state->render_states[WINED3D_RS_ZWRITEENABLE] || state->render_states[WINED3D_RS_ZENABLE])
- wined3d_texture_load_location(ds->container, dsv->sub_resource_idx, context, location);
+ wined3d_rendertarget_view_load_location(dsv, context, location);
else
wined3d_texture_prepare_location(ds->container, dsv->sub_resource_idx, context, location);
}
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 294ed9a..93788df 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -398,6 +398,25 @@ void wined3d_rendertarget_view_get_drawable_size(const struct wined3d_rendertarg
}
}
+void wined3d_rendertarget_view_load_location(struct wined3d_rendertarget_view *view,
+ struct wined3d_context *context, DWORD location)
+{
+ struct wined3d_resource *resource = view->resource;
+ unsigned int i, sub_resource_idx;
+ struct wined3d_texture *texture;
+
+ if (resource->type == WINED3D_RTYPE_BUFFER)
+ {
+ wined3d_buffer_load_location(buffer_from_resource(resource), context, location);
+ return;
+ }
+
+ texture = texture_from_resource(resource);
+ sub_resource_idx = view->sub_resource_idx;
+ for (i = 0; i < view->layer_count; ++i, sub_resource_idx += texture->level_count)
+ wined3d_texture_load_location(texture, sub_resource_idx, context, location);
+}
+
static void wined3d_render_target_view_cs_init(void *object)
{
struct wined3d_rendertarget_view *view = object;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9e48b49..13e375a 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_load_location(struct wined3d_rendertarget_view *view,
+ struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN;
struct wined3d_shader_resource_view
{
--
2.10.2
More information about the wine-patches
mailing list