Replaced remaining uses of old texture conversion functions in gl objects.

TRAC #22972 Signed-off-by: Jamie Madill Signed-off-by: Nicolas Capens Author: Geoff Lang git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2325 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 755012f4
......@@ -12,6 +12,7 @@
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
#include "libGLESv2/formatutils.h"
#include "libGLESv2/Buffer.h"
#include "libGLESv2/Fence.h"
#include "libGLESv2/Framebuffer.h"
......@@ -2108,7 +2109,10 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
return gl::error(GL_INVALID_OPERATION);
}
GLsizei outputPitch = ComputeRowPitch(width, ConvertSizedInternalFormat(format, type), getPackAlignment());
GLint sizedInternalFormat = IsSizedInternalFormat(format, mClientVersion) ? format
: GetSizedInternalFormat(format, type, mClientVersion);
GLsizei outputPitch = GetRowPitch(sizedInternalFormat, type, mClientVersion, width, getPackAlignment());
// sized query sanity check
if (bufSize)
{
......@@ -2165,7 +2169,7 @@ void Context::clear(GLbitfield mask)
return;
}
if (GetStencilSize(depthStencil->getActualFormat()) > 0)
if (gl::GetStencilBits(depthStencil->getActualFormat(), mClientVersion) > 0)
{
finalMask |= GL_STENCIL_BUFFER_BIT;
}
......@@ -2584,8 +2588,8 @@ bool Context::getCurrentReadFormatType(GLenum *format, GLenum *type)
return gl::error(GL_INVALID_OPERATION, false);
}
*format = gl::ExtractFormat(renderbuffer->getActualFormat());
*type = gl::ExtractType(renderbuffer->getActualFormat());
*format = gl::GetFormat(renderbuffer->getActualFormat(), mClientVersion);
*type = gl::GetType(renderbuffer->getActualFormat(), mClientVersion);
return true;
}
......
......@@ -12,6 +12,7 @@
#include "libGLESv2/main.h"
#include "libGLESv2/utilities.h"
#include "libGLESv2/formatutils.h"
#include "libGLESv2/Texture.h"
#include "libGLESv2/Context.h"
#include "libGLESv2/renderer/Renderer.h"
......@@ -320,9 +321,10 @@ GLenum Framebuffer::completeness() const
{
int width = 0;
int height = 0;
int colorbufferSize = 0;
unsigned int colorbufferSize = 0;
int samples = -1;
bool missingAttachment = true;
GLuint clientVersion = mRenderer->getCurrentClientVersion();
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
......@@ -342,7 +344,7 @@ GLenum Framebuffer::completeness() const
if (mColorbufferTypes[colorAttachment] == GL_RENDERBUFFER)
{
if (!gl::IsColorRenderable(colorbuffer->getInternalFormat()))
if (!gl::IsColorRenderingSupported(colorbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -350,23 +352,14 @@ GLenum Framebuffer::completeness() const
else if (IsInternalTextureTarget(mColorbufferTypes[colorAttachment]))
{
GLint internalformat = colorbuffer->getInternalFormat();
GLenum format = gl::ExtractFormat(internalformat);
if (IsCompressed(format) ||
format == GL_ALPHA ||
format == GL_LUMINANCE ||
format == GL_LUMINANCE_ALPHA)
if (!gl::IsColorRenderingSupported(internalformat, mRenderer))
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
if ((gl::IsFloat32Format(internalformat) && !mRenderer->getFloat32TextureSupport()) ||
(gl::IsFloat16Format(internalformat) && !mRenderer->getFloat16TextureSupport()))
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
if (gl::IsDepthTexture(internalformat) || gl::IsStencilTexture(internalformat))
if (gl::GetDepthBits(internalformat, clientVersion) > 0 ||
gl::GetStencilBits(internalformat, clientVersion) > 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -394,9 +387,9 @@ GLenum Framebuffer::completeness() const
// in GLES 2.0, all color attachments attachments must have the same number of bitplanes
// in GLES 3.0, there is no such restriction
if (mRenderer->getCurrentClientVersion() < 3)
if (clientVersion < 3)
{
if (ComputePixelSize(colorbuffer->getInternalFormat()) != colorbufferSize)
if (gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion) != colorbufferSize)
{
return GL_FRAMEBUFFER_UNSUPPORTED;
}
......@@ -416,7 +409,7 @@ GLenum Framebuffer::completeness() const
width = colorbuffer->getWidth();
height = colorbuffer->getHeight();
samples = colorbuffer->getSamples();
colorbufferSize = gl::ComputePixelSize(colorbuffer->getInternalFormat());
colorbufferSize = gl::GetPixelBytes(colorbuffer->getInternalFormat(), clientVersion);
missingAttachment = false;
}
}
......@@ -441,7 +434,7 @@ GLenum Framebuffer::completeness() const
if (mDepthbufferType == GL_RENDERBUFFER)
{
if (!gl::IsDepthRenderable(depthbuffer->getInternalFormat()))
if (!gl::IsDepthRenderingSupported(depthbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -456,7 +449,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (!gl::IsDepthTexture(internalformat))
if (gl::GetDepthBits(internalformat, clientVersion) == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -500,7 +493,7 @@ GLenum Framebuffer::completeness() const
if (mStencilbufferType == GL_RENDERBUFFER)
{
if (!gl::IsStencilRenderable(stencilbuffer->getInternalFormat()))
if (!gl::IsStencilRenderingSupported(stencilbuffer->getInternalFormat(), mRenderer))
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......@@ -516,7 +509,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (!gl::IsStencilTexture(internalformat))
if (gl::GetStencilBits(internalformat, clientVersion) == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
......
......@@ -15,6 +15,7 @@
#include "libGLESv2/Texture.h"
#include "libGLESv2/renderer/Renderer.h"
#include "libGLESv2/utilities.h"
#include "libGLESv2/formatutils.h"
namespace gl
{
......@@ -35,36 +36,6 @@ void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
{
}
GLuint RenderbufferInterface::getRedSize() const
{
return gl::GetRedSize(getActualFormat());
}
GLuint RenderbufferInterface::getGreenSize() const
{
return gl::GetGreenSize(getActualFormat());
}
GLuint RenderbufferInterface::getBlueSize() const
{
return gl::GetBlueSize(getActualFormat());
}
GLuint RenderbufferInterface::getAlphaSize() const
{
return gl::GetAlphaSize(getActualFormat());
}
GLuint RenderbufferInterface::getDepthSize() const
{
return gl::GetDepthSize(getActualFormat());
}
GLuint RenderbufferInterface::getStencilSize() const
{
return gl::GetStencilSize(getActualFormat());
}
///// RenderbufferTexture2D Implementation ////////
RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLenum target) : mTarget(target)
......@@ -199,6 +170,9 @@ Renderbuffer::Renderbuffer(rx::Renderer *renderer, GLuint id, RenderbufferInterf
{
ASSERT(instance != NULL);
mInstance = instance;
ASSERT(renderer != NULL);
mRenderer = renderer;
}
Renderbuffer::~Renderbuffer()
......@@ -254,32 +228,32 @@ GLenum Renderbuffer::getActualFormat() const
GLuint Renderbuffer::getRedSize() const
{
return mInstance->getRedSize();
return gl::GetRedBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLuint Renderbuffer::getGreenSize() const
{
return mInstance->getGreenSize();
return gl::GetGreenBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLuint Renderbuffer::getBlueSize() const
{
return mInstance->getBlueSize();
return gl::GetBlueBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLuint Renderbuffer::getAlphaSize() const
{
return mInstance->getAlphaSize();
return gl::GetAlphaBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLuint Renderbuffer::getDepthSize() const
{
return mInstance->getDepthSize();
return gl::GetDepthBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLuint Renderbuffer::getStencilSize() const
{
return mInstance->getStencilSize();
return gl::GetStencilBits(getActualFormat(), mRenderer->getCurrentClientVersion());
}
GLsizei Renderbuffer::getSamples() const
......
......@@ -53,13 +53,6 @@ class RenderbufferInterface
virtual GLenum getActualFormat() const = 0;
virtual GLsizei getSamples() const = 0;
GLuint getRedSize() const;
GLuint getGreenSize() const;
GLuint getBlueSize() const;
GLuint getAlphaSize() const;
GLuint getDepthSize() const;
GLuint getStencilSize() const;
virtual unsigned int getSerial() const = 0;
private:
......@@ -200,6 +193,7 @@ class Renderbuffer : public RefCountObject
private:
DISALLOW_COPY_AND_ASSIGN(Renderbuffer);
rx::Renderer const *mRenderer;
RenderbufferInterface *mInstance;
};
......
......@@ -636,8 +636,7 @@ bool Texture2D::isSamplerComplete() const
bool mipmapping = isMipmapFiltered();
if ((IsFloat32Format(getInternalFormat(0)) && !mRenderer->getFloat32TextureSupport()) ||
(IsFloat16Format(getInternalFormat(0)) && !mRenderer->getFloat16TextureSupport()))
if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
{
if (mSamplerState.magFilter != GL_NEAREST ||
(mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
......@@ -717,12 +716,12 @@ bool Texture2D::isMipmapComplete() const
bool Texture2D::isCompressed(GLint level) const
{
return IsCompressed(getInternalFormat(level));
return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
}
bool Texture2D::isDepth(GLint level) const
{
return IsDepthTexture(getInternalFormat(level));
return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
}
// Constructs a native texture resource from the texture images
......@@ -1082,8 +1081,7 @@ bool TextureCubeMap::isSamplerComplete() const
bool mipmapping = isMipmapFiltered();
if ((gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0)) == GL_FLOAT && !mRenderer->getFloat32TextureSupport()) ||
(gl::ExtractType(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0) == GL_HALF_FLOAT_OES) && !mRenderer->getFloat16TextureSupport()))
if (!IsTextureFilteringSupported(getInternalFormat(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0), mRenderer))
{
if (mSamplerState.magFilter != GL_NEAREST ||
(mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
......@@ -1176,7 +1174,7 @@ bool TextureCubeMap::isMipmapCubeComplete() const
bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
{
return IsCompressed(getInternalFormat(target, level));
return IsFormatCompressed(getInternalFormat(target, level), mRenderer->getCurrentClientVersion());
}
// Constructs a native texture resource from the texture images, or returns an existing one
......@@ -1604,12 +1602,12 @@ GLenum Texture3D::getActualFormat(GLint level) const
bool Texture3D::isCompressed(GLint level) const
{
return IsCompressed(getInternalFormat(level));
return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
}
bool Texture3D::isDepth(GLint level) const
{
return IsDepthTexture(getInternalFormat(level));
return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
}
void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
......@@ -1758,8 +1756,7 @@ bool Texture3D::isSamplerComplete() const
bool mipmapping = isMipmapFiltered();
if ((IsFloat32Format(getInternalFormat(0)) && !mRenderer->getFloat32TextureSupport()) ||
(IsFloat16Format(getInternalFormat(0)) && !mRenderer->getFloat16TextureSupport()))
if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
{
if (mSamplerState.magFilter != GL_NEAREST ||
(mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
......@@ -2048,12 +2045,12 @@ GLenum Texture2DArray::getActualFormat(GLint level) const
bool Texture2DArray::isCompressed(GLint level) const
{
return IsCompressed(getInternalFormat(level));
return IsFormatCompressed(getInternalFormat(level), mRenderer->getCurrentClientVersion());
}
bool Texture2DArray::isDepth(GLint level) const
{
return IsDepthTexture(getInternalFormat(level));
return GetDepthBits(getInternalFormat(level), mRenderer->getCurrentClientVersion()) > 0;
}
void Texture2DArray::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalFormat, GLenum format, GLenum type, GLint unpackAlignment, const void *pixels)
......@@ -2254,8 +2251,7 @@ bool Texture2DArray::isSamplerComplete() const
bool mipmapping = isMipmapFiltered();
if ((IsFloat32Format(getInternalFormat(0)) && !mRenderer->getFloat32TextureSupport()) ||
(IsFloat16Format(getInternalFormat(0)) && !mRenderer->getFloat16TextureSupport()))
if (!IsTextureFilteringSupported(getInternalFormat(0), mRenderer))
{
if (mSamplerState.magFilter != GL_NEAREST ||
(mSamplerState.minFilter != GL_NEAREST && mSamplerState.minFilter != GL_NEAREST_MIPMAP_NEAREST))
......
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