Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
vulkan_material_resources.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2026 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6#pragma once
7
9
10#include <utility>
11#include <vulkan/vulkan.h>
12
13namespace rendering_engine
14{
15class Material;
16class VulkanRenderer;
17
18/**
19 * @brief Vulkan-specific implementation of material render resources.
20 *
21 * This class manages Vulkan GPU resources required to render a specific Material.
22 * It provides access to the Vulkan descriptor set layout, pipeline layout, and graphics pipeline
23 * associated with a given material. The resource creation is delegated to the owning
24 * `VulkanRenderer` instance.
25 *
26 * The `Material` class calls `Initialize` and `Shutdown` to manage the lifecycle of these resources.
27 */
29{
30public:
31 /**
32 * @brief Constructs a VulkanMaterialResources instance.
33 *
34 * @param renderer Pointer to the VulkanRenderer that provides creation utilities.
35 */
37
38 /**
39 * @brief Initializes Vulkan-specific GPU resources for the material.
40 *
41 * Loads compiled SPIR-V shader binaries and creates descriptor set layout and pipeline.
42 *
43 * @param material Pointer to the owning Material instance.
44 */
45 void Initialize(Material* material) override;
46
47 /**
48 * @brief Releases all Vulkan GPU resources associated with this material.
49 *
50 * This should be called when the renderer shuts down or resources are rebuilt.
51 */
52 void Shutdown() override;
53
54 /**
55 * @brief Gets the Vulkan descriptor set layout for the material.
56 *
57 * @return Vulkan handle to the descriptor set layout.
58 */
59 VkDescriptorSetLayout GetDescriptorSetLayout() const;
60
61 /**
62 * @brief Gets the Vulkan pipeline layout used by the material.
63 *
64 * @return Vulkan handle to the pipeline layout.
65 */
66 VkPipelineLayout GetPipelineLayout() const;
67
68 /**
69 * @brief Gets the Vulkan graphics pipeline used by the material.
70 *
71 * @return Vulkan handle to the pipeline.
72 */
73 VkPipeline GetPipeline() const;
74
75private:
76 VulkanRenderer* mRenderer;
77 VkDescriptorSetLayout mDescriptorSetLayout = VK_NULL_HANDLE;
78 std::pair<VkPipelineLayout, VkPipeline> mPipelinePair;
79};
80
81} //namespace rendering_engine
Interface for backend-specific material GPU resources.
Represents a material instance with parameter values, texture bindings, and rendering configuration.
Definition: material.hpp:30
Vulkan-specific implementation of material render resources.
VkPipeline GetPipeline() const
Gets the Vulkan graphics pipeline used by the material.
void Shutdown() override
Releases all Vulkan GPU resources associated with this material.
void Initialize(Material *material) override
Initializes Vulkan-specific GPU resources for the material.
VkPipelineLayout GetPipelineLayout() const
Gets the Vulkan pipeline layout used by the material.
VulkanMaterialResources(VulkanRenderer *renderer)
Constructs a VulkanMaterialResources instance.
VkDescriptorSetLayout GetDescriptorSetLayout() const
Gets the Vulkan descriptor set layout for the material.
Vulkan-based implementation of the IRenderer interface.