Texture storage support detected at runtime.

This commit is contained in:
vlj 2014-09-05 18:33:05 +02:00
parent d741204ee0
commit 781288bf80
3 changed files with 13 additions and 6 deletions

View File

@ -498,6 +498,7 @@ void IrrDriver::initDevice()
hasBuffserStorage = false;
hasDrawIndirect = false;
hasComputeShaders = false;
hasTextureStorage = false;
// Default false value for hasVSLayer if --no-graphics argument is used
if (!ProfileWorld::isNoGraphics())
{
@ -521,6 +522,10 @@ void IrrDriver::initDevice()
hasComputeShaders = true;
Log::info("GLDriver", "ARB Compute Shader enabled");
}
if (GLEW_ARB_texture_storage) {
hasTextureStorage = true;
Log::info("GLDriver", "ARB Texture Storage enabled");
}
}

View File

@ -204,6 +204,7 @@ private:
bool hasDrawIndirect;
bool hasBuffserStorage;
bool hasComputeShaders;
bool hasTextureStorage;
bool m_need_ubo_workaround;
bool m_need_rh_workaround;
bool m_need_srgb_workaround;
@ -330,6 +331,11 @@ public:
return hasComputeShaders;
}
bool hasARBTextureStorage() const
{
return hasTextureStorage;
}
video::SColorf getAmbientLight() const;
struct GlowData {

View File

@ -29,11 +29,9 @@ static GLuint generateRTT3D(GLenum target, size_t w, size_t h, size_t d, GLint i
GLuint result;
glGenTextures(1, &result);
glBindTexture(target, result);
#if WIN32
if (irr_driver->getGLSLVersion() >= 420)
if (irr_driver->hasARBTextureStorage())
glTexStorage3D(target, 1, internalFormat, w, h, d);
else
#endif
glTexImage3D(target, 0, internalFormat, w, h, d, 0, format, type, 0);
return result;
}
@ -43,11 +41,9 @@ static GLuint generateRTT(const core::dimension2du &res, GLint internalFormat, G
GLuint result;
glGenTextures(1, &result);
glBindTexture(GL_TEXTURE_2D, result);
#if WIN32
if (irr_driver->getGLSLVersion() >= 420)
if (irr_driver->hasARBTextureStorage())
glTexStorage2D(GL_TEXTURE_2D, mipmaplevel, internalFormat, res.Width, res.Height);
else
#endif
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, res.Width, res.Height, 0, format, type, 0);
return result;
}