圖例:
- 未更動
- 新增
- 刪除
-
trunk
- 屬性 svn:mergeinfo 變動
/branches/VBox-4.3 已合併: 95451
- 屬性 svn:mergeinfo 變動
-
trunk/src/VBox
- 屬性 svn:mergeinfo 變動
/branches/VBox-4.3/src/VBox 已合併: 95451
- 屬性 svn:mergeinfo 變動
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state.h
r44290 r52329 77 77 void crStateGenNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names); 78 78 void crStateRegNames(CRContext *g, CRHashTable *table, GLsizei n, GLuint *names); 79 void crStateOnTextureUsageRelease(CRSharedState *pS, CRTextureObj *pObj); 79 80 #endif -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_init.c
r51559 r52329 50 50 } 51 51 52 53 54 52 /** 55 53 * Callback used for crFreeHashtable(). … … 70 68 } CR_STATE_RELEASEOBJ, *PCR_STATE_RELEASEOBJ; 71 69 70 void crStateOnTextureUsageRelease(CRSharedState *pS, CRTextureObj *pObj) 71 { 72 if (!pObj->pinned) 73 crHashtableDelete(pS->textureTable, pObj->id, crStateDeleteTextureCallback); 74 else 75 Assert(crHashtableSearch(pS->textureTable, pObj->id)); 76 } 77 78 void crStateReleaseTextureInternal(CRSharedState *pS, CRContext *pCtx, CRTextureObj *pObj) 79 { 80 Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj) || pObj->pinned); 81 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 82 if (CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 83 return; 84 85 crStateOnTextureUsageRelease(pS, pObj); 86 } 87 88 DECLEXPORT(void) crStateReleaseTexture(CRContext *pCtx, CRTextureObj *pObj) 89 { 90 Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)); 91 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 92 if (CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 93 return; 94 95 if (!gSharedState) 96 { 97 WARN(("no global shared")); 98 return; 99 } 100 101 crStateOnTextureUsageRelease(gSharedState, pObj); 102 } 103 104 void crStateReleaseBufferObjectInternal(CRSharedState *pS, CRContext *pCtx, CRBufferObject *pObj) 105 { 106 Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)); 107 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 108 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 109 crHashtableDelete(pS->buffersTable, pObj->id, crStateFreeBufferObject); 110 } 111 112 void crStateReleaseFBOInternal(CRSharedState *pS, CRContext *pCtx, CRFramebufferObject *pObj) 113 { 114 Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)); 115 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 116 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 117 crHashtableDelete(pS->fbTable, pObj->id, crStateFreeFBO); 118 } 119 120 void crStateReleaseRBOInternal(CRSharedState *pS, CRContext *pCtx, CRRenderbufferObject *pObj) 121 { 122 Assert(CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)); 123 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pCtx); 124 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 125 crHashtableDelete(pS->rbTable, pObj->id, crStateFreeRBO); 126 } 127 72 128 static void ReleaseTextureCallback(unsigned long key, void *data1, void *data2) 73 129 { 74 130 PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2; 75 131 CRTextureObj *pObj = (CRTextureObj *)data1; 76 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx); 77 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 78 crHashtableDelete(pData->s->textureTable, key, crStateDeleteTextureCallback); 132 crStateReleaseTextureInternal(pData->s, pData->pCtx, pObj); 79 133 } 80 134 … … 83 137 PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2; 84 138 CRBufferObject *pObj = (CRBufferObject *)data1; 85 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx); 86 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 87 crHashtableDelete(pData->s->buffersTable, key, crStateFreeBufferObject); 139 crStateReleaseBufferObjectInternal(pData->s, pData->pCtx, pObj); 88 140 } 89 141 … … 92 144 PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2; 93 145 CRFramebufferObject *pObj = (CRFramebufferObject *)data1; 94 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx); 95 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 96 crHashtableDelete(pData->s->fbTable, key, crStateFreeFBO); 146 crStateReleaseFBOInternal(pData->s, pData->pCtx, pObj); 97 147 } 98 148 … … 101 151 PCR_STATE_RELEASEOBJ pData = (PCR_STATE_RELEASEOBJ)data2; 102 152 CRRenderbufferObject *pObj = (CRRenderbufferObject *)data1; 103 CR_STATE_SHAREDOBJ_USAGE_CLEAR(pObj, pData->pCtx); 104 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pObj)) 105 crHashtableDelete(pData->s->rbTable, key, crStateFreeRBO); 153 crStateReleaseRBOInternal(pData->s, pData->pCtx, pObj); 106 154 } 107 155 -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_texture.c
r50041 r52329 754 754 #endif 755 755 } 756 757 CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g);758 756 } 759 757 … … 795 793 796 794 crStateCleanupTextureRefs(g, tObj); 795 796 CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g); 797 797 798 798 CR_STATE_SHAREDOBJ_USAGE_FOREACH_USED_IDX(tObj, j) … … 804 804 CRContext *ctx = g_pAvailableContexts[j]; 805 805 if (j && ctx) 806 { 806 807 crStateCleanupTextureRefs(ctx, tObj); 808 CR_STATE_SHAREDOBJ_USAGE_CLEAR(tObj, g); 809 } 807 810 else 808 811 CR_STATE_SHAREDOBJ_USAGE_CLEAR_IDX(tObj, j); … … 894 897 } 895 898 899 #ifndef IN_GUEST 900 # ifdef DEBUG 901 static uint32_t gDbgNumPinned = 0; 902 # endif 903 904 DECLEXPORT(void) crStatePinTexture(GLuint texture, GLboolean pin) 905 { 906 CRTextureObj * pTobj; 907 CRSharedState *pShared = crStateGlobalSharedAcquire(); 908 if (pShared) 909 { 910 pTobj = (CRTextureObj*)crHashtableSearch(pShared->textureTable, texture); 911 912 if (pTobj) 913 { 914 # ifdef DEBUG 915 if (!pTobj->pinned != !pin) 916 { 917 if (pin) 918 ++gDbgNumPinned; 919 else 920 { 921 Assert(gDbgNumPinned); 922 --gDbgNumPinned; 923 } 924 } 925 # endif 926 pTobj->pinned = !!pin; 927 if (!pin) 928 { 929 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(pTobj)) 930 crStateOnTextureUsageRelease(pShared, pTobj); 931 } 932 } 933 else 934 WARN(("texture %d not defined", texture)); 935 936 crStateGlobalSharedRelease(); 937 } 938 else 939 WARN(("no global shared")); 940 } 941 #endif 942 896 943 DECLEXPORT(void) crStateSetTextureUsed(GLuint texture, GLboolean used) 897 944 { … … 916 963 #endif 917 964 { 918 crWarning("crStateSetTextureUsed: failed to fined a HW name for texture(%d)!", texture);965 WARN(("crStateSetTextureUsed: failed to fined a HW name for texture(%d)!", texture)); 919 966 return; 920 967 } … … 931 978 crStateCleanupTextureRefs(g, tobj); 932 979 933 if (!CR_STATE_SHAREDOBJ_USAGE_IS_USED(tobj)) 934 { 935 /* on the host side, we need to delete an ogl texture object here as well, which crStateDeleteTextureCallback will do 936 * in addition to calling crStateDeleteTextureObject to delete a state object */ 937 crHashtableDelete(g->shared->textureTable, texture, crStateDeleteTextureCallback); 938 } 980 crStateReleaseTexture(g, tobj); 939 981 940 982 DIRTY(tb->dirty, g->neg_bitid);
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器