9#include <glm/mat4x4.hpp>
109 VkDeviceSize uniformBufferOffsetAlignment,
110 VkCommandPool graphicsCommandPool,
111 VkCommandPool transferCommandPool,
112 VkDescriptorPool descriptorPool,
113 VkDescriptorSetLayout graphicsDescriptorSetLayout,
168 void uploadNewTextures(
const std::vector<Texture *> & textures, uint32_t firstIndex )
const;
197 PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT =
nullptr;
198 PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT =
nullptr;
394 void updateLodConfig(
const glm::vec3& cameraPosition,
const glm::mat4& projMatrix,
395 float nearPlane,
float screenWidth,
float screenHeight,
396 float errorThresholdPixels = 1.0f,
bool ditherEnabled =
true);
448 void createHiZPyramid(VkDevice device, VkExtent2D resolution, uint32_t arrayLayers);
The application context is the core class which stores the basic openxr and vulkan objects.
VkCommandBuffer graphicsCommandBuffer
void createCountDispatcherBuffers()
const VulkanStagedBuffer & getLodConfigBuffer() const
VkSemaphore mirrorViewImageReadySemaphore
BS_tracy::tracy_thread_pool< BS_tracy::tp::none > bufferUpdateThreadPool
void processTextureUpload()
std::optional< VulkanBuffer > vsInstanceIdsBuffer_
Stage 2: VSInstanceUnpacking outputs.
void updateComputeVSBinningAllocatorDescriptorSets() const
std::optional< VulkanBuffer > dispatcherDispatchBuffer
const VulkanBuffer & getMeshletCounterBuffer() const
const VulkanBuffer & getCullingFailedBuffer() const
Two-pass occlusion culling buffer getters.
std::optional< VulkanStagedBuffer > meshRenderingInfoBuffer
VkCommandBuffer & getGraphicsCommandBuffer()
void updateComputeVSPrepareDrawDescriptorSets() const
void updateComputeMeshletCullingDescriptorSets() const
std::optional< VulkanStagedBuffer > perObjectDataBuffer
const VulkanBuffer & getPerObjectSSBO_StagingBuffer() const
const VulkanBuffer & getVisibleObjectRangesBuffer() const
const VulkanStagedBuffer & getFrustumUBOBuffer() const
bool ensureBufferSizes(uint32_t primitiveCount)
Ensures RenderProcess buffers have sufficient capacity for the given primitive count Dynamically resi...
const VulkanBuffer & getIndirectDrawBuffer() const
std::vector< TextureWriteContainer * > textureWritesToUpload
void updateComputeObjectCullingDescriptorSets(VkImageView previousFrameHiZView=VK_NULL_HANDLE) const
Updates object culling descriptor sets.
const std::unique_ptr< SceneManager > & sceneManager
std::optional< VulkanBuffer > vsGeometryCountersBuffer_
Atomic instance count per geometry type.
std::optional< VulkanBuffer > vsDrawCountBuffer_
Number of draw commands.
void createViewProjectionBuffer()
ApplicationContext * context
const VulkanBuffer & getPipelineCountersBuffer() const
std::optional< VulkanBuffer > allocationsBuffer
Binning allocator stage buffers (Stage 1)
struct EngineCore::RenderProcess::ViewMatrixUniformData staticVertexUniformData
VkSemaphore transferFinishedSemaphore
const VulkanBuffer & getVSInstanceIdsBuffer() const
void updateFrustumUBOData(const Headset *headset)
std::vector< PrimitiveMeshletData > objectMeshletData
void updateEyeViewProjectionMatrices(const Headset *headset)
writes a view projection matrix to an eye
void updateMeshletDataBuffer()
std::vector< PerObjectData > perObjectData
Rendering resource.
void createDispatcherDispatchBuffer()
const VulkanBuffer & getVSDrawCommandsBuffer() const
const VulkanBuffer & getLodClusterSurvivorsBuffer() const
LOD cluster-based selection buffer getters.
VkImageView getHiZPyramidFullView() const
void updateMeshRenderingData()
bool getGraphicsFenceSubmitted() const
VkDescriptorSet graphicsDescriptorSet
void createVSIndirectDrawBuffers()
void createPass1CounterBuffer()
uint32_t getHiZMipLevels() const
std::vector< GpuMeshDescription > unifiedMeshes
VulkanStagedBufferSyncObjects uploadMeshRenderingStagingData()
const VulkanBuffer & getCullingFailedCounterBuffer() const
VkSemaphore getRenderFinishedSemaphore() const
std::optional< VulkanBuffer > vsIndirectDrawCountBuffer_
Legacy: was draw count.
void createHiZPyramid(VkDevice device, VkExtent2D resolution, uint32_t arrayLayers)
const VulkanStagedBuffer & getHiZViewProjectionBuffer() const
VkFence & getGraphicsCompleteFence()
VulkanStagedBufferSyncObjects uploadLodConfigBuffer()
Upload LOD config buffer to GPU.
std::optional< VulkanBuffer > cullingFailedBuffer
Two-pass occlusion culling buffers.
std::optional< VulkanBuffer > vsVisibleCountBuffer_
Number of visible VS path primitives.
std::unordered_map< GraphicsPipeline *, uint32_t > pipelineIndices
void addTexturesToUpload(const std::vector< Texture * > &textures, uint32_t firstIndex)
void uploadNewTextures(const std::vector< Texture * > &textures, uint32_t firstIndex) const
const VulkanBuffer & getVSIndirectDrawCountBuffer() const
bool transferFenceSubmitted
VulkanStagedBuffer & getMeshletToObjectMapBuffer()
const VulkanBuffer & getLodClusterSurvivorCountBuffer() const
void createHiZViewProjectionBuffer()
void createVSInstancedDrawingBuffers()
void createVisibleObjectRangesBuffer()
FrustumPlanes frustumData
Rendering Resource.
VkImageView getHiZPyramidMipView(uint32_t mipLevel) const
RenderProcess(ApplicationContext *context, VkDeviceSize uniformBufferOffsetAlignment, VkCommandPool graphicsCommandPool, VkCommandPool transferCommandPool, VkDescriptorPool descriptorPool, VkDescriptorSetLayout graphicsDescriptorSetLayout, uint32_t eyeIndex, Renderer *renderer, const Engine *engine)
std::optional< VulkanStagedBuffer > objectMeshletDataBuffer
const VulkanBuffer & getAllocationsBuffer() const
Binning allocator stage buffer getters.
void updateLodConfig(const glm::vec3 &cameraPosition, const glm::mat4 &projMatrix, float nearPlane, float screenWidth, float screenHeight, float errorThresholdPixels=1.0f, bool ditherEnabled=true)
Update LOD configuration with camera and screen info Call this once per frame before dispatching prim...
void updateHiZViewProjectionData(const Headset *headset)
Updates Hi-Z view-projection data for occlusion culling Must be called after updateEyeViewProjectionM...
std::optional< VulkanBuffer > vsDrawCommandsBuffer_
Stage 3: VSPrepareDraw outputs.
bool getTransferFenceSubmitted() const
VulkanBuffer & getBinnedVisibleMeshletIndexBuffer()
const VulkanBuffer & getVSInstanceAllocationsBuffer() const
std::optional< VulkanBuffer > vsVisibleInstancesBuffer_
Primitive IDs from culling (uint array)
void setGraphicsFenceSubmitted(bool isSubmitted)
std::optional< VulkanBuffer > binnedVisibleMeshletIndexBuffer
const VulkanBuffer & getPass1CounterBuffer() const
std::optional< VulkanBuffer > pipelineCountersBuffer
Per-pipeline meshlet counters (atomic)
const VulkanBuffer & getVSGeometryCountersBuffer() const
std::optional< VulkanBuffer > pipelineBinOffsetsBuffer
Prefix sum of pipeline counters.
uint64_t lastSeenDataVersion_
VkDescriptorSet getGraphicsDescriptorSet() const
void createBinningAllocatorBuffers()
std::optional< VulkanBuffer > countDispatcherDispatchBuffer
VulkanStagedBufferSyncObjects uploadSSBOStagingBuffer()
std::optional< VulkanStagedBuffer > lodConfigBuffer_
LodConfigUBO for camera/screen info.
VkExtent2D getHiZExtent() const
void updateSSBO(const Renderer *renderer)
VkCommandBuffer transferCommandBuffer
void createMeshRenderingInfoBuffers()
void createBinnedVisibleMeshletIndexBuffer()
void createCullingFailedBuffers()
VkPhysicalDevice physicalDevice
VulkanStagedBufferSyncObjects uploadUniformBufferData()
VkFence & getTransferCompleteFence()
const VulkanBuffer & getVSVisibleCountBuffer() const
void createIndirectDrawBuffer()
VkFence graphicsCompleteFence
VkImage getHiZPyramidImage() const
StaticFragmentUniformData staticFragmentUniformData
const VulkanBuffer & getVSDrawCountBuffer() const
void updateComputeVSInstanceUnpackingDescriptorSets() const
void createMeshletCounterBuffer()
std::optional< VulkanBuffer > vsInstanceAllocationsBuffer_
Stage 1: VSBinningAllocator outputs.
VkCommandBuffer & getTransferCommandBuffer()
HiZViewProjectionData hiZViewProjectionData_
Hi-Z view-projection data for occlusion culling (per-frame to avoid races)
void updateComputeMeshletCullingDispatcherDescriptorSets() const
const VulkanStagedBuffer & getObjectMeshletDataBuffer() const
void createMeshletToObjectMapBuffer()
std::optional< VulkanBuffer > indirectDrawBuffer
void addStagingBufferForCleanup(VulkanBuffer &&stagingBuffer)
std::vector< VulkanBuffer > stagingBuffersForCleanup
void updateComputePrepareDrawDescriptorSets() const
std::optional< VulkanStagedBuffer > hiZViewProjectionBuffer_
void refreshAllDescriptorSets()
Refreshes all descriptor sets after buffer recreation Call this when RenderingDataManager buffers hav...
std::optional< VulkanBuffer > meshletCounterBuffer
void updateFragmentTime(float time)
Sets the time value for time based fragment shader effects.
std::optional< VulkanBuffer > vsIndirectDrawBuffer_
Legacy: was VkDrawIndexedIndirectCommand array.
VulkanStagedBufferSyncObjects uploadFrustumUBO()
void cleanup()
Cleans up all artifacts of the class.
void createPerObjectSSBOBuffer()
std::optional< VulkanBuffer > lodClusterSurvivorsBuffer_
LOD cluster-based selection buffers.
void setTransferFenceSubmitted(bool isSubmitted)
std::optional< VulkanBuffer > cullingFailedCounterBuffer
Atomic counter for failed objects.
const VulkanStagedBuffer & getPerObjectSSBOBuffer() const
LodConfigUBO lodConfigData_
CPU-side LOD config data.
VkSemaphore getMirrorViewImageSemaphore() const
VkFence transferCompleteFence
std::optional< VulkanBuffer > countDispatcherCounter
void updateComputeBinningAllocatorDescriptorSets() const
void updateRendererDescriptorSets()
VkSemaphore renderFinishedSemaphore
std::optional< VulkanStagedBuffer > meshletToObjectMapBuffer
void createFrustumUBOBuffer()
const VulkanBuffer & getPipelineBinOffsetsBuffer() const
std::optional< VulkanStagedBuffer > viewProjectionBuffer
std::optional< VulkanBuffer > pass1CounterBuffer
void cleanupStagingBuffer()
const VulkanBuffer & getMeshRenderingStagingBuffer() const
const VulkanStagedBuffer & getMeshRenderingBuffer() const
void syncWithRenderingDataManager(RenderingDataManager *rdm)
Sync descriptor sets with RenderingDataManager if data has changed Compares version numbers and updat...
bool graphicsFenceSubmitted
void createObjectMeshletDataBuffer()
VulkanStagedBuffer & getViewProjectionBuffer()
void updateComputeMeshletUnpackingDescriptorSets() const
const VulkanBuffer & getVSVisibleInstancesBuffer() const
Vertex shader path buffer getters (instanced drawing pipeline)
std::optional< VulkanBuffer > visibleObjectRangesBuffer
void updateComputeMeshletUnpackingDispatcherDescriptorSets() const
std::optional< VulkanStagedBuffer > frustumDataBuffer
VkSemaphore getTransferFinishedSemaphore() const
uint32_t getEyeIndex() const
const VulkanBuffer & getVSIndirectDrawBuffer() const
Legacy VS path buffer getters (backwards compatibility)
std::optional< VulkanBuffer > lodClusterSurvivorCountBuffer_
Atomic counter for LOD cluster survivors.
VulkanStagedBufferSyncObjects uploadHiZViewProjectionUBO()
Uploads Hi-Z view-projection UBO to GPU.
The renderer is the main class for rendering. It owns all data which is used any time in any frame....
The rendering data manager is supposed to hold all methods to update the contents of the buffers whic...
Manages game objects within a scene, handling registration, ID allocation, and GPU buffer synchroniza...
RAII wrapper for Vulkan buffer and device memory.
Log category system implementation.
Frustum planes for frustum culling in the first compute shader stage.
Describes a mesh on the gpu. Where it is in the memory and how many meshlets it consists of.
View-projection data for Hi-Z occlusion culling Contains matrices and screen info needed to project b...
LOD configuration for GPU shader selection. Updated per-frame with camera and screen information.
Stores all data which is unique to each object.
VkDeviceMemory deviceMemory
VkImageView fullView
View of all mip levels for sampling.
std::vector< VkImageView > mipViews
Per-mip views for compute writes.
VkWriteDescriptorSet write
std::vector< VkDescriptorImageInfo > imageInfos