]> git.tdb.fi Git - libs/gl.git/blob - source/backends/vulkan/texture_backend.h
Implement textures and samplers for Vulkan
[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 generate_mipmap();
34
35         void synchronize(int, unsigned, bool = false) const;
36
37         void set_debug_name(const std::string &);
38         void set_vulkan_object_names() const;
39 };
40
41 using TextureBackend = VulkanTexture;
42
43 } // namespace GL
44 } // namespace Msp
45
46 #endif