VPP  0.8
A high-level modern C++ API for Vulkan
vppBufferView.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 
51 template< class FormatT, unsigned int USAGE >
53 {
54 public:
57 
59  template< class BufferT, class MemoryT >
60  explicit TexelBufferView (
61  const MemoryBinding< BufferT, MemoryT >& binding );
62 
64  template< class BufferT, class MemoryT >
66  VkDeviceSize offset,
67  VkDeviceSize size,
68  const MemoryBinding< BufferT, MemoryT >& binding );
69 
71  template< unsigned int US >
72  explicit TexelBufferView (
73  const TexelBufferView< FormatT, US >& otherView );
74 
76  operator VkBufferView() const;
77 
79  const Buf& buffer() const;
80 };
81 
82 // -----------------------------------------------------------------------------
100 {
101 public:
104 
106  template< class BufferT, class MemoryT >
108  const MemoryBinding< BufferT, MemoryT >& binding,
109  VkDeviceSize offset = 0 );
110 
112  const Buf& buffer() const;
113 
115  VkDeviceSize offset() const;
116 };
117 
118 // -----------------------------------------------------------------------------
119 
121 {
122 public:
125 
126  template< class BufferT, class MemoryT >
128  const MemoryBinding< BufferT, MemoryT >& binding,
129  VkDeviceSize offset = 0,
130  VkIndexType indexType = VK_INDEX_TYPE_UINT32 );
131 
133  const Buf& buffer() const;
134 
135  VkDeviceSize offset() const;
136  VkIndexType type() const;
137 };
138 
139 // -----------------------------------------------------------------------------
140 
142 {
143 public:
146 
147  template< class BufferT, class MemoryT >
149  const MemoryBinding< BufferT, MemoryT >& binding,
150  VkDeviceSize offset = 0,
151  VkDeviceSize length = 0 );
152 
154  const Buf& buffer() const;
155 
156  VkDeviceSize offset() const;
157  VkDeviceSize size() const;
158 };
159 
160 // -----------------------------------------------------------------------------
161 
163 {
164 public:
167 
168  template< class BufferT, class MemoryT >
170  const MemoryBinding< BufferT, MemoryT >& binding,
171  VkDeviceSize offset = 0,
172  VkDeviceSize length = 0 );
173 
175  const Buf& buffer() const;
176 
177  VkDeviceSize offset() const;
178  VkDeviceSize size() const;
179 };
180 
181 // -----------------------------------------------------------------------------
182 
184 {
185 public:
188 
189  template< class BufferT, class MemoryT >
191  const MemoryBinding< BufferT, MemoryT >& binding );
192 
194  const Buf& buffer() const;
195 };
196 
197 // -----------------------------------------------------------------------------
198 } // namespace vpp
199 // -----------------------------------------------------------------------------
VertexBufferView()
Constructs null reference.
Definition: vppBufferView.hpp:120
Buffer view for vertex buffers.
Definition: vppBufferView.hpp:99
const Buf & buffer() const
Retrieves a reference to the buffer.
The VPP namespace.
Definition: main.hpp:1
const Buf & buffer() const
Retrieves a reference to the buffer.
VkDeviceSize offset() const
Retrieves the starting offset of the slice.
Definition: vppBufferView.hpp:183
A compound object containing references to a buffer and memory bound to it.
Definition: vppDeviceMemory.hpp:137
StorageBufferView()
Constructs null reference.
Definition: vppBufferView.hpp:162
UniformBufferView()
Constructs null reference.
IndirectBufferView()
Constructs null reference.
const Buf & buffer() const
Retrieves a reference to the buffer.
const Buf & buffer() const
Retrieves a reference to the buffer.
Generic class representing Vulkan buffers.
Definition: vppBuffer.hpp:43
TexelBufferView()
Constructs null reference.
Buffer view for texel buffers.
Definition: vppBufferView.hpp:52
const Buf & buffer() const
Retrieves a reference to the buffer.
Definition: vppBufferView.hpp:141
VertexIndexBufferView()
Constructs null reference.
const Buf & buffer() const
Retrieves a reference to the buffer.