vulkan: corrupted textures with mipmap and xBRZ
This commit is contained in:
parent
3ddce6dd45
commit
9f565f2d41
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue