Update the format table to check support for filtering and rendering.
Since filerability and renderability may depend on separate extensions,
use functions to determine their support. Context now uses these
functions to fill it's own TextureFormatCaps.
BUG=angle:658
Change-Id: Ib4dc877ba7c24f84a3823fd5aa2e01a3b3621705
Reviewed-on: https://chromium-review.googlesource.com/206831
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/Context.cpp b/src/libGLESv2/Context.cpp
index 10bd6f8..74244dc 100644
--- a/src/libGLESv2/Context.cpp
+++ b/src/libGLESv2/Context.cpp
@@ -44,9 +44,7 @@
{
ASSERT(robustAccess == false); // Unimplemented
- mCaps = mRenderer->getRendererCaps();
- mTextureCaps = mRenderer->getRendererTextureCaps();
- mExtensions = mRenderer->getRendererExtensions();
+ initCaps(clientVersion);
mClientVersion = clientVersion;
@@ -2329,7 +2327,7 @@
void Context::initExtensionStrings()
{
- mExtensionStrings = mExtensions.getStrings(mClientVersion);
+ mExtensionStrings = mExtensions.getStrings();
std::ostringstream combinedStringStream;
std::copy(mExtensionStrings.begin(), mExtensionStrings.end(), std::ostream_iterator<std::string>(combinedStringStream, " "));
@@ -2508,6 +2506,40 @@
return false;
}
+void Context::initCaps(GLuint clientVersion)
+{
+ mCaps = mRenderer->getRendererCaps();
+
+ mExtensions = mRenderer->getRendererExtensions();
+
+ if (clientVersion < 3)
+ {
+ // Disable ES3+ extensions
+ mExtensions.colorBufferFloat = false;
+ }
+
+ if (clientVersion > 2)
+ {
+ // FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
+ //mExtensions.sRGB = false;
+ }
+
+ const TextureCapsMap &rendererFormats = mRenderer->getRendererTextureCaps();
+ for (TextureCapsMap::const_iterator i = rendererFormats.begin(); i != rendererFormats.end(); i++)
+ {
+ GLenum format = i->first;
+ TextureCaps formatCaps = i->second;
+
+ if (formatCaps.texturable && IsValidInternalFormat(format, mExtensions, clientVersion))
+ {
+ // Update the format caps based on the client version and extensions
+ formatCaps.renderable = IsRenderingSupported(format, mExtensions, clientVersion);
+ formatCaps.filterable = IsFilteringSupported(format, mExtensions, clientVersion);
+ mTextureCaps.insert(format, formatCaps);
+ }
+ }
+}
+
}
extern "C"