Henri Verbeet : wined3d: Implement partial support for 3D texture blits.
Alexandre Julliard
julliard at winehq.org
Fri Apr 7 15:17:03 CDT 2017
Module: wine
Branch: master
Commit: 986e3eebceb3d890a215eb2c641ea871f0d51820
URL: http://source.winehq.org/git/wine.git/?a=commit;h=986e3eebceb3d890a215eb2c641ea871f0d51820
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Apr 6 23:44:33 2017 +0200
wined3d: Implement partial support for 3D texture blits.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/cs.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 78a3e1d..0866a16 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1759,6 +1759,88 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
&src_rect, op->flags, &op->fx, op->filter)))
FIXME("Blit failed.\n");
}
+ else if (op->dst_resource->type == WINED3D_RTYPE_TEXTURE_3D)
+ {
+ struct wined3d_texture *src_texture, *dst_texture;
+ unsigned int level, update_w, update_h, update_d;
+ unsigned int row_pitch, slice_pitch;
+ struct wined3d_context *context;
+ struct wined3d_bo_address addr;
+
+ if (op->flags)
+ {
+ FIXME("Flags %#x not implemented for %s resources.\n",
+ op->flags, debug_d3dresourcetype(op->dst_resource->type));
+ return;
+ }
+
+ if (op->src_resource->format != op->dst_resource->format)
+ {
+ FIXME("Format conversion not implemented for %s resources.\n",
+ debug_d3dresourcetype(op->dst_resource->type));
+ return;
+ }
+
+ update_w = op->dst_box.right - op->dst_box.left;
+ update_h = op->dst_box.bottom - op->dst_box.top;
+ update_d = op->dst_box.back - op->dst_box.front;
+ if (op->src_box.right - op->src_box.left != update_w
+ || op->src_box.bottom - op->src_box.top != update_h
+ || op->src_box.back - op->src_box.front != update_d)
+ {
+ FIXME("Stretching not implemented for %s resources.\n",
+ debug_d3dresourcetype(op->dst_resource->type));
+ return;
+ }
+
+ if (op->src_box.left || op->src_box.top || op->src_box.front)
+ {
+ FIXME("Source box %s not supported for %s resources.\n",
+ debug_box(&op->src_box), debug_d3dresourcetype(op->dst_resource->type));
+ return;
+ }
+
+ dst_texture = texture_from_resource(op->dst_resource);
+ src_texture = texture_from_resource(op->src_resource);
+
+ context = context_acquire(cs->device, NULL, 0);
+
+ if (!wined3d_texture_load_location(src_texture, op->src_sub_resource_idx,
+ context, src_texture->resource.map_binding))
+ {
+ ERR("Failed to load source sub-resource into %s.\n",
+ wined3d_debug_location(src_texture->resource.map_binding));
+ context_release(context);
+ return;
+ }
+
+ level = op->dst_sub_resource_idx % dst_texture->level_count;
+ if (update_w == wined3d_texture_get_level_width(dst_texture, level)
+ && update_h == wined3d_texture_get_level_height(dst_texture, level)
+ && update_d == wined3d_texture_get_level_depth(dst_texture, level))
+ {
+ wined3d_texture_prepare_texture(dst_texture, context, FALSE);
+ }
+ else if (!wined3d_texture_load_location(dst_texture, op->dst_sub_resource_idx,
+ context, WINED3D_LOCATION_TEXTURE_RGB))
+ {
+ ERR("Failed to load destination sub-resource.\n");
+ context_release(context);
+ return;
+ }
+
+ wined3d_texture_get_memory(src_texture, op->src_sub_resource_idx, &addr, src_texture->resource.map_binding);
+ wined3d_texture_get_pitch(src_texture, op->src_sub_resource_idx % src_texture->level_count,
+ &row_pitch, &slice_pitch);
+
+ wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
+ wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context, &op->dst_box,
+ wined3d_const_bo_address(&addr), row_pitch, slice_pitch);
+ wined3d_texture_validate_location(dst_texture, op->dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
+ wined3d_texture_invalidate_location(dst_texture, op->dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
+
+ context_release(context);
+ }
else
{
FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type));
More information about the wine-cvs
mailing list