Stefan Dösinger : ddraw: Materials in the execute buffer are handles.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 5 13:31:24 CDT 2007
Module: wine
Branch: master
Commit: c58b2f228386194476f95524270a8862d77f07e7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c58b2f228386194476f95524270a8862d77f07e7
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Sun Jul 1 01:01:50 2007 +0200
ddraw: Materials in the execute buffer are handles.
---
dlls/ddraw/executebuffer.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
index 9dbff68..ceb5605 100644
--- a/dlls/ddraw/executebuffer.c
+++ b/dlls/ddraw/executebuffer.c
@@ -246,14 +246,19 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This,
if (!ci->u1.dlstLightStateType && (ci->u1.dlstLightStateType > D3DLIGHTSTATE_COLORVERTEX))
ERR("Unexpected Light State Type\n");
else if (ci->u1.dlstLightStateType == D3DLIGHTSTATE_MATERIAL /* 1 */) {
- IDirect3DMaterialImpl *mat = (IDirect3DMaterialImpl *) ci->u2.dwArg[0];
-
- if (mat != NULL) {
- mat->activate(mat);
- } else {
- FIXME(" D3DLIGHTSTATE_MATERIAL called with NULL material !!!\n");
- }
+ DWORD matHandle = ci->u2.dwArg[0];
+
+ if(!matHandle) {
+ FIXME(" D3DLIGHTSTATE_MATERIAL called with NULL material !!!\n");
+ } else if(matHandle >= lpDevice->numHandles) {
+ WARN("Material handle %d is invalid\n", matHandle);
+ } else if(lpDevice->Handles[matHandle - 1].type != DDrawHandle_Material) {
+ WARN("Handle %d is not a material handle\n", matHandle);
+ } else {
+ IDirect3DMaterialImpl *mat = (IDirect3DMaterialImpl *) lpDevice->Handles[matHandle - 1].ptr;
+ mat->activate(mat);
}
+ }
else if (ci->u1.dlstLightStateType == D3DLIGHTSTATE_COLORMODEL /* 3 */) {
switch (ci->u2.dwArg[0]) {
case D3DCOLOR_MONO:
More information about the wine-cvs
mailing list