VulkanEngine 0.1
Graphics engine using Vulkan
Loading...
Searching...
No Matches
ShaderImage.h
1// Copyright (c) 2024 Michael Carlie. All Rights Reserved.
2//
3// This software is released under the MIT License.
4// https://opensource.org/licenses/MIT
5
6#ifndef INCLUDE_VULKANENGINE_SHADERIMAGE_H_
7#define INCLUDE_VULKANENGINE_SHADERIMAGE_H_
8
9#include <VulkanEngine/Descriptor.h>
10
11#include <memory>
12
13#ifdef __clang__
14#pragma clang diagnostic push
15#pragma clang diagnostic ignored "-Wnullability-completeness"
16#endif
17#include <vk_mem_alloc.h>
18#ifdef __clang__
19#pragma clang diagnostic pop
20#endif
21
22#include <vulkan/vulkan.hpp>
23
24namespace VulkanEngine {
25
26// Forward declaration
27template <vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling,
28 vk::SampleCountFlagBits // NOLINT(whitespace/indent_namespace)
29 sample_count_flags> // NOLINT(whitespace/indent_namespace)
30class Image;
31
32template <vk::Format format, vk::ImageType image_type, vk::ImageTiling tiling,
33 vk::SampleCountFlagBits // NOLINT(whitespace/indent_namespace)
34 sample_count_flags> // NOLINT(whitespace/indent_namespace)
36 : public Image<format, image_type, tiling, sample_count_flags>,
37 public Descriptor {
38 public:
47 ShaderImage(vk::ImageLayout initial_layout, vk::ImageUsageFlags usage_flags,
48 VmaMemoryUsage vma_memory_usage, uint32_t width, uint32_t height,
49 uint32_t depth, size_t pixel_size, uint32_t binding,
50 uint32_t descriptor_count, vk::DescriptorType descriptor_type,
51 vk::ShaderStageFlags shader_stage_flags);
52
55
57 void createSampler();
58
60 vk::DescriptorImageInfo getVkDescriptorImageInfo() const;
61
63 virtual void appendVkDescriptorSets(
64 std::shared_ptr<std::vector<vk::WriteDescriptorSet>>
65 write_descriptor_sets,
66 std::shared_ptr<std::vector<vk::CopyDescriptorSet>> copy_descriptor_sets,
67 const vk::DescriptorSet& destination_set);
68
69 private:
71 vk::Sampler vk_sampler;
72
73 vk::DescriptorImageInfo vk_descriptor_image_info;
74};
75
76} // namespace VulkanEngine
77
78#include <ShaderImage.cpp> // NOLINT(build/include)
79
80#endif // INCLUDE_VULKANENGINE_SHADERIMAGE_H_
Definition: Descriptor.h:17
uint32_t binding
The binding index.
Definition: Descriptor.h:49
uint32_t descriptor_count
The number of descriptors represented.
Definition: Descriptor.h:52
Definition: Image.h:32
uint32_t height
The height of the Image.
Definition: Image.h:106
uint32_t depth
The depth of the Image.
Definition: Image.h:109
uint32_t width
The width of the Image.
Definition: Image.h:103
Definition: ShaderImage.h:37
virtual void appendVkDescriptorSets(std::shared_ptr< std::vector< vk::WriteDescriptorSet > > write_descriptor_sets, std::shared_ptr< std::vector< vk::CopyDescriptorSet > > copy_descriptor_sets, const vk::DescriptorSet &destination_set)
Append descriptor sets to this shader image.
Definition: ShaderImage.cpp:96
vk::DescriptorImageInfo getVkDescriptorImageInfo() const
Get descriptor image info.
Definition: ShaderImage.cpp:85
~ShaderImage()
Destructor.
Definition: ShaderImage.cpp:47
void createSampler()
Create image sampler.
Definition: ShaderImage.cpp:55
TODO development of this class is in progress.
Definition: Attribute.h:13