| 844 | } |
| 845 | |
| 846 | bool CoreChecks::VerifyQueryIsReset(const vvl::CommandBuffer& cb_state, const QueryObject& query_obj, const Location& loc, |
| 847 | uint32_t perf_query_pass, QueryMap* local_query_to_state_map) { |
| 848 | bool skip = false; |
| 849 | const auto& state_data = cb_state.dev_data; |
| 850 | |
| 851 | auto query_pool_state = state_data.Get<vvl::QueryPool>(query_obj.pool); |
| 852 | ASSERT_AND_RETURN_SKIP(query_pool_state); |
| 853 | const auto& query_pool_ci = query_pool_state->create_info; |
| 854 | |
| 855 | QueryState state = GetLocalQueryState(local_query_to_state_map, query_obj.pool, query_obj.slot, perf_query_pass); |
| 856 | // If reset was in another command buffer, check the global map |
| 857 | if (state == QUERYSTATE_UNKNOWN) { |
| 858 | state = query_pool_state->GetQueryState(query_obj.slot, perf_query_pass); |
| 859 | } |
| 860 | // Performance queries have limitation upon when they can be |
| 861 | // reset. |
| 862 | if (query_pool_ci.queryType == VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR && state == QUERYSTATE_UNKNOWN && |
| 863 | perf_query_pass >= query_pool_state->n_performance_passes) { |
| 864 | // If the pass is invalid, assume RESET state, another error |
| 865 | // will be raised in ValidatePerformanceQuery(). |
| 866 | state = QUERYSTATE_RESET; |
| 867 | } |
| 868 | |
| 869 | if (state != QUERYSTATE_RESET) { |
| 870 | const LogObjectList objlist(cb_state.Handle(), query_obj.pool); |
| 871 | const vvl::Func command = loc.function; |
| 872 | |
| 873 | // Most of these VUIDs and the call sites of this function are not tested so we set here |
| 874 | // some default VUID name and assert in debug builds to detect unexpected callers. |
| 875 | const char* unexpected_caller_vuid = "UNASSIGNED-CoreValidation-QueryReset"; |
| 876 | const char* vuid = (command == Func::vkCmdBeginQuery) ? "VUID-vkCmdBeginQuery-None-00807" |
| 877 | : (command == Func::vkCmdBeginQueryIndexedEXT) ? "VUID-vkCmdBeginQueryIndexedEXT-None-00807" |
| 878 | : (command == Func::vkCmdWriteTimestamp) ? "VUID-vkCmdWriteTimestamp-None-00830" |
| 879 | : (command == Func::vkCmdWriteTimestamp2) ? "VUID-vkCmdWriteTimestamp2-None-03864" |
| 880 | : (command == Func::vkCmdDecodeVideoKHR) ? "VUID-vkCmdDecodeVideoKHR-pNext-08366" |
| 881 | : (command == Func::vkCmdEncodeVideoKHR) ? "VUID-vkCmdEncodeVideoKHR-pNext-08361" |
| 882 | : (command == Func::vkCmdWriteAccelerationStructuresPropertiesKHR) |
| 883 | ? "VUID-vkCmdWriteAccelerationStructuresPropertiesKHR-queryPool-02494" |
| 884 | : unexpected_caller_vuid; |
| 885 | assert(strcmp(vuid, unexpected_caller_vuid) != 0); |
| 886 | |
| 887 | skip |= state_data.LogError( |
| 888 | vuid, objlist, loc, |
| 889 | "%s and query %" PRIu32 |
| 890 | ": query not reset. " |
| 891 | "After query pool creation, each query must be reset (with vkCmdResetQueryPool or vkResetQueryPool) before it is used. " |
| 892 | "Queries must also be reset between uses.", |
| 893 | state_data.FormatHandle(query_obj.pool).c_str(), query_obj.slot); |
| 894 | } |
| 895 | |
| 896 | return skip; |
| 897 | } |
| 898 | |
| 899 | bool CoreChecks::ValidatePerformanceQuery(const vvl::CommandBuffer& cb_state, const QueryObject& query_obj, const Location& loc, |
| 900 | VkQueryPool& first_perf_query_pool, uint32_t perf_query_pass, |
no test coverage detected