1 // Copyright 2018 The SwiftShader Authors. All Rights Reserved. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include "VkQueryPool.hpp" 16 17 namespace vk 18 { QueryPool(const VkQueryPoolCreateInfo * pCreateInfo,void * mem)19 QueryPool::QueryPool(const VkQueryPoolCreateInfo* pCreateInfo, void* mem) : 20 queryCount(pCreateInfo->queryCount) 21 { 22 // According to the Vulkan spec, section 34.1. Features: 23 // "pipelineStatisticsQuery specifies whether the pipeline statistics 24 // queries are supported. If this feature is not enabled, queries of 25 // type VK_QUERY_TYPE_PIPELINE_STATISTICS cannot be created, and 26 // none of the VkQueryPipelineStatisticFlagBits bits can be set in the 27 // pipelineStatistics member of the VkQueryPoolCreateInfo structure." 28 if(pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS) 29 { 30 UNIMPLEMENTED(); 31 } 32 } 33 ComputeRequiredAllocationSize(const VkQueryPoolCreateInfo * pCreateInfo)34 size_t QueryPool::ComputeRequiredAllocationSize(const VkQueryPoolCreateInfo* pCreateInfo) 35 { 36 return 0; 37 } 38 getResults(uint32_t pFirstQuery,uint32_t pQueryCount,size_t pDataSize,void * pData,VkDeviceSize pStride,VkQueryResultFlags pFlags) const39 void QueryPool::getResults(uint32_t pFirstQuery, uint32_t pQueryCount, size_t pDataSize, 40 void* pData, VkDeviceSize pStride, VkQueryResultFlags pFlags) const 41 { 42 // dataSize must be large enough to contain the result of each query 43 ASSERT(static_cast<size_t>(pStride * pQueryCount) <= pDataSize); 44 45 // The sum of firstQuery and queryCount must be less than or equal to the number of queries 46 ASSERT((pFirstQuery + pQueryCount) <= queryCount); 47 48 char* data = static_cast<char*>(pData); 49 for(uint32_t i = 0; i < pQueryCount; i++, data += pStride) 50 { 51 UNIMPLEMENTED(); 52 } 53 } 54 } // namespace vk 55