VirtualBox

Ignore:
Timestamp:
Oct 6, 2009 6:07:06 AM (15 years ago)
Author:
vboxsync
Message:

crOpenGL: update to wine 1.1.30

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/indexbuffer.c

    r19678 r23571  
    5757    TRACE("(%p) : AddRef from %d\n", This, ref - 1);
    5858
     59    if (ref == 1)
     60    {
     61        IDirect3DDevice9Ex_AddRef(This->parentDevice);
     62        wined3d_mutex_lock();
     63        IWineD3DBuffer_AddRef(This->wineD3DIndexBuffer);
     64        wined3d_mutex_unlock();
     65    }
     66
    5967    return ref;
    6068}
     
    6775
    6876    if (ref == 0) {
    69         EnterCriticalSection(&d3d9_cs);
     77        IDirect3DDevice9Ex_Release(This->parentDevice);
     78        wined3d_mutex_lock();
    7079        IWineD3DBuffer_Release(This->wineD3DIndexBuffer);
    71         LeaveCriticalSection(&d3d9_cs);
    72         IDirect3DDevice9Ex_Release(This->parentDevice);
    73         HeapFree(GetProcessHeap(), 0, This);
     80        wined3d_mutex_unlock();
    7481    }
    7582    return ref;
     
    8390    TRACE("(%p) Relay\n", This);
    8491
    85     EnterCriticalSection(&d3d9_cs);
     92    wined3d_mutex_lock();
    8693    hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
    8794    if (SUCCEEDED(hr))
     
    9097        IWineD3DDevice_Release(wined3d_device);
    9198    }
    92     LeaveCriticalSection(&d3d9_cs);
     99    wined3d_mutex_unlock();
     100
    93101    return hr;
    94102}
     
    99107    TRACE("(%p) Relay\n", This);
    100108
    101     EnterCriticalSection(&d3d9_cs);
     109    wined3d_mutex_lock();
    102110    hr = IWineD3DBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
    103     LeaveCriticalSection(&d3d9_cs);
     111    wined3d_mutex_unlock();
     112
    104113    return hr;
    105114}
     
    110119    TRACE("(%p) Relay\n", This);
    111120
    112     EnterCriticalSection(&d3d9_cs);
     121    wined3d_mutex_lock();
    113122    hr = IWineD3DBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
    114     LeaveCriticalSection(&d3d9_cs);
     123    wined3d_mutex_unlock();
     124
    115125    return hr;
    116126}
     
    121131    TRACE("(%p) Relay\n", This);
    122132
    123     EnterCriticalSection(&d3d9_cs);
     133    wined3d_mutex_lock();
    124134    hr = IWineD3DBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
    125     LeaveCriticalSection(&d3d9_cs);
     135    wined3d_mutex_unlock();
     136
    126137    return hr;
    127138}
     
    132143    TRACE("(%p) Relay\n", This);
    133144
    134     EnterCriticalSection(&d3d9_cs);
     145    wined3d_mutex_lock();
    135146    ret = IWineD3DBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
    136     LeaveCriticalSection(&d3d9_cs);
     147    wined3d_mutex_unlock();
     148
    137149    return ret;
    138150}
     
    143155    TRACE("(%p) Relay\n", This);
    144156
    145     EnterCriticalSection(&d3d9_cs);
     157    wined3d_mutex_lock();
    146158    ret = IWineD3DBuffer_GetPriority(This->wineD3DIndexBuffer);
    147     LeaveCriticalSection(&d3d9_cs);
     159    wined3d_mutex_unlock();
     160
    148161    return ret;
    149162}
     
    153166    TRACE("(%p) Relay\n", This);
    154167
    155     EnterCriticalSection(&d3d9_cs);
     168    wined3d_mutex_lock();
    156169    IWineD3DBuffer_PreLoad(This->wineD3DIndexBuffer);
    157     LeaveCriticalSection(&d3d9_cs);
     170    wined3d_mutex_unlock();
    158171}
    159172
     
    171184    TRACE("(%p) Relay\n", This);
    172185
    173     EnterCriticalSection(&d3d9_cs);
     186    wined3d_mutex_lock();
    174187    hr = IWineD3DBuffer_Map(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, (BYTE **)ppbData, Flags);
    175     LeaveCriticalSection(&d3d9_cs);
     188    wined3d_mutex_unlock();
     189
    176190    return hr;
    177191}
     
    182196    TRACE("(%p) Relay\n", This);
    183197
    184     EnterCriticalSection(&d3d9_cs);
     198    wined3d_mutex_lock();
    185199    hr = IWineD3DBuffer_Unmap(This->wineD3DIndexBuffer);
    186     LeaveCriticalSection(&d3d9_cs);
     200    wined3d_mutex_unlock();
     201
    187202    return hr;
    188203}
     
    194209    TRACE("(%p) Relay\n", This);
    195210
    196     EnterCriticalSection(&d3d9_cs);
     211    wined3d_mutex_lock();
    197212    hr = IWineD3DBuffer_GetDesc(This->wineD3DIndexBuffer, &desc);
    198     LeaveCriticalSection(&d3d9_cs);
     213    wined3d_mutex_unlock();
    199214
    200215    if (SUCCEEDED(hr)) {
     
    231246};
    232247
    233 
    234 /* IDirect3DDevice9 IDirect3DIndexBuffer9 Methods follow: */
    235 HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface,
    236                               UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
    237                               IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) {
    238    
    239     IDirect3DIndexBuffer9Impl *object;
    240     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
    241     HRESULT hrc = D3D_OK;
    242    
    243     TRACE("(%p) Relay\n", This);
    244     /* Allocate the storage for the device */
    245     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
    246     if (NULL == object) {
    247         FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
    248         return D3DERR_OUTOFVIDEOMEMORY;
    249     }
    250 
    251     object->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
    252     object->ref = 1;
    253     object->format = wined3dformat_from_d3dformat(Format);
    254     TRACE("Calling wined3d create index buffer\n");
    255     EnterCriticalSection(&d3d9_cs);
    256     hrc = IWineD3DDevice_CreateIndexBuffer(This->WineD3DDevice, Length, Usage & WINED3DUSAGE_MASK,
    257             (WINED3DPOOL)Pool, &object->wineD3DIndexBuffer, (IUnknown *)object);
    258     LeaveCriticalSection(&d3d9_cs);
    259     if (hrc != D3D_OK) {
    260 
    261         /* free up object */
    262         FIXME("(%p) call to IWineD3DDevice_CreateIndexBuffer failed\n", This);
    263         HeapFree(GetProcessHeap(), 0, object);
    264     } else {
    265         IDirect3DDevice9Ex_AddRef(iface);
    266         object->parentDevice = iface;
    267         *ppIndexBuffer = (LPDIRECT3DINDEXBUFFER9) object;
    268         TRACE("(%p) : Created index buffer %p\n", This, object);
    269     }
    270     return hrc;
    271 }
     248static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent)
     249{
     250    HeapFree(GetProcessHeap(), 0, parent);
     251}
     252
     253static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops =
     254{
     255    d3d9_indexbuffer_wined3d_object_destroyed,
     256};
     257
     258HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl *device,
     259        UINT size, DWORD usage, D3DFORMAT format, D3DPOOL pool)
     260{
     261    HRESULT hr;
     262
     263    buffer->lpVtbl = &Direct3DIndexBuffer9_Vtbl;
     264    buffer->ref = 1;
     265    buffer->format = wined3dformat_from_d3dformat(format);
     266
     267    wined3d_mutex_lock();
     268    hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size,
     269            usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer,
     270            (IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops);
     271    wined3d_mutex_unlock();
     272    if (FAILED(hr))
     273    {
     274        WARN("Failed to create wined3d buffer, hr %#x.\n", hr);
     275        return hr;
     276    }
     277
     278    buffer->parentDevice = (IDirect3DDevice9Ex *)device;
     279    IDirect3DDevice9Ex_AddRef(buffer->parentDevice);
     280
     281    return D3D_OK;
     282}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette