first draft of vulkan texture impl

This commit is contained in:
niki
2022-05-06 16:06:09 +02:00
parent 8f55f093a4
commit 4e8304255d
5 changed files with 296 additions and 18 deletions
+31 -2
View File
@@ -1,13 +1,25 @@
#ifndef LOVE_GRAPHICS_VULKAN_TEXTURE_H
#define LOVE_GRAPHICS_VULKAN_TEXTURE_H
#include "graphics/Texture.h"
#include "graphics/Volatile.h"
#include "vk_mem_alloc.h"
#include <iostream>
namespace love {
namespace graphics {
namespace vulkan {
class Texture : public graphics::Texture {
class Texture : public graphics::Texture, public graphics::Volatile {
public:
Texture(love::graphics::Graphics* gfx, const Settings& settings, const Slices* data);
~Texture();
bool loadVolatile() override;
void unloadVolatile() override;
void copyFromBuffer(graphics::Buffer* source, size_t sourceoffset, int sourcewidth, size_t size, int slice, int mipmap, const Rect& rect) override { std::cout << "Texture::copyFromBuffer "; };
void copyToBuffer(graphics::Buffer* dest, int slice, int mipmap, const Rect& rect, size_t destoffset, int destwidth, size_t size) override { std::cout << "Texture::copyToBuffer "; };
@@ -22,7 +34,24 @@ namespace love {
int getMSAA() const override { std::cout << "Texture::getMSAA "; return 0; };
ptrdiff_t getHandle() const override { std::cout << "Texture::getHandle "; return (ptrdiff_t)0; }
private:
void transitionImageLayout(VkImage, VkFormat, VkImageLayout oldLayout, VkImageLayout newLayout);
void copyBufferToImage(VkBuffer, VkImage, uint32_t width, uint32_t height);
void createTextureImageView();
void createTextureSampler();
graphics::Graphics* gfx;
VkDevice device;
Slices slices;
VmaAllocator allocator;
VkImage textureImage;
VmaAllocation textureImageAllocation;
VkImageView textureImageView;
VkSampler textureSampler;
};
}
}
}
}
#endif