WebGL Compat: Add DEPTH_STENCIL renderbuffers.
This special internal format was defined in the WebGL 1 spec as a
special unsized format with at least 16 bits of depth and at least
8 bits of stencil. Intenally ANGLE will translate this to packed
24/8 depth/stencil.
The new test is adapted from the WebGL test:
conformance/renderbuffers/framebuffer-object-attachment
BUG=angleproject:1708
Change-Id: I44b03e41889eed02481f603b8d52c530dcfed5ce
Reviewed-on: https://chromium-review.googlesource.com/442094
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index 4f9936e..5a3f041 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -266,14 +266,15 @@
mResetStrategy(GetResetStrategy(attribs)),
mRobustAccess(GetRobustAccess(attribs)),
mCurrentSurface(nullptr),
- mSurfacelessFramebuffer(nullptr)
+ mSurfacelessFramebuffer(nullptr),
+ mWebGLContext(GetWebGLContext(attribs))
{
if (mRobustAccess)
{
UNIMPLEMENTED();
}
- initCaps(GetWebGLContext(attribs), displayExtensions);
+ initCaps(displayExtensions);
initWorkarounds();
mGLState.initialize(mCaps, mExtensions, getClientVersion(), GetDebug(attribs),
@@ -2410,7 +2411,7 @@
return false;
}
-void Context::initCaps(bool webGLContext, const egl::DisplayExtensions &displayExtensions)
+void Context::initCaps(const egl::DisplayExtensions &displayExtensions)
{
mCaps = mImplementation->getNativeCaps();
@@ -2468,11 +2469,11 @@
mCaps.maxFragmentInputComponents = std::min<GLuint>(mCaps.maxFragmentInputComponents, IMPLEMENTATION_MAX_VARYING_VECTORS * 4);
// WebGL compatibility
- mExtensions.webglCompatibility = webGLContext;
+ mExtensions.webglCompatibility = mWebGLContext;
for (const auto &extensionInfo : GetExtensionInfoMap())
{
// If this context is for WebGL, disable all enableable extensions
- if (webGLContext && extensionInfo.second.Requestable)
+ if (mWebGLContext && extensionInfo.second.Requestable)
{
mExtensions.*(extensionInfo.second.ExtensionsMember) = false;
}
@@ -2487,11 +2488,10 @@
mCaps.compressedTextureFormats.clear();
mTextureCaps.clear();
- const TextureCapsMap &rendererFormats = mImplementation->getNativeTextureCaps();
- for (TextureCapsMap::const_iterator i = rendererFormats.begin(); i != rendererFormats.end(); i++)
+ for (auto capsIt : mImplementation->getNativeTextureCaps())
{
- GLenum format = i->first;
- TextureCaps formatCaps = i->second;
+ GLenum format = capsIt.first;
+ TextureCaps formatCaps = capsIt.second;
const InternalFormat &formatInfo = GetInternalFormatInfo(format);
@@ -3786,8 +3786,11 @@
GLsizei width,
GLsizei height)
{
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
+
Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- handleError(renderbuffer->setStorage(internalformat, width, height));
+ handleError(renderbuffer->setStorage(convertedInternalFormat, width, height));
}
void Context::renderbufferStorageMultisample(GLenum target,
@@ -3796,9 +3799,12 @@
GLsizei width,
GLsizei height)
{
+ // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format.
+ GLenum convertedInternalFormat = getConvertedRenderbufferFormat(internalformat);
Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
- handleError(renderbuffer->setStorageMultisample(samples, internalformat, width, height));
+ handleError(
+ renderbuffer->setStorageMultisample(samples, convertedInternalFormat, width, height));
}
} // namespace gl