Remove the requirement that a format must be texturable to be renderable.
Previously, to determine if a texture format was renderable, the
texturable and renderable fields had to be and-ed together. This caused
issues for formats such as D24S8 which can be renderable but not
texturable depending on available extensions.
Made the renderable flag a complete check that may be different than the
textureable flag and removed assumptions that a format is texturable if
renderable from the code.
GL_DEPTH24_STENCIL8 now checks for ANGLE_depth_textures for texturability
and ANGLE_depth_textures or OES_packed_depth_stencil for renderability.
BUG=angle:752
Change-Id: I6d197cee72cc249e5996fa395303bdf43d246a87
Reviewed-on: https://chromium-review.googlesource.com/219093
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/validationES.cpp b/src/libGLESv2/validationES.cpp
index 9a5fa31..1b6180d 100644
--- a/src/libGLESv2/validationES.cpp
+++ b/src/libGLESv2/validationES.cpp
@@ -304,8 +304,8 @@
return false;
}
- const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
- if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
+ const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
+ if (!formatCaps.renderable)
{
context->recordError(Error(GL_INVALID_ENUM));
return false;
@@ -315,6 +315,7 @@
// sized but it does state that the format must be in the ES2.0 spec table 4.5 which contains
// only sized internal formats. The ES3 spec (section 4.4.2) does, however, state that the
// internal format must be sized and not an integer format if samples is greater than zero.
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
if (formatInfo.pixelBytes == 0)
{
context->recordError(Error(GL_INVALID_ENUM));
@@ -327,13 +328,6 @@
return false;
}
- const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
- if (!formatCaps.renderable)
- {
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
- }
-
if (static_cast<GLuint>(std::max(width, height)) > context->getCaps().maxRenderbufferSize)
{
context->recordError(Error(GL_INVALID_VALUE));