Toast Engine
Loading...
Searching...
No Matches
skinning_pass.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include "../shader_layout.hpp"
10#include "../vulkan_common.hpp"
11#include "../vulkan_pipeline.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <string>
16#include <unordered_map>
17#include <vector>
18
19namespace renderer {
20class VulkanCore;
21class VulkanMesh;
22
24class SkinningPass {
25public:
26 explicit SkinningPass(const VulkanCore& core);
27
28 void record(vk::CommandBuffer cmd, uint32_t frame_index);
29
30 [[nodiscard]]
31 auto getPosedVertexBuffer(uint32_t frame_index) const -> vk::Buffer;
32
33 [[nodiscard]]
34 auto getPosedInstanceCount() const noexcept -> uint32_t {
35 return m_posed_instances;
36 }
37
38 [[nodiscard]]
39 auto isReady() const noexcept -> bool {
40 return m_pipeline.isReady();
41 }
42
43 static constexpr uint32_t k_max_posed_vertices = 1u << 19;
44
45private:
47 struct PushConstants {
48 uint32_t vertex_count = 0;
49 uint32_t output_base = 0;
50 uint32_t joint_offset = 0;
51 uint32_t pad0 = 0;
52 };
53
54 struct MeshResources {
55 std::vector<vk::raii::DescriptorSet> sets;
56 };
57
58 auto ensureMeshResources(const VulkanMesh* mesh) -> MeshResources*;
59
60 const VulkanCore* m_core = nullptr;
61
62 ShaderLayout m_shader_layout;
63 VulkanPipeline m_pipeline;
64
65 std::vector<std::optional<vma::raii::Buffer>> m_posed_buffers;
66 std::unordered_map<const VulkanMesh*, MeshResources> m_mesh_resources;
67
68 uint32_t m_posed_instances = 0;
69};
70
71}
Definition shader_layout.hpp:12
Definition vulkan_core.hpp:48
Definition vulkan_mesh.hpp:26
Definition vulkan_pipeline.hpp:19