-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexture.h
30 lines (26 loc) · 1.48 KB
/
texture.h
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
#pragma once
#include <string>
#include <vector>
#include <vulkan/vulkan_core.h>
// Holds information for a storage image that the shaders output to
struct StorageImage {
VkDeviceMemory memory = VK_NULL_HANDLE;
VkImage image = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkFormat format;
};
void generateMipmaps(VkImage image, VkFormat imageFormat, int32_t texWidth, int32_t texHeight, uint32_t mipLevels);
void createTextureImage(const unsigned char *bytes, int size, VkImage &textureImage, VkDeviceMemory &textureImageMemory, uint32_t &mipLevels, bool useFloat=false);
void createTextureImage(const std::string &texturePath, VkImage &textureImage, VkDeviceMemory &textureImageMemory, uint32_t &mipLevels);
void createTextureImage(void *pixels,
const int &texWidth,
const int &texHeight,
const VkDeviceSize &imageSize,
VkImage &textureImage,
VkDeviceMemory &textureImageMemory,
uint32_t &mipLevels,
VkFormat format);
VkImageView createTextureImageView(const VkImage textureImage, const uint32_t mipLevels, VkFormat format);
void createTextureSampler(VkSampler &textureSampler, const uint32_t mipLevels);
void createStorageImage(std::vector<StorageImage> &storageImages, VkFormat format, VkImageAspectFlags aspect, VkExtent3D extent);
void deleteStorageImage(std::vector<StorageImage> &storageImages);