Disable mipmap generation for too small textures

This commit is contained in:
Benau 2022-05-02 10:42:32 +08:00
parent db4329cebf
commit c739aeb758

View File

@ -59,9 +59,11 @@ GEVulkanTexture::GEVulkanTexture(video::IImage* img, const std::string& name)
return; return;
} }
m_size = m_orig_size = img->getDimension(); m_size = m_orig_size = img->getDimension();
if (m_size.Width < 4 || m_size.Height < 4)
m_has_mipmaps = false;
uint8_t* data = (uint8_t*)img->lock(); uint8_t* data = (uint8_t*)img->lock();
bgraConversion(data); bgraConversion(data);
upload(data, true/*generate_hq_mipmap*/); upload(data, m_has_mipmaps/*generate_hq_mipmap*/);
img->unlock(); img->unlock();
img->drop(); img->drop();
} // GEVulkanTexture } // GEVulkanTexture
@ -428,6 +430,8 @@ void GEVulkanTexture::reloadInternal()
file->drop(); file->drop();
m_size = texture_image->getDimension(); m_size = texture_image->getDimension();
if (m_size.Width < 4 || m_size.Height < 4)
m_has_mipmaps = false;
m_size_lock.unlock(); m_size_lock.unlock();
if (m_image_mani) if (m_image_mani)
@ -435,7 +439,7 @@ void GEVulkanTexture::reloadInternal()
uint8_t* data = (uint8_t*)texture_image->lock(); uint8_t* data = (uint8_t*)texture_image->lock();
bgraConversion(data); bgraConversion(data);
upload(data, true/*generate_hq_mipmap*/); upload(data, m_has_mipmaps/*generate_hq_mipmap*/);
m_image_view_lock.unlock(); m_image_view_lock.unlock();
texture_image->unlock(); texture_image->unlock();