vsg 1.1.3
VulkanSceneGraph library
Loading...
Searching...
No Matches
QueryPool.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2022 Josef Stumpfegger & Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/core/Object.h>
16#include <vsg/vk/Context.h>
17#include <vsg/vk/Device.h>
18
19namespace vsg
20{
22 class VSG_DECLSPEC QueryPool : public Inherit<Object, QueryPool>
23 {
24 public:
27
29 QueryPool(Device* device, VkQueryPoolCreateFlags in_flags, VkQueryType in_queryType, uint32_t in_queryCount, VkQueryPipelineStatisticFlags in_pipelineStatistics);
30
31 operator VkQueryPool() const { return _queryPool; }
32 VkQueryPool vk() const { return _queryPool; }
33
34 VkQueryPoolCreateFlags flags = 0;
35 VkQueryType queryType = VK_QUERY_TYPE_TIMESTAMP;
36 uint32_t queryCount = 1;
37 VkQueryPipelineStatisticFlags pipelineStatistics = 0;
38
39 void read(Input& input) override;
40 void write(Output& output) const override;
41
42 void reset();
43
44 VkResult getResults(std::vector<uint32_t>& results, uint32_t firstQuery = 0, VkQueryResultFlags resultsFlags = VK_QUERY_RESULT_WAIT_BIT) const;
45 VkResult getResults(std::vector<uint64_t>& results, uint32_t firstQuery = 0, VkQueryResultFlags resultsFlags = VK_QUERY_RESULT_WAIT_BIT | VK_QUERY_RESULT_64_BIT) const;
46
48 void compile(Device* device);
49
51 void compile(Context& context);
52
53 protected:
54 ~QueryPool();
55
56 VkQueryPool _queryPool{};
57 ref_ptr<Device> _device{};
58 };
59 VSG_type_name(vsg::QueryPool);
60
61} // namespace vsg
Definition Context.h:67
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition Device.h:37
Definition Inherit.h:28
QueryPool encapsulates the VkQueryPool and the VkQueryPoolCreateInfo settings used to set it up.
Definition QueryPool.h:23
void compile(Context &context)
call compile(context.deivce)
QueryPool()
construct QueuePool and defer creation kQueuePool to compile().
QueryPool(Device *device, VkQueryPoolCreateFlags in_flags, VkQueryType in_queryType, uint32_t in_queryCount, VkQueryPipelineStatisticFlags in_pipelineStatistics)
construct QueryPool and create a vkQueuePool for it
void compile(Device *device)
create the Querypool
Definition ref_ptr.h:22