Foundation
Loading...
Searching...
No Matches
Common.hpp
Go to the documentation of this file.
1#pragma once
2#define VULKAN_HPP_NO_CONSTRUCTORS
3#define VULKAN_HPP_NO_EXCEPTIONS
4#ifndef VULKAN_HPP_ASSERT_ON_RESULT
5#define VULKAN_HPP_ASSERT_ON_RESULT(expr) CHECK(expr)
6#endif
7// This thing uses std::format!!!
8#define VULKAN_HPP_NO_TO_STRING
9#include <vulkan/vulkan.hpp>
10#include <vulkan/vulkan_raii.hpp>
11
12#include <RHICore/Common.hpp>
13namespace Foundation::RHI {
14 template <typename T>
15 [[nodiscard]] T VkExpect(vk::ResultValue<T>&& rv) {
16 CHECK(rv.result == vk::Result::eSuccess);
17 return std::move(rv.value);
18 }
19
20 inline void VkExpect(vk::Result result) {
21 CHECK(result == vk::Result::eSuccess);
22 }
23
24 inline void VkExpect(VkResult result) {
25 CHECK(result == VK_SUCCESS);
26 }
27
28 template <typename T, typename Enumerator>
29 [[nodiscard]] Vector<T> VkEnumerate(Enumerator&& enumerate, Allocator* allocator = GLOBAL_ALLOC) noexcept {
30 Vector<T> values(allocator);
31 uint32_t count = 0;
32 VkResult result;
33 do {
34 result = enumerate(&count, nullptr);
35 CHECK(result == VK_SUCCESS);
36 if (count == 0)
37 break;
38 values.resize(count);
39 result = enumerate(&count, values.data());
40 } while (result == VK_INCOMPLETE);
41 CHECK(result == VK_SUCCESS);
42 values.resize(count);
43 return values;
44 }
46 {
48 VkAllocationCallbacks callbacks{};
49
51 {
53 }
54
55 void Reset(Allocator* newAllocator)
56 {
57 allocator = newAllocator;
58 callbacks = VkAllocationCallbacks{
59 .pUserData = allocator,
61 .pfnReallocation = &VulkanAllocationCallbacks::Reallocate,
63 };
64 }
65
66 [[nodiscard]] vk::AllocationCallbacks const* Get() const
67 {
68 return allocator ? reinterpret_cast<vk::AllocationCallbacks const*>(&callbacks) : nullptr;
69 }
70
71 [[nodiscard]] VkAllocationCallbacks const* GetNative() const
72 {
73 return allocator ? &callbacks : nullptr;
74 }
75
76 private:
77 static void* VKAPI_PTR Allocate(void* userData, size_t size, size_t alignment,
78 VkSystemAllocationScope)
79 {
80 if (!userData || size == 0)
81 return nullptr;
82 return static_cast<Allocator*>(userData)->Allocate(size, alignment ? alignment : alignof(std::max_align_t));
83 }
84
85 static void* VKAPI_PTR Reallocate(void* userData, void* original, size_t size, size_t alignment,
86 VkSystemAllocationScope)
87 {
88 if (!userData)
89 return nullptr;
90 auto* allocator = static_cast<Allocator*>(userData);
91 if (size == 0)
92 {
93 allocator->Deallocate(original);
94 return nullptr;
95 }
96 if (!original)
97 return allocator->Allocate(size, alignment ? alignment : alignof(std::max_align_t));
98 return allocator->Reallocate(original, size, alignment ? alignment : alignof(std::max_align_t));
99 }
100
101 static void VKAPI_PTR Free(void* userData, void* memory)
102 {
103 if (userData && memory)
104 static_cast<Allocator*>(userData)->Deallocate(memory);
105 }
106 };
107
108 template<typename Bits> Bits vkFlagsToBits(vk::Flags<Bits> flags) {
109 return static_cast<Bits>(static_cast<std::underlying_type_t<Bits>>(flags));
110 }
111 inline vk::Format vkFormatFromRHIFormat(RHIResourceFormat format) {
112 using enum RHIResourceFormat;
113 switch (format) {
114 case R8G8B8A8Unorm: return vk::Format::eR8G8B8A8Unorm;
115 case R8G8B8A8Srgb: return vk::Format::eR8G8B8A8Srgb;
116 case B8G8R8A8Unrom: return vk::Format::eB8G8R8A8Unorm;
117 case B8G8R8A8Srgb: return vk::Format::eB8G8R8A8Srgb;
118 case A2R10G10B10Unorm: return vk::Format::eA2R10G10B10UnormPack32;
119 case A2R10G10B10Snorm: return vk::Format::eA2R10G10B10SnormPack32;
120 case A2B10G10R10Unorm: return vk::Format::eA2B10G10R10UnormPack32;
121 case A2B10G10R10Snorm: return vk::Format::eA2B10G10R10SnormPack32;
122 case B10G11R11Ufloat: return vk::Format::eB10G11R11UfloatPack32;
123 case R32SignedFloat: return vk::Format::eR32Sfloat;
124 case R32G32SignedFloat: return vk::Format::eR32G32Sfloat;
125 case R32G32B32SignedFloat: return vk::Format::eR32G32B32Sfloat;
126 case R32G32B32A32SignedFloat: return vk::Format::eR32G32B32A32Sfloat;
127 case R16SignedFloat: return vk::Format::eR16Sfloat;
128 case R16G16SignedFloat: return vk::Format::eR16G16Sfloat;
129 case R16G16B16SignedFloat: return vk::Format::eR16G16B16Sfloat;
130 case R16G16B16A16SignedFloat: return vk::Format::eR16G16B16A16Sfloat;
131 case R32Uint: return vk::Format::eR32Uint;
132 case R16Uint: return vk::Format::eR16Uint;
133 case R16Unorm: return vk::Format::eR16Unorm;
134 case D32SignedFloat: return vk::Format::eD32Sfloat;
135 case D16Unorm: return vk::Format::eD16Unorm;
136 case Bc1RgbUnorm: return vk::Format::eBc1RgbUnormBlock;
137 case Bc1RgbSrgb: return vk::Format::eBc1RgbSrgbBlock;
138 case Bc1RgbaUnorm: return vk::Format::eBc1RgbaUnormBlock;
139 case Bc1RgbaSrgb: return vk::Format::eBc1RgbaSrgbBlock;
140 case Bc2Unorm: return vk::Format::eBc2UnormBlock;
141 case Bc2Srgb: return vk::Format::eBc2SrgbBlock;
142 case Bc3Unorm: return vk::Format::eBc3UnormBlock;
143 case Bc3Srgb: return vk::Format::eBc3SrgbBlock;
144 case Bc4Unorm: return vk::Format::eBc4UnormBlock;
145 case Bc4Snorm: return vk::Format::eBc4SnormBlock;
146 case Bc5Unorm: return vk::Format::eBc5UnormBlock;
147 case Bc5Snorm: return vk::Format::eBc5SnormBlock;
148 case Bc6HUfloat: return vk::Format::eBc6HUfloatBlock;
149 case Bc6HSfloat: return vk::Format::eBc6HSfloatBlock;
150 case Bc7Unorm: return vk::Format::eBc7UnormBlock;
151 case Bc7Srgb: return vk::Format::eBc7SrgbBlock;
152 case Undefined:
153 default:
154 return vk::Format::eUndefined;
155 }
156 }
157
158 inline vk::ColorSpaceKHR vkColorSpaceFromRHIColorSpace(RHIColorSpace colorSpace) {
159 using enum RHIColorSpace;
160 switch (colorSpace) {
161 case SrgbNonLinear: return vk::ColorSpaceKHR::eSrgbNonlinear;
162 case ExtendedSrgbLinear: return vk::ColorSpaceKHR::eExtendedSrgbLinearEXT;
163 case Hdr10St2084: return vk::ColorSpaceKHR::eHdr10St2084EXT;
164 default:
165 return vk::ColorSpaceKHR::eSrgbNonlinear;
166 }
167 }
168
169 inline RHIColorSpace rhiColorSpaceFromVkColorSpace(vk::ColorSpaceKHR colorSpace) {
170 using enum RHIColorSpace;
171 switch (colorSpace) {
172 case vk::ColorSpaceKHR::eSrgbNonlinear: return SrgbNonLinear;
173 case vk::ColorSpaceKHR::eExtendedSrgbLinearEXT: return ExtendedSrgbLinear;
174 case vk::ColorSpaceKHR::eHdr10St2084EXT: return Hdr10St2084;
175 default:
176 return SrgbNonLinear;
177 }
178 }
179
180 inline RHIDeviceType rhiDeviceTypeFromVkPhysicalDeviceType(vk::PhysicalDeviceType type) {
181 using enum RHIDeviceType;
182 switch (type) {
183 case vk::PhysicalDeviceType::eIntegratedGpu: return Integrated;
184 case vk::PhysicalDeviceType::eDiscreteGpu: return Discrete;
185 case vk::PhysicalDeviceType::eVirtualGpu: return Virtual;
186 case vk::PhysicalDeviceType::eCpu: return Software;
187 case vk::PhysicalDeviceType::eOther:
188 default:
189 return Other;
190 }
191 }
192
193 inline vk::BufferUsageFlags vkBufferUsageFromRHIBufferUsage(RHIBufferUsage usage) {
194 using enum RHIBufferUsageBits;
195 vk::BufferUsageFlags flags{};
196 if (usage & VertexBuffer) flags |= vk::BufferUsageFlagBits::eVertexBuffer;
197 if (usage & IndexBuffer) flags |= vk::BufferUsageFlagBits::eIndexBuffer;
198 if (usage & UniformBuffer) flags |= vk::BufferUsageFlagBits::eUniformBuffer;
199 if (usage & StorageBuffer) flags |= vk::BufferUsageFlagBits::eStorageBuffer;
200 if (usage & IndirectBuffer) flags |= vk::BufferUsageFlagBits::eIndirectBuffer;
201 if (usage & TransferSource) flags |= vk::BufferUsageFlagBits::eTransferSrc;
202 if (usage & TransferDestination) flags |= vk::BufferUsageFlagBits::eTransferDst;
203 if (usage & DeviceAddress) flags |= vk::BufferUsageFlagBits::eShaderDeviceAddress;
204 if (usage & AccelerationStructureStorage) flags |= vk::BufferUsageFlagBits::eAccelerationStructureStorageKHR;
205 if (usage & AccelerationStructureBuildReadOnly) flags |= vk::BufferUsageFlagBits::eAccelerationStructureBuildInputReadOnlyKHR;
206 if (usage & ShaderBindingTable) flags |= vk::BufferUsageFlagBits::eShaderBindingTableKHR;
207 return flags;
208 }
209
210 inline vk::AccessFlags2 vkAccessFlagsFromRHIResourceAccess(RHIResourceAccess state) {
211 using enum RHIResourceAccessBits;
212 vk::AccessFlags2 flags{};
213 if (state & RenderTargetWrite) flags |= vk::AccessFlagBits2::eColorAttachmentWrite;
214 if (state & RenderTargetRead) flags |= vk::AccessFlagBits2::eColorAttachmentRead;
215 if (state & DepthStencilWrite) flags |= vk::AccessFlagBits2::eDepthStencilAttachmentWrite;
216 if (state & DepthStencilRead) flags |= vk::AccessFlagBits2::eDepthStencilAttachmentRead;
217 if (state & TransferWrite) flags |= vk::AccessFlagBits2::eTransferWrite;
218 if (state & TransferRead) flags |= vk::AccessFlagBits2::eTransferRead;
219 if (state & ShaderWrite) flags |= vk::AccessFlagBits2::eShaderWrite;
220 if (state & ShaderRead) flags |= vk::AccessFlagBits2::eShaderRead;
221 if (state & UniformRead) flags |= vk::AccessFlagBits2::eUniformRead;
222 if (state & HostWrite) flags |= vk::AccessFlagBits2::eHostWrite;
223 if (state & HostRead) flags |= vk::AccessFlagBits2::eHostRead;
224 if (state & AccelerationStructureRead) flags |= vk::AccessFlagBits2::eAccelerationStructureReadKHR;
225 if (state & AccelerationStructureWrite) flags |= vk::AccessFlagBits2::eAccelerationStructureWriteKHR;
226 if (state & IndirectCommandRead) flags |= vk::AccessFlagBits2::eIndirectCommandRead;
227 return flags;
228 }
229
231 switch (layout) {
232 case RHITextureLayout::Undefined: return vk::ImageLayout::eUndefined;
233 case RHITextureLayout::General: return vk::ImageLayout::eGeneral;
234 case RHITextureLayout::RenderTarget: return vk::ImageLayout::eColorAttachmentOptimal;
235 case RHITextureLayout::DepthStencil: return vk::ImageLayout::eDepthStencilAttachmentOptimal;
236 case RHITextureLayout::DepthStencilReadOnly: return vk::ImageLayout::eDepthStencilReadOnlyOptimal;
237 case RHITextureLayout::Present: return vk::ImageLayout::ePresentSrcKHR;
238 case RHITextureLayout::TransferDst: return vk::ImageLayout::eTransferDstOptimal;
239 case RHITextureLayout::TransferSrc: return vk::ImageLayout::eTransferSrcOptimal;
240 case RHITextureLayout::ShaderReadOnly: return vk::ImageLayout::eShaderReadOnlyOptimal;
241 default:
242 return vk::ImageLayout::eUndefined;
243 }
244 }
245
246 inline vk::PipelineStageFlags vkPipelineStageFlagsFromRHIPipelineStage(RHIPipelineStage stage) {
247 using enum RHIPipelineStageBits;
248 vk::PipelineStageFlags flags{};
249 if (stage & DrawIndirect) flags |= vk::PipelineStageFlagBits::eDrawIndirect;
250 if (stage & FragmentShader) flags |= vk::PipelineStageFlagBits::eFragmentShader;
251 if (stage & VertexShader) flags |= vk::PipelineStageFlagBits::eVertexShader;
252 if (stage & ComputeShader) flags |= vk::PipelineStageFlagBits::eComputeShader;
253 if (stage & RayTracingShader) flags |= vk::PipelineStageFlagBits::eRayTracingShaderKHR;
254 if (stage & MeshShader) flags |= vk::PipelineStageFlagBits::eMeshShaderEXT;
255 if (stage & RenderTargetOutput) flags |= vk::PipelineStageFlagBits::eColorAttachmentOutput;
256 if (stage & Transfer) flags |= vk::PipelineStageFlagBits::eTransfer;
257 if (stage & EarlyFragmentTests) flags |= vk::PipelineStageFlagBits::eEarlyFragmentTests;
258 if (stage & LateFragmentTests) flags |= vk::PipelineStageFlagBits::eLateFragmentTests;
259 if (stage & AccelerationBuild) flags |= vk::PipelineStageFlagBits::eAccelerationStructureBuildKHR;
260 if (stage & TopOfPipe) flags |= vk::PipelineStageFlagBits::eTopOfPipe;
261 if (stage & BottomOfPipe) flags |= vk::PipelineStageFlagBits::eBottomOfPipe;
262 if (stage & AllGraphics) flags |= vk::PipelineStageFlagBits::eAllGraphics;
263 if (stage & Host) flags |= vk::PipelineStageFlagBits::eHost;
264 return flags;
265 }
266
267 inline vk::PipelineStageFlags2 vkPipelineStageFlags2FromRHIPipelineStage(RHIPipelineStage stage) {
268 using enum RHIPipelineStageBits;
269 vk::PipelineStageFlags2 flags{};
270 if (stage & DrawIndirect) flags |= vk::PipelineStageFlagBits2::eDrawIndirect;
271 if (stage & FragmentShader) flags |= vk::PipelineStageFlagBits2::eFragmentShader;
272 if (stage & VertexShader) flags |= vk::PipelineStageFlagBits2::eVertexShader;
273 if (stage & ComputeShader) flags |= vk::PipelineStageFlagBits2::eComputeShader;
274 if (stage & RayTracingShader) flags |= vk::PipelineStageFlagBits2::eRayTracingShaderKHR;
275 if (stage & MeshShader) flags |= vk::PipelineStageFlagBits2::eMeshShaderEXT;
276 if (stage & TaskShader) flags |= vk::PipelineStageFlagBits2::eTaskShaderEXT;
277 if (stage & RenderTargetOutput) flags |= vk::PipelineStageFlagBits2::eColorAttachmentOutput;
278 if (stage & Transfer) flags |= vk::PipelineStageFlagBits2::eTransfer;
279 if (stage & EarlyFragmentTests) flags |= vk::PipelineStageFlagBits2::eEarlyFragmentTests;
280 if (stage & LateFragmentTests) flags |= vk::PipelineStageFlagBits2::eLateFragmentTests;
281 if (stage & AccelerationBuild) flags |= vk::PipelineStageFlagBits2::eAccelerationStructureBuildKHR;
282 if (stage & TopOfPipe) flags |= vk::PipelineStageFlagBits2::eTopOfPipe;
283 if (stage & BottomOfPipe) flags |= vk::PipelineStageFlagBits2::eBottomOfPipe;
284 if (stage & AllGraphics) flags |= vk::PipelineStageFlagBits2::eAllGraphics;
285 if (stage & Host) flags |= vk::PipelineStageFlagBits2::eHost;
286 return flags;
287 }
288
289 inline vk::ShaderStageFlags vkShaderStageFlagsFromRHIShaderStage(RHIShaderStage stage) {
290 using enum RHIShaderStageBits;
291 vk::ShaderStageFlags flags{};
292 if (stage == All) return vk::ShaderStageFlagBits::eAll;
293 if (stage & Vertex) flags |= vk::ShaderStageFlagBits::eVertex;
294 if (stage & Fragment) flags |= vk::ShaderStageFlagBits::eFragment;
295 if (stage & Compute) flags |= vk::ShaderStageFlagBits::eCompute;
296 if (stage & RayGeneration) flags |= vk::ShaderStageFlagBits::eRaygenKHR;
297 if (stage & RayAnyHit) flags |= vk::ShaderStageFlagBits::eAnyHitKHR;
298 if (stage & RayClosestHit) flags |= vk::ShaderStageFlagBits::eClosestHitKHR;
299 if (stage & RayMiss) flags |= vk::ShaderStageFlagBits::eMissKHR;
300 if (stage & RayIntersection) flags |= vk::ShaderStageFlagBits::eIntersectionKHR;
301 if (stage & Task) flags |= vk::ShaderStageFlagBits::eTaskEXT;
302 if (stage & Mesh) flags |= vk::ShaderStageFlagBits::eMeshEXT;
303 return flags;
304 }
305
307 using enum RHIDescriptorType;
308 switch (type)
309 {
310 case Sampler:
311 return vk::DescriptorType::eSampler;
312 case SampledImage:
313 return vk::DescriptorType::eSampledImage;
314 case StorageImage:
315 return vk::DescriptorType::eStorageImage;
316 case StorageBuffer:
317 return vk::DescriptorType::eStorageBuffer;
318 case UniformBuffer:
319 return vk::DescriptorType::eUniformBuffer;
321 return vk::DescriptorType::eAccelerationStructureKHR;
322 default:
323 return {};
324 }
325 }
326
327 inline vk::PipelineBindPoint vkPipelineBindPointFromRHIDevicePipelineType(RHIDevicePipelineType type) {
328 switch (type) {
329 case RHIDevicePipelineType::Compute: return vk::PipelineBindPoint::eCompute;
330 case RHIDevicePipelineType::Graphics: return vk::PipelineBindPoint::eGraphics;
331 case RHIDevicePipelineType::RayTracing: return vk::PipelineBindPoint::eRayTracingKHR;
332 default:
333 return {};
334 }
335 }
336
337 inline vk::ImageUsageFlags vkImageUsageFlagsFromRHITextureUsage(RHITextureUsage usage) {
338 using enum RHITextureUsageBits;
339 vk::ImageUsageFlags flags{};
340 if (usage & RenderTarget) flags |= vk::ImageUsageFlagBits::eColorAttachment;
341 if (usage & DepthStencil) flags |= vk::ImageUsageFlagBits::eDepthStencilAttachment;
342 if (usage & SampledImage) flags |= vk::ImageUsageFlagBits::eSampled;
343 if (usage & StorageImage) flags |= vk::ImageUsageFlagBits::eStorage;
344 if (usage & TransferSource) flags |= vk::ImageUsageFlagBits::eTransferSrc;
345 if (usage & TransferDestination) flags |= vk::ImageUsageFlagBits::eTransferDst;
346 return flags;
347 }
348
349 inline vk::SampleCountFlagBits vkSampleCountFlagFromRHIMultisampleCount(RHIMultisampleCount count) {
350 using enum RHIMultisampleCount;
351 switch (count) {
352 case E2: return vk::SampleCountFlagBits::e2;
353 case E4: return vk::SampleCountFlagBits::e4;
354 case E8: return vk::SampleCountFlagBits::e8;
355 case E16: return vk::SampleCountFlagBits::e16;
356 case E1: return vk::SampleCountFlagBits::e1;
357 default:
358 return {};
359 }
360 }
361
362 inline vk::ImageAspectFlags vkImageAspectFlagFromRHITextureAspect(RHITextureAspectFlag aspect) {
363 using enum RHITextureAspectFlagBits;
364 vk::ImageAspectFlags flags{};
365 if (aspect & Color) flags |= vk::ImageAspectFlagBits::eColor;
366 if (aspect & Depth) flags |= vk::ImageAspectFlagBits::eDepth;
367 if (aspect & Stencil) flags |= vk::ImageAspectFlagBits::eStencil;
368 return flags;
369 }
370
373 switch (type) {
374 case TopLevel: return vk::AccelerationStructureTypeKHR::eTopLevel;
375 case BottomLevel: return vk::AccelerationStructureTypeKHR::eBottomLevel;
376 default:
377 return {};
378 }
379 }
380
382 {
384 switch (op) {
385 case Build: return vk::BuildAccelerationStructureModeKHR::eBuild;
386 case Update: return vk::BuildAccelerationStructureModeKHR::eUpdate;
387 default:
388 return {};
389 }
390 }
391
392 inline vk::BuildAccelerationStructureFlagsKHR vkBuildAccelerationStructureFlagsFromRHIAccelerationStructureBuildFlags(RHIAccelerationStructureBuildFlags flags)
393 {
394 using enum RHIAccelerationStructureBuildFlagsBits;
395 vk::BuildAccelerationStructureFlagsKHR vkFlags{};
396 if (flags & AllowUpdate) vkFlags |= vk::BuildAccelerationStructureFlagBitsKHR::eAllowUpdate;
397 if (flags & AllowCompaction) vkFlags |= vk::BuildAccelerationStructureFlagBitsKHR::eAllowCompaction;
398 if (flags & PreferFastTrace) vkFlags |= vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastTrace;
399 if (flags & PreferFastBuild) vkFlags |= vk::BuildAccelerationStructureFlagBitsKHR::ePreferFastBuild;
400 if (flags & LowMemory) vkFlags |= vk::BuildAccelerationStructureFlagBitsKHR::eLowMemory;
401 return vkFlags;
402 }
403}
#define GLOBAL_ALLOC
Definition Allocator.hpp:240
#define CHECK(expr)
Definition Logging.hpp:92
Allocator interface (noexcept)
Definition Allocator.hpp:29
virtual void Deallocate(pointer ptr) noexcept=0
virtual pointer Allocate(size_type size, size_t alignment=alignof(std::max_align_t)) noexcept=0
virtual pointer Reallocate(pointer ptr, size_type new_size, size_t alignment) noexcept=0
std::vector< T, StlAllocator< T > > Vector
std::vector with explicit Foundation::Core::StlAllocator constructor
Definition Container.hpp:149
Low-level Rendering Hardware Interface (RHI) abstractions.
Definition Application.hpp:3
DeviceAddress
Definition Common.hpp:367
MeshShader
Definition Common.hpp:343
RayTracingShader
Definition Common.hpp:342
RHIAccelerationStructureBuildOp
Definition Common.hpp:237
vk::AccessFlags2 vkAccessFlagsFromRHIResourceAccess(RHIResourceAccess state)
Definition Common.hpp:210
IndexBuffer
Definition Common.hpp:359
AccelerationStructureBuildReadOnly
Definition Common.hpp:369
FragmentShader
Definition Common.hpp:340
vk::SampleCountFlagBits vkSampleCountFlagFromRHIMultisampleCount(RHIMultisampleCount count)
Definition Common.hpp:349
RHIColorSpace rhiColorSpaceFromVkColorSpace(vk::ColorSpaceKHR colorSpace)
Definition Common.hpp:169
PreferFastBuild
Definition Common.hpp:392
RHITextureLayout
Definition Common.hpp:218
Task
Definition Common.hpp:299
vk::AccelerationStructureTypeKHR vkAccelerationStructureTypeFromRHIAccelerationStructureType(RHIAccelerationStructureType type)
Definition Common.hpp:371
Depth
Definition Common.hpp:384
vk::ImageAspectFlags vkImageAspectFlagFromRHITextureAspect(RHITextureAspectFlag aspect)
Definition Common.hpp:362
vk::PipelineBindPoint vkPipelineBindPointFromRHIDevicePipelineType(RHIDevicePipelineType type)
Definition Common.hpp:327
UniformRead
Definition Common.hpp:327
VertexShader
Definition Common.hpp:339
RayGeneration
Definition Common.hpp:289
ShaderBindingTable
Definition Common.hpp:370
vk::DescriptorType vkDescriptorTypeFromRHIDescriptorType(RHIDescriptorType type)
Definition Common.hpp:306
TopOfPipe
Definition Common.hpp:353
RenderTargetOutput
Definition Common.hpp:345
All
Definition Common.hpp:302
Compute
Definition Common.hpp:196
vk::ColorSpaceKHR vkColorSpaceFromRHIColorSpace(RHIColorSpace colorSpace)
Definition Common.hpp:158
vk::BuildAccelerationStructureModeKHR vkBuildAccelerationStructureModeFromRHIAccelerationStructureBuildOp(RHIAccelerationStructureBuildOp op)
Definition Common.hpp:381
Host
Definition Common.hpp:351
RenderTargetRead
Definition Common.hpp:320
ComputeShader
Definition Common.hpp:341
vk::ImageLayout vkImageLayoutFromRHITextureLayout(RHITextureLayout layout)
Definition Common.hpp:230
AccelerationBuild
Definition Common.hpp:349
RHIAccelerationStructureType
Definition Common.hpp:231
T VkExpect(vk::ResultValue< T > &&rv)
Definition Common.hpp:15
Color
Definition Common.hpp:383
RHIDeviceType
Definition Common.hpp:164
EarlyFragmentTests
Definition Common.hpp:347
TransferRead
Definition Common.hpp:324
AccelerationStructureWrite
Definition Common.hpp:331
TransferSource
Definition Common.hpp:365
vk::Format vkFormatFromRHIFormat(RHIResourceFormat format)
Definition Common.hpp:111
vk::ImageUsageFlags vkImageUsageFlagsFromRHITextureUsage(RHITextureUsage usage)
Definition Common.hpp:337
RHIColorSpace
Definition Common.hpp:131
UniformBuffer
Definition Common.hpp:361
AccelerationStructureRead
Definition Common.hpp:330
AccelerationStructureStorage
Definition Common.hpp:368
ShaderRead
Definition Common.hpp:326
TaskShader
Definition Common.hpp:344
VertexBuffer
Definition Common.hpp:358
HostRead
Definition Common.hpp:329
StorageBuffer
Definition Common.hpp:363
IndirectCommandRead
Definition Common.hpp:332
vk::ShaderStageFlags vkShaderStageFlagsFromRHIShaderStage(RHIShaderStage stage)
Definition Common.hpp:289
DepthStencil
Definition Common.hpp:375
AllowCompaction
Definition Common.hpp:390
vk::PipelineStageFlags vkPipelineStageFlagsFromRHIPipelineStage(RHIPipelineStage stage)
Definition Common.hpp:246
Transfer
Definition Common.hpp:197
RayAnyHit
Definition Common.hpp:291
RHIDescriptorType
Definition Common.hpp:255
LateFragmentTests
Definition Common.hpp:348
RayClosestHit
Definition Common.hpp:293
HostWrite
Definition Common.hpp:328
PreferFastTrace
Definition Common.hpp:391
RHIResourceFormat
Definition Common.hpp:34
AllowUpdate
Definition Common.hpp:389
BottomOfPipe
Definition Common.hpp:354
RenderTargetWrite
Definition Common.hpp:319
RHIDeviceType rhiDeviceTypeFromVkPhysicalDeviceType(vk::PhysicalDeviceType type)
Definition Common.hpp:180
DepthStencilWrite
Definition Common.hpp:321
vk::BuildAccelerationStructureFlagsKHR vkBuildAccelerationStructureFlagsFromRHIAccelerationStructureBuildFlags(RHIAccelerationStructureBuildFlags flags)
Definition Common.hpp:392
Mesh
Definition Common.hpp:301
Vector< T > VkEnumerate(Enumerator &&enumerate, Allocator *allocator=GLOBAL_ALLOC) noexcept
Definition Common.hpp:29
Stencil
Definition Common.hpp:385
TransferDestination
Definition Common.hpp:366
vk::PipelineStageFlags2 vkPipelineStageFlags2FromRHIPipelineStage(RHIPipelineStage stage)
Definition Common.hpp:267
Bits vkFlagsToBits(vk::Flags< Bits > flags)
Definition Common.hpp:108
ShaderWrite
Definition Common.hpp:325
TransferWrite
Definition Common.hpp:323
RayMiss
Definition Common.hpp:295
RHIMultisampleCount
Definition Common.hpp:273
DepthStencilRead
Definition Common.hpp:322
SampledImage
Definition Common.hpp:376
Fragment
Definition Common.hpp:285
DrawIndirect
Definition Common.hpp:338
IndirectBuffer
Definition Common.hpp:364
RenderTarget
Definition Common.hpp:374
StorageImage
Definition Common.hpp:377
Vertex
Definition Common.hpp:283
AllGraphics
Definition Common.hpp:352
LowMemory
Definition Common.hpp:393
RayIntersection
Definition Common.hpp:297
vk::BufferUsageFlags vkBufferUsageFromRHIBufferUsage(RHIBufferUsage usage)
Definition Common.hpp:193
static void *VKAPI_PTR Reallocate(void *userData, void *original, size_t size, size_t alignment, VkSystemAllocationScope)
Definition Common.hpp:85
vk::AllocationCallbacks const * Get() const
Definition Common.hpp:66
VkAllocationCallbacks const * GetNative() const
Definition Common.hpp:71
VulkanAllocationCallbacks(Allocator *allocator=nullptr)
Definition Common.hpp:50
void Reset(Allocator *newAllocator)
Definition Common.hpp:55
Allocator * allocator
Definition Common.hpp:47
VkAllocationCallbacks callbacks
Definition Common.hpp:48
static void *VKAPI_PTR Allocate(void *userData, size_t size, size_t alignment, VkSystemAllocationScope)
Definition Common.hpp:77
static void VKAPI_PTR Free(void *userData, void *memory)
Definition Common.hpp:101