VirtualBox

Changeset 42408 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 26, 2012 12:28:23 PM (12 years ago)
Author:
vboxsync
Message:

wine: shader cache (enabled for wddm for now)

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Wine
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/Makefile.kmk

    r42309 r42408  
    223223        VBOX_WITH_WDDM \
    224224        VBOX_WINE_WITH_SINGLE_CONTEXT \
    225         IN_VBOXLIBWINE
     225        IN_VBOXLIBWINE \
     226        VBOX_WINE_WITH_SHADER_CACHE
    226227 wined3dwddm_INCS           = $(wined3d_INCS) \
    227228        $(PATH_ROOT)/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c

    r42285 r42408  
    637637        This->haveHardwareCursor = FALSE;
    638638
     639#ifdef VBOX_WINE_WITH_SHADER_CACHE
     640        shader_chaches_term(This);
     641#endif
     642
    639643        IWineD3D_Release(This->wined3d);
    640644        This->wined3d = NULL;
     
    13291333    }
    13301334
     1335#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1336    object = vertexshader_check_cached(This, object);
     1337#endif
     1338
    13311339    TRACE("Created vertex shader %p.\n", object);
    13321340    *ppVertexShader = (IWineD3DVertexShader *)object;
     
    13881396        return hr;
    13891397    }
     1398
     1399#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1400    object = pixelshader_check_cached(This, object);
     1401#endif
    13901402
    13911403    TRACE("Created pixel shader %p.\n", object);
     
    73267338    device->blitter = adapter->blitter;
    73277339
     7340#ifdef VBOX_WINE_WITH_SHADER_CACHE
     7341    shader_chaches_init(device);
     7342#endif
     7343
    73287344    return WINED3D_OK;
    73297345}
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/shader.c

    r37550 r42408  
    15721572}
    15731573
     1574#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1575static void shader_chache_put(PVBOXEXT_HASHCACHE pCache, IWineD3DBaseShaderImpl *pShader);
     1576#endif
     1577
    15741578static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface)
    15751579{
     
    15811585    if (!refcount)
    15821586    {
     1587#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1588        shader_chache_put(&((IWineD3DDeviceImpl*)shader->baseShader.device)->vshaderCache, (IWineD3DBaseShaderImpl*)shader);
     1589#else
    15831590        shader_cleanup((IWineD3DBaseShader *)iface);
    15841591        shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent);
    15851592        HeapFree(GetProcessHeap(), 0, shader);
     1593#endif
    15861594    }
    15871595
     
    19751983    if (!refcount)
    19761984    {
     1985#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1986        shader_chache_put(&((IWineD3DDeviceImpl*)shader->baseShader.device)->pshaderCache, (IWineD3DBaseShaderImpl*)shader);
     1987#else
    19771988        shader_cleanup((IWineD3DBaseShader *)iface);
    19781989        shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent);
    19791990        HeapFree(GetProcessHeap(), 0, shader);
     1991#endif
    19801992    }
    19811993
     
    23112323    }
    23122324}
     2325
     2326#ifdef VBOX_WINE_WITH_SHADER_CACHE
     2327
     2328static void shader_reinit(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device,
     2329        IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
     2330{
     2331    shader->ref = 1;
     2332    shader->device = (IWineD3DDevice *)device;
     2333    shader->parent = parent;
     2334    shader->parent_ops = parent_ops;
     2335    list_add_head(&device->shaders, &shader->shader_list_entry);
     2336}
     2337
     2338static DECLCALLBACK(uint32_t) shader_cache_hash(void *pvKey)
     2339{
     2340    uint32_t u32Hash, i;
     2341    DWORD *function;
     2342    IWineD3DBaseShaderImpl *pShader = (IWineD3DBaseShaderImpl *)pvKey;
     2343    if (pShader->baseShader.u32CacheDataInited)
     2344        return pShader->baseShader.u32Hash;
     2345
     2346    u32Hash = pShader->baseShader.functionLength;
     2347    function = pShader->baseShader.function;
     2348    for (i = 0; i < pShader->baseShader.functionLength / 4; ++i)
     2349    {
     2350        u32Hash += *function++;
     2351    }
     2352
     2353    for (i = 0; i < pShader->baseShader.functionLength % 4; ++i)
     2354    {
     2355        u32Hash += *((uint8_t*)function)++;
     2356    }
     2357
     2358    pShader->baseShader.u32Hash = u32Hash;
     2359    pShader->baseShader.u32CacheDataInited = TRUE;
     2360    return pShader->baseShader.u32Hash;
     2361}
     2362
     2363static DECLCALLBACK(bool) shader_cache_equal(void *pvKey1, void *pvKey2)
     2364{
     2365    IWineD3DBaseShaderImpl *pShader1 = (IWineD3DBaseShaderImpl *)pvKey1;
     2366    IWineD3DBaseShaderImpl *pShader2 = (IWineD3DBaseShaderImpl *)pvKey2;
     2367
     2368    if (pShader1 == pShader2)
     2369        return TRUE;
     2370
     2371    if (pShader1->baseShader.functionLength != pShader2->baseShader.functionLength)
     2372        return FALSE;
     2373
     2374    if (shader_cache_hash(pvKey1) != shader_cache_hash(pvKey2))
     2375    {
     2376#ifdef DEBUG_misha
     2377        Assert(memcmp(pShader1->baseShader.function, pShader2->baseShader.function, pShader1->baseShader.functionLength));
     2378#endif
     2379        return FALSE;
     2380    }
     2381
     2382    return !memcmp(pShader1->baseShader.function, pShader2->baseShader.function, pShader1->baseShader.functionLength);
     2383}
     2384
     2385#define VBOX_SHADER_FROM_CACHE_ENTRY(_pEntry) RT_FROM_MEMBER(RT_FROM_MEMBER((_pEntry), IWineD3DBaseShaderClass, CacheEntry), IWineD3DBaseShaderImpl, baseShader)
     2386
     2387static DECLCALLBACK(void) shader_cache_cleanup_entry(void *pvKey, struct VBOXEXT_HASHCACHE_ENTRY *pEntry)
     2388{
     2389    IWineD3DBaseShaderImpl *pShader = VBOX_SHADER_FROM_CACHE_ENTRY(pEntry);
     2390    shader_cleanup((IWineD3DBaseShader *)pShader);
     2391    if (pShader->baseShader.parent)
     2392        pShader->baseShader.parent_ops->wined3d_object_destroyed(pShader->baseShader.parent);
     2393    HeapFree(GetProcessHeap(), 0, pShader);
     2394}
     2395
     2396static void shader_chache_init(PVBOXEXT_HASHCACHE pCache)
     2397{
     2398    VBoxExtCacheInit(pCache, 1024, shader_cache_hash, shader_cache_equal, shader_cache_cleanup_entry);
     2399}
     2400
     2401static void shader_chache_term(PVBOXEXT_HASHCACHE pCache)
     2402{
     2403    VBoxExtCacheTerm(pCache);
     2404}
     2405
     2406static void shader_chache_put(PVBOXEXT_HASHCACHE pCache, IWineD3DBaseShaderImpl *pShader)
     2407{
     2408    if (pShader->baseShader.parent)
     2409    {
     2410        pShader->baseShader.parent_ops->wined3d_object_destroyed(pShader->baseShader.parent);
     2411        pShader->baseShader.parent = NULL;
     2412    }
     2413
     2414    VBoxExtCachePut(pCache, pShader, &pShader->baseShader.CacheEntry);
     2415}
     2416
     2417static IWineD3DBaseShaderImpl* shader_chache_get(PVBOXEXT_HASHCACHE pCache, IWineD3DBaseShaderImpl *pShader)
     2418{
     2419    PVBOXEXT_HASHCACHE_ENTRY pEntry = VBoxExtCacheGet(pCache, pShader);
     2420    IWineD3DBaseShaderImpl *pCachedShader;
     2421
     2422    if (!pEntry)
     2423        return pShader;
     2424
     2425    Assert(0);
     2426
     2427    pCachedShader = VBOX_SHADER_FROM_CACHE_ENTRY(pEntry);
     2428    shader_reinit(&pCachedShader->baseShader, (IWineD3DDeviceImpl *)pShader->baseShader.device,
     2429            pShader->baseShader.parent, pShader->baseShader.parent_ops);
     2430    pShader->baseShader.parent = NULL;
     2431    /* we can not do a IWineD3DBaseShader_Release here since this would result in putting a shader to the cache */
     2432    shader_cleanup((IWineD3DBaseShader *)pShader);
     2433    HeapFree(GetProcessHeap(), 0, pShader);
     2434    return pCachedShader;
     2435}
     2436
     2437IWineD3DVertexShaderImpl * vertexshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DVertexShaderImpl *object)
     2438{
     2439    return (IWineD3DVertexShaderImpl*)shader_chache_get(&device->vshaderCache, (IWineD3DBaseShaderImpl *)object);
     2440}
     2441
     2442IWineD3DPixelShaderImpl * pixelshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DPixelShaderImpl *object)
     2443{
     2444    return (IWineD3DPixelShaderImpl*)shader_chache_get(&device->pshaderCache, (IWineD3DBaseShaderImpl *)object);
     2445}
     2446
     2447void shader_chaches_init(IWineD3DDeviceImpl *device)
     2448{
     2449    shader_chache_init(&device->vshaderCache);
     2450    shader_chache_init(&device->pshaderCache);
     2451}
     2452
     2453void shader_chaches_term(IWineD3DDeviceImpl *device)
     2454{
     2455    shader_chache_term(&device->vshaderCache);
     2456    shader_chache_term(&device->pshaderCache);
     2457}
     2458#endif
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.c

    r42023 r42408  
    683683    return S_OK;
    684684}
     685
     686
     687/* hash map impl */
     688static void vboxExtHashInitEntries(PVBOXEXT_HASHMAP pMap)
     689{
     690    uint32_t i;
     691    pMap->cEntries = 0;
     692    for (i = 0; i < RT_ELEMENTS(pMap->aBuckets); ++i)
     693    {
     694        RTListInit(&pMap->aBuckets[i].EntryList);
     695    }
     696}
     697
     698void VBoxExtHashInit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_HASH pfnHash, PFNVBOXEXT_HASHMAP_EQUAL pfnEqual)
     699{
     700    pMap->pfnHash = pfnHash;
     701    pMap->pfnEqual = pfnEqual;
     702    vboxExtHashInitEntries(pMap);
     703}
     704
     705static DECLINLINE(uint32_t) vboxExtHashIdx(uint32_t u32Hash)
     706{
     707    return u32Hash % VBOXEXT_HASHMAP_NUM_BUCKETS;
     708}
     709
     710#define VBOXEXT_FOREACH_NODE(_pNode, _pList, _op) do { \
     711        PRTLISTNODE _pNode; \
     712        PRTLISTNODE __pNext; \
     713        for (_pNode = (_pList)->pNext; \
     714                _pNode != (_pList); \
     715                _pNode = __pNext) \
     716        { \
     717            __pNext = _pNode->pNext; /* <- the _pNode should not be referenced after the _op */ \
     718            _op \
     719        } \
     720    } while (0)
     721
     722DECLINLINE(PVBOXEXT_HASHMAP_ENTRY) vboxExtHashSearchEntry(PVBOXEXT_HASHMAP pMap, void *pvKey)
     723{
     724    uint32_t u32Hash = pMap->pfnHash(pvKey);
     725    uint32_t u32HashIdx = vboxExtHashIdx(u32Hash);
     726    PVBOXEXT_HASHMAP_BUCKET pBucket = &pMap->aBuckets[u32HashIdx];
     727    PVBOXEXT_HASHMAP_ENTRY pEntry;
     728    VBOXEXT_FOREACH_NODE(pNode, &pBucket->EntryList,
     729        pEntry = RT_FROM_MEMBER(pNode, VBOXEXT_HASHMAP_ENTRY, ListNode);
     730        if (pEntry->u32Hash != u32Hash)
     731            continue;
     732
     733        if (!pMap->pfnEqual(pvKey, pEntry->pvKey))
     734            continue;
     735        return pEntry;
     736    );
     737    return NULL;
     738}
     739
     740void* VBoxExtHashRemoveEntry(PVBOXEXT_HASHMAP pMap, PVBOXEXT_HASHMAP_ENTRY pEntry)
     741{
     742    RTListNodeRemove(&pEntry->ListNode);
     743    --pMap->cEntries;
     744    Assert(pMap->cEntries <= UINT32_MAX/2);
     745    return pEntry->pvKey;
     746}
     747
     748static void vboxExtHashPutEntry(PVBOXEXT_HASHMAP pMap, PVBOXEXT_HASHMAP_BUCKET pBucket, PVBOXEXT_HASHMAP_ENTRY pEntry)
     749{
     750    RTListNodeInsertAfter(&pBucket->EntryList, &pEntry->ListNode);
     751    ++pMap->cEntries;
     752}
     753
     754PVBOXEXT_HASHMAP_ENTRY VBoxExtHashRemove(PVBOXEXT_HASHMAP pMap, void *pvKey)
     755{
     756    PVBOXEXT_HASHMAP_ENTRY pEntry = vboxExtHashSearchEntry(pMap, pvKey);
     757    if (!pEntry)
     758        return NULL;
     759
     760    VBoxExtHashRemoveEntry(pMap, pEntry);
     761    return pEntry;
     762}
     763
     764PVBOXEXT_HASHMAP_ENTRY VBoxExtHashPut(PVBOXEXT_HASHMAP pMap, void *pvKey, PVBOXEXT_HASHMAP_ENTRY pEntry)
     765{
     766    PVBOXEXT_HASHMAP_ENTRY pOldEntry = VBoxExtHashRemove(pMap, pvKey);
     767    uint32_t u32Hash = pMap->pfnHash(pvKey);
     768    uint32_t u32HashIdx = vboxExtHashIdx(u32Hash);
     769    pEntry->pvKey = pvKey;
     770    pEntry->u32Hash = u32Hash;
     771    vboxExtHashPutEntry(pMap, &pMap->aBuckets[u32HashIdx], pEntry);
     772    return pOldEntry;
     773}
     774
     775
     776PVBOXEXT_HASHMAP_ENTRY VBoxExtHashGet(PVBOXEXT_HASHMAP pMap, void *pvKey)
     777{
     778    return vboxExtHashSearchEntry(pMap, pvKey);
     779}
     780
     781void VBoxExtHashVisit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor)
     782{
     783    uint32_t iBucket = 0, iEntry = 0;
     784    uint32_t cEntries = pMap->cEntries;
     785
     786    if (!cEntries)
     787        return;
     788
     789    for (; ; ++iBucket)
     790    {
     791        PVBOXEXT_HASHMAP_ENTRY pEntry;
     792        PVBOXEXT_HASHMAP_BUCKET pBucket = &pMap->aBuckets[iBucket];
     793        Assert(iBucket < RT_ELEMENTS(pMap->aBuckets));
     794        VBOXEXT_FOREACH_NODE(pNode, &pBucket->EntryList,
     795            pEntry = RT_FROM_MEMBER(pNode, VBOXEXT_HASHMAP_ENTRY, ListNode);
     796            if (!pfnVisitor(pMap, pEntry->pvKey, pEntry, pvVisitor))
     797                return;
     798
     799            if (++iEntry == cEntries)
     800                return;
     801        );
     802    }
     803
     804    /* should not be here! */
     805    AssertFailed();
     806}
     807
     808void VBoxExtHashCleanup(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor)
     809{
     810    VBoxExtHashVisit(pMap, pfnVisitor, pvVisitor);
     811    vboxExtHashInitEntries(pMap);
     812}
     813
     814static DECLCALLBACK(bool) vboxExtCacheCleanupCb(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor)
     815{
     816    PVBOXEXT_HASHCACHE pCache = VBOXEXT_HASHCACHE_FROM_MAP(pMap);
     817    PVBOXEXT_HASHCACHE_ENTRY pCacheEntry = VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(pValue);
     818    pCache->pfnCleanupEntry(pvKey, pCacheEntry);
     819    return TRUE;
     820}
     821
     822void VBoxExtCacheCleanup(PVBOXEXT_HASHCACHE pCache)
     823{
     824    VBoxExtHashCleanup(&pCache->Map, vboxExtCacheCleanupCb, NULL);
     825}
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/vboxext.h

    r39648 r42408  
    2020# include <windows.h>
    2121#endif
     22
     23#include <iprt/list.h>
    2224
    2325HRESULT VBoxExtCheckInit();
     
    4547HRESULT VBoxExtWndCreate(DWORD width, DWORD height, HWND *phWnd, HDC *phDC);
    4648
     49
     50/* hashmap */
     51typedef DECLCALLBACK(uint32_t) FNVBOXEXT_HASHMAP_HASH(void *pvKey);
     52typedef FNVBOXEXT_HASHMAP_HASH *PFNVBOXEXT_HASHMAP_HASH;
     53
     54typedef DECLCALLBACK(bool) FNVBOXEXT_HASHMAP_EQUAL(void *pvKey1, void *pvKey2);
     55typedef FNVBOXEXT_HASHMAP_EQUAL *PFNVBOXEXT_HASHMAP_EQUAL;
     56
     57typedef DECLCALLBACK(bool) FNVBOXEXT_HASHMAP_VISITOR(struct VBOXEXT_HASHMAP *pMap, void *pvKey, struct VBOXEXT_HASHMAP_ENTRY *pValue, void *pvVisitor);
     58typedef FNVBOXEXT_HASHMAP_VISITOR *PFNVBOXEXT_HASHMAP_VISITOR;
     59
     60typedef struct VBOXEXT_HASHMAP_ENTRY
     61{
     62    RTLISTNODE ListNode;
     63    void *pvKey;
     64    uint32_t u32Hash;
     65} VBOXEXT_HASHMAP_ENTRY, *PVBOXEXT_HASHMAP_ENTRY;
     66
     67typedef struct VBOXEXT_HASHMAP_BUCKET
     68{
     69    RTLISTNODE EntryList;
     70} VBOXEXT_HASHMAP_BUCKET, *PVBOXEXT_HASHMAP_BUCKET;
     71
     72#define VBOXEXT_HASHMAP_NUM_BUCKETS 29
     73
     74typedef struct VBOXEXT_HASHMAP
     75{
     76    PFNVBOXEXT_HASHMAP_HASH pfnHash;
     77    PFNVBOXEXT_HASHMAP_EQUAL pfnEqual;
     78    uint32_t cEntries;
     79    VBOXEXT_HASHMAP_BUCKET aBuckets[VBOXEXT_HASHMAP_NUM_BUCKETS];
     80} VBOXEXT_HASHMAP, *PVBOXEXT_HASHMAP;
     81
     82void VBoxExtHashInit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_HASH pfnHash, PFNVBOXEXT_HASHMAP_EQUAL pfnEqual);
     83PVBOXEXT_HASHMAP_ENTRY VBoxExtHashPut(PVBOXEXT_HASHMAP pMap, void *pvKey, PVBOXEXT_HASHMAP_ENTRY pEntry);
     84PVBOXEXT_HASHMAP_ENTRY VBoxExtHashGet(PVBOXEXT_HASHMAP pMap, void *pvKey);
     85PVBOXEXT_HASHMAP_ENTRY VBoxExtHashRemove(PVBOXEXT_HASHMAP pMap, void *pvKey);
     86void* VBoxExtHashRemoveEntry(PVBOXEXT_HASHMAP pMap, PVBOXEXT_HASHMAP_ENTRY pEntry);
     87void VBoxExtHashVisit(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor);
     88void VBoxExtHashCleanup(PVBOXEXT_HASHMAP pMap, PFNVBOXEXT_HASHMAP_VISITOR pfnVisitor, void *pvVisitor);
     89
     90DECLINLINE(uint32_t) VBoxExtHashSize(PVBOXEXT_HASHMAP pMap)
     91{
     92    return pMap->cEntries;
     93}
     94
     95DECLINLINE(void*) VBoxExtHashEntryKey(PVBOXEXT_HASHMAP_ENTRY pEntry)
     96{
     97    return pEntry->pvKey;
     98}
     99
     100typedef DECLCALLBACK(void) FNVBOXEXT_HASHCACHE_CLEANUP_ENTRY(void *pvKey, struct VBOXEXT_HASHCACHE_ENTRY *pEntry);
     101typedef FNVBOXEXT_HASHCACHE_CLEANUP_ENTRY *PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY;
     102
     103typedef struct VBOXEXT_HASHCACHE_ENTRY
     104{
     105    VBOXEXT_HASHMAP_ENTRY MapEntry;
     106    uint32_t u32Usage;
     107} VBOXEXT_HASHCACHE_ENTRY, *PVBOXEXT_HASHCACHE_ENTRY;
     108
     109typedef struct VBOXEXT_HASHCACHE
     110{
     111    VBOXEXT_HASHMAP Map;
     112    uint32_t cMaxElements;
     113    PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY pfnCleanupEntry;
     114} VBOXEXT_HASHCACHE, *PVBOXEXT_HASHCACHE;
     115
     116#define VBOXEXT_HASHCACHE_FROM_MAP(_pMap) RT_FROM_MEMBER((_pMap), VBOXEXT_HASHCACHE, Map)
     117#define VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(_pEntry) RT_FROM_MEMBER((_pEntry), VBOXEXT_HASHCACHE_ENTRY, MapEntry)
     118
     119DECLINLINE(void) VBoxExtCacheInit(PVBOXEXT_HASHCACHE pCache, uint32_t cMaxElements,
     120        PFNVBOXEXT_HASHMAP_HASH pfnHash,
     121        PFNVBOXEXT_HASHMAP_EQUAL pfnEqual,
     122        PFNVBOXEXT_HASHCACHE_CLEANUP_ENTRY pfnCleanupEntry)
     123{
     124    VBoxExtHashInit(&pCache->Map, pfnHash, pfnEqual);
     125    pCache->cMaxElements = cMaxElements;
     126    pCache->pfnCleanupEntry = pfnCleanupEntry;
     127}
     128
     129DECLINLINE(PVBOXEXT_HASHCACHE_ENTRY) VBoxExtCacheGet(PVBOXEXT_HASHCACHE pCache, void *pvKey)
     130{
     131    PVBOXEXT_HASHMAP_ENTRY pEntry = VBoxExtHashRemove(&pCache->Map, pvKey);
     132    return VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(pEntry);
     133}
     134
     135DECLINLINE(void) VBoxExtCachePut(PVBOXEXT_HASHCACHE pCache, void *pvKey, PVBOXEXT_HASHCACHE_ENTRY pEntry)
     136{
     137    PVBOXEXT_HASHMAP_ENTRY pOldEntry = VBoxExtHashPut(&pCache->Map, pvKey, &pEntry->MapEntry);
     138    PVBOXEXT_HASHCACHE_ENTRY pOld;
     139    if (!pOldEntry)
     140        return;
     141    pOld = VBOXEXT_HASHCACHE_ENTRY_FROM_MAP(pOldEntry);
     142    if (pOld != pEntry)
     143        pCache->pfnCleanupEntry(pvKey, pOld);
     144}
     145
     146void VBoxExtCacheCleanup(PVBOXEXT_HASHCACHE pCache);
     147
     148DECLINLINE(void) VBoxExtCacheTerm(PVBOXEXT_HASHCACHE pCache)
     149{
     150    VBoxExtCacheCleanup(pCache);
     151}
     152
    47153#endif /* #ifndef ___VBOXEXT_H__*/
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h

    r42285 r42408  
    18011801    UINT                    numContexts;
    18021802
     1803#ifdef VBOX_WINE_WITH_SHADER_CACHE
     1804    VBOXEXT_HASHCACHE vshaderCache;
     1805    VBOXEXT_HASHCACHE pshaderCache;
     1806#endif
     1807
    18031808    /* High level patch management */
    18041809#define PATCHMAP_SIZE 43
     
    29292934    struct list     shader_list_entry;
    29302935
     2936#ifdef VBOX_WINE_WITH_SHADER_CACHE
     2937    VBOXEXT_HASHCACHE_ENTRY CacheEntry;
     2938    uint32_t u32CacheDataInited;
     2939    uint32_t u32Hash;
     2940#endif
    29312941} IWineD3DBaseShaderClass;
    29322942
     
    30953105        struct ps_compile_args *args) DECLSPEC_HIDDEN;
    30963106
     3107#ifdef VBOX_WINE_WITH_SHADER_CACHE
     3108IWineD3DVertexShaderImpl * vertexshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DVertexShaderImpl *object) DECLSPEC_HIDDEN;
     3109IWineD3DPixelShaderImpl * pixelshader_check_cached(IWineD3DDeviceImpl *device, IWineD3DPixelShaderImpl *object) DECLSPEC_HIDDEN;
     3110void shader_chaches_init(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
     3111void shader_chaches_term(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
     3112#endif
     3113
    30973114/* sRGB correction constants */
    30983115static const float srgb_cmp = 0.0031308f;
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