Commit 0fe1949d by Geoff Lang

Updated gl::IsInternalTextureTarget to have a client version parameter.

TRAC #23470 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent 3ed0c484
...@@ -459,9 +459,22 @@ bool IsCubemapTextureTarget(GLenum target) ...@@ -459,9 +459,22 @@ bool IsCubemapTextureTarget(GLenum target)
return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z); return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
} }
bool IsInternalTextureTarget(GLenum target) bool IsInternalTextureTarget(GLenum target, GLuint clientVersion)
{ {
return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target); 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) bool IsTriangleMode(GLenum drawMode)
......
...@@ -40,7 +40,7 @@ int MatrixComponentCount(GLenum type, bool isRowMajorMatrix); ...@@ -40,7 +40,7 @@ int MatrixComponentCount(GLenum type, bool isRowMajorMatrix);
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize); int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
bool IsCubemapTextureTarget(GLenum target); bool IsCubemapTextureTarget(GLenum target);
bool IsInternalTextureTarget(GLenum target); bool IsInternalTextureTarget(GLenum target, GLuint clientVersion);
bool IsTriangleMode(GLenum drawMode); bool IsTriangleMode(GLenum drawMode);
......
...@@ -177,18 +177,18 @@ void Framebuffer::detachTexture(GLuint texture) ...@@ -177,18 +177,18 @@ void Framebuffer::detachTexture(GLuint texture)
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++) for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{ {
if (mColorbuffers[colorAttachment].id() == texture && if (mColorbuffers[colorAttachment].id() == texture &&
IsInternalTextureTarget(mColorbuffers[colorAttachment].type())) IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
{ {
mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0); mColorbuffers[colorAttachment].set(NULL, GL_NONE, 0, 0);
} }
} }
if (mDepthbuffer.id() == texture && IsInternalTextureTarget(mDepthbuffer.type())) if (mDepthbuffer.id() == texture && IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
{ {
mDepthbuffer.set(NULL, GL_NONE, 0, 0); mDepthbuffer.set(NULL, GL_NONE, 0, 0);
} }
if (mStencilbuffer.id() == texture && IsInternalTextureTarget(mStencilbuffer.type())) if (mStencilbuffer.id() == texture && IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
{ {
mStencilbuffer.set(NULL, GL_NONE, 0, 0); mStencilbuffer.set(NULL, GL_NONE, 0, 0);
} }
...@@ -478,7 +478,7 @@ GLenum Framebuffer::completeness() const ...@@ -478,7 +478,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
} }
else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type())) else if (IsInternalTextureTarget(mColorbuffers[colorAttachment].type(), mRenderer->getCurrentClientVersion()))
{ {
GLint internalformat = colorbuffer->getInternalFormat(); GLint internalformat = colorbuffer->getInternalFormat();
...@@ -568,7 +568,7 @@ GLenum Framebuffer::completeness() const ...@@ -568,7 +568,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
} }
else if (IsInternalTextureTarget(mDepthbuffer.type())) else if (IsInternalTextureTarget(mDepthbuffer.type(), mRenderer->getCurrentClientVersion()))
{ {
GLint internalformat = depthbuffer->getInternalFormat(); GLint internalformat = depthbuffer->getInternalFormat();
...@@ -627,7 +627,7 @@ GLenum Framebuffer::completeness() const ...@@ -627,7 +627,7 @@ GLenum Framebuffer::completeness() const
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
} }
else if (IsInternalTextureTarget(mStencilbuffer.type())) else if (IsInternalTextureTarget(mStencilbuffer.type(), mRenderer->getCurrentClientVersion()))
{ {
GLint internalformat = stencilbuffer->getInternalFormat(); GLint internalformat = stencilbuffer->getInternalFormat();
......
...@@ -800,7 +800,7 @@ bool validateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin ...@@ -800,7 +800,7 @@ bool validateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin
GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height,
GLint border) GLint border)
{ {
if (!gl::IsInternalTextureTarget(target)) if (!gl::IsInternalTextureTarget(target, context->getClientVersion()))
{ {
return gl::error(GL_INVALID_ENUM, false); return gl::error(GL_INVALID_ENUM, false);
} }
...@@ -5290,7 +5290,7 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac ...@@ -5290,7 +5290,7 @@ void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attac
{ {
attachmentObjectType = attachmentType; attachmentObjectType = attachmentType;
} }
else if (gl::IsInternalTextureTarget(attachmentType)) else if (gl::IsInternalTextureTarget(attachmentType, context->getClientVersion()))
{ {
attachmentObjectType = GL_TEXTURE; 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