Simplify formatutils.h by exposing the info structures.
Removed all the separate query functions and simply expose the internal
info structures. This reduces the number of std::map/std::set operations
that were hidden behind the API.
Moved the validation tables for ES3 format combinations and effective
internal formats into validationES3.cpp so that formatutils.h only has
generic GL format queries.
BUG=angle:658
Change-Id: Ieb60d42b8eafcdb4f21dcbec130b39478ce5f7c5
Reviewed-on: https://chromium-review.googlesource.com/206835
Reviewed-by: Nicolas Capens <capn@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/validationES2.cpp b/src/libGLESv2/validationES2.cpp
index 1a09400..59067f5 100644
--- a/src/libGLESv2/validationES2.cpp
+++ b/src/libGLESv2/validationES2.cpp
@@ -39,8 +39,7 @@
if (format != GL_NONE)
{
- GLenum internalformat = gl::GetSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(level))
+ if (gl::GetFormatTypeInfo(format, type).internalFormat != texture->getInternalFormat(level))
{
return gl::error(GL_INVALID_OPERATION, false);
}
@@ -80,8 +79,7 @@
if (format != GL_NONE)
{
- GLenum internalformat = gl::GetSizedInternalFormat(format, type);
- if (internalformat != texture->getInternalFormat(target, level))
+ if (gl::GetFormatTypeInfo(format, type).internalFormat != texture->getInternalFormat(target, level))
{
return gl::error(GL_INVALID_OPERATION, false);
}
@@ -475,7 +473,7 @@
gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer();
GLenum colorbufferFormat = framebuffer->getReadColorbuffer()->getInternalFormat();
- GLenum textureFormat = gl::GetFormat(textureInternalFormat);
+ GLenum textureFormat = gl::GetInternalFormatInfo(textureInternalFormat).format;
// [OpenGL ES 2.0.24] table 3.9
if (isSubImage)
@@ -706,10 +704,8 @@
return gl::error(GL_INVALID_OPERATION, false);
}
- GLenum format = gl::GetFormat(internalformat);
- GLenum type = gl::GetType(internalformat);
-
- if (format == GL_NONE || type == GL_NONE)
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
+ if (formatInfo.format == GL_NONE || formatInfo.type == GL_NONE)
{
return gl::error(GL_INVALID_ENUM, false);
}