diff options
| author | Tobin Ehlis <tobin@lunarg.com> | 2015-02-23 16:09:58 -0700 |
|---|---|---|
| committer | Tobin Ehlis <tobin@lunarg.com> | 2015-02-23 16:11:38 -0700 |
| commit | 6dc750ce58c77b309f6d55c71e7b7390f07c2e64 (patch) | |
| tree | d8f22d582f65df9f25bd4f3c14ddfd44e27c8dfe | |
| parent | cfe875fc793205405c28f9bf19178e388ab158f3 (diff) | |
| download | usermoji-6dc750ce58c77b309f6d55c71e7b7390f07c2e64.tar.xz | |
layers: In DrawState correctly clear update chain for Struct Node
| -rw-r--r-- | layers/draw_state.c | 17 | ||||
| -rw-r--r-- | layers/draw_state.h | 3 |
2 files changed, 12 insertions, 8 deletions
diff --git a/layers/draw_state.c b/layers/draw_state.c index 8208241e..de9d71c5 100644 --- a/layers/draw_state.c +++ b/layers/draw_state.c @@ -765,6 +765,7 @@ static GENERIC_HEADER* shadowUpdateNode(GENERIC_HEADER* pUpdate) size_t baseBuffAddr = 0; XGL_UPDATE_BUFFERS* pUBCI; XGL_UPDATE_IMAGES* pUICI; + char str[1024]; switch (pUpdate->sType) { case XGL_STRUCTURE_TYPE_UPDATE_SAMPLERS: @@ -849,14 +850,15 @@ static GENERIC_HEADER* shadowUpdateNode(GENERIC_HEADER* pUpdate) memcpy(pNewNode, pUpdate, sizeof(XGL_UPDATE_AS_COPY)); break; default: - // TODO : Flag specific error for this case + sprintf(str, "Unexpected UPDATE struct of type %s (value %u) in xglUpdateDescriptors() struct tree", string_XGL_STRUCTURE_TYPE(pUpdate->sType), pUpdate->sType); + layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, NULL, 0, DRAWSTATE_INVALID_UPDATE_STRUCT, "DS", str); return NULL; } // Make sure that pNext for the end of shadow copy is NULL pNewNode->pNext = NULL; return pNewNode; } -// For given ds, update it's mapping based on pUpdateChain linked-list +// For given ds, update its mapping based on pUpdateChain linked-list static void dsUpdate(XGL_DESCRIPTOR_SET ds, GENERIC_HEADER* pUpdateChain) { SET_NODE* pSet = getSetNode(ds); @@ -920,11 +922,12 @@ static void dsUpdate(XGL_DESCRIPTOR_SET ds, GENERIC_HEADER* pUpdateChain) } loader_platform_thread_unlock_mutex(&globalLock); } -// Free a shadowed update node +// Free the shadowed update node for this Set // NOTE : Calls to this function should be wrapped in mutex -static void freeShadowUpdateTree(GENERIC_HEADER* pUpdate) +static void freeShadowUpdateTree(SET_NODE* pSet) { - GENERIC_HEADER* pShadowUpdate = pUpdate; + GENERIC_HEADER* pShadowUpdate = pSet->pUpdateStructs; + pSet->pUpdateStructs = NULL; GENERIC_HEADER* pFreeUpdate = pShadowUpdate; while(pShadowUpdate) { pFreeUpdate = pShadowUpdate; @@ -1011,7 +1014,7 @@ static void freeRegions() pSet = pSet->pNext; // Freeing layouts handled in freeLayouts() function // Free Update shadow struct tree - freeShadowUpdateTree(pFreeSet->pUpdateStructs); + freeShadowUpdateTree(pFreeSet); if (pFreeSet->ppDescriptors) { #if ALLOC_DEBUG printf("Free35 #%lu pSet->ppDescriptors addr(%p)\n", ++g_free_count, (void*)pFreeSet->ppDescriptors); @@ -1079,7 +1082,7 @@ static void clearDescriptorSet(XGL_DESCRIPTOR_SET set) } else { loader_platform_thread_lock_mutex(&globalLock); - freeShadowUpdateTree(pSet->pUpdateStructs); + freeShadowUpdateTree(pSet); loader_platform_thread_unlock_mutex(&globalLock); } } diff --git a/layers/draw_state.h b/layers/draw_state.h index 18280f7a..7466e389 100644 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -43,7 +43,8 @@ typedef enum _DRAW_STATE_ERROR DRAWSTATE_OUT_OF_MEMORY, // malloc failed DRAWSTATE_DESCRIPTOR_TYPE_MISMATCH, // Type in layout vs. update are not the same DRAWSTATE_DESCRIPTOR_UPDATE_OUT_OF_BOUNDS, // Descriptors set for update out of bounds for corresponding layout section - DRAWSTATE_INVALID_UPDATE_INDEX // Index of requested update is invalid for specified descriptors set + DRAWSTATE_INVALID_UPDATE_INDEX, // Index of requested update is invalid for specified descriptors set + DRAWSTATE_INVALID_UPDATE_STRUCT // Struct in DS Update tree is of invalid type } DRAW_STATE_ERROR; typedef enum _DRAW_TYPE |
