Added KRDevice parameters to KRTexture2D::uploadTexture.
Stubbed out KRTextureTGA::compress. To be re-implemented after Vulkan refactoring.
This commit is contained in:
@@ -106,14 +106,16 @@ bool KRTextureCube::createGPUTexture(int lod_max_dim)
|
|||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for(int i=0; i<6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
std::string faceName = getName() + SUFFIXES[i];
|
std::string faceName = getName() + SUFFIXES[i];
|
||||||
if(m_textures[i]) {
|
if (m_textures[i]) {
|
||||||
if(m_textures[i]->hasMipmaps()) bMipMaps = true;
|
/* TODO - Vulkan refactoring...
|
||||||
m_textures[i]->uploadTexture(/* TARGETS[i], */lod_max_dim, m_new_lod_max_dim);
|
incorporate TARGETS[i],
|
||||||
|
*/
|
||||||
|
m_textures[i]->uploadTexture(device, lod_max_dim, m_new_lod_max_dim);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ long KRTextureKTX::getMemRequiredForSize(int max_dim)
|
|||||||
return memoryRequired;
|
return memoryRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTextureKTX::uploadTexture(int lod_max_dim, int ¤t_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTextureKTX::uploadTexture(KRDevice& device, int lod_max_dim, int ¤t_lod_max_dim, bool compress, 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;
|
||||||
@@ -168,8 +168,8 @@ bool KRTextureKTX::uploadTexture(int lod_max_dim, int ¤t_lod_max_dim, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine how much memory will be consumed
|
// Determine how much memory will be consumed
|
||||||
int width = m_header.pixelWidth;
|
int width = m_header.pixelWidth;
|
||||||
int height = m_header.pixelHeight;
|
int height = m_header.pixelHeight;
|
||||||
long memoryRequired = 0;
|
long memoryRequired = 0;
|
||||||
long memoryTransferred = 0;
|
long memoryTransferred = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
virtual ~KRTextureKTX();
|
virtual ~KRTextureKTX();
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
bool uploadTexture(int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, int lod_max_dim, int& current_lod_max_dim, bool compress = false, 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;
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ long KRTexturePVR::getMemRequiredForSize(int max_dim)
|
|||||||
return memoryRequired;
|
return memoryRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTexturePVR::uploadTexture(int lod_max_dim, int ¤t_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTexturePVR::uploadTexture(KRDevice& device, int lod_max_dim, int ¤t_lod_max_dim, bool compress, 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(int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, int lod_max_dim, int& current_lod_max_dim, bool compress = false, 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;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ KRTextureTGA::~KRTextureTGA()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KRTextureTGA::uploadTexture(int lod_max_dim, int ¤t_lod_max_dim, bool compress, bool premultiply_alpha)
|
bool KRTextureTGA::uploadTexture(KRDevice& device, int lod_max_dim, int ¤t_lod_max_dim, bool compress, bool premultiply_alpha)
|
||||||
{
|
{
|
||||||
m_pData->lock();
|
m_pData->lock();
|
||||||
TGA_HEADER *pHeader = (TGA_HEADER *)m_pData->getStart();
|
TGA_HEADER *pHeader = (TGA_HEADER *)m_pData->getStart();
|
||||||
@@ -349,6 +349,12 @@ bool KRTextureTGA::uploadTexture(int lod_max_dim, int ¤t_lod_max_dim, bool
|
|||||||
|
|
||||||
KRTexture *KRTextureTGA::compress(bool premultiply_alpha)
|
KRTexture *KRTextureTGA::compress(bool premultiply_alpha)
|
||||||
{
|
{
|
||||||
|
// TODO - Vulkan refactoring...
|
||||||
|
assert(false);
|
||||||
|
return nullptr;
|
||||||
|
/*
|
||||||
|
* TODO - Vulkan refactoring...
|
||||||
|
|
||||||
m_pData->lock();
|
m_pData->lock();
|
||||||
|
|
||||||
std::list<KRDataBlock *> blocks;
|
std::list<KRDataBlock *> blocks;
|
||||||
@@ -373,12 +379,6 @@ KRTexture *KRTextureTGA::compress(bool premultiply_alpha)
|
|||||||
GLDEBUG(glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height));
|
GLDEBUG(glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &height));
|
||||||
GLDEBUG(glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internal_format));
|
GLDEBUG(glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internal_format));
|
||||||
|
|
||||||
/*
|
|
||||||
int texture_base_level = 0;
|
|
||||||
int texture_max_level = 0;
|
|
||||||
GLDEBUG(glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, &texture_base_level));
|
|
||||||
GLDEBUG(glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, &texture_max_level));
|
|
||||||
*/
|
|
||||||
switch(internal_format)
|
switch(internal_format)
|
||||||
{
|
{
|
||||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||||
@@ -423,6 +423,7 @@ KRTexture *KRTextureTGA::compress(bool premultiply_alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new_texture;
|
return new_texture;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
virtual ~KRTextureTGA();
|
virtual ~KRTextureTGA();
|
||||||
virtual std::string getExtension();
|
virtual std::string getExtension();
|
||||||
|
|
||||||
bool uploadTexture(int lod_max_dim, int& current_lod_max_dim, bool compress = false, bool premultiply_alpha = false) override;
|
bool uploadTexture(KRDevice& device, int lod_max_dim, int& current_lod_max_dim, bool compress = false, 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