Commit 986e3eeb authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Implement partial support for 3D texture blits.

parent 26d7f991
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment