Commit bb94f341 by Jamie Madill

Remove gl::IsInternalTextureTarget.

This function was a duplicate of ValidTexture2DDestinationTarget. Also clean up a bit of the code in Framebuffer::completeness. BUG=angle:660 Change-Id: Iee8d011274bfb2e426346e3ccdde7342fbb7ef44 Reviewed-on: https://chromium-review.googlesource.com/202595Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent e261b44a
......@@ -392,24 +392,6 @@ bool IsCubemapTextureTarget(GLenum target)
return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
}
bool IsInternalTextureTarget(GLenum target, GLuint clientVersion)
{
if (clientVersion == 2)
{
return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target);
}
else if (clientVersion == 3)
{
return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target) ||
target == GL_TEXTURE_3D || target == GL_TEXTURE_2D_ARRAY;
}
else
{
UNREACHABLE();
return false;
}
}
bool IsTriangleMode(GLenum drawMode)
{
switch (drawMode)
......
......@@ -38,7 +38,6 @@ int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
bool IsCubemapTextureTarget(GLenum target);
bool IsInternalTextureTarget(GLenum target, GLuint clientVersion);
bool IsTriangleMode(GLenum drawMode);
......
......@@ -416,15 +416,10 @@ GLenum Framebuffer::completeness() const
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
if (mColorbuffers[colorAttachment])
{
const FramebufferAttachment *colorbuffer = mColorbuffers[colorAttachment];
if (colorbuffer->type() == GL_NONE)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
const FramebufferAttachment *colorbuffer = mColorbuffers[colorAttachment];
if (colorbuffer)
{
if (colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
......@@ -432,14 +427,7 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = colorbuffer->getInternalFormat();
const TextureCaps &formatCaps = mRenderer->getCaps().textureCaps.get(internalformat);
if (colorbuffer->type() == GL_RENDERBUFFER)
{
if (!formatCaps.colorRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else if (IsInternalTextureTarget(colorbuffer->type(), mRenderer->getCurrentClientVersion()))
if (colorbuffer->isTexture())
{
if (!formatCaps.colorRendering)
{
......@@ -454,8 +442,10 @@ GLenum Framebuffer::completeness() const
}
else
{
UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!formatCaps.colorRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
if (!missingAttachment)
......@@ -513,14 +503,7 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = mDepthbuffer->getInternalFormat();
const TextureCaps &formatCaps = mRenderer->getCaps().textureCaps.get(internalformat);
if (mDepthbuffer->type() == GL_RENDERBUFFER)
{
if (!formatCaps.depthRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else if (IsInternalTextureTarget(mDepthbuffer->type(), mRenderer->getCurrentClientVersion()))
if (mDepthbuffer->isTexture())
{
GLenum internalformat = mDepthbuffer->getInternalFormat();
......@@ -542,8 +525,10 @@ GLenum Framebuffer::completeness() const
}
else
{
UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!formatCaps.depthRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
if (missingAttachment)
......@@ -572,14 +557,7 @@ GLenum Framebuffer::completeness() const
GLenum internalformat = mStencilbuffer->getInternalFormat();
const TextureCaps &formatCaps = mRenderer->getCaps().textureCaps.get(internalformat);
if (mStencilbuffer->type() == GL_RENDERBUFFER)
{
if (!formatCaps.stencilRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
else if (IsInternalTextureTarget(mStencilbuffer->type(), mRenderer->getCurrentClientVersion()))
if (mStencilbuffer->isTexture())
{
GLenum internalformat = mStencilbuffer->getInternalFormat();
......@@ -602,8 +580,10 @@ GLenum Framebuffer::completeness() const
}
else
{
UNREACHABLE();
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
if (!formatCaps.stencilRendering)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
}
if (missingAttachment)
......
......@@ -2709,7 +2709,7 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
{
attachmentObjectType = attachmentType;
}
else if (gl::IsInternalTextureTarget(attachmentType, context->getClientVersion()))
else if (gl::ValidTexture2DDestinationTarget(context, attachmentType))
{
attachmentObjectType = GL_TEXTURE;
}
......
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