Re: Re: Re: D3D: Implement vertex blending in drawStridedSlow

2009-01-26 Thread Claudio Ciccani
I found that the reason of the crash was that VBOs were not removed when
using drawStridedSlow for vertex blending.
Attached is the modified patch, which doesn't make NOLF2 crash.


Il giorno lun, 26/01/2009 alle 12.12 +0100, Claudio Ciccani ha scritto:
 Il giorno dom, 25/01/2009 alle 23.19 +0100, David Adam ha scritto:
  
  
  2009/1/25 Claudio Ciccani k...@users.sf.net
  
  The patch implements a software fallback for vertex blending
  in
  drawStridedSlow, fixing Bug #6955.
  Although vertex blending is an old and outdated extension,
  there are
  still many applications(games) relying on it nowadays. This
  because the
  extension is generally supported by Direct3D, either directly
  in
  hardware (using vertex programs) or in software.
  
  
  
   
  
  This patch makes NOLF2 demo crashes.
  
  
  Register
  dump:  
   CS:0073 SS:007b DS:007b ES:007b FS:0033
  GS:003b
   EIP:7e6095c7 ESP:0033f0b4 EBP:0033f1ec EFLAGS:00010246(   - 00
  -RIZP1)
   EAX:00ec1b28 EBX:7e6bbc54 ECX:014c
  EDX:
   ESI:0048
  EDI:  
  Stack
  dump: 
  0x0033f0b4:    
  3f80
  0x0033f0c4:  0033f110 7d05e000 7c03d008
  7c7aa346
  0x0033f0d4:   0003 7e6bc7a0
  7e69ee95
  0x0033f0e4:  7e69e648 0001 000c
  0010
  0x0033f0f4:  795a5f68 7d09c0ac 0002d008
  00ebd44c
  0x0033f104:  00eba698 00ebd7a8 
  0007
  Backtrace:  
  
  =0 0x7e6095c7 drawStridedSlow+0x697(iface=0xeba698, sd=0xebd44c,
  NumVertexes=72, glPrimType=4, idxData=0x31dca00, idxSize=2,
  minIndex=0, startIdx=0) [/home/david/wine/dlls/wined3d/drawprim.c:307]
  in wined3d (0x0033f1ec)
1 0x7e60ea1b drawPrimitive+0x101b(iface=0xeba698, PrimitiveType=4,
  NumPrimitives=24, numberOfVertices=24, StartIdx=0, idxSize=is not
  available, idxData=(nil), minIndex=0)
  [/home/david/wine/dlls/wined3d/drawprim.c:1024] in wined3d
  (0x0033f55c)

2 0x7e5e41f9 IWineD3DDeviceImpl_DrawIndexedPrimitive
  +0xe9(iface=0xeba698, PrimitiveType=WINED3DPT_TRIANGLELIST,
  minIndex=0, NumVertices=24, startIndex=0, primCount=24)
  [/home/david/wine/dlls/wined3d/device.c:5314] in wined3d (0x0033f5cc) 
3 0x7e6d43b6 IDirect3DDevice8Impl_DrawIndexedPrimitive
  +0x96(iface=register ESI not in topmost frame,
  PrimitiveType=D3DPT_TRIANGLELIST, MinVertexIndex=0, NumVertices=24,
  startIndex=0, primCount=24) [/home/david/wine/dlls/d3d8/device.c:1419]
  in d3d8
  (0x0033f5fc)
  0x7e6095c7 drawStridedSlow+0x697
  [/home/david/wine/dlls/wined3d/drawprim.c:307] in wined3d: flds
  0x0(%ecx)   
  307 m =
  stateBlock-transforms[WINED3DTS_WORLDMATRIX((indices ? indices[0] :
  0))].u.m[0][0];   
  Modules: 
 
 Really strange! Tested the patch against other games and it worked.
 With NOLF2 I'm getting a crash too, but at a different location:
 
   1 0x7e6217ca drawPrimitive+0x112a(iface=0xec7660, PrimitiveType=4,
 NumPrimitives=18, numberOfVertices=20, StartIdx=0, idxSize=2,
 idxData=0x3d871e0, minIndex=0)
 [/home/klan/src/wine/dlls/wined3d/drawprim.c:540] in wined3d
 (0x)
 0x7d2b3771: movl0x0(%ecx),%edx
 
 540   for (texture = 0; tmp_tex_mask; tmp_tex_mask = 1, ++texture)
 
 
 
 
 
 
-- 
Claudio Ciccani
k...@users.sf.net
k...@directfb.org
http://directfb.org
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 478c216..7b2a010 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3387,8 +3387,13 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
 pCaps-MaxUserClipPlanes   = GL_LIMITS(clipplanes);
 pCaps-MaxActiveLights = GL_LIMITS(lights);
 
-pCaps-MaxVertexBlendMatrices  = GL_LIMITS(blends);
-pCaps-MaxVertexBlendMatrixIndex   = 0;
+if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
+pCaps-MaxVertexBlendMatrices= GL_LIMITS(blends);
+pCaps-MaxVertexBlendMatrixIndex = 0;
+} else {
+pCaps-MaxVertexBlendMatrices= 4;
+pCaps-MaxVertexBlendMatrixIndex = 255;
+}
 
 pCaps-MaxAnisotropy   = GL_LIMITS(anisotropy);
 pCaps-MaxPointSize= GL_LIMITS(pointsize);

Re: Re: Re: D3D: Implement vertex blending in drawStridedSlow

2009-01-26 Thread David Adam
2009/1/26 Claudio Ciccani k...@users.sf.net

 I found that the reason of the crash was that VBOs were not removed when
 using drawStridedSlow for vertex blending.
 Attached is the modified patch, which doesn't make NOLF2 crash.


 Il giorno lun, 26/01/2009 alle 12.12 +0100, Claudio Ciccani ha scritto:
  Il giorno dom, 25/01/2009 alle 23.19 +0100, David Adam ha scritto:
  
  
   2009/1/25 Claudio Ciccani k...@users.sf.net
  
   The patch implements a software fallback for vertex blending
   in
   drawStridedSlow, fixing Bug #6955.
   Although vertex blending is an old and outdated extension,
   there are
   still many applications(games) relying on it nowadays. This
   because the
   extension is generally supported by Direct3D, either directly
   in
   hardware (using vertex programs) or in software.
  
  
  
  
  
   This patch makes NOLF2 demo crashes.
  
  
   Register
   dump:
CS:0073 SS:007b DS:007b ES:007b FS:0033
   GS:003b
EIP:7e6095c7 ESP:0033f0b4 EBP:0033f1ec EFLAGS:00010246(   - 00
   -RIZP1)
EAX:00ec1b28 EBX:7e6bbc54 ECX:014c
   EDX:
ESI:0048
   EDI:
   Stack
   dump:
   0x0033f0b4:    
   3f80
   0x0033f0c4:  0033f110 7d05e000 7c03d008
   7c7aa346
   0x0033f0d4:   0003 7e6bc7a0
   7e69ee95
   0x0033f0e4:  7e69e648 0001 000c
   0010
   0x0033f0f4:  795a5f68 7d09c0ac 0002d008
   00ebd44c
   0x0033f104:  00eba698 00ebd7a8 
   0007
   Backtrace:
   =0 0x7e6095c7 drawStridedSlow+0x697(iface=0xeba698, sd=0xebd44c,
   NumVertexes=72, glPrimType=4, idxData=0x31dca00, idxSize=2,
   minIndex=0, startIdx=0) [/home/david/wine/dlls/wined3d/drawprim.c:307]
   in wined3d (0x0033f1ec)
 1 0x7e60ea1b drawPrimitive+0x101b(iface=0xeba698, PrimitiveType=4,
   NumPrimitives=24, numberOfVertices=24, StartIdx=0, idxSize=is not
   available, idxData=(nil), minIndex=0)
   [/home/david/wine/dlls/wined3d/drawprim.c:1024] in wined3d
   (0x0033f55c)
 2 0x7e5e41f9 IWineD3DDeviceImpl_DrawIndexedPrimitive
   +0xe9(iface=0xeba698, PrimitiveType=WINED3DPT_TRIANGLELIST,
   minIndex=0, NumVertices=24, startIndex=0, primCount=24)
   [/home/david/wine/dlls/wined3d/device.c:5314] in wined3d (0x0033f5cc)
 3 0x7e6d43b6 IDirect3DDevice8Impl_DrawIndexedPrimitive
   +0x96(iface=register ESI not in topmost frame,
   PrimitiveType=D3DPT_TRIANGLELIST, MinVertexIndex=0, NumVertices=24,
   startIndex=0, primCount=24) [/home/david/wine/dlls/d3d8/device.c:1419]
   in d3d8
   (0x0033f5fc)
   0x7e6095c7 drawStridedSlow+0x697
   [/home/david/wine/dlls/wined3d/drawprim.c:307] in wined3d: flds
   0x0(%ecx)
   307 m =
   stateBlock-transforms[WINED3DTS_WORLDMATRIX((indices ? indices[0] :
   0))].u.m[0][0];
   Modules:
 
  Really strange! Tested the patch against other games and it worked.
  With NOLF2 I'm getting a crash too, but at a different location:
 
1 0x7e6217ca drawPrimitive+0x112a(iface=0xec7660, PrimitiveType=4,
  NumPrimitives=18, numberOfVertices=20, StartIdx=0, idxSize=2,
  idxData=0x3d871e0, minIndex=0)
  [/home/klan/src/wine/dlls/wined3d/drawprim.c:540] in wined3d
  (0x)
  0x7d2b3771: movl0x0(%ecx),%edx
 
  540   for (texture = 0; tmp_tex_mask; tmp_tex_mask = 1, ++texture)
 
 
 
 
 
 
 --
 Claudio Ciccani
 k...@users.sf.net
 k...@directfb.org
 http://directfb.org

Great, the patch works like a charm. I hope that it will bw accepted by D3D
gurus and Alexandre .

David