Remove useless ifdef.

It should depend on features available in graphics drivers and not on headers that were used for compilation.
In theory there was a possible case that GL_VERSION_3_3 was not defined and CVS->getGLSLVersion() >= 330 was true, so that bind wasn't done at all.
And still GL_VERSION_3_3 should be always true for OpenGL renderer because it's defined in glew.
This commit is contained in:
deve 2017-02-01 10:40:48 +01:00
parent 3c8369b915
commit d124c61e3c
2 changed files with 4 additions and 20 deletions

View File

@ -248,7 +248,6 @@ GLuint TextureShaderBase::createSamplers(SamplerTypeNew sampler_type)
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createNearestSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -258,13 +257,11 @@ GLuint TextureShaderBase::createNearestSampler()
if (CVS->isEXTTextureFilterAnisotropicUsable())
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
return id;
#endif
} // createNearestSampler
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createTrilinearSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -279,13 +276,11 @@ GLuint TextureShaderBase::createTrilinearSampler()
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso);
}
return id;
#endif
} // createTrilinearSampler
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createBilinearSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -295,12 +290,10 @@ GLuint TextureShaderBase::createBilinearSampler()
if (CVS->isEXTTextureFilterAnisotropicUsable())
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
return id;
#endif
} // createBilinearSampler
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createShadowSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -310,13 +303,11 @@ GLuint TextureShaderBase::createShadowSampler()
glSamplerParameterf(id, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE);
glSamplerParameterf(id, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
return id;
#endif
} // createShadowSampler
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createBilinearClampedSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -326,14 +317,12 @@ GLuint TextureShaderBase::createBilinearClampedSampler()
if (CVS->isEXTTextureFilterAnisotropicUsable())
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
return id;
#endif
} // createBilinearClampedSampler
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createTrilinearClampedArray()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -348,12 +337,10 @@ GLuint TextureShaderBase::createTrilinearClampedArray()
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso);
}
return id;
#endif
} // createTrilinearClampedArray
// ----------------------------------------------------------------------------
GLuint TextureShaderBase::createSemiTrilinearSampler()
{
#ifdef GL_VERSION_3_3
unsigned id;
glGenSamplers(1, &id);
glSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -363,7 +350,6 @@ GLuint TextureShaderBase::createSemiTrilinearSampler()
if (CVS->isEXTTextureFilterAnisotropicUsable())
glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.);
return id;
#endif
} // createSemiTrilinearSampler
// ----------------------------------------------------------------------------

View File

@ -48,8 +48,8 @@ enum SamplerTypeNew
// ============================================================================
/** A simple non-templated base class for a shader that uses textures. A non
* templated base class is necessary to easily handle static objects (like
* list of all bind functions to call) - with templates each instance is a
* templated base class is necessary to easily handle static objects (like
* list of all bind functions to call) - with templates each instance is a
* different class (with different static values).
*/
class TextureShaderBase
@ -68,7 +68,7 @@ protected:
static void bindTextureShadow(GLuint tex_unit, GLuint tex_id);
static void bindTrilinearClampedArrayTexture(GLuint tex_unit, GLuint tex_id);
static void bindTextureVolume(GLuint tex_unit, GLuint tex_id);
GLuint createSamplers(SamplerTypeNew sampler_type);
private:
@ -88,7 +88,7 @@ protected:
// ========================================================================
/** Class C needs to be the newly declared shaders class (necessary for
* the instance template). NUM_TEXTURES is the number of texture units
* used in this shader. It is used to test at compile time that the
* used in this shader. It is used to test at compile time that the
* right number of arguments are supplied to the variadic functions.
*/
template<class C, int NUM_TEXTURES, typename...tp>
@ -173,11 +173,9 @@ public:
{
if (CVS->getGLSLVersion() >= 330)
{
#ifdef GL_VERSION_3_3
glActiveTexture(GL_TEXTURE0 + m_texture_units[N]);
glBindTexture(m_texture_type[N], tex_id);
glBindSampler(m_texture_units[N], m_sampler_ids[N]);
#endif
}
else
{