Commit e0a0d611 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a wined3d_color struct to wined3d_device_clear().

parent 7459180a
...@@ -1200,17 +1200,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(IDirect3DD ...@@ -1200,17 +1200,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(IDirect3DD
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD Count, static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD rect_count,
const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
{ {
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, Count, pRects, Flags, Color, Z, Stencil); iface, rect_count, rects, flags, color, z, stencil);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); hr = wined3d_device_clear(This->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
......
...@@ -1218,18 +1218,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_EndScene(IDirect3DD ...@@ -1218,18 +1218,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_EndScene(IDirect3DD
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_Clear(IDirect3DDevice9Ex *iface, DWORD Count, static HRESULT WINAPI IDirect3DDevice9Impl_Clear(IDirect3DDevice9Ex *iface, DWORD rect_count,
const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil)
{ {
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n",
iface, Count, pRects, Flags, Color, Z, Stencil); iface, rect_count, rects, flags, color, z, stencil);
/* Note: D3DRECT is compatible with WINED3DRECT */
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); hr = wined3d_device_clear(This->wined3d_device, rect_count, (const RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
......
...@@ -5065,23 +5065,24 @@ static HRESULT WINAPI IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *ifa ...@@ -5065,23 +5065,24 @@ static HRESULT WINAPI IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *ifa
* For details, see IWineD3DDevice::Clear * For details, see IWineD3DDevice::Clear
* *
*****************************************************************************/ *****************************************************************************/
static HRESULT static HRESULT IDirect3DDeviceImpl_7_Clear(IDirect3DDevice7 *iface, DWORD count,
IDirect3DDeviceImpl_7_Clear(IDirect3DDevice7 *iface, D3DRECT *rects, DWORD flags, D3DCOLOR color, D3DVALUE z, DWORD stencil)
DWORD Count,
D3DRECT *Rects,
DWORD Flags,
D3DCOLOR Color,
D3DVALUE Z,
DWORD Stencil)
{ {
const struct wined3d_color c =
{
((color >> 16) & 0xff) / 255.0f,
((color >> 8) & 0xff) / 255.0f,
(color & 0xff) / 255.0f,
((color >> 24) & 0xff) / 255.0f,
};
IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice7(iface); IDirect3DDeviceImpl *This = impl_from_IDirect3DDevice7(iface);
HRESULT hr; HRESULT hr;
TRACE("iface %p, count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %#x.\n", TRACE("iface %p, count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %#x.\n",
iface, Count, Rects, Flags, Color, Z, Stencil); iface, count, rects, flags, color, z, stencil);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = wined3d_device_clear(This->wined3d_device, Count, (RECT *)Rects, Flags, Color, Z, Stencil); hr = wined3d_device_clear(This->wined3d_device, count, (RECT *)rects, flags, &c, z, stencil);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hr; return hr;
......
...@@ -1199,6 +1199,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device) ...@@ -1199,6 +1199,7 @@ void CDECL wined3d_device_release_focus_window(struct wined3d_device *device)
HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
WINED3DPRESENT_PARAMETERS *present_parameters) WINED3DPRESENT_PARAMETERS *present_parameters)
{ {
static const struct wined3d_color black = {0.0f, 0.0f, 0.0f, 0.0f};
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_swapchain *swapchain = NULL; struct wined3d_swapchain *swapchain = NULL;
struct wined3d_context *context; struct wined3d_context *context;
...@@ -1345,7 +1346,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, ...@@ -1345,7 +1346,7 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
/* Clear the screen */ /* Clear the screen */
wined3d_device_clear(device, 0, NULL, WINED3DCLEAR_TARGET wined3d_device_clear(device, 0, NULL, WINED3DCLEAR_TARGET
| (present_parameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0), | (present_parameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0),
0x00, 1.0f, 0); &black, 1.0f, 0);
device->d3d_initialized = TRUE; device->d3d_initialized = TRUE;
...@@ -4025,13 +4026,12 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const ...@@ -4025,13 +4026,12 @@ HRESULT CDECL wined3d_device_present(const struct wined3d_device *device, const
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count,
const RECT *rects, DWORD flags, WINED3DCOLOR color, float depth, DWORD stencil) const RECT *rects, DWORD flags, const struct wined3d_color *color, float depth, DWORD stencil)
{ {
const struct wined3d_color c = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)};
RECT draw_rect; RECT draw_rect;
TRACE("device %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.\n", TRACE("device %p, rect_count %u, rects %p, flags %#x, color {%.8e, %.8e, %.8e, %.8e}, depth %.8e, stencil %u.\n",
device, rect_count, rects, flags, color, depth, stencil); device, rect_count, rects, flags, color->r, color->g, color->b, color->a, depth, stencil);
if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL))
{ {
...@@ -4057,7 +4057,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou ...@@ -4057,7 +4057,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
&device->fb, rect_count, rects, &device->fb, rect_count, rects,
&draw_rect, flags, &c, depth, stencil); &draw_rect, flags, color, depth, stencil);
} }
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
......
...@@ -591,10 +591,12 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R ...@@ -591,10 +591,12 @@ static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const R
* (The Max Payne bug has been confirmed on Windows with the debug runtime) */ * (The Max Payne bug has been confirmed on Windows with the debug runtime) */
if (FALSE && swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) if (FALSE && swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD)
{ {
static const struct wined3d_color cyan = {0.0f, 1.0f, 1.0f, 1.0f};
TRACE("Clearing the color buffer with cyan color\n"); TRACE("Clearing the color buffer with cyan color\n");
wined3d_device_clear(swapchain->device, 0, NULL, wined3d_device_clear(swapchain->device, 0, NULL,
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0f, 0); WINED3DCLEAR_TARGET, &cyan, 1.0f, 0);
} }
if (!swapchain->render_to_fbo && ((swapchain->front_buffer->flags & SFLAG_INSYSMEM) if (!swapchain->render_to_fbo && ((swapchain->front_buffer->flags & SFLAG_INSYSMEM)
......
...@@ -65,8 +65,6 @@ ...@@ -65,8 +65,6 @@
#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205) #define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205)
#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577) #define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)
typedef DWORD WINED3DCOLOR;
typedef enum _WINED3DLIGHTTYPE typedef enum _WINED3DLIGHTTYPE
{ {
WINED3DLIGHT_POINT = 1, WINED3DLIGHT_POINT = 1,
...@@ -2168,7 +2166,7 @@ HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *devic ...@@ -2168,7 +2166,7 @@ HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *devic
HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device); HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device); 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, HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags,
WINED3DCOLOR color, float z, DWORD stencil); const struct wined3d_color *color, float z, DWORD stencil);
void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device,
struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color); struct wined3d_rendertarget_view *rendertarget_view, const struct wined3d_color *color);
HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface, HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface,
......
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