VPP  0.7
A high-level modern C++ API for Vulkan
vppComputationEngine.hpp
1 /*
2  Copyright 2016-2018 SOFT-ERG, Przemek Kuczmierczyk (www.softerg.com)
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification,
6  are permitted provided that the following conditions are met:
7 
8  1. Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  2. Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
17  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 // -----------------------------------------------------------------------------
28 namespace vpp {
29 // -----------------------------------------------------------------------------
30 
47 {
48 public:
59  ComputationEngine ( const Device& hDevice, EQueueType queueType = Q_GRAPHICS );
60 
67  ComputationEngine ( const Queue& hQueue );
68 
78  ComputationEngine ( const Queue& hQueue, const CommandPool& hCommandPool );
79 
90  ComputationEngine ( const CommandPool& hCommandPool );
91 
100  void compile();
101 
108  void wait();
109 
113  const Device& device() const;
114 };
115 
116 // -----------------------------------------------------------------------------
125 class Computation : public ComputePass
126 {
127 public:
132  Computation();
133 
139  Computation ( Computation& predecessor );
140 
149  void operator()( const Fence& sigFenceOnEnd = Fence() );
150 
163  bool operator()( std::uint64_t waitTimeout );
164 
172  void operator()( const Queue& hQueue, const Fence& sigFenceOnEnd = Fence() );
173 
184  void operator()(
185  const Queue& hQueue,
186  const Semaphore& waitSem,
187  const Semaphore& sigSem = Semaphore() );
188 };
189 
190 // -----------------------------------------------------------------------------
191 } // namespace vpp
192 // -----------------------------------------------------------------------------
Represents logical rendering device.
Definition: vppDevice.hpp:49
Represents compute pass.
Definition: vppComputePass.hpp:139
Base class for single computation routine.
Definition: vppComputationEngine.hpp:125
The VPP namespace.
Definition: main.hpp:1
void compile()
Compiles all computations.
Allows the GPU to wait for another GPU operation to finish.
Definition: vppSynchronization.hpp:127
void operator()(const Fence &sigFenceOnEnd=Fence())
Launches a computation on GPU.
Allows the CPU to wait for GPU operation to finish.
Definition: vppSynchronization.hpp:41
const Device & device() const
Retrieves the device.
Definition: vppCommands.hpp:498
Allocates and manages the lifetime of command buffers.
Definition: vppCommandPool.hpp:36
Computation()
Creates a computation without dependency.
Command queue for execution of commands.
Definition: vppQueue.hpp:65
ComputationEngine(const Device &hDevice, EQueueType queueType=Q_GRAPHICS)
Construct a computation engine attached to specified device and default command queue.
void wait()
Waits for all computations to finish.
Base class for computation engines.
Definition: vppComputationEngine.hpp:46