Commit b2f3d05c by Geoff Lang Committed by Geoff Lang

Replaced the custom component type and SRGB bool with GLenums.

TRAC #23474 Author: Geoff Lang Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent 9060a4e0
......@@ -65,13 +65,8 @@ bool IsSpecialInterpretationType(GLenum type);
GLenum GetFormat(GLint internalFormat, GLuint clientVersion);
GLenum GetType(GLint internalFormat, GLuint clientVersion);
bool IsNormalizedFixedPointFormat(GLint internalFormat, GLuint clientVersion);
bool IsIntegerFormat(GLint internalFormat, GLuint clientVersion);
bool IsSignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
bool IsUnsignedIntegerFormat(GLint internalFormat, GLuint clientVersion);
bool IsFloatingPointFormat(GLint internalFormat, GLuint clientVersion);
bool IsSRGBFormat(GLint internalFormat, GLuint clientVersion);
GLenum GetComponentType(GLint internalFormat, GLuint clientVersion);
GLenum GetColorEncoding(GLint internalFormat, GLuint clientVersion);
bool IsColorRenderingSupported(GLint internalFormat, const rx::Renderer *renderer);
bool IsColorRenderingSupported(GLint internalFormat, const Context *context);
......
......@@ -232,7 +232,7 @@ bool Blit11::copyTexture(ID3D11ShaderResourceView *source, const gl::Box &source
BlitParameters parameters = { 0 };
parameters.mDestinationFormat = destFormat;
parameters.mSignedInteger = gl::IsSignedIntegerFormat(sourceInternalFormat, mRenderer->getCurrentClientVersion());
parameters.mSignedInteger = gl::GetComponentType(sourceInternalFormat, mRenderer->getCurrentClientVersion()) == GL_INT;
parameters.m3DBlit = sourceArea.depth > 1;
BlitShaderMap::const_iterator i = mShaderMap.find(parameters);
......
......@@ -2494,7 +2494,8 @@ GLsizei Renderer11::getNumSampleCounts(GLint internalFormat) const
unsigned int numCounts = 0;
// D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
if (!gl::IsIntegerFormat(internalFormat, getCurrentClientVersion()))
GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
if (componentType != GL_INT && componentType != GL_UNSIGNED_INT)
{
DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
......@@ -2518,8 +2519,11 @@ GLsizei Renderer11::getNumSampleCounts(GLint internalFormat) const
void Renderer11::getSampleCounts(GLint internalFormat, GLsizei bufSize, GLint *params) const
{
// D3D11 supports multisampling for signed and unsigned format, but ES 3.0 does not
if (gl::IsIntegerFormat(internalFormat, getCurrentClientVersion()))
GLenum componentType = gl::GetComponentType(internalFormat, getCurrentClientVersion());
if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
{
return;
}
DXGI_FORMAT format = gl_d3d11::GetRenderableFormat(internalFormat, getCurrentClientVersion());
MultisampleSupportMap::const_iterator iter = mMultisampleSupportMap.find(format);
......
......@@ -52,7 +52,8 @@ bool ValidateRenderbufferStorageParameters(const gl::Context *context, GLenum ta
return gl::error(GL_INVALID_ENUM, false);
}
if (gl::IsIntegerFormat(internalformat, context->getClientVersion()) && samples > 0)
GLenum componentType = gl::GetComponentType(internalformat, context->getClientVersion());
if ((componentType == GL_UNSIGNED_INT || componentType == GL_INT) && samples > 0)
{
return gl::error(GL_INVALID_OPERATION, false);
}
......@@ -183,40 +184,43 @@ bool ValidateBlitFramebufferParameters(gl::Context *context, GLint srcX0, GLint
if (readColorBuffer && drawColorBuffer)
{
GLint readInternalFormat = readColorBuffer->getActualFormat();
GLint drawInternalFormat = drawColorBuffer->getActualFormat();
GLenum readComponentType = gl::GetComponentType(readInternalFormat, clientVersion);
for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_DRAW_BUFFERS; i++)
{
if (drawFramebuffer->isEnabledColorAttachment(i))
{
GLint drawbufferAttachmentFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat();
if (gl::IsNormalizedFixedPointFormat(readInternalFormat, clientVersion) &&
!gl::IsNormalizedFixedPointFormat(drawbufferAttachmentFormat, clientVersion))
GLint drawInternalFormat = drawFramebuffer->getColorbuffer(i)->getActualFormat();
GLenum drawComponentType = gl::GetComponentType(drawInternalFormat, clientVersion);
// The GL ES 3.0.2 spec (pg 193) states that:
// 1) If the read buffer is fixed point format, the draw buffer must be as well
// 2) If the read buffer is an unsigned integer format, the draw buffer must be as well
// 3) If the read buffer is a signed integer format, the draw buffer must be as well
if ( (readComponentType == GL_UNSIGNED_NORMALIZED || readComponentType == GL_SIGNED_NORMALIZED) &&
!(drawComponentType == GL_UNSIGNED_NORMALIZED || drawComponentType == GL_SIGNED_NORMALIZED))
{
return gl::error(GL_INVALID_OPERATION, false);
}
if (gl::IsUnsignedIntegerFormat(readInternalFormat, clientVersion) &&
!gl::IsUnsignedIntegerFormat(drawbufferAttachmentFormat, clientVersion))
if (readComponentType == GL_UNSIGNED_INT && drawComponentType != GL_UNSIGNED_INT)
{
return gl::error(GL_INVALID_OPERATION, false);
}
if (gl::IsSignedIntegerFormat(readInternalFormat, clientVersion) &&
!gl::IsSignedIntegerFormat(drawbufferAttachmentFormat, clientVersion))
if (readComponentType == GL_INT && drawComponentType != GL_INT)
{
return gl::error(GL_INVALID_OPERATION, false);
}
if (readColorBuffer->getSamples() > 0 && (readInternalFormat != drawbufferAttachmentFormat || !sameBounds))
if (readColorBuffer->getSamples() > 0 && (readInternalFormat != drawInternalFormat || !sameBounds))
{
return gl::error(GL_INVALID_OPERATION, false);
}
}
}
if (gl::IsIntegerFormat(readInternalFormat, clientVersion) && filter == GL_LINEAR)
if ((readComponentType == GL_INT || readComponentType == GL_UNSIGNED_INT) && filter == GL_LINEAR)
{
return gl::error(GL_INVALID_OPERATION, false);
}
......
......@@ -756,13 +756,13 @@ bool ValidES3ReadFormatType(GLenum internalFormat, GLenum format, GLenum type)
switch (type)
{
case GL_INT:
if (!gl::IsSignedIntegerFormat(internalFormat, 3))
if (gl::GetComponentType(internalFormat, 3) != GL_INT)
{
return false;
}
break;
case GL_UNSIGNED_INT:
if (!gl::IsUnsignedIntegerFormat(internalFormat, 3))
if (gl::GetComponentType(internalFormat, 3) != GL_UNSIGNED_INT)
{
return false;
}
......
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