[PATCH 2/8] wined3d: Implement depth clear in wined3d_device_clear_rendertarget_view().
Józef Kucia
jkucia at codeweavers.com
Sun Mar 13 18:03:03 CDT 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/d3d11/device.c | 6 ++++--
dlls/d3d9/device.c | 3 ++-
dlls/wined3d/device.c | 24 ++++++++++++++++++++----
dlls/wined3d/utils.c | 8 ++++++++
dlls/wined3d/wined3d.spec | 2 +-
dlls/wined3d/wined3d_private.h | 1 +
include/wine/wined3d.h | 3 ++-
7 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 6ec154f..8228de9 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -909,7 +909,8 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_ClearRenderTargetView(ID3D
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
wined3d_mutex_lock();
- if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color)))
+ if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL,
+ WINED3DCLEAR_TARGET, &color, 0.0f, 0)))
ERR("Failed to clear view, hr %#x.\n", hr);
wined3d_mutex_unlock();
}
@@ -3301,7 +3302,8 @@ static void STDMETHODCALLTYPE d3d10_device_ClearRenderTargetView(ID3D10Device1 *
iface, render_target_view, color_rgba[0], color_rgba[1], color_rgba[2], color_rgba[3]);
wined3d_mutex_lock();
- if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL, &color)))
+ if (FAILED(hr = wined3d_device_clear_rendertarget_view(device->wined3d_device, view->wined3d_view, NULL,
+ WINED3DCLEAR_TARGET, &color, 0.0f, 0)))
ERR("Failed to clear view, hr %#x.\n", hr);
wined3d_mutex_unlock();
}
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 918e1e0..0ed2aff 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1450,7 +1450,8 @@ static HRESULT WINAPI d3d9_device_ColorFill(IDirect3DDevice9Ex *iface,
}
hr = wined3d_device_clear_rendertarget_view(device->wined3d_device,
- d3d9_surface_get_rendertarget_view(surface_impl), rect, &c);
+ d3d9_surface_get_rendertarget_view(surface_impl), rect,
+ WINED3DCLEAR_TARGET, &c, 0.0f, 0);
wined3d_mutex_unlock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5dced96..c33efde 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4087,12 +4087,22 @@ void CDECL wined3d_device_update_sub_resource(struct wined3d_device *device, str
}
HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
- struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color)
+ struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags,
+ const struct wined3d_color *color, float depth, DWORD stencil)
{
RECT r;
- TRACE("device %p, view %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n",
- device, view, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a);
+ TRACE("device %p, view %p, rect %s, flags %#x, color %s, depth %.8e, stencil %u.\n",
+ device, view, wine_dbgstr_rect(rect), flags, debug_color(color), depth, stencil);
+
+ if (!flags)
+ return WINED3D_OK;
+
+ if (flags & WINED3DCLEAR_STENCIL)
+ {
+ FIXME("Stencil clear not implemented.\n");
+ return E_NOTIMPL;
+ }
if (!rect)
{
@@ -4100,7 +4110,13 @@ HRESULT CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *devi
rect = &r;
}
- return wined3d_rendertarget_view_clear(view, rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
+ if (!(flags & WINED3DCLEAR_TARGET) == !(flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)))
+ {
+ ERR("Color and depth/stencil clears are mutually exclusive.\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ return wined3d_rendertarget_view_clear(view, rect, flags, color, depth, stencil);
}
struct wined3d_rendertarget_view * CDECL wined3d_device_get_rendertarget_view(const struct wined3d_device *device,
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 5cd482e..e210a8a 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3278,6 +3278,14 @@ const char *debug_box(const struct wined3d_box *box)
box->right, box->bottom, box->back);
}
+const char *debug_color(const struct wined3d_color *color)
+{
+ if (!color)
+ return "(null)";
+ return wine_dbg_sprintf("{%.8e, %.8e, %.8e, %.8e}",
+ color->r, color->g, color->b, color->a);
+}
+
const char *debug_d3dformat(enum wined3d_format_id format_id)
{
switch (format_id)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 247e4de..82e0d4f 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -36,7 +36,7 @@
@ cdecl wined3d_device_begin_scene(ptr)
@ cdecl wined3d_device_begin_stateblock(ptr)
@ cdecl wined3d_device_clear(ptr long ptr long ptr float long)
-@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr ptr)
+@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr long ptr float long)
@ cdecl wined3d_device_copy_resource(ptr ptr ptr)
@ cdecl wined3d_device_copy_sub_resource_region(ptr ptr long long long long ptr long ptr)
@ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 06e8f97..d66bbc3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2990,6 +2990,7 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPE
/* Trace routines */
const char *debug_box(const struct wined3d_box *box) DECLSPEC_HIDDEN;
+const char *debug_color(const struct wined3d_color *color) DECLSPEC_HIDDEN;
const char *debug_d3dshaderinstructionhandler(enum WINED3D_SHADER_INSTRUCTION_HANDLER handler_idx) DECLSPEC_HIDDEN;
const char *debug_d3dformat(enum wined3d_format_id format_id) DECLSPEC_HIDDEN;
const char *debug_d3ddevicetype(enum wined3d_device_type device_type) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index e678c39..d69d11e 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2054,7 +2054,8 @@ HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags,
const struct wined3d_color *color, float z, DWORD stencil);
HRESULT __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
- struct wined3d_rendertarget_view *view, const RECT *rect, const struct wined3d_color *color);
+ struct wined3d_rendertarget_view *view, const RECT *rect, DWORD flags,
+ const struct wined3d_color *color, float depth, DWORD stencil);
void __cdecl wined3d_device_copy_resource(struct wined3d_device *device,
struct wined3d_resource *dst_resource, struct wined3d_resource *src_resource);
HRESULT __cdecl wined3d_device_copy_sub_resource_region(struct wined3d_device *device,
--
2.4.10
More information about the wine-patches
mailing list