Commit 493daf5a by Geoff Lang

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/206831Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 4836d22a
......@@ -36,11 +36,18 @@ struct TextureCaps
class TextureCapsMap
{
public:
typedef std::unordered_map<GLenum, TextureCaps>::const_iterator const_iterator;
void insert(GLenum internalFormat, const TextureCaps &caps);
void remove(GLenum internalFormat);
const TextureCaps &get(GLenum internalFormat) const;
const_iterator begin() const;
const_iterator end() const;
size_t size() const;
private:
typedef std::unordered_map<GLenum, TextureCaps> InternalFormatToCapsMap;
InternalFormatToCapsMap mCapsMap;
......@@ -51,7 +58,7 @@ struct Extensions
Extensions();
// Generate a vector of supported extension strings
std::vector<std::string> getStrings(GLuint clientVersion) const;
std::vector<std::string> getStrings() const;
// Set all texture related extension support based on the supported textures.
// Determines support for:
......
......@@ -44,9 +44,7 @@ Context::Context(int clientVersion, const gl::Context *shareContext, rx::Rendere
{
ASSERT(robustAccess == false); // Unimplemented
mCaps = mRenderer->getRendererCaps();
mTextureCaps = mRenderer->getRendererTextureCaps();
mExtensions = mRenderer->getRendererExtensions();
initCaps(clientVersion);
mClientVersion = clientVersion;
......@@ -2329,7 +2327,7 @@ const std::string &Context::getRendererString() const
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 @@ bool Context::hasMappedBuffer(GLenum target) const
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"
......
......@@ -278,6 +278,8 @@ class Context
size_t getBoundFramebufferTextureSerials(FramebufferTextureSerialArray *outSerialArray);
void initCaps(GLuint clientVersion);
// Caps to use for validation
Caps mCaps;
TextureCapsMap mTextureCaps;
......
......@@ -45,6 +45,9 @@ bool IsValidType(GLenum type, const Extensions &extensions, GLuint clientVersion
bool IsValidFormatCombination(GLenum internalFormat, GLenum format, GLenum type, const Extensions &extensions, GLuint clientVersion);
bool IsValidCopyTexImageCombination(GLenum textureInternalFormat, GLenum frameBufferInternalFormat, GLuint readBufferHandle, GLuint clientVersion);
bool IsRenderingSupported(GLenum internalFormat, const Extensions &extensions, GLuint clientVersion);
bool IsFilteringSupported(GLenum internalFormat, const Extensions &extensions, GLuint clientVersion);
bool IsSizedInternalFormat(GLenum internalFormat);
GLenum GetSizedInternalFormat(GLenum format, GLenum type);
......
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