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
9
10#include <chrono>
13#include <filesystem>
14#include <memory>
15#include <unordered_map>
16#include <vector>
17#include <vulkan/vulkan_core.h>
18
19#ifdef ENABLE_TRACY
20# include <tracy/TracyVulkan.hpp>
21#endif
22
24{
25 class TracyVkContextManager;
26} // namespace Engine::Debug::Tracy
27
28namespace Vulkan
29{
30 class BarrierBundle;
31} // namespace Vulkan
32
33namespace Engine
34{
35 class EngineKern;
36 class ParticleSystem;
37}
38
39namespace Engine::Core
40{
41 class RenderingDataManager;
42}
43
44namespace Engine::Assets
45{
46 class Material;
47}
48
49namespace Engine::Rendering
50{
51 class ComputePassManager;
52 class RenderProcess;
53 class BufferManager;
54 class Headset;
55 class TimelineSynchronizer;
56 class WorldUiRenderer;
57
63 {
64 std::filesystem::path meshShaderPath;
65 std::filesystem::path fragmentShaderPath;
67 };
68
77 {
82 {
83 TaskConstants() = default;
84
85 explicit TaskConstants( const uint32_t drawCommandOffset = 0 )
87 {
88 }
89
95
96 uint32_t drawCommandOffset = 0u;
97 uint32_t cascadeIndex = 0u;
98 uint32_t _padding[2]{};
99 };
100
101
102 public:
110 explicit Renderer(
111 Core::ApplicationContext * context = nullptr,
112 Headset * headset = nullptr,
113 const EngineKern * engine = nullptr
114 );
115
120
127
129 void prepareTransferSubmission( uint32_t frameIndex ) const;
130
135 void updateViewMatrix() const;
136
137 // Compute pass resources are now created via ComputePassManager
138 // void createPrimitiveCullingResources(); // 1
139 // void createBinningAllocatorResources(); // 1.5 (Stage 1)
140 // void createMeshletUnpackingResources(); // 3 (Stage 2)
141 // void createMeshletCullingResources(); // 5
142 // void createPrepareDrawResources(); // 6
143 void createVertexShaderPathResources(); // Vertex shader path for single-meshlet geometry
144
149 // void createMeshletUnpackingDispatcherResources(); // 2 - Now in ComputePassManager
154 // void createMeshletCullingDispatcherResources(); // 4 - Now in ComputePassManager
155
161 void updateCpuRenderResources( float time );
162
167
168 void recordTonemapToSwapchain( uint32_t swapChainImageIndex ) const;
169
174 void recordRenderPass( size_t swapChainImageIndex );
175
179 const std::unique_ptr<Core::RenderingDataManager> & getRenderingDataManager() const;
180
184 const std::unique_ptr<BufferManager> & getBufferManager() const;
185
186 const std::unique_ptr<ComputePassManager> & getComputePassManager() const;
187
192 bool ensureOutputBufferSizes( uint32_t primitive_count ) const;
193
194 private:
195
196 std::unique_ptr<Core::RenderingDataManager> renderingDataManager_;
197 std::unique_ptr<BufferManager> bufferManager_;
198 std::unique_ptr<ComputePassManager> computePassManager_;
199
200 public:
201 [[nodiscard]] const Vulkan::Buffer & getObjectCullingDataBuffer() const;
202 [[nodiscard]] const Vulkan::Buffer & getObjectMeshletDataBuffer() const;
203 [[nodiscard]] const Vulkan::Buffer & getObjectIDsBuffer() const;
204 [[nodiscard]] const Vulkan::Buffer & getCounterBuffer() const;
205 [[nodiscard]] const Vulkan::Buffer & getDispatchBuffer() const;
206 [[nodiscard]] const Vulkan::Buffer & getMeshUnpackingDataBuffer() const;
207
208 [[nodiscard]] const Vulkan::Buffer & getPlaceholderBuffer() const;
209 [[nodiscard]] const Vulkan::Buffer & getPlaceholderUniformBuffer() const;
210
211 VkDependencyInfo getObjectCullingToMeshletUnpackingDispatchBarriers(Vulkan::BarrierBundle & bundle ) const;
212 VkDependencyInfo getMeshletUnpackingDispatchToMeshletUnpackingBarriers(Vulkan::BarrierBundle &bundle) const;
213 VkDependencyInfo getMeshletUnpackingToMeshletCullingDispatchBarriers( Vulkan::BarrierBundle & bundle ) const;
216
219
220 void renderToXr( size_t swapChainImageIndex, float time );
221
222 void recordTransfer( float time );
224 void uploadFrameData( float time );
225 void submitTransfer() const;
226
233
235 uint32_t swapChainImageIndex,
236 VkSemaphore mirrorAcquireSemaphore = VK_NULL_HANDLE
237 ) const;
239
245 [[nodiscard]] VkCommandBuffer getCurrentTransferCommandBuffer() const;
246 [[nodiscard]] VkCommandBuffer getCurrentRenderingCommandBuffer() const;
247 [[nodiscard]] VkSemaphore getCurrentMirrorViewSemaphore() const;
248 [[nodiscard]] VkSemaphore getCurrentPresentableSemaphore( uint32_t swapchainImageIndex ) const;
249
255 std::vector<VkCommandBuffer> getGraphicsCommandBuffers() const;
256 std::vector<VkCommandBuffer> getTransferCommandBuffers() const;
257
261 [[nodiscard]] const std::vector<RenderProcess*>& getRenderProcesses() const { return renderProcesses; }
262
268 [[nodiscard]] VkCommandPool getGraphicsCommandPool() const;
269
275 [[nodiscard]] VkCommandPool getTransferCommandPool() const;
276
280 void cleanup();
281
287 RenderProcess * getCurrentRenderProcess() const;
288
293
306
318 [[nodiscard]] bool shouldSkipMirrorView();
319
325
332
339 [[nodiscard]] int64_t getFrameElapsedMs() const;
340
347 [[nodiscard]] bool isInStallRecovery() const;
348
353 VkSemaphore getTimelineSemaphore() const;
354
360 const std::vector<GraphicsPipeline *> & getGraphicsPipelines() const;
361
367 [[nodiscard]] Headset* getHeadset() const { return headset_; }
368
369 [[nodiscard]] const ImageBasedLightingResources & getIBLResources() const { return iblResources_; }
370 [[nodiscard]] const SunShadowResources & getSunShadowResources() const { return sunShadowResources_; }
372
383 void setFreezeCulling(bool freeze);
384
390 [[nodiscard]] bool isFreezeCulling() const { return freezeCulling_; }
391
392 void setVertexShaderOnlyMode(bool enabled) { vertexShaderOnlyMode_ = enabled; }
393 [[nodiscard]] bool isVertexShaderOnlyMode() const { return vertexShaderOnlyMode_; }
394
395 void setParallelLodSelection(bool enabled ) const;
396
397 void setVSInstancedDrawing(bool enabled) { useVSInstancedDrawing_ = enabled; }
398 void setSkipMeshShaderDraw(bool skip) { skipMeshShaderDraw_ = skip; }
401
402 void registerWindTrailEmitter(std::shared_ptr<Entities::SceneNode> node) { windTrailEmitterNode_ = node; }
404
405 void setTracyContextManager( Debug::Tracy::TracyVkContextManager * manager ) { tracyContextManager_ = manager; }
406
411 [[nodiscard]] const TimelineSynchronizer& getTimelineSynchronizer() const;
412
413 [[nodiscard]] WorldUiRenderer * getWorldUiRenderer() const { return worldUiRenderer_.get(); }
414
415 void notifyMaterialLoaded( Assets::Material * material ) const;
416
423 bool getPipelineIndex( GraphicsPipeline * pipeline, uint32_t & pipelineIndex ) const;
424
431 bool getPipelineIndex( PipelineNames pipelineName, uint32_t & pipelineIndex ) const;
432
441
442 private:
443 Debug::Tracy::TracyVkContextManager * tracyContextManager_ = nullptr;
444
445#ifdef ENABLE_TRACY
446 TracyVkCtx getCurrentTracyVkContext() const;
447 TracyVkCtx getCurrentTracyTransferVkContext() const;
448#else
451#endif
452
453 std::unique_ptr<TimelineSynchronizer> timelineSynchronizer_;
454 std::unique_ptr<WorldUiRenderer> worldUiRenderer_;
455
458
460
464
466 static constexpr int SKIP_FRAMES_AFTER_STALL = 4;
467
469 std::chrono::steady_clock::time_point lastFrameStartTime_ = std::chrono::steady_clock::now();
470
472 static constexpr std::chrono::milliseconds STALL_THRESHOLD_MS{1000};
473
474 std::vector<Vulkan::StagedBufferSyncObjects> syncCopyObjects_{};
475
476 // Maps each graphics pipeline pointer to its index within the graphicsPipelines vector
477 std::unordered_map<GraphicsPipeline *, uint32_t> pipelineIndices_;
478
479 // Maps PipelineNames enum to the created GraphicsPipeline object
480 std::unordered_map<PipelineNames, GraphicsPipeline *> pipelinesByName_;
481
482 // Maps PipelineNames enum to VS pipeline index (for when mesh shader pipelines are unavailable)
483 std::unordered_map<PipelineNames, uint32_t> vsPipelineNameToIndex_;
484
485 const EngineKern * engine_ = nullptr;
486
497 const std::string & meshShader,
498 const std::string & fragShader,
499 const PipelineMaterialPayload & pipelineData
500 ) const;
501
505 VkCommandPool vkGraphicsCommandPool_ = VK_NULL_HANDLE;
506
510 VkCommandPool vkTransferCommandPool_ = VK_NULL_HANDLE;
511
515 VkDescriptorPool descriptorPool_ = VK_NULL_HANDLE;
516
517
518 // Vertex Shader Path for single-meshlet geometry
519 // Uses traditional vertex shader + instancing (faster than mesh shader for small meshes)
520 std::vector<VkPipeline> vsGraphicsPipelines_; // Per-material vertex shader pipelines (indexed by PipelineNames)
521 VkPipelineLayout vsPipelineLayout_ = VK_NULL_HANDLE; // Pipeline layout for VS path
522 bool useVertexShaderPath_ = true; // Enable VS path for single-meshlet geometry
523 bool vertexShaderOnlyMode_ = false; // Force ALL geometry through VS pipeline (bypass mesh shaders)
524
526 void recordVertexShaderDraws(size_t swapChainImageIndex) const;
527
528 bool useVSInstancedDrawing_ = true; // Enable VS instanced drawing optimization
529
532
533
535 void resetVisibilityBuffers(VkCommandBuffer commandBuffer) const;
536 void recordVisibilityComputeToGraphicsBarriers(VkCommandBuffer commandBuffer) const;
537
538 // IBL (Image-Based Lighting) resources
540 VkDescriptorPool iblDescriptorPool_ = VK_NULL_HANDLE;
541 VkDescriptorSet brdfLutDescriptorSet_ = VK_NULL_HANDLE;
542
544
545 // Cascaded sun shadow resources and pass state
550 VkPipeline sunShadowOpaquePipeline_ = VK_NULL_HANDLE;
551 VkPipeline sunShadowMovableAlphaPipeline_ = VK_NULL_HANDLE;
552 VkPipeline sunShadowStaticAlphaPipeline_ = VK_NULL_HANDLE;
553 VkPipeline vsSunShadowOpaquePipeline_ = VK_NULL_HANDLE;
554 VkPipeline vsSunShadowMovableAlphaPipeline_ = VK_NULL_HANDLE;
555 VkPipeline vsSunShadowStaticAlphaPipeline_ = VK_NULL_HANDLE;
556
561 void recordSunShadowVisibilityPipeline(uint32_t cascadeIndex) const;
562 void recordSunShadowPipelineDraws(VkCommandBuffer commandBuffer, PipelineNames pipelineName, VkPipeline shadowPipeline, uint32_t cascadeIndex);
563 void recordSunShadowVertexShaderDraws(VkCommandBuffer commandBuffer, uint32_t cascadeIndex, bool staticCastersOnly, bool dynamicCastersOnly) const;
564 [[nodiscard]] VkPipeline getSunShadowPipelineForCaster(PipelineNames pipelineName) const;
565 [[nodiscard]] VkPipeline getVSSunShadowPipelineForCaster(PipelineNames pipelineName) const;
566
567 // Debug line rendering pipeline
568 VkPipeline debugLinePipeline_ = VK_NULL_HANDLE;
569 VkPipeline debugLineOverlayPipeline_ = VK_NULL_HANDLE;
570
572 void recordDebugLineDraws(VkCommandBuffer commandBuffer ) const;
573
574 // Sky gradient pipeline
575 VkPipeline skyGradientPipeline_ = VK_NULL_HANDLE;
576 VkPipelineLayout skyGradientPipelineLayout_ = VK_NULL_HANDLE;
577
579 void recordSkyGradientDraw(VkCommandBuffer commandBuffer);
580
581 // Final scene color grading / display conversion pass
583 {
584 float exposure = 1.0f;
585 uint32_t tonemapMode = 0u;
586 };
587
588 VkDescriptorSetLayout tonemapDescriptorSetLayout_ = VK_NULL_HANDLE;
589 VkDescriptorSet tonemapDescriptorSet_ = VK_NULL_HANDLE;
590 VkPipelineLayout tonemapPipelineLayout_ = VK_NULL_HANDLE;
591 VkPipeline tonemapPipeline_ = VK_NULL_HANDLE;
592
594
595 // Wind trail particle system
596 ParticleSystem* particleSystem_ = nullptr;
597 std::weak_ptr<Entities::SceneNode> windTrailEmitterNode_;
598 float lastRenderTime_ = 0.0f;
599
601 bool freezeCulling_ = false;
602
606
607 VkDescriptorSetLayout graphicsDescriptorSetLayout = VK_NULL_HANDLE;
608
609#ifdef IS_IN_DEBUG
610 PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT = nullptr;
611 PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = nullptr;
612#endif
613
618 {
619 MeshConstants() = default;
620
625
627 uint32_t _padding1 = 0u;
628 uint32_t _padding2 = 0u;
629 uint32_t _padding3 = 0u;
630 };
631
632 std::vector<VkPushConstantRange> pushConstants;
633
637 VkPipelineLayout computeObjectCullingPipelineLayout = VK_NULL_HANDLE;
638 VkPipelineLayout computeMeshletCullingPipelineLayout = VK_NULL_HANDLE;
639 VkPipelineLayout prepareDrawsComputePipelineLayout = VK_NULL_HANDLE;
640 VkPipelineLayout graphicsPipelineLayout = VK_NULL_HANDLE;
641
645 std::vector<RenderProcess *> renderProcesses;
646
650 //ComputePipeline * objectCullingComputePipeline = nullptr;
651 //ComputePipeline * meshletCullingComputePipeline = nullptr;
652 //ComputePipeline * prepareDrawsComputePipeline = nullptr;
653
654 std::vector<GraphicsPipeline *> graphicsPipelines;
655
656 uint32_t currentFrame = 0u;
657
659 Headset * headset_ = nullptr;
660
661 uint64_t frameCounter = 0u;
662
663 std::vector<VkSemaphore> renderFinishedSemaphores;
664 };
665} // namespace EngineCore
the material asset is another wrapper for asset data which is stored in entt. It has the EngineCore::...
The application context is the core class which stores the basic openxr and vulkan objects.
const Vulkan::Buffer & getPlaceholderUniformBuffer() const
std::unique_ptr< TimelineSynchronizer > timelineSynchronizer_
Definition Renderer.h:453
VkPipelineLayout vsPipelineLayout_
Definition Renderer.h:521
VkDependencyInfo getMeshletUnpackingDispatchToMeshletUnpackingBarriers(Vulkan::BarrierBundle &bundle) const
void resetVisibilityBuffers(VkCommandBuffer commandBuffer) const
const std::unique_ptr< Core::RenderingDataManager > & getRenderingDataManager() const
Getter for the rendering data manager.
void setTracyContextManager(Debug::Tracy::TracyVkContextManager *manager)
Definition Renderer.h:405
std::vector< GraphicsPipeline * > graphicsPipelines
The pipelines.
Definition Renderer.h:654
VkPipelineLayout skyGradientPipelineLayout_
Definition Renderer.h:576
std::unordered_map< GraphicsPipeline *, uint32_t > pipelineIndices_
Definition Renderer.h:477
const SunShadowResources & getSunShadowResources() const
Definition Renderer.h:370
void uploadFrameData(float time)
RenderProcess * getCurrentRenderProcess() const
Gets the render process of the current frame.
void advanceFrameIndices()
advances the frame indices for the next frame in flight
void recordTonemapToSwapchain(uint32_t swapChainImageIndex) const
std::unique_ptr< BufferManager > bufferManager_
Definition Renderer.h:197
void markFrameStart()
Marks the start of a new frame for stall detection. Call this at the beginning of each render frame.
void allocateDescriptors()
allocates the first batch of mesh data to the shaders
void recordSunShadowVisibilityPipeline(uint32_t cascadeIndex) const
VkDescriptorSetLayout tonemapDescriptorSetLayout_
Definition Renderer.h:588
VkPipeline vsSunShadowOpaquePipeline_
Definition Renderer.h:553
const std::vector< RenderProcess * > & getRenderProcesses() const
Gets all render processes for cleanup/synchronization.
Definition Renderer.h:261
VkPipelineLayout computeObjectCullingPipelineLayout
The pipeline layout.
Definition Renderer.h:637
static constexpr int SKIP_FRAMES_AFTER_STALL
Number of frames to skip after detecting a stall (covers all swapchain images)
Definition Renderer.h:466
void resetFrameTimer()
Resets the frame timer to prevent false stall detection. Call after long blocking operations (e....
void setVSInstancedDrawing(bool enabled)
Definition Renderer.h:397
const Vulkan::Buffer & getMeshUnpackingDataBuffer() const
std::unique_ptr< ComputePassManager > computePassManager_
Definition Renderer.h:198
VkPipeline sunShadowOpaquePipeline_
Definition Renderer.h:550
void setSunShadowCasterDebugView(bool enabled)
Definition Renderer.h:400
const std::unique_ptr< BufferManager > & getBufferManager() const
Getter for the buffer manager of the renderer.
void updateCpuRenderResources(float time)
Creates the complete pipeline for the meshlet unpacker. This should only be called after the buffer h...
const Vulkan::Buffer & getPlaceholderBuffer() const
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 recordSunShadowPipelineDraws(VkCommandBuffer commandBuffer, PipelineNames pipelineName, VkPipeline shadowPipeline, uint32_t cascadeIndex)
static PipelineConfig getPipelineConfig(PipelineNames pipelineName)
Gets the static configuration for a given pipeline type Returns shader paths and pipeline data for th...
std::vector< RenderProcess * > renderProcesses
The render processes.
Definition Renderer.h:645
VkDescriptorSetLayout graphicsDescriptorSetLayout
Definition Renderer.h:607
void setVertexShaderOnlyMode(bool enabled)
Definition Renderer.h:392
void updateViewMatrix() const
Requests an update of the current render processes view matrix. The matrix is pulled from the headset...
void resetMeshletCullingDispatchBuffers() const
void getCurrentTracyTransferVkContext() const
Definition Renderer.h:450
VkPipeline vsSunShadowMovableAlphaPipeline_
Definition Renderer.h:554
void renderToXr(size_t swapChainImageIndex, float time)
bool freezeCulling_
When true, culling data (frustum planes) is frozen for debugging.
Definition Renderer.h:601
std::vector< VkCommandBuffer > getGraphicsCommandBuffers() const
Gets all graphics command buffers from all owned render processes.
void recordSunShadowVertexShaderDraws(VkCommandBuffer commandBuffer, uint32_t cascadeIndex, bool staticCastersOnly, bool dynamicCastersOnly) const
VkDependencyInfo getMeshletCullingToPrepareDrawBarriers() const
VkPipelineLayout graphicsPipelineLayout
Definition Renderer.h:640
Core::ApplicationContext * context_
Definition Renderer.h:658
VkSemaphore getCurrentMirrorViewSemaphore() const
VkCommandBuffer getCurrentRenderingCommandBuffer() const
VkPipeline skyGradientPipeline_
Definition Renderer.h:575
VkDependencyInfo getMeshletCullingDispatchToMeshletCullingBarriers() const
void cleanup()
Cleans up all resources of the renderer.
VkPipelineLayout tonemapPipelineLayout_
Definition Renderer.h:590
void submitGraphics(uint32_t swapChainImageIndex, VkSemaphore mirrorAcquireSemaphore=VK_NULL_HANDLE) const
std::vector< VkSemaphore > renderFinishedSemaphores
Definition Renderer.h:663
VkPipeline getVSSunShadowPipelineForCaster(PipelineNames pipelineName) const
void registerWindTrailEmitter(std::shared_ptr< Entities::SceneNode > node)
Definition Renderer.h:402
SunShadowCascadeBuffer staticSunShadowCascadeData_
Definition Renderer.h:548
VkDescriptorPool descriptorPool_
The descriptor pool for all descriptors of the renderer.
Definition Renderer.h:515
const Vulkan::Buffer & getDispatchBuffer() const
const std::vector< GraphicsPipeline * > & getGraphicsPipelines() const
Gets the list of all graphics pipelines.
VkCommandPool vkGraphicsCommandPool_
The graphics and present command pool.
Definition Renderer.h:505
const Vulkan::Buffer & getObjectMeshletDataBuffer() const
std::chrono::steady_clock::time_point lastFrameStartTime_
Time when the last frame started, for stall detection.
Definition Renderer.h:469
void notifyMaterialLoaded(Assets::Material *material) const
const Vulkan::Buffer & getCounterBuffer() const
void initializeXrSwapchainFormats() const
bool getPipelineIndex(GraphicsPipeline *pipeline, uint32_t &pipelineIndex) const
Gets the index of a pipeline.
std::unique_ptr< Core::RenderingDataManager > renderingDataManager_
Definition Renderer.h:196
void recordSkyGradientDraw(VkCommandBuffer commandBuffer)
ParticleSystem * particleSystem_
Definition Renderer.h:596
void initializeGpuBuffers() const
VkDependencyInfo getObjectCullingToMeshletUnpackingDispatchBarriers(Vulkan::BarrierBundle &bundle) const
bool shouldSkipMirrorView()
Checks if mirror view should be skipped this frame.
std::vector< VkPushConstantRange > pushConstants
Definition Renderer.h:632
static constexpr std::chrono::milliseconds STALL_THRESHOLD_MS
Threshold for considering a frame as "stalled" (1 second)
Definition Renderer.h:472
void setParallelLodSelection(bool enabled) const
std::unique_ptr< WorldUiRenderer > worldUiRenderer_
Definition Renderer.h:454
void setFreezeCulling(bool freeze)
Freezes culling data (frustum planes, view-projection)
const std::unique_ptr< ComputePassManager > & getComputePassManager() const
VkDependencyInfo getMeshletUnpackingToMeshletCullingDispatchBarriers(Vulkan::BarrierBundle &bundle) const
Headset * getHeadset() const
Gets the headset pointer.
Definition Renderer.h:367
void waitForPreviousFrame() const
Waits for the previous frame's transfer to complete before writing to GPU buffers....
VkPipeline sunShadowMovableAlphaPipeline_
Definition Renderer.h:551
int64_t getFrameElapsedMs() const
Gets the elapsed time since markFrameStart() was called. Used to check if the current frame has taken...
bool getPipelineIndex(PipelineNames pipelineName, uint32_t &pipelineIndex) const
Gets the pipeline index for a given PipelineNames enum.
VkPipeline debugLineOverlayPipeline_
Definition Renderer.h:569
void restartRenderCommandBuffers() const
Resets the command buffers of the active frame and begins a new write.
void recordVisibilityComputeToGraphicsBarriers(VkCommandBuffer commandBuffer) const
std::unordered_map< PipelineNames, uint32_t > vsPipelineNameToIndex_
Definition Renderer.h:483
ImageBasedLightingResources iblResources_
Definition Renderer.h:539
bool ensureOutputBufferSizes(uint32_t primitive_count) const
Calculates buffer sizes based on primitive count.
bool isVertexShaderOnlyMode() const
Definition Renderer.h:393
VkDescriptorSet tonemapDescriptorSet_
Definition Renderer.h:589
Renderer(Core::ApplicationContext *context=nullptr, Headset *headset=nullptr, const EngineKern *engine=nullptr)
Constructor.
VkPipelineLayout prepareDrawsComputePipelineLayout
Definition Renderer.h:639
std::vector< VkCommandBuffer > getTransferCommandBuffers() const
std::unordered_map< PipelineNames, GraphicsPipeline * > pipelinesByName_
Definition Renderer.h:480
const SunShadowResources & getDynamicSunShadowResources() const
Definition Renderer.h:371
const TimelineSynchronizer & getTimelineSynchronizer() const
Gets the timeline synchronizer for managing frame synchronization.
VkDescriptorPool iblDescriptorPool_
Definition Renderer.h:540
std::vector< Vulkan::StagedBufferSyncObjects > syncCopyObjects_
Definition Renderer.h:474
VkPipelineLayout computeMeshletCullingPipelineLayout
Definition Renderer.h:638
VkCommandPool vkTransferCommandPool_
The transfer command pool for all commands submitted to the transfer queue.
Definition Renderer.h:510
void recordVSInstancedDrawingPipeline() const
void recordDebugLineDraws(VkCommandBuffer commandBuffer) const
VkCommandPool getTransferCommandPool() const
gets the command pool used for recording data transfer at the beginning of a frame
VkCommandBuffer getCurrentTransferCommandBuffer() const
Gets the current frame in flight and retrieves the transfer command buffer.
void getCurrentTracyVkContext() const
Definition Renderer.h:449
const Vulkan::Buffer & getObjectCullingDataBuffer() const
SunShadowResources dynamicSunShadowResources_
Definition Renderer.h:547
void recordTransfer(float time)
bool isInStallRecovery() const
Checks if we're currently in stall recovery mode. During stall recovery, extra GPU synchronization sh...
const Vulkan::Buffer & getObjectIDsBuffer() const
uint64_t getTimelineSemaphoreValue() const
~Renderer()
cleans up the object
std::vector< VkPipeline > vsGraphicsPipelines_
Definition Renderer.h:520
void setSkipMeshShaderDraw(bool skip)
Definition Renderer.h:398
void syncTimelineAfterPause()
Synchronizes the frame counter with the timeline semaphore after pausing.
SunShadowResources sunShadowResources_
Definition Renderer.h:546
void setSkipVertexShaderDraw(bool skip)
Definition Renderer.h:399
VkDescriptorSet brdfLutDescriptorSet_
Definition Renderer.h:541
const EngineKern * engine_
Definition Renderer.h:485
Debug::Tracy::TracyVkContextManager * tracyContextManager_
Definition Renderer.h:443
VkCommandPool getGraphicsCommandPool() const
gets the graphics command pool
WorldUiRenderer * getWorldUiRenderer() const
Definition Renderer.h:413
VkPipeline vsSunShadowStaticAlphaPipeline_
Definition Renderer.h:555
VkSemaphore getCurrentPresentableSemaphore(uint32_t swapchainImageIndex) const
VkPipeline sunShadowStaticAlphaPipeline_
Definition Renderer.h:552
VkSemaphore getTimelineSemaphore() const
Getter for the main timeline renderer semaphore.
void recordVertexShaderDraws(size_t swapChainImageIndex) const
void recordRenderPass(size_t swapChainImageIndex)
Records the main render pass using dynamic rendering.
VkPipeline getSunShadowPipelineForCaster(PipelineNames pipelineName) const
const ImageBasedLightingResources & getIBLResources() const
Definition Renderer.h:369
void prepareTransferSubmission(uint32_t frameIndex) const
bool isFreezeCulling() const
Checks if culling data is currently frozen.
Definition Renderer.h:390
std::weak_ptr< Entities::SceneNode > windTrailEmitterNode_
Definition Renderer.h:597
void recordParallelLodSelectionPipeline() const
RAII wrapper for Vulkan buffer and device memory.
Definition Buffer.h:26
Manages IBL (Image-Based Lighting) resources for specular reflections.
PipelineNames
Named graphics pipelines used by material selection and shader lookup.
GpuBuffers::SunShadowCascadeBuffer SunShadowCascadeBuffer
Definition RenderData.h:545
Static configuration for a graphics pipeline Defines which shaders to use for a given PipelineNames e...
Definition Renderer.h:63
std::filesystem::path meshShaderPath
Definition Renderer.h:64
PipelineMaterialPayload pipelineData
Definition Renderer.h:66
std::filesystem::path fragmentShaderPath
Definition Renderer.h:65
MeshConstants(uint32_t baseVisibleMeshletIndex)
Definition Renderer.h:621
TaskConstants(const uint32_t drawCommandOffset, const uint32_t cascadeIndex)
Definition Renderer.h:90
TaskConstants(const uint32_t drawCommandOffset=0)
Definition Renderer.h:85