summaryrefslogtreecommitdiff
path: root/engine/xe_image.hpp
blob: 7d514d94a600d34b4d18a200c9213f63fc0ed3a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#include "xe_device.hpp"

#include <string>

namespace xe {
  
class XeImage {

  public:
  
    XeImage(XeDevice &xeDevice, const std::string &filename);
    ~XeImage();

    XeImage(const XeImage&) = delete;
    XeImage operator=(const XeImage&) = delete;

  private:

    void createTextureImage(const std::string &filename);
    void createImage(uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, VkMemoryPropertyFlags properties, VkImage& image, VkDeviceMemory& imageMemory);
    void transitionImageLayout(VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout);
    void copyBufferToImage(VkBuffer buffer, VkImage image, uint32_t width, uint32_t height);
    void createTextureImageView();

    XeDevice &xeDevice;

    VkImage textureImage;
    VkImageView textureImageView;
    VkDeviceMemory textureImageMemory;

    friend class XeRenderSystem;

};

}