Nebula
Loading...
Searching...
No Matches
resourcetable.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
11//------------------------------------------------------------------------------
12
13#include "ids/id.h"
14#include "ids/idpool.h"
15#include "texture.h"
16#include "textureview.h"
17#include "buffer.h"
18#include "sampler.h"
20#include "coregraphics/config.h"
21namespace CoreGraphics
22{
23
24
26
34
43
52
59
66
73
85
90
91//------------------------------------------------------------------------------
96
98extern bool ResourceTableBlocked;
100
102{
104 : tex(InvalidTextureId)
105 , slot(0)
106 , index(0)
107 , sampler(CoreGraphics::InvalidSamplerId)
108 , isDepth(false)
109 , isStencil(false)
110 {};
111
113 : tex(tex)
114 , slot(slot)
115 , index(0)
116 , sampler(CoreGraphics::InvalidSamplerId)
117 , isDepth(false)
118 , isStencil(false)
119 {};
120
122 : tex(tex)
123 , slot(slot)
124 , index(index)
125 , sampler(CoreGraphics::InvalidSamplerId)
126 , isDepth(false)
127 , isStencil(false)
128 {};
129
131 : tex(tex)
132 , slot(slot)
133 , index(0)
134 , sampler(CoreGraphics::InvalidSamplerId)
137 {};
138
147
152 bool isDepth : 1;
153 bool isStencil : 1;
154};
155
157{
159 : tex(InvalidTextureViewId)
160 , slot(0)
161 , index(0)
162 , sampler(CoreGraphics::InvalidSamplerId)
163 , isDepth(false)
164 , isStencil(false)
165 {};
166
168 : tex(tex)
169 , slot(slot)
170 , index(0)
171 , sampler(CoreGraphics::InvalidSamplerId)
172 , isDepth(false)
173 , isStencil(false)
174 {};
175
177 : tex(tex)
178 , slot(slot)
179 , index(index)
180 , sampler(CoreGraphics::InvalidSamplerId)
181 , isDepth(false)
182 , isStencil(false)
183 {};
184
186 : tex(tex)
187 , slot(slot)
188 , index(0)
189 , sampler(CoreGraphics::InvalidSamplerId)
192 {};
193
202
207 bool isDepth : 1;
208 bool isStencil : 1;
209};
210
212{
214 : tex(InvalidTextureViewId)
215 , slot(0)
216 , index(0)
217 , sampler(CoreGraphics::InvalidSamplerId)
218 , isDepth(false)
219 {};
220
222 : tex(tex)
223 , slot(slot)
224 , index(0)
225 , sampler(CoreGraphics::InvalidSamplerId)
226 , isDepth(false)
227 {};
228
230 : tex(tex)
231 , slot(slot)
232 , index(0)
233 , sampler(CoreGraphics::InvalidSamplerId)
235 {};
236
244
249 bool isDepth : 1;
250};
251
253{
255 : buf(InvalidBufferId)
256 , slot(0)
257 , index(0)
259 , offset(0)
260 , texelBuffer(false)
261 , dynamicOffset(false)
262 {};
263
265 : buf(buf)
266 , slot(slot)
267 , index(0)
269 , offset(0)
270 , texelBuffer(false)
271 , dynamicOffset(false)
272 {};
273
275 : buf(buf)
276 , slot(slot)
277 , index(0)
278 , size(size)
279 , offset(0)
280 , texelBuffer(false)
281 , dynamicOffset(false)
282 {};
283
285 : buf(buf)
286 , slot(slot)
287 , index(0)
288 , size(size)
289 , offset(offset)
290 , texelBuffer(false)
291 , dynamicOffset(false)
292 {};
293
303
307
310
313};
314
320
330
336
341
344
364void ResourceTableCopy(const ResourceTableId from, const IndexT fromSlot, const IndexT fromIndex, const ResourceTableId to, const IndexT toSlot, const IndexT toIndex, const SizeT numResources);
365
367void ResourceTableBlock(bool b);
370
371//------------------------------------------------------------------------------
376{
380 ResourceTableSet(const ResourceTableCreateInfo& createInfo);
385
387 void ForEach(std::function<void(const ResourceTableId, const IndexT)> func);
388
390 void operator=(ResourceTableSet&& rhs);
391
394
396};
397
398//------------------------------------------------------------------------------
403
410
417
422
423} // namespace CoreGraphics
Critical section objects are used to protect a portion of code from parallel execution.
Nebula's dynamic array class.
Definition array.h:60
Implements a fixed size one-dimensional array.
Definition fixedarray.h:20
#define ID_24_8_TYPE(x)
Definition id.h:132
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
void ResourceTableSetTexture(const ResourceTableId id, const ResourceTableTexture &tex)
set resource table texture
Definition vkresourcetable.cc:281
void ResourceTableCommitChanges(const ResourceTableId id)
apply updates of previous sets
Definition vkresourcetable.cc:688
const ResourceTableLayoutId & ResourceTableGetLayout(CoreGraphics::ResourceTableId id)
Get resource table layout.
Definition vkresourcetable.cc:244
bool ResourceTableBlocked
Definition vkresourcetable.cc:204
ResourceTableLayoutId CreateResourceTableLayout(const ResourceTableLayoutCreateInfo &info)
create resource table layout
Definition vkresourcetable.cc:798
void ResourceTableSetAccelerationStructure(const ResourceTableId id, const ResourceTableTlas &tlas)
Set resource table acceleration structure.
Definition vkresourcetable.cc:647
ResourceTableId CreateResourceTable(const ResourceTableCreateInfo &info)
create resource table
Definition vkresourcetable.cc:211
void DestroyResourceTable(const ResourceTableId id)
destroy resource table
Definition vkresourcetable.cc:232
void DestroyResourceTableLayout(const ResourceTableLayoutId &id)
destroy resource table layout
Definition vkresourcetable.cc:1082
ShaderVisibility
Definition config.h:60
ResourcePipelineId CreateResourcePipeline(const ResourcePipelineCreateInfo &info)
create resource pipeline
Definition vkresourcetable.cc:1102
void ResourceTableSetRWTexture(const ResourceTableId id, const ResourceTableTexture &tex)
set resource table texture as read-write
Definition vkresourcetable.cc:433
void DestroyResourcePipeline(const ResourcePipelineId &id)
destroy resource pipeline
Definition vkresourcetable.cc:1148
void ResourceTableSetSampler(const ResourceTableId id, const ResourceTableSampler &samp)
set resource table sampler
Definition vkresourcetable.cc:607
Threading::CriticalSection PendingTableCommitsLock
Definition vkresourcetable.cc:205
Util::Array< CoreGraphics::ResourceTableId > PendingTableCommits
Definition vkresourcetable.cc:203
void ResourceTableSetRWBuffer(const ResourceTableId id, const ResourceTableBuffer &buf)
set resource table shader rw buffer
Definition vkresourcetable.cc:561
void ResourceTableCopy(const ResourceTableId from, const IndexT fromSlot, const IndexT fromIndex, const ResourceTableId to, const IndexT toSlot, const IndexT toIndex, const SizeT numResources)
copy resources from a slot, index and array size between resource tables
Definition vkresourcetable.cc:253
void ResourceTableBlock(bool b)
disallow the resource table system to make modifications
Definition vkresourcetable.cc:679
void ResourceTableSetConstantBuffer(const ResourceTableId id, const ResourceTableBuffer &buf)
set resource table constant buffer
Definition vkresourcetable.cc:513
void ResourceTableSetInputAttachment(const ResourceTableId id, const ResourceTableInputAttachment &tex)
set resource table input attachment
Definition vkresourcetable.cc:393
Compile time configuration options for the CoreGraphics subsystem.
#define NEBULA_WHOLE_BUFFER_SIZE
Definition config.h:16
Samplers.
Definition buffer.h:23
Definition resourcetable.h:412
Util::Array< ResourceTableLayoutId > tables
Definition resourcetable.h:413
Util::Array< uint32_t > indices
Definition resourcetable.h:414
ResourcePipelinePushConstantRange push
Definition resourcetable.h:415
Definition resourcetable.h:402
SizeT size
Definition resourcetable.h:406
SizeT offset
Definition resourcetable.h:407
CoreGraphics::ShaderVisibility vis
Definition resourcetable.h:408
Definition resourcetable.h:253
ResourceTableBuffer(const CoreGraphics::BufferId buf, IndexT slot, SizeT size, SizeT offset)
Definition resourcetable.h:284
SizeT offset
Definition resourcetable.h:309
ResourceTableBuffer(const CoreGraphics::BufferId buf, IndexT slot, SizeT size)
Definition resourcetable.h:274
IndexT slot
Definition resourcetable.h:305
CoreGraphics::BufferId buf
Definition resourcetable.h:304
ResourceTableBuffer(const CoreGraphics::BufferId buf, IndexT slot)
Definition resourcetable.h:264
SizeT size
Definition resourcetable.h:308
bool texelBuffer
Definition resourcetable.h:311
ResourceTableBuffer()
Definition resourcetable.h:254
ResourceTableBuffer(const CoreGraphics::BufferId buf, IndexT slot, SizeT index, SizeT size, SizeT offset, bool texelBuffer=false, bool dynamicOffset=false)
Definition resourcetable.h:294
bool dynamicOffset
Definition resourcetable.h:312
IndexT index
Definition resourcetable.h:306
Definition resourcetable.h:332
ResourceTableLayoutId layout
Definition resourcetable.h:333
uint overallocationSize
Definition resourcetable.h:334
Definition resourcetable.h:95
Definition resourcetable.h:212
ResourceTableInputAttachment()
Definition resourcetable.h:213
ResourceTableInputAttachment(const CoreGraphics::TextureViewId tex, IndexT slot, IndexT index, CoreGraphics::SamplerId sampler, bool isDepth=false)
Definition resourcetable.h:237
ResourceTableInputAttachment(const CoreGraphics::TextureViewId tex, IndexT slot)
Definition resourcetable.h:221
CoreGraphics::TextureViewId tex
Definition resourcetable.h:245
IndexT slot
Definition resourcetable.h:246
IndexT index
Definition resourcetable.h:247
bool isDepth
Definition resourcetable.h:249
CoreGraphics::SamplerId sampler
Definition resourcetable.h:248
ResourceTableInputAttachment(const CoreGraphics::TextureViewId tex, IndexT slot, bool isDepth=false)
Definition resourcetable.h:229
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:57
IndexT slot
Definition resourcetable.h:55
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:39
SizeT num
Definition resourcetable.h:38
IndexT slot
Definition resourcetable.h:37
bool dynamicOffset
Definition resourcetable.h:41
Definition resourcetable.h:75
Util::Array< ResourceTableLayoutAccelerationStructure > accelerationStructures
Definition resourcetable.h:80
uint32_t descriptorPoolInitialGrow
Definition resourcetable.h:83
Util::Array< ResourceTableLayoutInputAttachment > inputAttachments
Definition resourcetable.h:82
Util::Array< ResourceTableLayoutSampler > samplers
Definition resourcetable.h:81
Util::Array< ResourceTableLayoutShaderRWBuffer > rwBuffers
Definition resourcetable.h:79
Util::Array< ResourceTableLayoutTexture > rwTextures
Definition resourcetable.h:77
Util::Array< ResourceTableLayoutConstantBuffer > constantBuffers
Definition resourcetable.h:78
Util::Array< ResourceTableLayoutTexture > textures
Definition resourcetable.h:76
Definition resourcetable.h:25
IndexT slot
Definition resourcetable.h:69
SizeT num
Definition resourcetable.h:70
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:71
Definition resourcetable.h:61
IndexT slot
Definition resourcetable.h:62
CoreGraphics::SamplerId sampler
Definition resourcetable.h:64
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:63
IndexT slot
Definition resourcetable.h:46
bool dynamicOffset
Definition resourcetable.h:50
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:48
SizeT num
Definition resourcetable.h:47
Definition resourcetable.h:28
CoreGraphics::SamplerId immutableSampler
Definition resourcetable.h:32
IndexT slot
Definition resourcetable.h:29
CoreGraphics::ShaderVisibility visibility
Definition resourcetable.h:31
SizeT num
Definition resourcetable.h:30
Definition resourcetable.h:316
IndexT slot
Definition resourcetable.h:318
CoreGraphics::SamplerId samp
Definition resourcetable.h:317
Set of buffers which creates a resource table per each buffered frame.
Definition resourcetable.h:376
const CoreGraphics::ResourceTableId Get()
Get buffer for this frame.
Definition resourcetable.cc:70
~ResourceTableSet()
Destructor.
Definition resourcetable.cc:35
Util::FixedArray< CoreGraphics::ResourceTableId > tables
Definition resourcetable.h:395
void ForEach(std::function< void(const ResourceTableId, const IndexT)> func)
Run a for each function per table.
Definition resourcetable.cc:48
void operator=(ResourceTableSet &&rhs)
Move assignment.
Definition resourcetable.cc:60
ResourceTableSet()
Default constructor.
Definition resourcetable.h:378
Definition resourcetable.h:102
bool isDepth
Definition resourcetable.h:152
CoreGraphics::SamplerId sampler
Definition resourcetable.h:151
ResourceTableTexture(const CoreGraphics::TextureId tex, IndexT slot)
Definition resourcetable.h:112
ResourceTableTexture(const CoreGraphics::TextureId tex, IndexT slot, bool isDepth, bool isStencil)
Definition resourcetable.h:130
ResourceTableTexture()
Definition resourcetable.h:103
ResourceTableTexture(const CoreGraphics::TextureId tex, IndexT slot, IndexT index)
Definition resourcetable.h:121
IndexT slot
Definition resourcetable.h:149
CoreGraphics::TextureId tex
Definition resourcetable.h:148
IndexT index
Definition resourcetable.h:150
ResourceTableTexture(const CoreGraphics::TextureId tex, IndexT slot, IndexT index, CoreGraphics::SamplerId sampler, bool isDepth=false, bool isStencil=false)
Definition resourcetable.h:139
bool isStencil
Definition resourcetable.h:153
Definition resourcetable.h:157
ResourceTableTextureView(const CoreGraphics::TextureViewId tex, IndexT slot, IndexT index, CoreGraphics::SamplerId sampler, bool isDepth=false, bool isStencil=false)
Definition resourcetable.h:194
bool isDepth
Definition resourcetable.h:207
ResourceTableTextureView(const CoreGraphics::TextureViewId tex, IndexT slot, bool isDepth, bool isStencil)
Definition resourcetable.h:185
IndexT slot
Definition resourcetable.h:204
CoreGraphics::TextureViewId tex
Definition resourcetable.h:203
IndexT index
Definition resourcetable.h:205
ResourceTableTextureView(const CoreGraphics::TextureViewId tex, IndexT slot)
Definition resourcetable.h:167
bool isStencil
Definition resourcetable.h:208
ResourceTableTextureView()
Definition resourcetable.h:158
ResourceTableTextureView(const CoreGraphics::TextureViewId tex, IndexT slot, IndexT index)
Definition resourcetable.h:176
CoreGraphics::SamplerId sampler
Definition resourcetable.h:206
Definition resourcetable.h:322
CoreGraphics::TlasId tlas
Definition resourcetable.h:327
ResourceTableTlas(const CoreGraphics::TlasId tlas, IndexT slot)
Definition resourcetable.h:323
IndexT slot
Definition resourcetable.h:328
Definition sampler.h:17
texture type
Definition texture.h:25
Definition textureview.h:16
Definition accelerationstructure.h:98
int SizeT
Definition types.h:49
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48