Remove compress argument from KRTExture::uploadTexture and all descendants
This commit is contained in:
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual bool save(const std::string& path);
|
virtual bool save(const std::string& path);
|
||||||
virtual bool save(KRDataBlock& data);
|
virtual bool save(KRDataBlock& data);
|
||||||
|
|
||||||
virtual bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) = 0;
|
virtual bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha = false) = 0;
|
||||||
virtual Vector2i getDimensions() const = 0;
|
virtual Vector2i getDimensions() const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ long KRTextureKTX::getMemRequiredForSize(int max_dim)
|
|||||||
return memoryRequired;
|
return memoryRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTextureKTX::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTextureKTX::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha)
|
||||||
{
|
{
|
||||||
int target_dim = lod_max_dim;
|
int target_dim = lod_max_dim;
|
||||||
if (target_dim < (int)m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
if (target_dim < (int)m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
virtual ~KRTextureKTX();
|
virtual ~KRTextureKTX();
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha = false) override;
|
||||||
|
|
||||||
virtual long getMemRequiredForSize(int max_dim);
|
virtual long getMemRequiredForSize(int max_dim);
|
||||||
virtual Vector2i getDimensions() const override;
|
virtual Vector2i getDimensions() const override;
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ long KRTexturePVR::getMemRequiredForSize(int max_dim)
|
|||||||
return memoryRequired;
|
return memoryRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTexturePVR::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTexturePVR::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha)
|
||||||
{
|
{
|
||||||
int target_dim = lod_max_dim;
|
int target_dim = lod_max_dim;
|
||||||
if (target_dim < (int)m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
if (target_dim < (int)m_min_lod_max_dim) target_dim = m_min_lod_max_dim;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
virtual ~KRTexturePVR();
|
virtual ~KRTexturePVR();
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha = false) override;
|
||||||
|
|
||||||
virtual long getMemRequiredForSize(int max_dim);
|
virtual long getMemRequiredForSize(int max_dim);
|
||||||
virtual Vector2i getDimensions() const override;
|
virtual Vector2i getDimensions() const override;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ KRTextureTGA::~KRTextureTGA()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTextureTGA::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTextureTGA::uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha)
|
||||||
{
|
{
|
||||||
// TODO - Vulkan Refactoring - Perhaps it would be more efficient to reformat the color channels during the copy to the staging buffer.
|
// TODO - Vulkan Refactoring - Perhaps it would be more efficient to reformat the color channels during the copy to the staging buffer.
|
||||||
|
|
||||||
@@ -124,14 +124,6 @@ bool KRTextureTGA::uploadTexture(KRDevice& device, VkImage& image, int lod_max_d
|
|||||||
TGA_HEADER* pHeader = (TGA_HEADER*)m_pData->getStart();
|
TGA_HEADER* pHeader = (TGA_HEADER*)m_pData->getStart();
|
||||||
unsigned char* pData = (unsigned char*)pHeader + (long)pHeader->idlength + (long)pHeader->colourmaplength * (long)pHeader->colourmaptype + sizeof(TGA_HEADER);
|
unsigned char* pData = (unsigned char*)pHeader + (long)pHeader->idlength + (long)pHeader->colourmaplength * (long)pHeader->colourmaptype + sizeof(TGA_HEADER);
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO - Vulkan refactoring to support compressing textures on load
|
|
||||||
unsigned int internal_format = GL_RGBA;
|
|
||||||
if(compress) {
|
|
||||||
internal_format = pHeader->bitsperpixel == 24 ? GL_COMPRESSED_RGB_S3TC_DXT1_EXT : GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (pHeader->colourmaptype != 0) {
|
if (pHeader->colourmaptype != 0) {
|
||||||
m_pData->unlock();
|
m_pData->unlock();
|
||||||
return false; // Mapped colors not supported
|
return false; // Mapped colors not supported
|
||||||
@@ -347,7 +339,7 @@ KRTexture* KRTextureTGA::compress(bool premultiply_alpha)
|
|||||||
GLDEBUG(glBindTexture(GL_TEXTURE_2D, compressed_handle));
|
GLDEBUG(glBindTexture(GL_TEXTURE_2D, compressed_handle));
|
||||||
|
|
||||||
int current_max_dim = 0;
|
int current_max_dim = 0;
|
||||||
if(!uploadTexture(m_max_lod_max_dim, current_max_dim, true, premultiply_alpha)) {
|
if(!uploadTexture(m_max_lod_max_dim, current_max_dim, premultiply_alpha)) {
|
||||||
assert(false); // Failed to upload the texture
|
assert(false); // Failed to upload the texture
|
||||||
}
|
}
|
||||||
GLDEBUG(glGenerateMipmap(GL_TEXTURE_2D));
|
GLDEBUG(glGenerateMipmap(GL_TEXTURE_2D));
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
virtual ~KRTextureTGA();
|
virtual ~KRTextureTGA();
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, VkImage& image, int lod_max_dim, int& current_lod_max_dim, bool premultiply_alpha = false) override;
|
||||||
|
|
||||||
#if !TARGET_OS_IPHONE && !defined(ANDROID)
|
#if !TARGET_OS_IPHONE && !defined(ANDROID)
|
||||||
virtual KRTexture* compress(bool premultiply_alpha = false);
|
virtual KRTexture* compress(bool premultiply_alpha = false);
|
||||||
|
|||||||
Reference in New Issue
Block a user