Commit 589a0bad by Geoff Lang

Revert "Always use sized internal formats for textures in TextureGL."

Causing failures on the Intel and AMD bots which seem to have incorrect rounding for 1-bit alpha formats. This reverts commit 0bcb68f3. Change-Id: I00d333b5c10ba3f41d54bec95769f4baf07b0771 Reviewed-on: https://chromium-review.googlesource.com/288206Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b98c3a82
...@@ -55,23 +55,6 @@ static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget) ...@@ -55,23 +55,6 @@ static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget)
} }
} }
static const nativegl::InternalFormat &GetNativeInternalFormat(const FunctionsGL *functions,
GLenum internalFormat,
GLenum type)
{
if (functions->standard == STANDARD_GL_DESKTOP || functions->isAtLeastGLES(gl::Version(3, 0)))
{
// On Desktop GL, always use sized internal formats. Passing an internal format of
// GL_RGBA will generate a GL_RGBA8 texture even if the provided type is GL_FLOAT.
GLenum sizedFormat = gl::GetSizedInternalFormat(internalFormat, type);
return nativegl::GetInternalFormatInfo(sizedFormat, functions->standard);
}
else
{
return nativegl::GetInternalFormatInfo(internalFormat, functions->standard);
}
}
TextureGL::TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager) TextureGL::TextureGL(GLenum type, const FunctionsGL *functions, StateManagerGL *stateManager)
: TextureImpl(), : TextureImpl(),
mTextureType(type), mTextureType(type),
...@@ -107,8 +90,7 @@ gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat ...@@ -107,8 +90,7 @@ gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat
SetUnpackStateForTexImage(mStateManager, unpack); SetUnpackStateForTexImage(mStateManager, unpack);
const nativegl::InternalFormat &nativeInternalFormatInfo = const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
GetNativeInternalFormat(mFunctions, internalFormat, type);
mStateManager->bindTexture(mTextureType, mTextureID); mStateManager->bindTexture(mTextureType, mTextureID);
if (UseTexImage2D(mTextureType)) if (UseTexImage2D(mTextureType))
...@@ -161,8 +143,7 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte ...@@ -161,8 +143,7 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte
SetUnpackStateForTexImage(mStateManager, unpack); SetUnpackStateForTexImage(mStateManager, unpack);
const nativegl::InternalFormat &nativeInternalFormatInfo = const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
GetNativeInternalFormat(mFunctions, internalFormat, GL_UNSIGNED_BYTE);
mStateManager->bindTexture(mTextureType, mTextureID); mStateManager->bindTexture(mTextureType, mTextureID);
if (UseTexImage2D(mTextureType)) if (UseTexImage2D(mTextureType))
...@@ -190,17 +171,19 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl ...@@ -190,17 +171,19 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl
SetUnpackStateForTexImage(mStateManager, unpack); SetUnpackStateForTexImage(mStateManager, unpack);
const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(format, mFunctions->standard);
mStateManager->bindTexture(mTextureType, mTextureID); mStateManager->bindTexture(mTextureType, mTextureID);
if (UseTexImage2D(mTextureType)) if (UseTexImage2D(mTextureType))
{ {
ASSERT(area.z == 0 && area.depth == 1); ASSERT(area.z == 0 && area.depth == 1);
mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, mFunctions->compressedTexSubImage2D(target, level, area.x, area.y, area.width, area.height, nativeInternalFormatInfo.internalFormat, imageSize,
format, imageSize, pixels); pixels);
} }
else if (UseTexImage3D(mTextureType)) else if (UseTexImage3D(mTextureType))
{ {
mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, mFunctions->compressedTexSubImage3D(target, level, area.x, area.y, area.z, area.width, area.height, area.depth,
area.height, area.depth, format, imageSize, pixels); nativeInternalFormatInfo.internalFormat, imageSize, pixels);
} }
else else
{ {
...@@ -213,8 +196,7 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl ...@@ -213,8 +196,7 @@ gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl
gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat, gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle &sourceArea, GLenum internalFormat,
const gl::Framebuffer *source) const gl::Framebuffer *source)
{ {
const nativegl::InternalFormat &nativeInternalFormatInfo = GetNativeInternalFormat( const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalFormat, mFunctions->standard);
mFunctions, internalFormat, source->getImplementationColorReadType());
const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source);
......
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