[PATCH 1/2] wined3d: make wined3d_device_copy_sub_resource_region return an error code
Riccardo Bortolato
rikyz619 at gmail.com
Wed Oct 28 09:31:03 CDT 2015
only check for resources being volume textures to allow operations with cube textures.
Signed-off-by: Riccardo Bortolato <rikyz619 at gmail.com>
---
dlls/wined3d/device.c | 27 +++++++++++----------------
include/wine/wined3d.h | 2 +-
2 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 087dc33..6f10c42 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3862,7 +3862,7 @@ void CDECL wined3d_device_copy_resource(struct wined3d_device *device,
}
}
-void CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
+HRESULT CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x,
unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box)
@@ -3881,15 +3881,7 @@ void CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device
if (src_resource == dst_resource && src_sub_resource_idx == dst_sub_resource_idx)
{
WARN("Source and destination are the same sub-resource.\n");
- return;
- }
-
- if (src_resource->type != dst_resource->type)
- {
- WARN("Resource types (%s / %s) don't match.\n",
- debug_d3dresourcetype(dst_resource->type),
- debug_d3dresourcetype(src_resource->type));
- return;
+ return WINED3DERR_INVALIDCALL;
}
if (src_resource->format->id != dst_resource->format->id)
@@ -3897,20 +3889,21 @@ void CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device
WARN("Resource formats (%s / %s) don't match.\n",
debug_d3dformat(dst_resource->format->id),
debug_d3dformat(src_resource->format->id));
- return;
+ return WINED3DERR_INVALIDCALL;
}
- if (dst_resource->type != WINED3D_RTYPE_TEXTURE)
+ if (dst_resource->type == WINED3D_RTYPE_VOLUME_TEXTURE
+ || src_resource->type == WINED3D_RTYPE_VOLUME_TEXTURE)
{
- FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(dst_resource->type));
- return;
+ FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(WINED3D_RTYPE_VOLUME_TEXTURE));
+ return WINED3DERR_INVALIDCALL;
}
dst_texture = wined3d_texture_from_resource(dst_resource);
if (!(tmp = wined3d_texture_get_sub_resource(dst_texture, dst_sub_resource_idx)))
{
WARN("Invalid dst_sub_resource_idx %u.\n", dst_sub_resource_idx);
- return;
+ return WINED3DERR_INVALIDCALL;
}
dst_surface = surface_from_resource(tmp);
@@ -3918,7 +3911,7 @@ void CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device
if (!(tmp = wined3d_texture_get_sub_resource(src_texture, src_sub_resource_idx)))
{
WARN("Invalid src_sub_resource_idx %u.\n", src_sub_resource_idx);
- return;
+ return WINED3DERR_INVALIDCALL;
}
src_surface = surface_from_resource(tmp);
@@ -3934,6 +3927,8 @@ void CDECL wined3d_device_copy_sub_resource_region(struct wined3d_device *device
if (FAILED(hr = wined3d_surface_blt(dst_surface, &dst_rect, src_surface, &src_rect, 0, NULL, WINED3D_TEXF_POINT)))
ERR("Failed to blit, hr %#x.\n", hr);
+
+ return hr;
}
void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, struct wined3d_resource *resource,
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 82ad493..3d8211c 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2130,7 +2130,7 @@ HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *de
struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color);
void __cdecl wined3d_device_copy_resource(struct wined3d_device *device,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource);
-void __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
+HRESULT __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x,
unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box);
--
1.9.1
More information about the wine-patches
mailing list