VPP  0.8
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 
188  void cmdLoad (
189  CommandBuffer cmdBuffer,
190  size_t firstItem = 0,
191  size_t nItems = std::numeric_limits< size_t >::max() );
192 
199  void cmdLoad (
200  size_t firstItem = 0,
201  size_t nItems = std::numeric_limits< size_t >::max() );
202 
208  void commit (
209  EQueueType eQueue = Q_GRAPHICS,
210  const Fence& signalFenceOnEnd = Fence(),
211  const Semaphore& waitOnBegin = Semaphore(),
212  const Semaphore& signalOnEnd = Semaphore() );
213 
216  void commitAndWait (
217  EQueueType eQueue = Q_GRAPHICS );
218 
227  void load (
228  EQueueType eQueue = Q_GRAPHICS,
229  const Fence& signalFenceOnEnd = Fence(),
230  const Semaphore& waitOnBegin = Semaphore(),
231  const Semaphore& signalOnEnd = Semaphore() );
232 
238  void loadAndWait (
239  EQueueType eQueue = Q_GRAPHICS );
240 
246  void cmdCopyToImage (
247  CommandBuffer hCmdBuffer,
248  const Img& img,
249  VkImageLayout targetLayout,
250  std::uint32_t mipLevel = 0,
251  std::uint32_t layer = 0,
252  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
253  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
254  VkDeviceSize bufferOffset = 0,
255  std::uint32_t bufferRowLength = 0,
256  std::uint32_t bufferImageHeight = 0 );
257 
264  void cmdCopyToImage (
265  const Img& img,
266  VkImageLayout targetLayout,
267  std::uint32_t mipLevel = 0,
268  std::uint32_t layer = 0,
269  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
270  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
271  VkDeviceSize bufferOffset = 0,
272  std::uint32_t bufferRowLength = 0,
273  std::uint32_t bufferImageHeight = 0 );
274 
280  void copyToImage (
281  EQueueType eQueue,
282  const Img& img,
283  VkImageLayout targetLayout,
284  const Fence& signalFenceOnEnd = Fence(),
285  const Semaphore& waitOnBegin = Semaphore(),
286  const Semaphore& signalOnEnd = Semaphore(),
287  std::uint32_t mipLevel = 0,
288  std::uint32_t layer = 0,
289  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
290  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
291  VkDeviceSize bufferOffset = 0,
292  std::uint32_t bufferRowLength = 0,
293  std::uint32_t bufferImageHeight = 0 );
294 
301  void copyToImageAndWait (
302  EQueueType eQueue,
303  const Img& img,
304  VkImageLayout targetLayout,
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 
318  void cmdCopyFromImage (
319  CommandBuffer hCmdBuffer,
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 
336  void cmdCopyFromImage (
337  const Img& img,
338  VkImageLayout sourceImageLayout,
339  std::uint32_t mipLevel = 0,
340  std::uint32_t layer = 0,
341  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
342  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
343  VkDeviceSize bufferOffset = 0,
344  std::uint32_t bufferRowLength = 0,
345  std::uint32_t bufferImageHeight = 0 );
346 
352  void copyFromImage (
353  EQueueType eQueue,
354  const Img& img,
355  VkImageLayout sourceImageLayout,
356  const Fence& signalFenceOnEnd = Fence(),
357  const Semaphore& waitOnBegin = Semaphore(),
358  const Semaphore& signalOnEnd = Semaphore(),
359  std::uint32_t mipLevel = 0,
360  std::uint32_t layer = 0,
361  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
362  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
363  VkDeviceSize bufferOffset = 0,
364  std::uint32_t bufferRowLength = 0,
365  std::uint32_t bufferImageHeight = 0 );
366 
373  void copyFromImageAndWait (
374  EQueueType eQueue,
375  const Img& img,
376  VkImageLayout sourceImageLayout,
377  std::uint32_t mipLevel = 0,
378  std::uint32_t layer = 0,
379  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
380  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
381  VkDeviceSize bufferOffset = 0,
382  std::uint32_t bufferRowLength = 0,
383  std::uint32_t bufferImageHeight = 0 );
384 };
385 
386 // -----------------------------------------------------------------------------
394  public gvector< VkDrawIndirectCommand, Buf::INDIRECT >
395 {
396 public:
398  size_t maxItemCount,
399  MemProfile::ECharacteristic memProfile,
400  Device hDevice );
401 };
402 
403 // -----------------------------------------------------------------------------
411  public gvector< VkDrawIndexedIndirectCommand, Buf::INDIRECT >
412 {
413 public:
415  size_t maxItemCount,
416  MemProfile::ECharacteristic memProfile,
417  Device hDevice );
418 };
419 
420 // -----------------------------------------------------------------------------
428  public gvector< VkDispatchIndirectCommand, Buf::INDIRECT >
429 {
430 public:
432  size_t maxItemCount,
433  MemProfile::ECharacteristic memProfile,
434  Device hDevice );
435 };
436 
437 // -----------------------------------------------------------------------------
444 class Indices :
445  public gvector< std::uint32_t, Buf::INDEX >
446 {
447 public:
448  Indices (
449  size_t maxItemCount,
450  MemProfile::ECharacteristic memProfile,
451  Device hDevice );
452 };
453 
454 // -----------------------------------------------------------------------------
455 
468 template< typename ItemT, unsigned int USAGE >
469 class dgvector :
470  public Buffer< USAGE >,
471  public MemoryBinding< Buffer< USAGE >, DeviceMemory >
472 {
473 public:
474  dgvector ( size_t maxItemCount, const Device& hDevice );
475 
477  void cmdCopyToImage (
478  CommandBuffer hCmdBuffer,
479  const Img& img,
480  VkImageLayout targetLayout,
481  std::uint32_t mipLevel = 0,
482  std::uint32_t layer = 0,
483  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
484  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
485  VkDeviceSize bufferOffset = 0,
486  std::uint32_t bufferRowLength = 0,
487  std::uint32_t bufferImageHeight = 0 );
488 
491  void cmdCopyToImage (
492  const Img& img,
493  VkImageLayout targetLayout,
494  std::uint32_t mipLevel = 0,
495  std::uint32_t layer = 0,
496  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
497  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
498  VkDeviceSize bufferOffset = 0,
499  std::uint32_t bufferRowLength = 0,
500  std::uint32_t bufferImageHeight = 0 );
501 
503  void copyToImage (
504  EQueueType eQueue,
505  const Img& img,
506  VkImageLayout targetLayout,
507  const Fence& signalFenceOnEnd = Fence(),
508  const Semaphore& waitOnBegin = Semaphore(),
509  const Semaphore& signalOnEnd = Semaphore(),
510  std::uint32_t mipLevel = 0,
511  std::uint32_t layer = 0,
512  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
513  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
514  VkDeviceSize bufferOffset = 0,
515  std::uint32_t bufferRowLength = 0,
516  std::uint32_t bufferImageHeight = 0 );
517 
521  void copyToImageAndWait (
522  EQueueType eQueue,
523  const Img& img,
524  VkImageLayout targetLayout,
525  std::uint32_t mipLevel = 0,
526  std::uint32_t layer = 0,
527  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
528  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
529  VkDeviceSize bufferOffset = 0,
530  std::uint32_t bufferRowLength = 0,
531  std::uint32_t bufferImageHeight = 0 );
532 
534  void cmdCopyFromImage (
535  CommandBuffer hCmdBuffer,
536  const Img& img,
537  VkImageLayout sourceImageLayout,
538  std::uint32_t mipLevel = 0,
539  std::uint32_t layer = 0,
540  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
541  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
542  VkDeviceSize bufferOffset = 0,
543  std::uint32_t bufferRowLength = 0,
544  std::uint32_t bufferImageHeight = 0 );
545 
548  void cmdCopyFromImage (
549  const Img& img,
550  VkImageLayout sourceImageLayout,
551  std::uint32_t mipLevel = 0,
552  std::uint32_t layer = 0,
553  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
554  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
555  VkDeviceSize bufferOffset = 0,
556  std::uint32_t bufferRowLength = 0,
557  std::uint32_t bufferImageHeight = 0 );
558 
560  void copyFromImage (
561  EQueueType eQueue,
562  const Img& img,
563  VkImageLayout sourceImageLayout,
564  const Fence& signalFenceOnEnd = Fence(),
565  const Semaphore& waitOnBegin = Semaphore(),
566  const Semaphore& signalOnEnd = Semaphore(),
567  std::uint32_t mipLevel = 0,
568  std::uint32_t layer = 0,
569  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
570  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
571  VkDeviceSize bufferOffset = 0,
572  std::uint32_t bufferRowLength = 0,
573  std::uint32_t bufferImageHeight = 0 );
574 
578  void copyFromImageAndWait (
579  EQueueType eQueue,
580  const Img& img,
581  VkImageLayout sourceImageLayout,
582  std::uint32_t mipLevel = 0,
583  std::uint32_t layer = 0,
584  const VkOffset3D& imageOffset = VkOffset3D { 0, 0, 0 },
585  const VkExtent3D& imageExtent = VkExtent3D { 0, 0, 0 },
586  VkDeviceSize bufferOffset = 0,
587  std::uint32_t bufferRowLength = 0,
588  std::uint32_t bufferImageHeight = 0 );
589 };
590 
591 // -----------------------------------------------------------------------------
592 } // namespace vpp
593 // -----------------------------------------------------------------------------
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:427
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:444
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:469
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:410
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:393
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.