Add gl::Format to represent a texture/rb/surface format.
This has a few advantages: it preserves all the information of the
internal format, such as if it is sized or unsized. It also saves
looking up the format multiple times in the table, which should
improve speed in some cases.
The extra sized-ness information will allow us to perform the
correct validation in CopyTexSubImage calls.
BUG=angleproject:1228
Change-Id: I42954771b0a9a968f5d787b8cf6e0af721791855
Reviewed-on: https://chromium-review.googlesource.com/362626
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FramebufferGL.cpp b/src/libANGLE/renderer/gl/FramebufferGL.cpp
index 6191a41..4606114 100644
--- a/src/libANGLE/renderer/gl/FramebufferGL.cpp
+++ b/src/libANGLE/renderer/gl/FramebufferGL.cpp
@@ -210,18 +210,16 @@
GLenum FramebufferGL::getImplementationColorReadFormat() const
{
- const FramebufferAttachment *readAttachment = mState.getReadAttachment();
- GLenum internalFormat = readAttachment->getInternalFormat();
- const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat);
- return internalFormatInfo.format;
+ const auto *readAttachment = mState.getReadAttachment();
+ const Format &format = readAttachment->getFormat();
+ return format.info->format;
}
GLenum FramebufferGL::getImplementationColorReadType() const
{
- const FramebufferAttachment *readAttachment = mState.getReadAttachment();
- GLenum internalFormat = readAttachment->getInternalFormat();
- const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat);
- return internalFormatInfo.type;
+ const auto *readAttachment = mState.getReadAttachment();
+ const Format &format = readAttachment->getFormat();
+ return format.info->type;
}
Error FramebufferGL::readPixels(ContextImpl *context,