Commit c8bfefac by Kenneth Russell Committed by Commit Bot

Emulate unsized depth/stencil textures on ES 3.0 without OES_depth_texture.

Use sized internal formats for unsized depth/stencil textures on ES 3.0 devices that don't advertise the GL_OES_depth_texture extension. This CL makes the webgl-depth-texture.html conformance test pass on WebKit's ANGLE backend on iOS. Bug: angleproject:4591 Change-Id: Ifc45e74258ecf2e6433662bb10b081f1f94bded9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2213678Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org>
parent 02fa7313
...@@ -559,6 +559,27 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, ...@@ -559,6 +559,27 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
} }
} }
} }
else if ((internalFormat.internalFormat == GL_DEPTH_COMPONENT ||
internalFormat.internalFormat == GL_DEPTH_STENCIL) &&
!functions->hasGLESExtension("GL_OES_depth_texture"))
{
// Use ES 3.0 sized internal formats for depth/stencil textures when the driver doesn't
// advertise GL_OES_depth_texture, since it's likely the driver will reject unsized
// internal formats.
if (internalFormat.internalFormat == GL_DEPTH_COMPONENT &&
internalFormat.type == GL_UNSIGNED_INT &&
!functions->hasGLESExtension("GL_OES_depth32"))
{
// Best-effort attempt to provide as many bits as possible.
result = GL_DEPTH_COMPONENT24;
// Note: could also consider promoting GL_DEPTH_COMPONENT / GL_UNSIGNED_SHORT to a
// higher precision.
}
else
{
result = internalFormat.sizedInternalFormat;
}
}
} }
return result; return result;
......
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