mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
first draft of vulkan texture impl
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user