VPP  0.7
A high-level modern C++ API for Vulkan
vppContainers.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 
78 template< typename ItemT, unsigned int USAGE >
79 class gvector :
80  public Buffer< USAGE >,
81  public MemoryBinding< Buffer< USAGE >, DeviceMemory >
82 {
83 public:
85  typedef ItemT* iterator;
86 
88  typedef const ItemT* const_iterator;
89 
94  gvector (
95  size_t maxItemCount,
96  MemProfile::ECharacteristic memProfile,
97  const Device& hDevice );
98 
100  iterator begin() { return d_pBegin; }
101 
103  iterator end() { return d_pBegin + d_size; }
104 
106  const_iterator cbegin() const { return d_pBegin; }
107 
109  const_iterator cend() const { return d_pBegin + d_size; }
110 
112  bool empty() const { return d_size == 0; }
113 
115  size_t size() const { return d_size; }
116 
118  size_t capacity() const { return d_capacity; }
119 
121  void push_back ( const ItemT& item );
122 
124  template< typename ... ArgsT >
125  void emplace_back ( ArgsT... args );
126 
128  ItemT* allocate_back();
129 
136  void resize ( size_t newSize, const ItemT& value = ItemT() );
137 
141  void setSize ( size_t newSize );
142 
144  void clear();
145 
147  ItemT& operator[] ( size_t index )
148 
149 
150  const ItemT& operator[] ( size_t index ) const;
151 
155  void cmdCommit (
156  CommandBuffer cmdBuffer,
157  size_t firstItem = 0,
158  size_t nItems = std::numeric_limits< size_t >::max() );
159 
163  void cmdCommitAll (
164  CommandBuffer cmdBuffer,
165  size_t firstItem = 0,
166  size_t nItems = std::numeric_limits< size_t >::max() );
167 
171  void cmdCommit (
172  size_t firstItem = 0,
173  size_t nItems = std::numeric_limits< size_t >::max() );
174 
178  void cmdCommitAll (
179  size_t firstItem = 0,
180  size_t nItems = std::numeric_limits< size_t >::max() );
181 
185  void cmdLoad (
186  CommandBuffer cmdBuffer,
187  size_t firstItem = 0,
188  size_t nItems = std::numeric_limits< size_t >::max() );
189 
193  void cmdLoad (
194  size_t firstItem = 0,
195  size_t nItems = std::numeric_limits< size_t >::max() );
196 
202  void commit (
203  EQueueType eQueue = Q_GRAPHICS,
204  const Fence& signalFenceOnEnd = Fence(),
205  const Semaphore& waitOnBegin = Semaphore(),
206  const Semaphore& signalOnEnd = Semaphore() );
207 
210  void commitAndWait (
211  EQueueType eQueue = Q_GRAPHICS );
212 
218  void load (
219  EQueueType eQueue = Q_GRAPHICS,
220  const Fence& signalFenceOnEnd = Fence(),
221  const Semaphore& waitOnBegin = Semaphore(),
222  const Semaphore& signalOnEnd = Semaphore() );
223 
225  void loadAndWait (
226  EQueueType eQueue = Q_GRAPHICS );
227 
232  void cmdCopyToImage (
233  CommandBuffer hCmdBuffer,
234  const Img& img,
235  VkImageLayout targetLayout,
236  std::uint32_t mipLevel = 0,
237  std::uint32_t layer = 0,
238  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
239  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
240  VkDeviceSize bufferOffset = 0,
241  std::uint32_t bufferRowLength = 0,
242  std::uint32_t bufferImageHeight = 0 );
243 
249  void cmdCopyToImage (
250  const Img& img,
251  VkImageLayout targetLayout,
252  std::uint32_t mipLevel = 0,
253  std::uint32_t layer = 0,
254  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
255  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
256  VkDeviceSize bufferOffset = 0,
257  std::uint32_t bufferRowLength = 0,
258  std::uint32_t bufferImageHeight = 0 );
259 
264  void copyToImage (
265  EQueueType eQueue,
266  const Img& img,
267  VkImageLayout targetLayout,
268  const Fence& signalFenceOnEnd = Fence(),
269  const Semaphore& waitOnBegin = Semaphore(),
270  const Semaphore& signalOnEnd = Semaphore(),
271  std::uint32_t mipLevel = 0,
272  std::uint32_t layer = 0,
273  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
274  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
275  VkDeviceSize bufferOffset = 0,
276  std::uint32_t bufferRowLength = 0,
277  std::uint32_t bufferImageHeight = 0 );
278 
284  void copyToImageAndWait (
285  EQueueType eQueue,
286  const Img& img,
287  VkImageLayout targetLayout,
288  std::uint32_t mipLevel = 0,
289  std::uint32_t layer = 0,
290  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
291  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
292  VkDeviceSize bufferOffset = 0,
293  std::uint32_t bufferRowLength = 0,
294  std::uint32_t bufferImageHeight = 0 );
295 
301  void cmdCopyFromImage (
302  CommandBuffer hCmdBuffer,
303  const Img& img,
304  VkImageLayout sourceImageLayout,
305  std::uint32_t mipLevel = 0,
306  std::uint32_t layer = 0,
307  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
308  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
309  VkDeviceSize bufferOffset = 0,
310  std::uint32_t bufferRowLength = 0,
311  std::uint32_t bufferImageHeight = 0 );
312 
319  void cmdCopyFromImage (
320  const Img& img,
321  VkImageLayout sourceImageLayout,
322  std::uint32_t mipLevel = 0,
323  std::uint32_t layer = 0,
324  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
325  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
326  VkDeviceSize bufferOffset = 0,
327  std::uint32_t bufferRowLength = 0,
328  std::uint32_t bufferImageHeight = 0 );
329 
335  void copyFromImage (
336  EQueueType eQueue,
337  const Img& img,
338  VkImageLayout sourceImageLayout,
339  const Fence& signalFenceOnEnd = Fence(),
340  const Semaphore& waitOnBegin = Semaphore(),
341  const Semaphore& signalOnEnd = Semaphore(),
342  std::uint32_t mipLevel = 0,
343  std::uint32_t layer = 0,
344  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
345  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
346  VkDeviceSize bufferOffset = 0,
347  std::uint32_t bufferRowLength = 0,
348  std::uint32_t bufferImageHeight = 0 );
349 
356  void copyFromImageAndWait (
357  EQueueType eQueue,
358  const Img& img,
359  VkImageLayout sourceImageLayout,
360  std::uint32_t mipLevel = 0,
361  std::uint32_t layer = 0,
362  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
363  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
364  VkDeviceSize bufferOffset = 0,
365  std::uint32_t bufferRowLength = 0,
366  std::uint32_t bufferImageHeight = 0 );
367 };
368 
369 // -----------------------------------------------------------------------------
377  public gvector< VkDrawIndirectCommand, Buf::INDIRECT >
378 {
379 public:
381  size_t maxItemCount,
382  MemProfile::ECharacteristic memProfile,
383  Device hDevice );
384 };
385 
386 // -----------------------------------------------------------------------------
394  public gvector< VkDrawIndexedIndirectCommand, Buf::INDIRECT >
395 {
396 public:
398  size_t maxItemCount,
399  MemProfile::ECharacteristic memProfile,
400  Device hDevice );
401 };
402 
403 // -----------------------------------------------------------------------------
411  public gvector< VkDispatchIndirectCommand, Buf::INDIRECT >
412 {
413 public:
415  size_t maxItemCount,
416  MemProfile::ECharacteristic memProfile,
417  Device hDevice );
418 };
419 
420 // -----------------------------------------------------------------------------
427 class Indices :
428  public gvector< std::uint32_t, Buf::INDEX >
429 {
430 public:
431  Indices (
432  size_t maxItemCount,
433  MemProfile::ECharacteristic memProfile,
434  Device hDevice );
435 };
436 
437 // -----------------------------------------------------------------------------
438 
451 template< typename ItemT, unsigned int USAGE >
452 class dgvector :
453  public Buffer< USAGE >,
454  public MemoryBinding< Buffer< USAGE >, DeviceMemory >
455 {
456 public:
457  dgvector ( size_t maxItemCount, const Device& hDevice );
458 
460  void cmdCopyToImage (
461  CommandBuffer hCmdBuffer,
462  const Img& img,
463  VkImageLayout targetLayout,
464  std::uint32_t mipLevel = 0,
465  std::uint32_t layer = 0,
466  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
467  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
468  VkDeviceSize bufferOffset = 0,
469  std::uint32_t bufferRowLength = 0,
470  std::uint32_t bufferImageHeight = 0 );
471 
474  void cmdCopyToImage (
475  const Img& img,
476  VkImageLayout targetLayout,
477  std::uint32_t mipLevel = 0,
478  std::uint32_t layer = 0,
479  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
480  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
481  VkDeviceSize bufferOffset = 0,
482  std::uint32_t bufferRowLength = 0,
483  std::uint32_t bufferImageHeight = 0 );
484 
486  void copyToImage (
487  EQueueType eQueue,
488  const Img& img,
489  VkImageLayout targetLayout,
490  const Fence& signalFenceOnEnd = Fence(),
491  const Semaphore& waitOnBegin = Semaphore(),
492  const Semaphore& signalOnEnd = Semaphore(),
493  std::uint32_t mipLevel = 0,
494  std::uint32_t layer = 0,
495  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
496  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
497  VkDeviceSize bufferOffset = 0,
498  std::uint32_t bufferRowLength = 0,
499  std::uint32_t bufferImageHeight = 0 );
500 
504  void copyToImageAndWait (
505  EQueueType eQueue,
506  const Img& img,
507  VkImageLayout targetLayout,
508  std::uint32_t mipLevel = 0,
509  std::uint32_t layer = 0,
510  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
511  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
512  VkDeviceSize bufferOffset = 0,
513  std::uint32_t bufferRowLength = 0,
514  std::uint32_t bufferImageHeight = 0 );
515 
517  void cmdCopyFromImage (
518  CommandBuffer hCmdBuffer,
519  const Img& img,
520  VkImageLayout sourceImageLayout,
521  std::uint32_t mipLevel = 0,
522  std::uint32_t layer = 0,
523  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
524  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
525  VkDeviceSize bufferOffset = 0,
526  std::uint32_t bufferRowLength = 0,
527  std::uint32_t bufferImageHeight = 0 );
528 
531  void cmdCopyFromImage (
532  const Img& img,
533  VkImageLayout sourceImageLayout,
534  std::uint32_t mipLevel = 0,
535  std::uint32_t layer = 0,
536  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
537  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
538  VkDeviceSize bufferOffset = 0,
539  std::uint32_t bufferRowLength = 0,
540  std::uint32_t bufferImageHeight = 0 );
541 
543  void copyFromImage (
544  EQueueType eQueue,
545  const Img& img,
546  VkImageLayout sourceImageLayout,
547  const Fence& signalFenceOnEnd = Fence(),
548  const Semaphore& waitOnBegin = Semaphore(),
549  const Semaphore& signalOnEnd = Semaphore(),
550  std::uint32_t mipLevel = 0,
551  std::uint32_t layer = 0,
552  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
553  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
554  VkDeviceSize bufferOffset = 0,
555  std::uint32_t bufferRowLength = 0,
556  std::uint32_t bufferImageHeight = 0 );
557 
561  void copyFromImageAndWait (
562  EQueueType eQueue,
563  const Img& img,
564  VkImageLayout sourceImageLayout,
565  std::uint32_t mipLevel = 0,
566  std::uint32_t layer = 0,
567  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
568  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
569  VkDeviceSize bufferOffset = 0,
570  std::uint32_t bufferRowLength = 0,
571  std::uint32_t bufferImageHeight = 0 );
572 };
573 
574 // -----------------------------------------------------------------------------
575 } // namespace vpp
576 // -----------------------------------------------------------------------------
void copyFromImageAndWait(EQueueType eQueue, const Img &img, VkImageLayout sourceImageLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents from specified image. Waits for completion.
Represents logical rendering device.
Definition: vppDevice.hpp:49
void push_back(const ItemT &item)
Adds element to the end of the valid range.
Generic STL-style vector allocating memory on the GPU.
Definition: vppContainers.hpp:79
void copyToImageAndWait(EQueueType eQueue, const Img &img, VkImageLayout targetLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents to specified image, waits for completion.
void cmdCommit(CommandBuffer cmdBuffer, size_t firstItem=0, size_t nItems=std::numeric_limits< size_t >::max())
Generates a command ensuring that valid elements have been synchronized from host to device...
Class representing generic (untyped) Vulkan image.
Definition: vppImage.hpp:54
ECharacteristic
Enumeration specifying the characteristic of requested memory.
Definition: vppDeviceMemory.hpp:45
void cmdCopyFromImage(CommandBuffer hCmdBuffer, const Img &img, VkImageLayout sourceImageLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Generates a command to copy the buffer contents from specified image.
The VPP namespace.
Definition: main.hpp:1
void cmdCopyToImage(CommandBuffer hCmdBuffer, const Img &img, VkImageLayout targetLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Generates a command to copy the buffer contents to specified image.
void resize(size_t newSize, const ItemT &value=ItemT())
Resizes the vector in proper way (constructing/destructing elements).
const_iterator cbegin() const
Const iterator to begin of the vector.
Definition: vppContainers.hpp:106
void cmdLoad(CommandBuffer cmdBuffer, size_t firstItem=0, size_t nItems=std::numeric_limits< size_t >::max())
Generates a command ensuring that valid elements have been synchronized from device to host...
void load(EQueueType eQueue=Q_GRAPHICS, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore())
Synchronizes entire buffer from device to host.
Represents a sequence of Vulkan commands.
Definition: vppCommandBuffer.hpp:68
void copyToImage(EQueueType eQueue, const Img &img, VkImageLayout targetLayout, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore(), std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents to specified image.
void copyFromImageAndWait(EQueueType eQueue, const Img &img, VkImageLayout sourceImageLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents from specified image. Waits for completion.
Allows the GPU to wait for another GPU operation to finish.
Definition: vppSynchronization.hpp:127
Allows the CPU to wait for GPU operation to finish.
Definition: vppSynchronization.hpp:41
void copyToImage(EQueueType eQueue, const Img &img, VkImageLayout targetLayout, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore(), std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents to specified image.
A compound object containing references to a buffer and memory bound to it.
Definition: vppDeviceMemory.hpp:137
void commitAndWait(EQueueType eQueue=Q_GRAPHICS)
Synchronizes entire buffer from host to device and waits for completion.
Utility subclass representing a vector of indirect dispatch ranges.
Definition: vppContainers.hpp:410
ItemT * allocate_back()
Allocates space for new item without constructing it.
const_iterator cend() const
Const iterator to the end of the valid range (but not whole area).
Definition: vppContainers.hpp:109
void commit(EQueueType eQueue=Q_GRAPHICS, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore())
Synchronizes entire buffer from host to device.
void copyFromImage(EQueueType eQueue, const Img &img, VkImageLayout sourceImageLayout, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore(), std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents from specified image.
const ItemT * const_iterator
Random access const iterator.
Definition: vppContainers.hpp:88
void setSize(size_t newSize)
Resizes the vector in dumb way (just setting the size without initialization). Use for numeric or vec...
void cmdCopyFromImage(CommandBuffer hCmdBuffer, const Img &img, VkImageLayout sourceImageLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Generates a command to copy the buffer contents from specified image.
Utility subclass representing a vector of indices for indexed draws.
Definition: vppContainers.hpp:427
void copyFromImage(EQueueType eQueue, const Img &img, VkImageLayout sourceImageLayout, const Fence &signalFenceOnEnd=Fence(), const Semaphore &waitOnBegin=Semaphore(), const Semaphore &signalOnEnd=Semaphore(), std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents from specified image.
Array allocated entirely on GPU side, without any mapping to the CPU side.
Definition: vppContainers.hpp:452
iterator begin()
Iterator to begin of the vector.
Definition: vppContainers.hpp:100
Utility subclass representing a vector of indexed indirect draw ranges.
Definition: vppContainers.hpp:393
size_t capacity() const
Returns the size of the whole allocated area (maximum number of elements).
Definition: vppContainers.hpp:118
bool empty() const
Checks whether the valid range is empty.
Definition: vppContainers.hpp:112
void cmdCommitAll(CommandBuffer cmdBuffer, size_t firstItem=0, size_t nItems=std::numeric_limits< size_t >::max())
Generates a command ensuring that entire memory area has been synchronized from host to device...
void copyToImageAndWait(EQueueType eQueue, const Img &img, VkImageLayout targetLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Submits a command to copy the buffer contents to specified image, waits for completion.
iterator end()
Iterator to the end of the valid range (but not whole area).
Definition: vppContainers.hpp:103
ItemT * iterator
Random access iterator.
Definition: vppContainers.hpp:85
void emplace_back(ArgsT... args)
Constructs element in place at the end of the valid range.
Typed Vulkan buffer of specified purpose. Most functions operating on buffers require typed buffer...
Definition: vppBuffer.hpp:186
void loadAndWait(EQueueType eQueue=Q_GRAPHICS)
Synchronizes entire buffer from device to host and waits for completion.
size_t size() const
Returns the size of the valid range.
Definition: vppContainers.hpp:115
void clear()
Empties the valid range.
ItemT & operator[](size_t index) const ItemT &operator[](size_t index) const
Access to indexed element.
Utility subclass representing a vector of indirect draw ranges.
Definition: vppContainers.hpp:376
gvector(size_t maxItemCount, MemProfile::ECharacteristic memProfile, const Device &hDevice)
Constructor.
void cmdCopyToImage(CommandBuffer hCmdBuffer, const Img &img, VkImageLayout targetLayout, std::uint32_t mipLevel=0, std::uint32_t layer=0, const VkOffset3D &imageOffset=VkOffset3D { 0, 0, 0 }, const VkExtent3D &imageExtent=VkExtent3D { 0, 0, 0 }, VkDeviceSize bufferOffset=0, std::uint32_t bufferRowLength=0, std::uint32_t bufferImageHeight=0)
Generates a command to copy the buffer contents to specified image.