]> git.tdb.fi Git - libs/gl.git/blob - source/backends/vulkan/texture_backend.h
Implement mipmap generation for the Vulkan backend
[libs/gl.git] / source / backends / vulkan / texture_backend.h
1 #ifndef MSP_GL_TEXTURE_BACKEND_H_
2 #define MSP_GL_TEXTURE_BACKEND_H_
3
4 #include <msp/core/noncopyable.h>
5 #include "handles.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Device;
11
12 class VulkanTexture: public NonCopyable
13 {
14         friend class VulkanFramebuffer;
15         friend class VulkanPipelineState;
16
17 protected:
18         Device &device;
19         VkImage handle = 0;
20         VkImageView view_handle = 0;
21         unsigned memory_id = 0;
22         unsigned view_type;
23         std::string debug_name;
24
25         VulkanTexture(unsigned);
26         VulkanTexture(VulkanTexture &&);
27         ~VulkanTexture();
28
29         void allocate();
30         virtual void fill_image_info(void *) const = 0;
31         void require_swizzle() { }
32
33         virtual void generate_mipmap() = 0;
34         void generate_mipmap_levels(unsigned);
35         virtual void fill_mipmap_blit(unsigned, void *) = 0;
36
37         void change_layout(unsigned, int, unsigned, bool) const;
38
39         void set_debug_name(const std::string &);
40         void set_vulkan_object_names() const;
41 };
42
43 using TextureBackend = VulkanTexture;
44
45 } // namespace GL
46 } // namespace Msp
47
48 #endif