Adds a level parameter to texture getWidth and getHeight

TRAC #18802 Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch Author: Shannon Woods git-svn-id: https://angleproject.googlecode.com/svn/trunk@899 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 67d72526
#define MAJOR_VERSION 1
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 898
#define BUILD_REVISION 899
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -72,12 +72,12 @@ IDirect3DSurface9 *RenderbufferTexture::getDepthStencil()
GLsizei RenderbufferTexture::getWidth() const
{
return mTexture->getWidth();
return mTexture->getWidth(0);
}
GLsizei RenderbufferTexture::getHeight() const
{
return mTexture->getHeight();
return mTexture->getHeight(0);
}
GLenum RenderbufferTexture::getInternalFormat() const
......
......@@ -1707,14 +1707,20 @@ GLenum Texture2D::getTarget() const
return GL_TEXTURE_2D;
}
GLsizei Texture2D::getWidth() const
GLsizei Texture2D::getWidth(GLint level) const
{
return mImageArray[0].getWidth();
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[level].getWidth();
else
return 0;
}
GLsizei Texture2D::getHeight() const
GLsizei Texture2D::getHeight(GLint level) const
{
return mImageArray[0].getHeight();
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[level].getHeight();
else
return 0;
}
GLenum Texture2D::getInternalFormat() const
......@@ -2335,14 +2341,20 @@ GLenum TextureCubeMap::getTarget() const
return GL_TEXTURE_CUBE_MAP;
}
GLsizei TextureCubeMap::getWidth() const
GLsizei TextureCubeMap::getWidth(GLint level) const
{
return mImageArray[0][0].getWidth();
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[0][level].getWidth();
else
return 0;
}
GLsizei TextureCubeMap::getHeight() const
GLsizei TextureCubeMap::getHeight(GLint level) const
{
return mImageArray[0][0].getHeight();
if (level < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
return mImageArray[0][level].getHeight();
else
return 0;
}
GLenum TextureCubeMap::getInternalFormat() const
......
......@@ -184,8 +184,8 @@ class Texture : public RefCountObject
GLenum getWrapT() const;
GLenum getUsage() const;
virtual GLsizei getWidth() const = 0;
virtual GLsizei getHeight() const = 0;
virtual GLsizei getWidth(GLint level) const = 0;
virtual GLsizei getHeight(GLint level) const = 0;
virtual GLenum getInternalFormat() const = 0;
virtual GLenum getType() const = 0;
virtual D3DFORMAT getD3DFormat() const = 0;
......@@ -277,8 +277,8 @@ class Texture2D : public Texture
virtual GLenum getTarget() const;
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLsizei getWidth(GLint level) const;
virtual GLsizei getHeight(GLint level) const;
virtual GLenum getInternalFormat() const;
virtual GLenum getType() const;
virtual D3DFORMAT getD3DFormat() const;
......@@ -351,8 +351,8 @@ class TextureCubeMap : public Texture
virtual GLenum getTarget() const;
virtual GLsizei getWidth() const;
virtual GLsizei getHeight() const;
virtual GLsizei getWidth(GLint level) const;
virtual GLsizei getHeight(GLint level) const;
virtual GLenum getInternalFormat() const;
virtual GLenum getType() const;
virtual D3DFORMAT getD3DFormat() const;
......
......@@ -1036,8 +1036,8 @@ void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffs
return error(GL_INVALID_OPERATION);
}
if ((width % 4 != 0 && width != texture->getWidth()) ||
(height % 4 != 0 && height != texture->getHeight()))
if ((width % 4 != 0 && width != texture->getWidth(0)) ||
(height % 4 != 0 && height != texture->getHeight(0)))
{
return error(GL_INVALID_OPERATION);
}
......@@ -1058,8 +1058,8 @@ void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffs
return error(GL_INVALID_OPERATION);
}
if ((width % 4 != 0 && width != texture->getWidth()) ||
(height % 4 != 0 && height != texture->getHeight()))
if ((width % 4 != 0 && width != texture->getWidth(0)) ||
(height % 4 != 0 && height != texture->getHeight(0)))
{
return error(GL_INVALID_OPERATION);
}
......
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