vulkan: corrupted textures with mipmap and xBRZ

This commit is contained in:
Flyinghead 2020-02-17 17:44:34 +01:00
parent 3ddce6dd45
commit 9f565f2d41
2 changed files with 4 additions and 4 deletions

View File

@ -180,18 +180,18 @@ void Texture::UploadToGPU(int width, int height, u8 *data, bool mipmapped)
}
bool isNew = true;
if (width != extent.width || height != extent.height || format != this->format)
Init(width, height, format, dataSize);
Init(width, height, format, dataSize, mipmapped);
else
isNew = false;
SetImage(dataSize, data, isNew);
}
void Texture::Init(u32 width, u32 height, vk::Format format, u32 dataSize)
void Texture::Init(u32 width, u32 height, vk::Format format, u32 dataSize, bool mipmapped)
{
this->extent = vk::Extent2D(width, height);
this->format = format;
mipmapLevels = 1;
if (IsMipmapped() && settings.rend.UseMipmaps)
if (mipmapped)
mipmapLevels += floor(log2(std::max(width, height)));
vk::FormatProperties formatProperties = physicalDevice.getFormatProperties(format);

View File

@ -43,7 +43,7 @@ struct Texture : BaseTextureCacheData
void SetDevice(vk::Device device) { this->device = device; }
private:
void Init(u32 width, u32 height, vk::Format format ,u32 dataSize);
void Init(u32 width, u32 height, vk::Format format ,u32 dataSize, bool mipmapped);
void SetImage(u32 size, void *data, bool isNew);
void CreateImage(vk::ImageTiling tiling, vk::ImageUsageFlags usage, vk::ImageLayout initialLayout,
vk::MemoryPropertyFlags memoryProperties, vk::ImageAspectFlags aspectMask);