Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Renderer.h
Go to the documentation of this file.
1#pragma once
2
8
9#include <array>
10#include <BS_tracy_thread_pool.hpp>
11#include <chrono>
15#include <filesystem>
16#include <memory>
17#include <unordered_map>
18#include <vector>
19#include <vulkan/vulkan_core.h>
20
21#ifdef ENABLE_TRACY
22# include <tracy/TracyVulkan.hpp>
23#endif
24
25namespace Vulkan {
26 class BarrierBundle;
27}
28
29namespace EngineCore
30{
32 struct MaterialShader;
33 class AssetManager;
34} // namespace EngineCore
35
36namespace EngineCore
37{
38 class Headset;
40 class GraphicsPipeline;
41 class Engine;
42 class DataBuffer;
43 class RenderProcess;
44} // namespace EngineCore
45
46namespace EngineCore
47{
53 {
54 std::filesystem::path meshShaderPath;
55 std::filesystem::path fragmentShaderPath;
57 };
58
72 {
80 {
81 TaskConstants() = default;
82
83 explicit TaskConstants( const uint32_t drawCommandOffset = 0 )
85 {
86 }
87
88 uint32_t drawCommandOffset = 0u;
89 };
90
91
92 public:
103 explicit Renderer(
104 ApplicationContext * context = nullptr,
105 Headset * headset = nullptr,
106 const Engine * engine = nullptr
107 );
108
112 ~Renderer();
113
122 void allocateDescriptors();
123
124 void initializeGpuBuffers() const;
125 void prepareTransferSubmission( uint32_t frameIndex ) const;
126
134 void updateViewMatrix();
135
136 void recordRenderPass( size_t swapChainImageIndex );
137
139 void createBinningAllocatorResources(); // 1.5 (Stage 1)
140 void createMeshletUnpackingResources(); // 3 (Stage 2)
142 void createPrepareDrawResources(); // 6
143 void createHiZGenerationResources(); // Hi-Z generation compute pass
144 void createVertexShaderPathResources(); // Vertex shader path for single-meshlet geometry
145
163
172 void updateCpuRenderResources( float time );
173
180 void restartRenderCommandBuffers() const;
181
182 void recordXrSwapchainImageWritableBarrier( uint32_t swapChainImageIndex ) const;
183
184 void recordXrSwapchainImageFinishedWritingBarrier( uint32_t swapChainImageIndex ) const;
185
190 void recordHiZGeneration();
191
198 void recordPass2Culling( size_t swapChainImageIndex );
199
205 void recordPass2RenderPass( size_t swapChainImageIndex );
206
211 const std::unique_ptr<RenderingDataManager> & getRenderingDataManager() const;
212 private:
213
214 std::unique_ptr<RenderingDataManager> renderingDataManager;
215
216 std::optional<VulkanBuffer> objectCullingDataBuffer;
217 std::optional<VulkanBuffer> objectMeshletDataBuffer;
218 std::optional<VulkanBuffer> objectIDsBuffer;
219 std::optional<VulkanBuffer> meshUnpackingDataBuffer;
220
221 std::optional<VulkanBuffer> counterBuffer;
222 std::optional<VulkanBuffer> dispatchBuffer;
223
224 std::optional<VulkanBuffer> placeholderBuffer;
225 std::optional<VulkanBuffer> placeholderUniformBuffer;
226
233 void createCounterBuffer();
238
239 public:
240 [[nodiscard]] const VulkanBuffer & getObjectCullingDataBuffer() const;
241 [[nodiscard]] const VulkanBuffer & getObjectMeshletDataBuffer() const;
242 [[nodiscard]] const VulkanBuffer & getObjectIDsBuffer() const;
243 [[nodiscard]] const VulkanBuffer & getCounterBuffer() const;
244 [[nodiscard]] const VulkanBuffer & getDispatchBuffer() const;
245 [[nodiscard]] const VulkanBuffer & getMeshUnpackingDataBuffer() const;
246
247 [[nodiscard]] const VulkanBuffer & getPlaceholderBuffer() const;
248 [[nodiscard]] const VulkanBuffer & getPlaceholderUniformBuffer() const;
249
256 bool ensureOutputBufferSizes(uint32_t primitiveCount);
257
263
266
267 void renderToXr( size_t swapChainImageIndex, float time );
268
269 void recordTransfer( float time );
271 void uploadFrameData( float time );
272 void submitTransfer();
273 void submitGraphics(
274 uint32_t swapChainImageIndex,
275 VkSemaphore mirrorAcquireSemaphore = VK_NULL_HANDLE
276 );
277 uint64_t getTimelineSemaphoreValue() const;
278
287 [[nodiscard]] VkCommandBuffer getCurrentTransferCommandBuffer() const;
288 [[nodiscard]] VkCommandBuffer getCurrentRenderingCommandBuffer() const;
289 [[nodiscard]] VkSemaphore getCurrentMirrorViewSemaphore() const;
290 [[nodiscard]] VkSemaphore getCurrentPresentableSemaphore( uint32_t swapchainImageIndex ) const;
291
300 std::vector<VkCommandBuffer> getGraphicsCommandBuffers() const;
301
305 [[nodiscard]] const std::vector<RenderProcess*>& getRenderProcesses() const { return renderProcesses; }
306
315 [[nodiscard]] VkCommandPool getGraphicsCommandPool() const;
316
325 [[nodiscard]] VkCommandPool getTransferCommandPool() const;
326
333 void cleanup();
334
344
351 void advanceFrameIndices();
352
368
383 [[nodiscard]] bool shouldSkipMirrorView();
384
392 void markFrameStart();
393
403 [[nodiscard]] int64_t getFrameElapsedMs() const;
404
414 [[nodiscard]] bool isInStallRecovery() const;
415
423 VkSemaphore getTimelineSemaphore() const;
424
433 const std::vector<GraphicsPipeline *> & getGraphicsPipelines() const;
434
443 [[nodiscard]] Headset* getHeadset() const { return headset; }
444
458 void setFreezeCulling(bool freeze);
459
468 [[nodiscard]] bool isFreezeCulling() const { return freezeCulling_; }
469
470#ifdef ENABLE_TRACY
479 void setupTracy( const std::vector<TracyVkCtx> & tracyVulkanContext );
480
491 void resetTracyContexts();
492#endif
493
502 [[nodiscard]] const TimelineSynchronizer& getTimelineSynchronizer() const;
503
515 bool getPipelineIndex( GraphicsPipeline * pipeline, uint32_t & pipelineIndex ) const;
516
527 bool getPipelineIndex( PipelineNames pipelineName, uint32_t & pipelineIndex ) const;
528
539 static PipelineConfig getPipelineConfig( PipelineNames pipelineName );
540
541 private:
542#ifdef ENABLE_TRACY
543 std::vector<TracyVkCtx> tracyVkContext;
544
545 TracyVkCtx getCurrentTracyVkContext() const;
546 void destroyTracyContexts();
547#else
549#endif
550
551 std::unique_ptr<TimelineSynchronizer> timelineSynchronizer_;
552
555
556 uint64_t renderedFrameCounter = 0u;
557
561
563 static constexpr int SKIP_FRAMES_AFTER_STALL = 4;
564
566 std::chrono::steady_clock::time_point lastFrameStartTime_ = std::chrono::steady_clock::now();
567
569 static constexpr std::chrono::milliseconds STALL_THRESHOLD_MS{1000};
570
571 std::vector<VulkanStagedBufferSyncObjects> syncCopyObjects{};
572
573 BS_tracy::tracy_thread_pool<BS_tracy::tp::none> updateThreadPool;
574
575 // Maps each graphics pipeline pointer to its index within the graphicsPipelines vector
576 std::unordered_map<GraphicsPipeline *, uint32_t> pipelineIndices;
577
578 // Maps PipelineNames enum to the created GraphicsPipeline object
579 std::unordered_map<PipelineNames, GraphicsPipeline*> pipelinesByName;
580
581 const Engine * engine = nullptr;
582
596 const std::string & meshShader,
597 const std::string & fragShader,
598 const PipelineMaterialPayload & pipelineData
599 ) const;
600
604 VkCommandPool vkGraphicsCommandPool = VK_NULL_HANDLE;
605
612 VkCommandPool vkTransferCommandPool = VK_NULL_HANDLE;
613
620 VkDescriptorPool descriptorPool = VK_NULL_HANDLE;
621
625 std::optional<ComputePass> objectCullingComputePass;
626 std::optional<ComputePass> binningAllocatorComputePass;
627 std::optional<DispatcherComputePass> meshletUnpackingDispatchComputePass;
628 std::optional<ComputePass> meshletUnpackingComputePass;
629 std::optional<DispatcherComputePass> meshletCullingDispatchComputePass;
630 std::optional<ComputePass> meshletCullingComputePass;
631 std::optional<ComputePass> drawPreparationComputePass;
632
633 std::optional<ComputePass> primitiveCulling;
634 std::optional<ComputePass> primitiveBinning;
635 std::optional<ComputePass> meshletUnpacking;
636 std::optional<ComputePass> drawPreparation;
637
638 // Hi-Z Occlusion Culling (legacy multi-pass - kept for fallback)
639 std::optional<ComputePass> hiZGenerationComputePass;
640
643 static constexpr uint32_t MAX_HIZ_MIP_LEVELS = 16;
644 std::array<std::array<VkDescriptorSet, MAX_HIZ_MIP_LEVELS>, MAX_FRAMES_IN_FLIGHT> hiZMipDescriptorSets{};
645 VkDescriptorPool hiZDescriptorPool = VK_NULL_HANDLE;
646
647 // Hi-Z SPD (Single Pass Downsampler) - generates all mips in one dispatch
648 std::optional<ComputePass> hiZSPDComputePass;
649 std::optional<VulkanBuffer> hiZSPDAtomicBuffer; // Global atomic counter for SPD workgroup sync
650 std::array<VkDescriptorSet, MAX_FRAMES_IN_FLIGHT> hiZSPDDescriptorSets{};
651 bool useSPDHiZ_ = false; // Use SPD by default, can fall back to multi-pass
652
655 void updateHiZSPDDescriptorSets(uint32_t frameIndex);
657
658 // Vertex Shader Path for single-meshlet geometry
659 // Uses traditional vertex shader + instancing (faster than mesh shader for small meshes)
660 VkPipeline vsGraphicsPipeline_ = VK_NULL_HANDLE; // Vertex shader pipeline for single-meshlet geometry
661 VkPipelineLayout vsPipelineLayout_ = VK_NULL_HANDLE; // Pipeline layout for VS path
662 bool useVertexShaderPath_ = true; // Enable VS path for single-meshlet geometry
663
665 void recordVertexShaderDraws(size_t swapChainImageIndex) const;
666 void recordVertexShaderDrawsDepthOnly(size_t swapChainImageIndex) const;
667
668 // VS Instanced Drawing Pipeline (reduces ~5k draw calls to ~1)
669 // Stage 1: VSBinningAllocator - Count instances per geometry type
670 // Stage 2: VSInstanceUnpacking - Write instance IDs to per-geometry bins
671 // Stage 3: VSPrepareDraw - Generate one draw command per geometry type
672 std::optional<ComputePass> vsBinningAllocatorComputePass_;
673 std::optional<ComputePass> vsInstanceUnpackingComputePass_;
674 std::optional<ComputePass> vsPrepareDrawComputePass_;
675 bool useVSInstancedDrawing_ = true; // Enable VS instanced drawing optimization
676
679
681 bool freezeCulling_ = false;
682
684 void updateHiZMipDescriptorSets(uint32_t frameIndex);
685
686
687
688 public:
700
701 // VS Instanced Drawing Pipeline compute pass getters
705
706 private:
707 VkDescriptorSetLayout graphicsDescriptorSetLayout = VK_NULL_HANDLE;
708
709#ifdef IS_IN_DEBUG
710 PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT = nullptr;
711 PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = nullptr;
712#endif
713
721 {
722 MeshConstants() = default;
723
728
730 uint32_t _padding1 = 0u;
731 uint32_t _padding2 = 0u;
732 uint32_t _padding3 = 0u;
733 };
734
735 std::vector<VkPushConstantRange> pushConstants;
736
740 VkPipelineLayout computeObjectCullingPipelineLayout = VK_NULL_HANDLE;
741 VkPipelineLayout computeMeshletCullingPipelineLayout = VK_NULL_HANDLE;
742 VkPipelineLayout prepareDrawsComputePipelineLayout = VK_NULL_HANDLE;
743 VkPipelineLayout graphicsPipelineLayout = VK_NULL_HANDLE;
744
748 std::vector<RenderProcess *> renderProcesses;
749
753 //ComputePipeline * objectCullingComputePipeline = nullptr;
754 //ComputePipeline * meshletCullingComputePipeline = nullptr;
755 //ComputePipeline * prepareDrawsComputePipeline = nullptr;
756
757 std::vector<GraphicsPipeline *> graphicsPipelines;
758
759 // Depth-only pipelines for Z-prepass (Pass 1)
760 // These have colorAttachmentCount = 0, enabling "Double-Speed Z" on NVIDIA/AMD
761 std::vector<GraphicsPipeline *> depthOnlyGraphicsPipelines;
762 VkPipeline vsDepthOnlyPipeline_ = VK_NULL_HANDLE; // Depth-only VS pipeline
763
764 uint32_t currentFrame = 0u;
765
767 Headset * headset = nullptr;
768
769 uint64_t frameCounter = 0u;
770
771 std::vector<VkSemaphore> renderFinishedSemaphores;
772 };
773} // namespace EngineCore
constexpr int MAX_FRAMES_IN_FLIGHT
Definition Settings.h:26
The application context is the core class which stores the basic openxr and vulkan objects.
The compute pass stores all resources which belong to a compute pipeline.
Definition ComputePass.h:26
The render process class consolidates all the resources that needs to be duplicated for each frame th...
std::optional< VulkanBuffer > meshUnpackingDataBuffer
Definition Renderer.h:219
DispatcherComputePass & getMeshletUnpackingDispatchComputePass()
void restartRenderCommandBuffers() const
Resets the command buffers of the active frame and begins a new write.
ComputePass & getMeshletUnpackingComputePass()
void createMeshletUnpackingResources()
std::vector< RenderProcess * > renderProcesses
The render processes.
Definition Renderer.h:748
std::optional< ComputePass > primitiveCulling
Definition Renderer.h:633
void createHiZMipDescriptorSets()
uint32_t currentFrame
Definition Renderer.h:764
std::optional< ComputePass > primitiveBinning
Definition Renderer.h:634
std::optional< ComputePass > hiZGenerationComputePass
Definition Renderer.h:639
VkDependencyInfo getObjectCullingToMeshletUnpackingDispatchBarriers(Vulkan::BarrierBundle &bundle) const
ComputePass & getObjectCullingComputePass()
VkCommandPool getTransferCommandPool() const
gets the command pool used for recording data transfer at the beginning of a frame
int64_t getFrameElapsedMs() const
Gets the elapsed time since markFrameStart() was called. Used to check if the current frame has taken...
void updateHiZSPDDescriptorSets(uint32_t frameIndex)
std::optional< ComputePass > vsPrepareDrawComputePass_
Definition Renderer.h:674
Headset * getHeadset() const
Gets the headset pointer.
Definition Renderer.h:443
VkPipelineLayout vsPipelineLayout_
Definition Renderer.h:661
const std::vector< RenderProcess * > & getRenderProcesses() const
Gets all render processes for cleanup/synchronization.
Definition Renderer.h:305
void createPlaceholderBuffer()
Creates a buffer which can be used anywhere and holds one single 32 bit integer.
std::optional< ComputePass > hiZSPDComputePass
Definition Renderer.h:648
std::unordered_map< PipelineNames, GraphicsPipeline * > pipelinesByName
Definition Renderer.h:579
void initializeXrSwapchainFormats()
bool freezeCulling_
When true, culling data (frustum planes, Hi-Z VP) is frozen for debugging.
Definition Renderer.h:681
const Engine * engine
Definition Renderer.h:581
bool isFreezeCulling() const
Checks if culling data is currently frozen.
Definition Renderer.h:468
bool ensureOutputBufferSizes(uint32_t primitiveCount)
Ensures output buffers are sized to handle the given primitive count. Called by RenderingDataManager ...
void createObjectMeshletDataBuffer()
static constexpr std::chrono::milliseconds STALL_THRESHOLD_MS
Threshold for considering a frame as "stalled" (1 second)
Definition Renderer.h:569
std::optional< ComputePass > binningAllocatorComputePass
Stage 1: Binning allocator.
Definition Renderer.h:626
VkPipeline vsGraphicsPipeline_
Definition Renderer.h:660
VkDependencyInfo getMeshletCullingToPrepareDrawBarriers()
const VulkanBuffer & getObjectCullingDataBuffer() const
VkDescriptorSetLayout graphicsDescriptorSetLayout
Definition Renderer.h:707
RenderProcess * getCurrentRenderProcess() const
Gets the render process of the current frame.
std::unique_ptr< TimelineSynchronizer > timelineSynchronizer_
Definition Renderer.h:551
const VulkanBuffer & getObjectMeshletDataBuffer() const
uint64_t getTimelineSemaphoreValue() const
void recordVertexShaderDraws(size_t swapChainImageIndex) const
void setFreezeCulling(bool freeze)
Freezes culling data (frustum planes, Hi-Z view-projection)
Definition Renderer.cpp:713
void markFrameStart()
Marks the start of a new frame for stall detection. Call this at the beginning of each render frame.
std::optional< ComputePass > drawPreparationComputePass
Definition Renderer.h:631
std::vector< VulkanStagedBufferSyncObjects > syncCopyObjects
Definition Renderer.h:571
std::unordered_map< GraphicsPipeline *, uint32_t > pipelineIndices
Definition Renderer.h:576
const VulkanBuffer & getCounterBuffer() const
void updateViewMatrix()
Requests an update of the current render processes view matrix. The matrix is pulled from the headset...
Definition Renderer.cpp:698
void recordXrSwapchainImageFinishedWritingBarrier(uint32_t swapChainImageIndex) const
VkDependencyInfo getMeshletCullingDispatchToMeshletCullingBarriers()
VkPipelineLayout graphicsPipelineLayout
Definition Renderer.h:743
static constexpr uint32_t MAX_HIZ_MIP_LEVELS
Definition Renderer.h:643
void renderToXr(size_t swapChainImageIndex, float time)
Definition Renderer.cpp:849
void resetMeshletCullingDispatchBuffers()
std::optional< VulkanBuffer > hiZSPDAtomicBuffer
Definition Renderer.h:649
VkPipelineLayout computeObjectCullingPipelineLayout
The pipeline layout.
Definition Renderer.h:740
void initializeGpuBuffers() const
Definition Renderer.cpp:557
ComputePass & getMeshletCullingComputePass()
const VulkanBuffer & getPlaceholderUniformBuffer() const
const TimelineSynchronizer & getTimelineSynchronizer() const
Gets the timeline synchronizer for managing frame synchronization.
BS_tracy::tracy_thread_pool< BS_tracy::tp::none > updateThreadPool
Definition Renderer.h:573
void createVertexShaderPathResources()
VkCommandBuffer getCurrentRenderingCommandBuffer() const
DispatcherComputePass & getMeshletCullingDispatchComputePass()
const std::vector< GraphicsPipeline * > & getGraphicsPipelines() const
Gets the list of all graphics pipelines.
void createHiZGenerationResources()
std::optional< VulkanBuffer > objectMeshletDataBuffer
Definition Renderer.h:217
void recordTransfer(float time)
Definition Renderer.cpp:725
void submitGraphics(uint32_t swapChainImageIndex, VkSemaphore mirrorAcquireSemaphore=VK_NULL_HANDLE)
void cleanup()
Cleans up all resources of the renderer.
void createPlaceholderUniformBuffer()
VkCommandPool vkGraphicsCommandPool
The graphics and present command pool.
Definition Renderer.h:604
void recordPass2RenderPass(size_t swapChainImageIndex)
Records the Pass 2 render pass using dynamic rendering Uses VK_ATTACHMENT_LOAD_OP_LOAD to preserve Pa...
std::vector< VkPushConstantRange > pushConstants
Definition Renderer.h:735
void recordVSInstancedDrawingPipeline()
std::vector< GraphicsPipeline * > graphicsPipelines
The pipelines.
Definition Renderer.h:757
VkSemaphore getTimelineSemaphore() const
Getter for the main timeline renderer semaphore.
void recordVertexShaderDrawsDepthOnly(size_t swapChainImageIndex) const
std::optional< VulkanBuffer > objectCullingDataBuffer
Definition Renderer.h:216
VkCommandPool vkTransferCommandPool
The transfer command pool for all commands submitted to the transfer queue.
Definition Renderer.h:612
void createHiZSPDDescriptorSets()
std::unique_ptr< RenderingDataManager > renderingDataManager
Definition Renderer.h:214
VkCommandBuffer getCurrentTransferCommandBuffer() const
Gets the current frame in flight and retrieves the transfer command buffer.
const VulkanBuffer & getDispatchBuffer() const
std::chrono::steady_clock::time_point lastFrameStartTime_
Time when the last frame started, for stall detection.
Definition Renderer.h:566
~Renderer()
cleans up the object
Definition Renderer.cpp:202
VkPipeline vsDepthOnlyPipeline_
Definition Renderer.h:762
VkPipelineLayout computeMeshletCullingPipelineLayout
Definition Renderer.h:741
VkDependencyInfo getMeshletUnpackingDispatchToMeshletUnpackingBarriers(Vulkan::BarrierBundle &bundle) const
std::optional< ComputePass > objectCullingComputePass
The descriptor set layout.
Definition Renderer.h:625
void resetMeshletUnpackingDispatchBuffers()
std::optional< VulkanBuffer > counterBuffer
Definition Renderer.h:221
void updateHiZMipDescriptorSets(uint32_t frameIndex)
void createPrepareDrawResources()
VkCommandPool getGraphicsCommandPool() const
gets the graphics command pool
void uploadFrameData(float time)
Definition Renderer.cpp:719
std::optional< ComputePass > drawPreparation
Definition Renderer.h:636
void prepareTransferSubmission(uint32_t frameIndex) const
Definition Renderer.cpp:582
VkSemaphore getCurrentPresentableSemaphore(uint32_t swapchainImageIndex) const
void createObjectCullingDataBuffer()
void createVSInstancedDrawingResources()
const std::unique_ptr< RenderingDataManager > & getRenderingDataManager() const
Getter for the rendering data manager.
std::optional< ComputePass > vsBinningAllocatorComputePass_
Definition Renderer.h:672
void advanceFrameIndices()
advances the frame indices for the next frame in flight
void createMeshletCullingDispatcherResources()
Creates the compute pipeline for the meshlet culling stage. This should only be called after the mesh...
VkPipelineLayout prepareDrawsComputePipelineLayout
Definition Renderer.h:742
std::optional< ComputePass > meshletUnpacking
Definition Renderer.h:635
VkDescriptorPool hiZDescriptorPool
Definition Renderer.h:645
uint64_t renderedFrameCounter
Definition Renderer.h:556
void allocateDescriptors()
allocates the first batch of mesh data to the shaders
Definition Renderer.cpp:209
std::optional< VulkanBuffer > objectIDsBuffer
Definition Renderer.h:218
ComputePass & getDrawPreparationComputePass()
int findExistingPipeline(const std::string &meshShader, const std::string &fragShader, const PipelineMaterialPayload &pipelineData) const
Searches for the first existing pipeline which has the same vertex and fragment shader.
void createPrimitiveCullingResources()
const VulkanBuffer & getObjectIDsBuffer() const
const VulkanBuffer & getMeshUnpackingDataBuffer() const
std::array< VkDescriptorSet, MAX_FRAMES_IN_FLIGHT > hiZSPDDescriptorSets
Definition Renderer.h:650
bool shouldSkipMirrorView()
Checks if mirror view should be skipped this frame.
const VulkanBuffer & getPlaceholderBuffer() const
std::vector< GraphicsPipeline * > depthOnlyGraphicsPipelines
Definition Renderer.h:761
ComputePass & getVSPrepareDrawComputePass()
static constexpr int SKIP_FRAMES_AFTER_STALL
Number of frames to skip after detecting a stall (covers all swapchain images)
Definition Renderer.h:563
void createVertexShaderPipelineResources()
VkDescriptorPool descriptorPool
The descriptor pool for all descriptors of the renderer.
Definition Renderer.h:620
bool getPipelineIndex(GraphicsPipeline *pipeline, uint32_t &pipelineIndex) const
Gets the index of a pipeline.
void getCurrentTracyVkContext() const
Definition Renderer.h:548
std::optional< VulkanBuffer > placeholderBuffer
Definition Renderer.h:224
std::optional< DispatcherComputePass > meshletCullingDispatchComputePass
Definition Renderer.h:629
std::optional< VulkanBuffer > dispatchBuffer
Definition Renderer.h:222
void createMeshUnpackingDataBuffer()
std::vector< VkSemaphore > renderFinishedSemaphores
Definition Renderer.h:771
void createBinningAllocatorResources()
void syncTimelineAfterPause()
Synchronizes the frame counter with the timeline semaphore after pausing.
std::optional< DispatcherComputePass > meshletUnpackingDispatchComputePass
Definition Renderer.h:627
ComputePass & getVSInstanceUnpackingComputePass()
void recordPass2Culling(size_t swapChainImageIndex)
Records Pass 2 of two-pass occlusion culling Re-tests objects that failed Pass 1 Hi-Z against the new...
std::optional< VulkanBuffer > placeholderUniformBuffer
Definition Renderer.h:225
std::optional< ComputePass > vsInstanceUnpackingComputePass_
Definition Renderer.h:673
VkSemaphore getCurrentMirrorViewSemaphore() const
std::array< std::array< VkDescriptorSet, MAX_HIZ_MIP_LEVELS >, MAX_FRAMES_IN_FLIGHT > hiZMipDescriptorSets
Definition Renderer.h:644
ComputePass & getVSBinningAllocatorComputePass()
void createMeshletUnpackingDispatcherResources()
Creates the complete pipeline for the meshlet unpacker. This should only be called after the buffer h...
ComputePass & getBinningAllocatorComputePass()
void recordXrSwapchainImageWritableBarrier(uint32_t swapChainImageIndex) const
bool isInStallRecovery() const
Checks if we're currently in stall recovery mode. During stall recovery, extra GPU synchronization sh...
ApplicationContext * context
Definition Renderer.h:766
static PipelineConfig getPipelineConfig(PipelineNames pipelineName)
Gets the static configuration for a given pipeline type Returns shader paths and pipeline data for th...
void updateCpuRenderResources(float time)
Updates all data for gpu frame buffers.
std::vector< VkCommandBuffer > getGraphicsCommandBuffers() const
Gets all graphics command buffers from all owned EngineCore::RenderProcess.
uint64_t frameCounter
Definition Renderer.h:769
VkDependencyInfo getMeshletUnpackingToMeshletCullingDispatchBarriers(Vulkan::BarrierBundle &bundle)
std::optional< ComputePass > meshletUnpackingComputePass
Definition Renderer.h:628
std::optional< ComputePass > meshletCullingComputePass
Definition Renderer.h:630
void recordRenderPass(size_t swapChainImageIndex)
void createMeshletCullingResources()
void recordHiZGeneration()
Records the Hi-Z pyramid generation compute pass Should be called after the render pass completes.
The rendering data manager is supposed to hold all methods to update the contents of the buffers whic...
Centralized timeline semaphore management for the rendering pipeline.
RAII wrapper for Vulkan buffer and device memory.
Log category system implementation.
Used for vulkan specific helpers like something to chain pNexts together.
Static configuration for a graphics pipeline Defines which shaders to use for a given PipelineNames e...
Definition Renderer.h:53
std::filesystem::path fragmentShaderPath
Definition Renderer.h:55
PipelineMaterialPayload pipelineData
Definition Renderer.h:56
std::filesystem::path meshShaderPath
Definition Renderer.h:54
MeshConstants(uint32_t baseVisibleMeshletIndex)
Definition Renderer.h:724
TaskConstants(const uint32_t drawCommandOffset=0)
Definition Renderer.h:83