]> git.tdb.fi Git - libs/gl.git/blob - source/backends/vulkan/texture_backend.h
Convert RGB pixel data to RGBA when staging
[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         void stage_pixels(void *, const void *, size_t);
34
35         virtual void generate_mipmap() = 0;
36         void generate_mipmap_levels(unsigned);
37         virtual void fill_mipmap_blit(unsigned, void *) = 0;
38
39         void change_layout(unsigned, int, unsigned, bool) const;
40
41         void set_debug_name(const std::string &);
42         void set_vulkan_object_names() const;
43 };
44
45 using TextureBackend = VulkanTexture;
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif