30 std::vector<char> spvVert;
31 std::vector<char> spvFrag;
36 std::string materialEntry =
"Shaders/" + matName;
38 std::vector<uint8_t> binaryFileDataVert =
Utility::ReadPackedFile(materialEntry +
"/" + std::string(matName +
"_vert.spv"));
39 std::vector<uint8_t> binaryFileDataFrag =
Utility::ReadPackedFile(materialEntry +
"/" + std::string(matName +
"_frag.spv"));
41 spvVert.assign(binaryFileDataVert.begin(), binaryFileDataVert.end());
42 spvFrag.assign(binaryFileDataFrag.begin(), binaryFileDataFrag.end());
63 if (mPipelinePair.second != VK_NULL_HANDLE)
65 vkDestroyPipeline(device, mPipelinePair.second,
nullptr);
66 mPipelinePair.second = VK_NULL_HANDLE;
70 if (mPipelinePair.first != VK_NULL_HANDLE)
72 vkDestroyPipelineLayout(device, mPipelinePair.first,
nullptr);
73 mPipelinePair.first = VK_NULL_HANDLE;
77 if (mDescriptorSetLayout != VK_NULL_HANDLE)
79 vkDestroyDescriptorSetLayout(device, mDescriptorSetLayout,
nullptr);
80 mDescriptorSetLayout = VK_NULL_HANDLE;
86 return mDescriptorSetLayout;
91 return mPipelinePair.first;
96 return mPipelinePair.second;
Represents a material instance with parameter values, texture bindings, and rendering configuration.
const MaterialSettings GetMaterialSettings() const
Returns the material's static settings (domain, blend mode, shading model, etc.).
static boost::filesystem::path GetShadersFolderPath()
Returns absolute path to Content/Shaders.
static std::vector< char > ReadShaderBinaryFile(std::string const &filename)
Reads a binary shader file from disk.
static const PackEntries & GetPackEntries()
Returns the manifest of packed files.
static std::vector< uint8_t > ReadPackedFile(const std::string &entryPath)
Reads raw bytes of a file stored inside Pack.bin.
static bool IsPackageProvided()
Checks whether packed assets (Pack.bin / Pack.json) exist.
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.
VkDevice & GetLogicalDevice()
Returns reference to the logical Vulkan device.
VkDescriptorSetLayout CreateDescriptorSetLayout(Material *material)
Creates a descriptor set layout corresponding to a given material.
std::pair< VkPipelineLayout, VkPipeline > CreateGraphicsPipeline(Material *material, VkDescriptorSetLayout &descriptorSetLayout, std::vector< char > &spvVertShaderCode, std::vector< char > &spvFragShaderCode)
Creates a Vulkan graphics pipeline based on material and shader inputs.
std::string parentMaterialName