Removing OpenGL code related to textures
This commit is contained in:
@@ -251,11 +251,6 @@ bool KRTexture::hasMipmaps()
|
||||
return m_max_lod_max_dim != m_min_lod_max_dim;
|
||||
}
|
||||
|
||||
void KRTexture::bind(GLuint texture_unit)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void KRTexture::_swapHandles()
|
||||
{
|
||||
//while(m_handle_lock.test_and_set()); // Spin lock
|
||||
|
||||
@@ -45,7 +45,6 @@ public:
|
||||
KRTexture(KRContext& context, std::string name);
|
||||
virtual ~KRTexture();
|
||||
|
||||
virtual void bind(GLuint texture_unit);
|
||||
void releaseHandles();
|
||||
long getMemSize();
|
||||
virtual long getReferencedMemSize();
|
||||
|
||||
@@ -105,20 +105,6 @@ bool KRTexture2D::createGPUTexture(int lod_max_dim)
|
||||
return success;
|
||||
}
|
||||
|
||||
void KRTexture2D::bind(GLuint texture_unit)
|
||||
{
|
||||
KRTexture::bind(texture_unit);
|
||||
GLuint handle = getHandle();
|
||||
|
||||
if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_2D, texture_unit, handle)) {
|
||||
if (handle) {
|
||||
// TODO - These texture parameters should be assigned by the material or texture parameters
|
||||
m_pContext->getTextureManager()->_setWrapModeS(texture_unit, GL_REPEAT);
|
||||
m_pContext->getTextureManager()->_setWrapModeT(texture_unit, GL_REPEAT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool KRTexture2D::save(const std::string& path)
|
||||
{
|
||||
if (m_pData) {
|
||||
|
||||
@@ -49,7 +49,6 @@ public:
|
||||
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 void bind(GLuint texture_unit);
|
||||
virtual Vector2i getDimensions() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -102,6 +102,8 @@ void KRTextureAnimated::resetPoolExpiry(float lodCoverage, texture_usage_t textu
|
||||
}
|
||||
}
|
||||
|
||||
// TODO - Vulkan refactoring. Perhaps The texture selection for animation should be done in the shader.
|
||||
/*
|
||||
void KRTextureAnimated::bind(GLuint texture_unit)
|
||||
{
|
||||
resetPoolExpiry(0.0f, TEXTURE_USAGE_NONE); // TODO - Need to set parameters here for streaming priority?
|
||||
@@ -112,6 +114,7 @@ void KRTextureAnimated::bind(GLuint texture_unit)
|
||||
frame_texture->bind(texture_unit);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
long KRTextureAnimated::getReferencedMemSize()
|
||||
{
|
||||
|
||||
@@ -43,7 +43,6 @@ public:
|
||||
virtual bool save(const std::string& path);
|
||||
virtual bool save(KRDataBlock& data);
|
||||
|
||||
virtual void bind(GLuint texture_unit);
|
||||
virtual long getMemRequiredForSize(int max_dim);
|
||||
virtual void resetPoolExpiry(float lodCoverage, texture_usage_t textureUsage);
|
||||
|
||||
|
||||
@@ -113,9 +113,7 @@ bool KRTextureCube::createGPUTexture(int lod_max_dim)
|
||||
for (int i = 0; i < 6; i++) {
|
||||
std::string faceName = getName() + SUFFIXES[i];
|
||||
if (m_textures[i]) {
|
||||
/* TODO - Vulkan refactoring...
|
||||
incorporate TARGETS[i],
|
||||
*/
|
||||
// TODO - Vulkan refactoring. We need to create a cube map texture rather than individual 2d textures.
|
||||
m_textures[i]->uploadTexture(device, texture.image, lod_max_dim, m_new_lod_max_dim);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +142,7 @@ long KRTextureCube::getMemRequiredForSize(int max_dim)
|
||||
return memoryRequired;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
void KRTextureCube::resetPoolExpiry(float lodCoverage, texture_usage_t textureUsage)
|
||||
{
|
||||
KRTexture::resetPoolExpiry(lodCoverage, textureUsage);
|
||||
@@ -154,19 +152,6 @@ void KRTextureCube::resetPoolExpiry(float lodCoverage, texture_usage_t textureUs
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void KRTextureCube::bind(GLuint texture_unit)
|
||||
{
|
||||
KRTexture::bind(texture_unit);
|
||||
GLuint handle = getHandle();
|
||||
if (m_pContext->getTextureManager()->selectTexture(GL_TEXTURE_CUBE_MAP, texture_unit, handle)) {
|
||||
if (handle) {
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
|
||||
GLDEBUG(glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string KRTextureCube::getExtension()
|
||||
{
|
||||
|
||||
@@ -44,22 +44,12 @@ public:
|
||||
virtual bool save(const std::string& path);
|
||||
virtual bool save(KRDataBlock& data);
|
||||
|
||||
virtual void bind(GLuint texture_unit);
|
||||
virtual long getMemRequiredForSize(int max_dim);
|
||||
// virtual void resetPoolExpiry(float lodCoverage, texture_usage_t textureUsage);
|
||||
virtual void resetPoolExpiry(float lodCoverage, texture_usage_t textureUsage);
|
||||
|
||||
private:
|
||||
bool createGPUTexture(int lod_max_dim) override;
|
||||
|
||||
const GLenum TARGETS[6] = {
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
};
|
||||
|
||||
const char* SUFFIXES[6] = {
|
||||
"_positive_x",
|
||||
"_negative_x",
|
||||
|
||||
@@ -71,10 +71,7 @@ KRTextureManager::~KRTextureManager()
|
||||
void KRTextureManager::_clearGLState()
|
||||
{
|
||||
for (int i = 0; i < KRENGINE_MAX_TEXTURE_UNITS; i++) {
|
||||
m_wrapModeS[i] = 0;
|
||||
m_wrapModeT[i] = 0;
|
||||
m_maxAnisotropy = -1.0f;
|
||||
selectTexture(i, NULL, 0.0f, KRTexture::TEXTURE_USAGE_NONE);
|
||||
}
|
||||
|
||||
m_iActiveTexture = -1;
|
||||
@@ -93,11 +90,6 @@ void KRTextureManager::_setActiveTexture(int i)
|
||||
|
||||
void KRTextureManager::_setWrapModeS(GLuint i, GLuint wrap_mode)
|
||||
{
|
||||
if (m_wrapModeS[i] != wrap_mode) {
|
||||
_setActiveTexture(i);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_mode);
|
||||
m_wrapModeS[i] = wrap_mode;
|
||||
}
|
||||
}
|
||||
|
||||
void KRTextureManager::setMaxAnisotropy(float max_anisotropy)
|
||||
@@ -107,11 +99,6 @@ void KRTextureManager::setMaxAnisotropy(float max_anisotropy)
|
||||
|
||||
void KRTextureManager::_setWrapModeT(GLuint i, GLuint wrap_mode)
|
||||
{
|
||||
if (m_wrapModeT[i] != wrap_mode) {
|
||||
_setActiveTexture(i);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_mode);
|
||||
m_wrapModeT[i] = wrap_mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +241,7 @@ void KRTextureManager::selectTexture(int iTextureUnit, KRTexture* pTexture, floa
|
||||
|
||||
if (pTexture != NULL) {
|
||||
_setActiveTexture(iTextureUnit);
|
||||
pTexture->bind(iTextureUnit);
|
||||
//pTexture->bind(iTextureUnit);
|
||||
} else {
|
||||
selectTexture(GL_TEXTURE_2D, iTextureUnit, 0);
|
||||
}
|
||||
|
||||
@@ -95,8 +95,6 @@ private:
|
||||
|
||||
KRTexture* m_boundTextures[KRENGINE_MAX_TEXTURE_UNITS];
|
||||
int m_boundTextureHandles[KRENGINE_MAX_TEXTURE_UNITS];
|
||||
GLuint m_wrapModeS[KRENGINE_MAX_TEXTURE_UNITS];
|
||||
GLuint m_wrapModeT[KRENGINE_MAX_TEXTURE_UNITS];
|
||||
float m_maxAnisotropy;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user