Commit 6a48e405 authored by Alexander Dorofeyev's avatar Alexander Dorofeyev Committed by Alexandre Julliard

ddraw: Add possibility to ignore lights in viewport_activate.

Mostly NOP regarding existing functionality, but makes it possible to skip light activation when it's not needed (like when clearing).
parent 7c8fa9c2
......@@ -540,7 +540,7 @@ struct IDirect3DViewportImpl
} viewports;
/* Activation function */
void (*activate)(IDirect3DViewportImpl*);
void (*activate)(IDirect3DViewportImpl*, BOOL);
/* Field used to chain viewports together */
IDirect3DViewportImpl *next;
......@@ -556,7 +556,7 @@ struct IDirect3DViewportImpl
const IDirect3DViewport3Vtbl IDirect3DViewport3_Vtbl;
/* Helper functions */
void viewport_activate(IDirect3DViewportImpl* This);
void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights);
/*****************************************************************************
* IDirect3DExecuteBuffer - Wraps to D3D7
......
......@@ -1763,7 +1763,7 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface,
/* Activate this viewport */
This->current_viewport->active_device = This;
This->current_viewport->activate(This->current_viewport);
This->current_viewport->activate(This->current_viewport, FALSE);
LeaveCriticalSection(&ddraw_cs);
return D3D_OK;
......
......@@ -103,7 +103,7 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
/* Activate the viewport */
lpViewport->active_device = lpDevice;
lpViewport->activate(lpViewport);
lpViewport->activate(lpViewport, FALSE);
TRACE("ExecuteData :\n");
if (TRACE_ON(d3d7))
......
......@@ -54,10 +54,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d7);
* activates the viewport using IDirect3DDevice7::SetViewport
*
*****************************************************************************/
void viewport_activate(IDirect3DViewportImpl* This) {
void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) {
IDirect3DLightImpl* light;
D3DVIEWPORT7 vp;
if (!ignore_lights) {
/* Activate all the lights associated with this context */
light = This->lights;
......@@ -65,6 +66,7 @@ void viewport_activate(IDirect3DViewportImpl* This) {
light->activate(light);
light = light->next;
}
}
/* And copy the values in the structure used by the device */
if (This->use_vp2) {
......@@ -312,7 +314,7 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This);
This->activate(This, FALSE);
if(current_viewport) IDirect3DViewport3_Release(current_viewport);
}
LeaveCriticalSection(&ddraw_cs);
......@@ -900,7 +902,7 @@ IDirect3DViewportImpl_SetViewport2(IDirect3DViewport3 *iface,
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), &current_viewport);
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
This->activate(This);
This->activate(This, FALSE);
IDirect3DViewport3_Release(current_viewport);
}
LeaveCriticalSection(&ddraw_cs);
......
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