Alexander Dorofeyev : ddraw: Add possibility to ignore lights in viewport_activate.
Alexandre Julliard
julliard at winehq.org
Fri Apr 11 06:28:38 CDT 2008
Module: wine
Branch: master
Commit: 6a48e405db398e913981f6082f09c4cf4cb54669
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6a48e405db398e913981f6082f09c4cf4cb54669
Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date: Thu Apr 10 23:11:36 2008 +0300
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).
---
dlls/ddraw/ddraw_private.h | 4 ++--
dlls/ddraw/device.c | 2 +-
dlls/ddraw/executebuffer.c | 2 +-
dlls/ddraw/viewport.c | 20 +++++++++++---------
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index c10f981..e879143 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -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
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index f39b0b0..4e528af 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -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;
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index fe24fe3..09125e2 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -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))
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c
index 3d78383..c720a57 100644
--- a/dlls/ddraw/viewport.c
+++ b/dlls/ddraw/viewport.c
@@ -54,16 +54,18 @@ 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;
-
- /* Activate all the lights associated with this context */
- light = This->lights;
- while (light != NULL) {
- light->activate(light);
- light = light->next;
+ if (!ignore_lights) {
+ /* Activate all the lights associated with this context */
+ light = This->lights;
+
+ while (light != NULL) {
+ light->activate(light);
+ light = light->next;
+ }
}
/* And copy the values in the structure used by the device */
@@ -312,7 +314,7 @@ IDirect3DViewportImpl_SetViewport(IDirect3DViewport3 *iface,
if (This->active_device) {
IDirect3DDevice3_GetCurrentViewport(ICOM_INTERFACE(This->active_device, IDirect3DDevice3), ¤t_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), ¤t_viewport);
if (ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, current_viewport) == This)
- This->activate(This);
+ This->activate(This, FALSE);
IDirect3DViewport3_Release(current_viewport);
}
LeaveCriticalSection(&ddraw_cs);
More information about the wine-cvs
mailing list