DirectX 8 wrapper update

H. Verbeet hverbeet at gmail.com
Sat Nov 26 23:13:38 CST 2005


On 26/11/05, H. Verbeet <hverbeet at gmail.com> wrote:
> Are StateBlocks supposed to be nestable?
> I don't think they currently are on Wine, but my debug output appears
> to suggest they should be:
>
Actually, nevermind that comment. They're not.
However, BeginStateBlock should return D3DERR_INVALIDCALL when called
twice in a row.

Executing the above sequence on Windows gives:
BeginStateBlock returned: 00000000
BeginStateBlock returned: 8876086C
EndStateBlock returned: 00000000
BeginStateBlock returned: 00000000
EndStateBlock returned: 00000000
EndStateBlock returned: 8876086C

After that, the demo dies on an AddRef in IWineD3DPixelShaderImpl_GetParent.
Replacing *parent= (IUnknown*) parent; with *parent = This->parent;
seems to be enough to get it going again.

Right now, the demo dies somewhere in
IWineD3DPixelShaderImpl_SetFunction. At first sight, I'd say it never
detects the end of its input and just keeps on reading untill it
generates an access violation.
-------------- next part --------------
Index: dlls/wined3d/device.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/device.c,v
retrieving revision 1.100
diff -u -r1.100 device.c
--- dlls/wined3d/device.c	23 Nov 2005 19:29:20 -0000	1.100
+++ dlls/wined3d/device.c	27 Nov 2005 05:07:49 -0000
@@ -4465,6 +4465,11 @@
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     IWineD3DStateBlockImpl *object;
     TRACE("(%p)", This);
+
+    if (This->isRecordingState) {
+        return D3DERR_INVALIDCALL;
+    }
+    
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DStateBlockImpl));
     if (NULL == object ) {
         FIXME("(%p)Error allocating memory for stateblock\n", This);
Index: dlls/wined3d/pixelshader.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/pixelshader.c,v
retrieving revision 1.4
diff -u -r1.4 pixelshader.c
--- dlls/wined3d/pixelshader.c	23 Nov 2005 19:29:20 -0000	1.4
+++ dlls/wined3d/pixelshader.c	27 Nov 2005 05:07:50 -0000
@@ -100,8 +100,9 @@
 HRESULT WINAPI IWineD3DPixelShaderImpl_GetParent(IWineD3DPixelShader *iface, IUnknown** parent){
     IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
 
-    *parent= (IUnknown*) parent;
+    *parent = This->parent;
     IUnknown_AddRef(*parent);
+
     TRACE("(%p) : returning %p\n", This, *parent);
     return D3D_OK;
 }
Index: dlls/wined3d/vertexshader.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/vertexshader.c,v
retrieving revision 1.18
diff -u -r1.18 vertexshader.c
--- dlls/wined3d/vertexshader.c	23 Nov 2005 19:29:20 -0000	1.18
+++ dlls/wined3d/vertexshader.c	27 Nov 2005 05:07:52 -0000
@@ -2012,8 +2012,9 @@
 HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){
     IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
     
-    *parent = (IUnknown*)This->parent;
+    *parent = This->parent;
     IUnknown_AddRef(*parent);
+    
     TRACE("(%p) : returning %p\n", This, *parent);
     return D3D_OK;
 }


More information about the wine-devel mailing list