Commit 86f8bdb2 by Alexis Hetu Committed by Alexis Hétu

QueryPool object creation

Added QueryPool object. Fixes all tests in: dEQP-VK.api.object_management.*.query_pool Change-Id: Ie564848b616714c39961e7a80bc421ec7bb0ef58 Reviewed-on: https://swiftshader-review.googlesource.com/c/23948Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com>
parent 6ab37b0f
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "VkPipelineCache.hpp" #include "VkPipelineCache.hpp"
#include "VkPipelineLayout.hpp" #include "VkPipelineLayout.hpp"
#include "VkPhysicalDevice.hpp" #include "VkPhysicalDevice.hpp"
#include "VkQueryPool.hpp"
#include "VkQueue.hpp" #include "VkQueue.hpp"
#include "VkSampler.hpp" #include "VkSampler.hpp"
#include "VkSemaphore.hpp" #include "VkSemaphore.hpp"
......
// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "VkQueryPool.hpp"
namespace vk
{
QueryPool::QueryPool(const VkQueryPoolCreateInfo* pCreateInfo, void* mem) :
queryCount(pCreateInfo->queryCount)
{
// According to the Vulkan spec, section 34.1. Features:
// "pipelineStatisticsQuery specifies whether the pipeline statistics
// queries are supported. If this feature is not enabled, queries of
// type VK_QUERY_TYPE_PIPELINE_STATISTICS cannot be created, and
// none of the VkQueryPipelineStatisticFlagBits bits can be set in the
// pipelineStatistics member of the VkQueryPoolCreateInfo structure."
if(pCreateInfo->queryType == VK_QUERY_TYPE_PIPELINE_STATISTICS)
{
UNIMPLEMENTED();
}
}
size_t QueryPool::ComputeRequiredAllocationSize(const VkQueryPoolCreateInfo* pCreateInfo)
{
return 0;
}
void QueryPool::getResults(uint32_t pFirstQuery, uint32_t pQueryCount, size_t pDataSize,
void* pData, VkDeviceSize pStride, VkQueryResultFlags pFlags) const
{
// dataSize must be large enough to contain the result of each query
ASSERT(static_cast<size_t>(pStride * pQueryCount) <= pDataSize);
// The sum of firstQuery and queryCount must be less than or equal to the number of queries
ASSERT((pFirstQuery + pQueryCount) <= queryCount);
char* data = static_cast<char*>(pData);
for(uint32_t i = 0; i < pQueryCount; i++, data += pStride)
{
UNIMPLEMENTED();
}
}
} // namespace vk
// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef VK_QUERY_POOL_HPP_
#define VK_QUERY_POOL_HPP_
#include "VkObject.hpp"
namespace vk
{
class QueryPool : public Object<QueryPool, VkQueryPool>
{
public:
QueryPool(const VkQueryPoolCreateInfo* pCreateInfo, void* mem);
~QueryPool() = delete;
static size_t ComputeRequiredAllocationSize(const VkQueryPoolCreateInfo* pCreateInfo);
void getResults(uint32_t pFirstQuery, uint32_t pQueryCount, size_t pDataSize,
void* pData, VkDeviceSize pStride, VkQueryResultFlags pFlags) const;
private:
uint32_t queryCount;
};
static inline QueryPool* Cast(VkQueryPool object)
{
return reinterpret_cast<QueryPool*>(object);
}
} // namespace vk
#endif // VK_QUERY_POOL_HPP_
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "VkPipeline.hpp" #include "VkPipeline.hpp"
#include "VkPipelineCache.hpp" #include "VkPipelineCache.hpp"
#include "VkPipelineLayout.hpp" #include "VkPipelineLayout.hpp"
#include "VkQueryPool.hpp"
#include "VkQueue.hpp" #include "VkQueue.hpp"
#include "VkSampler.hpp" #include "VkSampler.hpp"
#include "VkSemaphore.hpp" #include "VkSemaphore.hpp"
...@@ -747,21 +748,32 @@ VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) ...@@ -747,21 +748,32 @@ VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event)
VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool) VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool)
{ {
TRACE("()"); TRACE("(VkDevice device = 0x%X, const VkQueryPoolCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkQueryPool* pQueryPool = 0x%X)",
device, pCreateInfo, pAllocator, pQueryPool);
if(pCreateInfo->pNext || pCreateInfo->flags)
{
UNIMPLEMENTED(); UNIMPLEMENTED();
return VK_SUCCESS; }
return vk::QueryPool::Create(pAllocator, pCreateInfo, pQueryPool);
} }
VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator) VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator)
{ {
TRACE("()"); TRACE("(VkDevice device = 0x%X, VkQueryPool queryPool = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X)",
UNIMPLEMENTED(); device, queryPool, pAllocator);
vk::destroy(queryPool, pAllocator);
} }
VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags) VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags)
{ {
TRACE("()"); TRACE("(VkDevice device = 0x%X, VkQueryPool queryPool = 0x%X, uint32_t firstQuery = %d, uint32_t queryCount = %d, size_t dataSize = %d, void* pData = 0x%X, VkDeviceSize stride = 0x%X, VkQueryResultFlags flags = %d)",
UNIMPLEMENTED(); device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
vk::Cast(queryPool)->getResults(firstQuery, queryCount, dataSize, pData, stride, flags);
return VK_SUCCESS; return VK_SUCCESS;
} }
......
...@@ -116,6 +116,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor ...@@ -116,6 +116,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor
<ClCompile Include="VkPipeline.cpp" /> <ClCompile Include="VkPipeline.cpp" />
<ClCompile Include="VkPipelineLayout.cpp" /> <ClCompile Include="VkPipelineLayout.cpp" />
<ClCompile Include="VkPromotedExtensions.cpp" /> <ClCompile Include="VkPromotedExtensions.cpp" />
<ClCompile Include="VkQueryPool.cpp" />
<ClCompile Include="VkQueue.cpp" /> <ClCompile Include="VkQueue.cpp" />
<ClCompile Include="VkRenderPass.cpp" /> <ClCompile Include="VkRenderPass.cpp" />
<ClCompile Include="VkShaderModule.cpp" /> <ClCompile Include="VkShaderModule.cpp" />
...@@ -213,6 +214,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor ...@@ -213,6 +214,7 @@ copy "$(OutDir)vk_swiftshader.dll" "$(SolutionDir)out\$(Configuration)_$(Platfor
<ClInclude Include="VkPipeline.hpp" /> <ClInclude Include="VkPipeline.hpp" />
<ClInclude Include="VkPipelineCache.hpp" /> <ClInclude Include="VkPipelineCache.hpp" />
<ClInclude Include="VkPipelineLayout.hpp" /> <ClInclude Include="VkPipelineLayout.hpp" />
<ClInclude Include="VkQueryPool.hpp" />
<ClInclude Include="VkQueue.hpp" /> <ClInclude Include="VkQueue.hpp" />
<ClInclude Include="VkRenderPass.hpp" /> <ClInclude Include="VkRenderPass.hpp" />
<ClInclude Include="VkSampler.hpp" /> <ClInclude Include="VkSampler.hpp" />
......
...@@ -255,6 +255,9 @@ ...@@ -255,6 +255,9 @@
<ClCompile Include="VkShaderModule.cpp"> <ClCompile Include="VkShaderModule.cpp">
<Filter>Source Files\Vulkan</Filter> <Filter>Source Files\Vulkan</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="VkQueryPool.cpp">
<Filter>Source Files\Vulkan</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="resource.h"> <ClInclude Include="resource.h">
...@@ -320,6 +323,9 @@ ...@@ -320,6 +323,9 @@
<ClInclude Include="VkPhysicalDevice.hpp"> <ClInclude Include="VkPhysicalDevice.hpp">
<Filter>Header Files\Vulkan</Filter> <Filter>Header Files\Vulkan</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="VkQueryPool.hpp">
<Filter>Header Files\Vulkan</Filter>
</ClInclude>
<ClInclude Include="VkQueue.hpp"> <ClInclude Include="VkQueue.hpp">
<Filter>Header Files\Vulkan</Filter> <Filter>Header Files\Vulkan</Filter>
</ClInclude> </ClInclude>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment