save code
This commit is contained in:
+13
-19
@@ -8,24 +8,18 @@
|
||||
|
||||
struct Texture
|
||||
{
|
||||
VkSampler sampler;
|
||||
VkImage image;
|
||||
VkImageLayout image_layout;
|
||||
VkDeviceMemory device_memory;
|
||||
VkImageView view;
|
||||
uint32_t width, height;
|
||||
uint32_t mip_levels;
|
||||
VkSampler sampler = VK_NULL_HANDLE;
|
||||
VkImage image = VK_NULL_HANDLE;
|
||||
VkImageLayout image_layout = VkImageLayout::VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
VkDeviceMemory device_memory = VK_NULL_HANDLE;
|
||||
VkImageView view = VK_NULL_HANDLE;
|
||||
uint32_t width = 0;
|
||||
uint32_t height = 0;
|
||||
uint32_t mip_levels = 0;
|
||||
VkBuffer stagingBuffer = VK_NULL_HANDLE;
|
||||
VkDeviceMemory stagingBufferMemory = VK_NULL_HANDLE;
|
||||
VkDevice device;
|
||||
void reset() {
|
||||
sampler = VK_NULL_HANDLE;
|
||||
image = VK_NULL_HANDLE;
|
||||
device_memory = VK_NULL_HANDLE;
|
||||
view = VK_NULL_HANDLE;
|
||||
stagingBuffer = VK_NULL_HANDLE;
|
||||
stagingBufferMemory = VK_NULL_HANDLE;
|
||||
}
|
||||
VkDevice device = VK_NULL_HANDLE;
|
||||
std::string texture_path;
|
||||
};
|
||||
|
||||
class Application : public AppBase
|
||||
@@ -54,7 +48,7 @@ public:
|
||||
virtual void render(VkCommandBuffer commandBuffer, long long frameTime);
|
||||
virtual bool isInited() { return inited; }
|
||||
|
||||
void processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& out_texture, bool srgb, VkCommandPool pool);
|
||||
void processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture, bool srgb, VkCommandPool pool, std::string tex_path);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -88,14 +82,14 @@ public:
|
||||
|
||||
protected:
|
||||
void loadTexture(std::string path, Texture& tex, bool srgb, VkCommandPool pool);
|
||||
void loadTexture(std::vector<unsigned char>& image_data, size_t image_size, int w, int h, Texture& tex, bool srgb, VkCommandPool pool);
|
||||
void loadTexture(std::vector<unsigned char>& image_data, size_t image_size, int w, int h, Texture& tex, bool srgb, VkCommandPool pool, std::string path);
|
||||
#ifdef _WIN32
|
||||
void loadTextureExample(std::wstring path, Texture& tex, bool srgb, VkCommandPool pool);
|
||||
#endif
|
||||
|
||||
uint32_t findMemoryType(VkPhysicalDevice physicalDevice, uint32_t typeFilter,
|
||||
VkMemoryPropertyFlags properties);
|
||||
void createTexture(VkDevice device, VkPhysicalDevice physicalDevice, int width, int height, Texture& texture, bool srgb);
|
||||
void createTexture(VkDevice device, VkPhysicalDevice physicalDevice, int width, int height, Texture& texture, bool srgb, std::string tex_path, size_t dataSize);
|
||||
void updateTexture(VkDevice device, VkPhysicalDevice physicalDevice, VkCommandPool commandPool, VkQueue queue, uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& texture);
|
||||
VkCommandBuffer beginSingleTimeCommands(VkDevice device, VkCommandPool commandPool);
|
||||
void endSingleTimeCommands(VkDevice device, VkCommandPool commandPool, VkQueue queue, VkCommandBuffer commandBuffer);
|
||||
|
||||
Reference in New Issue
Block a user