[9/10] WineD3D: Use VBOs for index buffers

Mirek thunder.m at czela.net
Tue Feb 20 09:54:03 CST 2007


Stefan Dösinger napsal(a):
> Am Dienstag 20 Februar 2007 15:03 schrieb Mirek:
>> Hi, this patch caused regression in many Direct3D games. TES IV:
>> Oblivion can't start game (menu works), Flatout II is completly broken,
>> Alpine Sky Racing 2007 can't run, HalfLife 2 EO can't run. I tried
>> rewrite GLint vbo; to GLuint vbo; but it doesn't help.
> Argh, sounds kinda bad :-( .
> 
> Do the games crash, or display incorrect graphics?

HL 2 EO can't even start to menu, it just hangs
TES IV: Oblivion can start, but it hangs while loading game
Flatout II can start, but graphic in menu is completly broken and it 
crash after start of game


> 
> Can you try to add the following line in 
> IWineD3DIndexBufferImpl_Unlock(dlls/wined3d/indexbuffer.c),somewhere in the 
> locks == 0 && This->vbo if statement:
> 
> IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, 
> STATE_INDEXBUFFER);
> 
> The bound index buffer is changed there, and it needs to be restored for the 
> next draw. I forgot to add that because originally I planned to make the vbo 
> and state table things 2 patches, but that didn't work out right.

I tried it three times in different places, it helped in some games:

Flatout II - graphic in menu was without any problems, but game crashed 
(still regression).
HalfLife 2 EO - works, I was in game only about 2 minuts and it look fixed
Alpine Sky Racing 2007 - works
TES IV: Oblivion - still crashing while loading (it just hang while 
loading, picture is frozen, and I have to manualy kill it)

So it fixed something, but not all regressions.


1.
     /* For now load in unlock */
     if(locks == 0 && This->vbo) {
         ENTER_GL();
         IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, 
STATE_INDEXBUFFER);
         GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 
This->vbo));
         checkGLcall("glBindBufferARB");
         GL_EXTCALL(glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
                 This->dirtystart, This->dirtyend - This->dirtystart, 
This->resource.allocatedMemory + This->dirtystart));
         checkGLcall("glBufferSubDataARB");
         LEAVE_GL();
         This->dirtystart = 0;
         This->dirtyend = 0;
     }
     return WINED3D_OK;

2.
     /* For now load in unlock */
     if(locks == 0 && This->vbo) {
         IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, 
STATE_INDEXBUFFER);
         ENTER_GL();
         GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 
This->vbo));
         checkGLcall("glBindBufferARB");
         GL_EXTCALL(glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
                 This->dirtystart, This->dirtyend - This->dirtystart, 
This->resource.allocatedMemory + This->dirtystart));
         checkGLcall("glBufferSubDataARB");
         LEAVE_GL();
         This->dirtystart = 0;
         This->dirtyend = 0;
         IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, 
STATE_INDEXBUFFER);
     }
     return WINED3D_OK;

3.
     /* For now load in unlock */
     if(locks == 0 && This->vbo) {
         ENTER_GL();
         GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 
This->vbo));
         checkGLcall("glBindBufferARB");
         GL_EXTCALL(glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
                 This->dirtystart, This->dirtyend - This->dirtystart, 
This->resource.allocatedMemory + This->dirtystart));
         checkGLcall("glBufferSubDataARB");
         LEAVE_GL();
         This->dirtystart = 0;
         This->dirtyend = 0;
     }
     return WINED3D_OK;

Mirek



More information about the wine-devel mailing list