Centralize GL format workarounds.
Instead of trying to encapsulate the GL texture format workarounds into
tables, use functions that do manual checks for specific cases. Simplifies
the logic.
Fixes:
* conformance/extensions/ext-sRGB.html
* conformance/extensions/oes-texture-half-float.html
* conformance/extensions/oes-texture-half-float-with-canvas.html
* conformance/extensions/oes-texture-half-float-with-image.htm
* conformance/extensions/oes-texture-half-float-with-video.html
BUG=angleproject:884
Change-Id: Ifb719fff908680fddc7c53a544e2284a42a58356
Reviewed-on: https://chromium-review.googlesource.com/289082
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/RenderbufferGL.cpp b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
index a5877f6..320c5f4 100644
--- a/src/libANGLE/renderer/gl/RenderbufferGL.cpp
+++ b/src/libANGLE/renderer/gl/RenderbufferGL.cpp
@@ -18,10 +18,13 @@
namespace rx
{
-
-RenderbufferGL::RenderbufferGL(const FunctionsGL *functions, StateManagerGL *stateManager, const gl::TextureCapsMap &textureCaps)
+RenderbufferGL::RenderbufferGL(const FunctionsGL *functions,
+ const WorkaroundsGL &workarounds,
+ StateManagerGL *stateManager,
+ const gl::TextureCapsMap &textureCaps)
: RenderbufferImpl(),
mFunctions(functions),
+ mWorkarounds(workarounds),
mStateManager(stateManager),
mTextureCaps(textureCaps),
mRenderbufferID(0)
@@ -40,8 +43,10 @@
{
mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
- const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalformat, mFunctions->standard);
- mFunctions->renderbufferStorage(GL_RENDERBUFFER, nativeInternalFormatInfo.internalFormat, width, height);
+ nativegl::RenderbufferFormat renderbufferFormat =
+ nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat);
+ mFunctions->renderbufferStorage(GL_RENDERBUFFER, renderbufferFormat.internalFormat, width,
+ height);
return gl::Error(GL_NO_ERROR);
}
@@ -50,8 +55,10 @@
{
mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID);
- const nativegl::InternalFormat &nativeInternalFormatInfo = nativegl::GetInternalFormatInfo(internalformat, mFunctions->standard);
- mFunctions->renderbufferStorageMultisample(GL_RENDERBUFFER, samples, nativeInternalFormatInfo.internalFormat, width, height);
+ nativegl::RenderbufferFormat renderbufferFormat =
+ nativegl::GetRenderbufferFormat(mFunctions, mWorkarounds, internalformat);
+ mFunctions->renderbufferStorageMultisample(GL_RENDERBUFFER, samples,
+ renderbufferFormat.internalFormat, width, height);
const gl::TextureCaps &formatCaps = mTextureCaps.get(internalformat);
if (samples > formatCaps.getMaxSamples())