diff options
| author | Michael Lentine <mlentine@google.com> | 2016-02-02 18:29:30 -0600 |
|---|---|---|
| committer | Tobin Ehlis <tobine@google.com> | 2016-02-04 08:44:26 -0700 |
| commit | 96591cd784afc7b62d146572db2882329ad2ab04 (patch) | |
| tree | c86e36206bc9d6b1f9d34ca946a28350bce5b0ba | |
| parent | 43923ec1a4a0278b682dd57127ad4889dd392402 (diff) | |
| download | usermoji-96591cd784afc7b62d146572db2882329ad2ab04.tar.xz | |
layers: Valdiate query is not active when cmd buffer is ending.
| -rw-r--r-- | layers/draw_state.cpp | 13 | ||||
| -rwxr-xr-x | layers/draw_state.h | 1 | ||||
| -rw-r--r-- | layers/vk_validation_layer_details.md | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index e10de464..c2c480f9 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -2764,6 +2764,7 @@ static void resetCB(layer_data* my_data, const VkCommandBuffer cb) pCB->waitedEvents.clear(); pCB->waitedEventsBeforeQueryReset.clear(); pCB->queryToStateMap.clear(); + pCB->activeQueries.clear(); pCB->secondaryCommandBuffers.clear(); } } @@ -4428,6 +4429,10 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffe if (pCB->state != CB_RECORDING) { skipCall |= report_error_no_cb_begin(dev_data, commandBuffer, "vkEndCommandBuffer()"); } + for (auto query : pCB->activeQueries) { + skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_QUERY, "DS", + "Ending command buffer with in progress query: queryPool %" PRIu64 ", index %d", (uint64_t)(query.pool), query.index); + } } if (VK_FALSE == skipCall) { result = dev_data->device_dispatch_table->EndCommandBuffer(commandBuffer); @@ -5514,6 +5519,8 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer comma layer_data* dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map); GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer); if (pCB) { + QueryObject query = {queryPool, slot}; + pCB->activeQueries.insert(query); skipCall |= addCmd(dev_data, pCB, CMD_BEGINQUERY, "vkCmdBeginQuery()"); } if (VK_FALSE == skipCall) @@ -5527,6 +5534,12 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer command GLOBAL_CB_NODE* pCB = getCBNode(dev_data, commandBuffer); if (pCB) { QueryObject query = {queryPool, slot}; + if (!pCB->activeQueries.count(query)) { + skipCall |= log_msg(dev_data->report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, (VkDebugReportObjectTypeEXT)0, 0, __LINE__, DRAWSTATE_INVALID_QUERY, "DS", + "Ending a query before it was started: queryPool %" PRIu64 ", index %d", (uint64_t)(queryPool), slot); + } else { + pCB->activeQueries.erase(query); + } pCB->queryToStateMap[query] = 1; if (pCB->state == CB_RECORDING) { skipCall |= addCmd(dev_data, pCB, CMD_ENDQUERY, "VkCmdEndQuery()"); diff --git a/layers/draw_state.h b/layers/draw_state.h index 9d7dcecc..f8cf2f13 100755 --- a/layers/draw_state.h +++ b/layers/draw_state.h @@ -537,6 +537,7 @@ typedef struct _GLOBAL_CB_NODE { vector<VkEvent> waitedEvents; unordered_map<QueryObject, vector<VkEvent> > waitedEventsBeforeQueryReset; unordered_map<QueryObject, bool> queryToStateMap; // 0 is unavailable, 1 is available + unordered_set<QueryObject> activeQueries; unordered_map<VkImage, IMAGE_CMD_BUF_NODE> imageLayoutMap; vector<DRAW_DATA> drawData; DRAW_DATA currentDrawData; diff --git a/layers/vk_validation_layer_details.md b/layers/vk_validation_layer_details.md index 4a78b5b3..d4f1269d 100644 --- a/layers/vk_validation_layer_details.md +++ b/layers/vk_validation_layer_details.md @@ -71,7 +71,7 @@ The VK_LAYER_LUNARG_draw_state layer tracks state leading into Draw cmds. This i | Verify Memory Buffer Not Deleted | Validate Command Buffer not submitted with deleted memory buffer | INVALID_BUFFER | vkQueueSubmit | TBD | None | | Verify Memory Buffer Destroy | Validate memory buffers are not destroyed more than once | DOUBLE_DESTROY | vkDestroyBuffer | TBD | None | | Verify Object Not In Use | Validate that object being freed or modified is not in use | OBJECT_INUSE | vkDestroyBuffer vkFreeDescriptorSets vkUpdateDescriptorSets | TBD | None | -| Verify Get Queries| Validate that that queries are properly initialized and synchronized | INVALID_QUERY | vkGetFenceStatus vkQueueWaitIdle vkWaitForFences vkDeviceWaitIdle | TBD | None | +| Verify Get Queries| Validate that that queries are properly setup, initialized, synchronized | INVALID_QUERY | vkGetFenceStatus vkQueueWaitIdle vkWaitForFences vkDeviceWaitIdle vkCmdBeginQuery vkCmdEndQuery| TBD | None | | Live Semaphore | When waiting on a semaphore, need to make sure that the semaphore is live and therefore can be signalled, otherwise queue is stalled and cannot make forward progress. | QUEUE_FORWARD_PROGRESS | vkQueueSubmit vkQueueBindSparse vkQueuePresentKHR vkAcquireNextImageKHR | TODO | Create test | | Storage Buffer Alignment | Storage Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_STORAGE_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | | Uniform Buffer Alignment | Uniform Buffer offsets in BindDescriptorSets must agree with offset alignment device limit | INVALID_UNIFORM_BUFFER_OFFSET | vkCmdBindDescriptorSets | TODO | Create test | |
