Nebula
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12#include "core/types.h"
13#include "util/string.h"
14#include "core/rttimacros.h"
15
16#define NEBULA_WHOLE_BUFFER_SIZE (-1)
17#define NEBULA_ALL_MIPS (-1)
18#define NEBULA_ALL_LAYERS (-1)
19namespace CoreGraphics
20{
22
24{
25 struct
26 {
28 bool primRestart : 1;
29 };
30 byte key;
31
32 void operator=(const InputAssemblyKey& rhs) { this->key = rhs.key; }
33 bool operator==(const InputAssemblyKey& rhs) const { return this->key == rhs.key; }
34 bool operator!=(const InputAssemblyKey& rhs) const { return this->key != rhs.key; }
35 bool operator>(const InputAssemblyKey& rhs) const { return this->key > rhs.key; }
36 bool operator<(const InputAssemblyKey& rhs) const { return this->key < rhs.key; }
37};
38
50
58
80
81enum class ImageBits
82{
83 None = 0,
84 Auto = 1, // Special value to be used only by framescript
85 ColorBits = (1 << 1),
86 DepthBits = (1 << 2),
87 StencilBits = (1 << 3),
88 MetaBits = (1 << 4),
89 Plane0Bits = (1 << 5),
90 Plane1Bits = (1 << 6),
91 Plane2Bits = (1 << 7)
92};
95
109
111{
114 ComputePipeline, // Compute pipeline is not the compute queue, it's just resources available for compute shaders
117
118//------------------------------------------------------------------------------
121inline ShaderVisibility
123{
124 Util::Array<Util::String> components = str.Tokenize("|");
126 IndexT i;
127 for (i = 0; i < components.Size(); i++)
128 {
129 const Util::String& component = components[i];
130 if (component == "VS") ret |= VertexShaderVisibility;
131 else if (component == "HS") ret |= HullShaderVisibility;
132 else if (component == "DS") ret |= DomainShaderVisibility;
133 else if (component == "GS") ret |= GeometryShaderVisibility;
134 else if (component == "PS") ret |= PixelShaderVisibility;
135 else if (component == "CS") ret |= ComputeShaderVisibility;
136 else if (component == "TS") ret |= TaskShaderVisibility;
137 else if (component == "MS") ret |= MeshShaderVisibility;
138 else if (component == "RGS") ret |= RayGenerationShaderVisibility;
139 else if (component == "RAS") ret |= RayAnyHitShaderVisibility;
140 else if (component == "RCS") ret |= RayClosestHitShaderVisibility;
141 else if (component == "RMS") ret |= RayMissShaderVisibility;
142 else if (component == "RIS") ret |= RayIntersectionShaderVisibility;
143 else if (component == "CAS") ret |= CallableShaderVisibility;
144 }
145
146 return ret;
147}
148
149//------------------------------------------------------------------------------
152inline QueueType
154{
155 if (str == "Graphics") return GraphicsQueueType;
156 else if (str == "Compute") return ComputeQueueType;
157 else if (str == "Transfer") return TransferQueueType;
158 else if (str == "Sparse") return SparseQueueType;
159 return GraphicsQueueType;
160}
161
162//------------------------------------------------------------------------------
165inline const char*
167{
168 switch (type)
169 {
171 return "Graphics";
172 case ComputeQueueType:
173 return "Compute";
175 return "Transfer";
176 case SparseQueueType:
177 return "Sparse";
178 default:
179 return "Graphics";
180 }
181}
182
183
185{
186 Global,
187 Pass
188};
189
191{
193 Top, // Top of pipe
194 Bottom, // Bottom of pipe
195 Indirect, // Indirect dispatch/draw fetching stage
196 Index, // Index fetch (automatically vertex shader)
197 Vertex, // Vertex fetch stage (automatically vertex shader)
198 UniformGraphics, // Uniform read on graphics queue
199 UniformCompute, // Uniform read on compute queue
200 InputAttachment, // Input attachment read (automatically pixel shader)
201 ReadOnlyAccess = InputAttachment, // All of the above enums are read-only
218 ColorRead, // Color output read
219 ColorWrite, // Color output write
220 DepthStencilRead, // Depth-Stencil output read
221 DepthStencilWrite, // Depth-Stencil output write
228 TransferRead, // Memory transfering read
229 TransferWrite, // Memory transfering write
230 HostRead, // Host operations read
231 HostWrite, // Host operations write
232 MemoryRead, // Memory operations read
233 MemoryWrite, // Memory operations write
234 AccelerationStructureRead, // Read acceleration structure
235 AccelerationStructureWrite, // Write acceleration structure
236 ImageInitial, // Special pipeline stage for initial images
237 Present // Special pipeline stage for present images
238};
239
241
242//------------------------------------------------------------------------------
245inline PipelineStage
247{
248 if (str == "Top") return PipelineStage::Top;
249 else if (str == "Bottom") return PipelineStage::Bottom;
250 else if (str == "IndirectRead") return PipelineStage::Indirect;
251 else if (str == "IndexRead") return PipelineStage::Index;
252 else if (str == "VertexRead") return PipelineStage::Vertex;
253 else if (str == "UniformGraphicsRead") return PipelineStage::UniformGraphics;
254 else if (str == "UniformComputeRead") return PipelineStage::UniformCompute;
255 else if (str == "InputAttachmentRead") return PipelineStage::InputAttachment;
256 else if (str == "VertexShaderRead") return PipelineStage::VertexShaderRead;
257 else if (str == "VertexShaderWrite") return PipelineStage::VertexShaderWrite;
258 else if (str == "HullShaderRead") return PipelineStage::HullShaderRead;
259 else if (str == "HullShaderWrite") return PipelineStage::HullShaderWrite;
260 else if (str == "DomainShaderRead") return PipelineStage::DomainShaderRead;
261 else if (str == "DomainShaderWrite") return PipelineStage::DomainShaderWrite;
262 else if (str == "GeometryShaderRead") return PipelineStage::GeometryShaderRead;
263 else if (str == "GeometryShaderWrite") return PipelineStage::GeometryShaderWrite;
264 else if (str == "PixelShaderRead") return PipelineStage::PixelShaderRead;
265 else if (str == "PixelShaderWrite") return PipelineStage::PixelShaderWrite;
266 else if (str == "ComputeShaderRead") return PipelineStage::ComputeShaderRead;
267 else if (str == "ComputeShaderWrite") return PipelineStage::ComputeShaderWrite;
268 else if (str == "ColorAttachmentRead") return PipelineStage::ColorRead;
269 else if (str == "ColorAttachmentWrite") return PipelineStage::ColorWrite;
270 else if (str == "DepthAttachmentRead") return PipelineStage::DepthStencilRead;
271 else if (str == "DepthAttachmentWrite") return PipelineStage::DepthStencilWrite;
272 else if (str == "TransferRead") return PipelineStage::TransferRead;
273 else if (str == "TransferWrite") return PipelineStage::TransferWrite;
274 else if (str == "HostRead") return PipelineStage::HostRead;
275 else if (str == "HostWrite") return PipelineStage::HostWrite;
276 else if (str == "MemoryRead") return PipelineStage::MemoryRead;
277 else if (str == "MemoryWrite") return PipelineStage::MemoryWrite;
278 else if (str == "Present") return PipelineStage::Present;
279 else
280 {
281 n_error("Invalid pipeline stage '%s'\n", str.AsCharPtr());
283 }
284}
285
286//------------------------------------------------------------------------------
289inline bool
310
311
312//------------------------------------------------------------------------------
316} // namespace CoreGraphics
317
318
319#define SHADER_POSTEFFECT_DEFAULT_FEATURE_MASK "Alt0"
320
321#if !PUBLIC_BUILD
322#define NEBULA_GRAPHICS_DEBUG 1
323#define NEBULA_MARKER_BLUE Math::vec4(0.8f, 0.8f, 1.0f, 1.0f)
324#define NEBULA_MARKER_RED Math::vec4(1.0f, 0.8f, 0.8f, 1.0f)
325#define NEBULA_MARKER_GREEN Math::vec4(0.8f, 1.0f, 0.8f, 1.0f)
326#define NEBULA_MARKER_DARK_GREEN Math::vec4(0.6f, 0.8f, 0.6f, 1.0f)
327#define NEBULA_MARKER_DARK_DARK_GREEN Math::vec4(0.5f, 0.7f, 0.5f, 1.0f)
328#define NEBULA_MARKER_PINK Math::vec4(1.0f, 0.8f, 0.9f, 1.0f)
329#define NEBULA_MARKER_PURPLE Math::vec4(0.9f, 0.7f, 0.9f, 1.0f)
330#define NEBULA_MARKER_ORANGE Math::vec4(1.0f, 0.9f, 0.8f, 1.0f)
331#define NEBULA_MARKER_TURQOISE Math::vec4(0.8f, 0.9f, 1.0f, 1.0f)
332#define NEBULA_MARKER_GRAY Math::vec4(0.9f, 0.9f, 0.9f, 1.0f)
333#define NEBULA_MARKER_BLACK Math::vec4(0.001f)
334#define NEBULA_MARKER_WHITE Math::vec4(1)
335
336#define NEBULA_MARKER_COMPUTE NEBULA_MARKER_BLUE
337#define NEBULA_MARKER_GRAPHICS NEBULA_MARKER_GREEN
338#define NEBULA_MARKER_TRANSFER NEBULA_MARKER_RED
339
340#endif
341
342//------------------------------------------------------------------------------
343#if __VULKAN__
344 #define COREGRAPHICS_TRIANGLE_FRONT_FACE_CCW (1)
345 // define the same descriptor set slots as we do in the shaders
346 #define NEBULA_TICK_GROUP 0 // set per tick (once for all views) by the system
347 #define NEBULA_FRAME_GROUP 1 // set per frame (once per view) by the system
348 #define NEBULA_PASS_GROUP 2 // set per pass by the system
349 #define NEBULA_BATCH_GROUP 3 // set per batch (material settings or system stuff)
350 #define NEBULA_INSTANCE_GROUP 4 // set a batch-internal copy of some specific settings
351 #define NEBULA_SYSTEM_GROUP 5 // set a batch-internal copy of some specific settings
352 #define NEBULA_DYNAMIC_OFFSET_GROUP 6 // set once per shader and is offset for each instance
353 #define NEBULA_NUM_GROUPS (NEBULA_DYNAMIC_OFFSET_GROUP + 1)
354
355 #define MAX_INPUT_ATTACHMENTS 32
356
357 #define SHADER_MODEL_5 (1)
358 #ifdef _DEBUG
359 #define NEBULA_VULKAN_DEBUG (1)
360 #else
361 #define NEBULA_VULKAN_DEBUG (0)
362 #endif
363 #define PROJECTION_HANDEDNESS_LH (0)
364#if __X64__
365 #define VK_DEVICE_SIZE_CONV(x) uint64_t(x)
366#else
367 #define VK_DEVICE_SIZE_CONV(x) uint32_t(x)
368#endif
369#endif
370//------------------------------------------------------------------------------
A pass describe a set of textures used for rendering.
Nebula's dynamic array class.
Definition array.h:60
const SizeT Size() const
get number of elements in array
Definition array.h:880
void __cdecl n_error(const char *msg,...)
This function is called when a serious situation is encountered which requires abortion of the applic...
Definition debug.cc:138
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
ImageLayout
Definition config.h:97
QueryType
Definition config.h:52
@ TimestampsQueryType
Definition config.h:55
@ NumQueryTypes
Definition config.h:56
@ StatisticsQueryType
Definition config.h:54
@ OcclusionQueryType
Definition config.h:53
const char * QueueNameFromQueueType(const QueueType type)
Definition config.h:166
QueueType
Definition config.h:40
@ ComputeQueueType
Definition config.h:42
@ NumQueueTypes
Definition config.h:46
@ InvalidQueueType
Definition config.h:48
@ SparseQueueType
Definition config.h:44
@ GraphicsQueueType
Definition config.h:41
@ TransferQueueType
Definition config.h:43
ShaderVisibility
Definition config.h:60
@ AllGraphicsVisibility
Definition config.h:67
@ InvalidVisibility
Definition config.h:61
@ VertexShaderVisibility
Definition config.h:62
@ RayMissShaderVisibility
Definition config.h:74
@ RayGenerationShaderVisibility
Definition config.h:71
@ HullShaderVisibility
Definition config.h:63
@ ComputeShaderVisibility
Definition config.h:70
@ TaskShaderVisibility
Definition config.h:68
@ MeshShaderVisibility
Definition config.h:69
@ CallableShaderVisibility
Definition config.h:76
@ RayAnyHitShaderVisibility
Definition config.h:72
@ GeometryShaderVisibility
Definition config.h:65
@ RayIntersectionShaderVisibility
Definition config.h:75
@ DomainShaderVisibility
Definition config.h:64
@ RayClosestHitShaderVisibility
Definition config.h:73
@ AllVisibility
Definition config.h:77
@ PixelShaderVisibility
Definition config.h:66
uint ConstantBufferOffset
Definition config.h:21
bool PipelineStageWrites(const PipelineStage stage)
Definition config.h:290
PipelineStage PipelineStageFromString(const Util::String &str)
Definition config.h:246
ShaderPipeline
Definition config.h:111
@ ComputePipeline
Definition config.h:114
@ InvalidPipeline
Definition config.h:112
@ GraphicsPipeline
Definition config.h:113
@ RayTracingPipeline
Definition config.h:115
ImageBits
Definition config.h:82
BarrierDomain
Definition config.h:185
PipelineStage
Definition config.h:191
QueueType QueueTypeFromString(const Util::String &str)
Definition config.h:153
ShaderVisibility ShaderVisibilityFromString(const Util::String &str)
Definition config.h:122
@ None
Definition resourceloader.h:51
#define __ImplementEnumComparisonOperators(type)
#define __ImplementEnumBitOperators(type)
This defines the macros for Nebula's RTTI mechanism (__DeclareClass, __ImplementClass,...
Nebula's universal string class.
Definition string.h:50
const char * AsCharPtr() const
return contents as character pointer
Definition string.h:540
SizeT Tokenize(const String &whiteSpace, Array< String > &outTokens) const
tokenize string into a provided String array (faster if tokens array can be reused)
Definition string.cc:203
unsigned int uint
Definition types.h:31
int IndexT
Definition types.h:48
Definition config.h:24
uint topo
Definition config.h:27
byte key
Definition config.h:30
void operator=(const InputAssemblyKey &rhs)
Definition config.h:32
bool operator<(const InputAssemblyKey &rhs) const
Definition config.h:36
bool operator!=(const InputAssemblyKey &rhs) const
Definition config.h:34
bool primRestart
Definition config.h:28
bool operator==(const InputAssemblyKey &rhs) const
Definition config.h:33
bool operator>(const InputAssemblyKey &rhs) const
Definition config.h:35