Commit 51a94370 by Jamie Madill

Replace API queries of immutable texture level count with a specialized function.

TRAC #23978 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods
parent 2ebab858
...@@ -329,6 +329,11 @@ bool Texture::isImmutable() const ...@@ -329,6 +329,11 @@ bool Texture::isImmutable() const
return mImmutable; return mImmutable;
} }
int Texture::immutableLevelCount()
{
return (mImmutable ? getNativeTexture()->getStorageInstance()->levelCount() : 0);
}
GLint Texture::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const GLint Texture::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
{ {
// NPOT checks are not required in ES 3.0, NPOT texture support is assumed. // NPOT checks are not required in ES 3.0, NPOT texture support is assumed.
......
...@@ -88,7 +88,6 @@ class Texture : public RefCountObject ...@@ -88,7 +88,6 @@ class Texture : public RefCountObject
int getLodOffset(); int getLodOffset();
void getSamplerState(SamplerState *sampler); void getSamplerState(SamplerState *sampler);
GLenum getUsage() const; GLenum getUsage() const;
virtual int levelCount() = 0;
GLint getBaseLevelWidth() const; GLint getBaseLevelWidth() const;
GLint getBaseLevelHeight() const; GLint getBaseLevelHeight() const;
...@@ -108,6 +107,7 @@ class Texture : public RefCountObject ...@@ -108,6 +107,7 @@ class Texture : public RefCountObject
unsigned int getTextureSerial(); unsigned int getTextureSerial();
bool isImmutable() const; bool isImmutable() const;
int immutableLevelCount();
static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager. static const GLuint INCOMPLETE_TEXTURE_ID = static_cast<GLuint>(-1); // Every texture takes an id at creation time. The value is arbitrary because it is never registered with the resource manager.
......
...@@ -3739,7 +3739,7 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) ...@@ -3739,7 +3739,7 @@ void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
{ {
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
} }
*params = (GLfloat)(texture->isImmutable() ? texture->levelCount() : 0); *params = (GLfloat)texture->immutableLevelCount();
break; break;
case GL_TEXTURE_USAGE_ANGLE: case GL_TEXTURE_USAGE_ANGLE:
*params = (GLfloat)texture->getUsage(); *params = (GLfloat)texture->getUsage();
...@@ -3809,7 +3809,7 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) ...@@ -3809,7 +3809,7 @@ void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
{ {
return gl::error(GL_INVALID_ENUM); return gl::error(GL_INVALID_ENUM);
} }
*params = texture->isImmutable() ? texture->levelCount() : 0; *params = texture->immutableLevelCount();
break; break;
case GL_TEXTURE_USAGE_ANGLE: case GL_TEXTURE_USAGE_ANGLE:
*params = texture->getUsage(); *params = texture->getUsage();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment