Commit eb66a6e2 by Geoff Lang Committed by Commit Bot

Replace the GLVersion class with gl::Version.

Update code to use gl::Version in as many places as possible to ease ES 3.1 support. BUG=angleproject:1588 Change-Id: I3490b53a81027cf849dac551a9cc66ce04506144 Reviewed-on: https://chromium-review.googlesource.com/404946Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent cfe7b2c4
......@@ -149,6 +149,11 @@ EGLint GetClientMinorVersion(const egl::AttributeMap &attribs)
return static_cast<EGLint>(attribs.get(EGL_CONTEXT_MINOR_VERSION, 0));
}
gl::Version GetClientVersion(const egl::AttributeMap &attribs)
{
return gl::Version(GetClientMajorVersion(attribs), GetClientMinorVersion(attribs));
}
GLenum GetResetStrategy(const egl::AttributeMap &attribs)
{
EGLAttrib attrib = attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT,
......@@ -230,8 +235,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
const Context *shareContext,
const egl::AttributeMap &attribs)
: ValidationContext(GetClientMajorVersion(attribs),
GetClientMinorVersion(attribs),
: ValidationContext(GetClientVersion(attribs),
&mGLState,
mCaps,
mTextureCaps,
......@@ -241,8 +245,6 @@ Context::Context(rx::EGLImplFactory *implFactory,
GetNoError(attribs)),
mImplementation(implFactory->createContext(mState)),
mCompiler(nullptr),
mClientMajorVersion(GetClientMajorVersion(attribs)),
mClientMinorVersion(GetClientMinorVersion(attribs)),
mConfig(config),
mClientType(EGL_OPENGL_ES_API),
mHasBeenCurrent(false),
......@@ -259,7 +261,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
initCaps(GetWebGLContext(attribs));
initWorkarounds();
mGLState.initialize(mCaps, mExtensions, mClientMajorVersion, GetDebug(attribs),
mGLState.initialize(mCaps, mExtensions, getClientVersion(), GetDebug(attribs),
GetBindGeneratesResource(attribs));
mFenceNVHandleAllocator.setBaseHandle(0);
......@@ -288,7 +290,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, GL_TEXTURE_CUBE_MAP);
mZeroTextures[GL_TEXTURE_CUBE_MAP].set(zeroTextureCube);
if (mClientMajorVersion >= 3)
if (getClientVersion() >= Version(3, 0))
{
// TODO: These could also be enabled via extension
Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, GL_TEXTURE_3D);
......@@ -324,7 +326,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
bindPixelPackBuffer(0);
bindPixelUnpackBuffer(0);
if (mClientMajorVersion >= 3)
if (getClientVersion() >= Version(3, 0))
{
// [OpenGL ES 3.0.2] section 2.14.1 pg 85:
// In the initial state, a default transform feedback object is bound and treated as
......@@ -1299,10 +1301,10 @@ void Context::getIntegerv(GLenum pname, GLint *params)
case GL_MIN_PROGRAM_TEXEL_OFFSET: *params = mCaps.minProgramTexelOffset; break;
case GL_MAX_PROGRAM_TEXEL_OFFSET: *params = mCaps.maxProgramTexelOffset; break;
case GL_MAJOR_VERSION:
*params = mClientMajorVersion;
*params = getClientVersion().major;
break;
case GL_MINOR_VERSION:
*params = mClientMinorVersion;
*params = getClientVersion().minor;
break;
case GL_MAX_ELEMENTS_INDICES: *params = mCaps.maxElementsIndices; break;
case GL_MAX_ELEMENTS_VERTICES: *params = mCaps.maxElementsVertices; break;
......@@ -2332,7 +2334,7 @@ void Context::initCaps(bool webGLContext)
mLimitations = mImplementation->getNativeLimitations();
if (mClientMajorVersion < 3)
if (getClientVersion() < Version(3, 0))
{
// Disable ES3+ extensions
mExtensions.colorBufferFloat = false;
......@@ -2340,7 +2342,7 @@ void Context::initCaps(bool webGLContext)
mExtensions.textureNorm16 = false;
}
if (mClientMajorVersion > 2)
if (getClientVersion() > Version(2, 0))
{
// FIXME(geofflang): Don't support EXT_sRGB in non-ES2 contexts
//mExtensions.sRGB = false;
......@@ -2403,11 +2405,11 @@ void Context::updateCaps()
// Caps are AND'd with the renderer caps because some core formats are still unsupported in
// ES3.
formatCaps.texturable =
formatCaps.texturable && formatInfo.textureSupport(mClientMajorVersion, mExtensions);
formatCaps.texturable && formatInfo.textureSupport(getClientVersion(), mExtensions);
formatCaps.renderable =
formatCaps.renderable && formatInfo.renderSupport(mClientMajorVersion, mExtensions);
formatCaps.renderable && formatInfo.renderSupport(getClientVersion(), mExtensions);
formatCaps.filterable =
formatCaps.filterable && formatInfo.filterSupport(mClientMajorVersion, mExtensions);
formatCaps.filterable && formatInfo.filterSupport(getClientVersion(), mExtensions);
// OpenGL ES does not support multisampling with integer formats
if (!formatInfo.renderSupport || formatInfo.componentType == GL_INT || formatInfo.componentType == GL_UNSIGNED_INT)
......
......@@ -643,9 +643,6 @@ class Context final : public ValidationContext
State mGLState;
int mClientMajorVersion;
int mClientMinorVersion;
const egl::Config *mConfig;
EGLenum mClientType;
......
......@@ -15,15 +15,14 @@ namespace gl
{
ContextState::ContextState(uintptr_t contextIn,
GLint clientMajorVersionIn,
GLint clientMinorVersionIn,
const Version &clientVersion,
State *stateIn,
const Caps &capsIn,
const TextureCapsMap &textureCapsIn,
const Extensions &extensionsIn,
const ResourceManager *resourceManagerIn,
const Limitations &limitationsIn)
: mGLVersion(clientMajorVersionIn, clientMinorVersionIn),
: mClientVersion(clientVersion),
mContext(contextIn),
mState(stateIn),
mCaps(capsIn),
......@@ -43,8 +42,7 @@ const TextureCaps &ContextState::getTextureCap(GLenum internalFormat) const
return mTextureCaps.get(internalFormat);
}
ValidationContext::ValidationContext(GLint clientMajorVersion,
GLint clientMinorVersion,
ValidationContext::ValidationContext(const Version &clientVersion,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
......@@ -53,8 +51,7 @@ ValidationContext::ValidationContext(GLint clientMajorVersion,
const Limitations &limitations,
bool skipValidation)
: mState(reinterpret_cast<uintptr_t>(this),
clientMajorVersion,
clientMinorVersion,
clientVersion,
state,
caps,
textureCaps,
......@@ -399,9 +396,7 @@ bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsign
return true;
}
const GLVersion &glVersion = mState.getGLVersion();
if (!glVersion.isES3OrGreater())
if (getClientVersion() < Version(3, 0))
{
return false;
}
......@@ -477,7 +472,7 @@ bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsign
}
}
if (!glVersion.isES31())
if (getClientVersion() < Version(3, 1))
{
return false;
}
......@@ -541,9 +536,7 @@ bool ValidationContext::getIndexedQueryParameterInfo(GLenum target,
GLenum *type,
unsigned int *numParams)
{
const GLVersion &glVersion = mState.getGLVersion();
if (!glVersion.isES3OrGreater())
if (getClientVersion() < Version(3, 0))
{
return false;
}
......@@ -568,7 +561,7 @@ bool ValidationContext::getIndexedQueryParameterInfo(GLenum target,
}
}
if (!glVersion.isES31())
if (getClientVersion() < Version(3, 1))
{
return false;
}
......
......@@ -11,39 +11,22 @@
#include "common/angleutils.h"
#include "libANGLE/State.h"
#include "libANGLE/Version.h"
namespace gl
{
class ValidationContext;
class ContextState;
class GLVersion final : angle::NonCopyable
{
public:
GLVersion(GLint clientMajorVersion, GLint clientMinorVersion)
: mClientMajorVersion(clientMajorVersion), mClientMinorVersion(clientMinorVersion)
{
}
GLint getClientMajorVersion() const { return mClientMajorVersion; }
GLint getClientMinorVersion() const { return mClientMinorVersion; }
bool isES2() const { return mClientMajorVersion == 2; }
bool isES3() const { return mClientMajorVersion == 3 && mClientMinorVersion == 0; }
bool isES31() const { return mClientMajorVersion == 3 && mClientMinorVersion == 1; }
bool isES3OrGreater() const { return mClientMajorVersion >= 3; }
private:
GLint mClientMajorVersion;
GLint mClientMinorVersion;
};
static constexpr Version ES_2_0 = Version(2, 0);
static constexpr Version ES_3_0 = Version(3, 0);
static constexpr Version ES_3_1 = Version(3, 1);
class ContextState final : public angle::NonCopyable
{
public:
ContextState(uintptr_t context,
GLint clientMajorVersion,
GLint clientMinorVersion,
const Version &clientVersion,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
......@@ -53,9 +36,9 @@ class ContextState final : public angle::NonCopyable
~ContextState();
uintptr_t getContext() const { return mContext; }
GLint getClientMajorVersion() const { return mGLVersion.getClientMajorVersion(); }
GLint getClientMinorVersion() const { return mGLVersion.getClientMinorVersion(); }
const GLVersion &getGLVersion() const { return mGLVersion; }
GLint getClientMajorVersion() const { return mClientVersion.major; }
GLint getClientMinorVersion() const { return mClientVersion.minor; }
const Version &getClientVersion() const { return mClientVersion; }
const State &getState() const { return *mState; }
const Caps &getCaps() const { return mCaps; }
const TextureCapsMap &getTextureCaps() const { return mTextureCaps; }
......@@ -69,7 +52,7 @@ class ContextState final : public angle::NonCopyable
friend class Context;
friend class ValidationContext;
GLVersion mGLVersion;
Version mClientVersion;
uintptr_t mContext;
State *mState;
const Caps &mCaps;
......@@ -82,8 +65,7 @@ class ContextState final : public angle::NonCopyable
class ValidationContext : angle::NonCopyable
{
public:
ValidationContext(GLint clientMajorVersion,
GLint clientMinorVersion,
ValidationContext(const Version &clientVersion,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
......@@ -96,9 +78,9 @@ class ValidationContext : angle::NonCopyable
virtual void handleError(const Error &error) = 0;
const ContextState &getContextState() const { return mState; }
int getClientMajorVersion() const { return mState.getClientMajorVersion(); }
int getClientMinorVersion() const { return mState.getClientMinorVersion(); }
const GLVersion &getGLVersion() const { return mState.mGLVersion; }
GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); }
GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); }
const Version &getClientVersion() const { return mState.getClientVersion(); }
const State &getGLState() const { return mState.getState(); }
const Caps &getCaps() const { return mState.getCaps(); }
const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); }
......
......@@ -72,7 +72,7 @@ State::~State()
void State::initialize(const Caps &caps,
const Extensions &extensions,
GLuint clientVersion,
const Version &clientVersion,
bool debug,
bool bindGeneratesResource)
{
......@@ -164,7 +164,7 @@ void State::initialize(const Caps &caps,
mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits);
mSamplerTextures[GL_TEXTURE_CUBE_MAP].resize(caps.maxCombinedTextureImageUnits);
if (clientVersion >= 3)
if (clientVersion >= Version(3, 0))
{
// TODO: These could also be enabled via extension
mSamplerTextures[GL_TEXTURE_2D_ARRAY].resize(caps.maxCombinedTextureImageUnits);
......
......@@ -21,6 +21,7 @@
#include "libANGLE/Sampler.h"
#include "libANGLE/Texture.h"
#include "libANGLE/TransformFeedback.h"
#include "libANGLE/Version.h"
#include "libANGLE/VertexAttribute.h"
#include "libANGLE/angletypes.h"
......@@ -41,7 +42,7 @@ class State : angle::NonCopyable
void initialize(const Caps &caps,
const Extensions &extensions,
GLuint clientVersion,
const Version &clientVersion,
bool debug,
bool bindGeneratesResource);
void reset();
......
......@@ -16,8 +16,8 @@ namespace gl
struct Version
{
Version();
Version(GLuint major, GLuint minor);
constexpr Version();
constexpr Version(GLuint major, GLuint minor);
GLuint major;
GLuint minor;
......@@ -26,8 +26,9 @@ struct Version
bool operator==(const Version &a, const Version &b);
bool operator!=(const Version &a, const Version &b);
bool operator>=(const Version &a, const Version &b);
bool operator<=(const Version &a, const Version &b);
bool operator<(const Version &a, const Version &b);
bool operator>(const Version &a, const Version &b);
}
#include "Version.inl"
......
......@@ -6,38 +6,54 @@
// Version.inl: Encapsulation of a GL version.
#include <tuple>
namespace gl
{
inline Version::Version()
constexpr Version::Version()
: Version(0, 0)
{
}
inline Version::Version(GLuint major_, GLuint minor_)
// Avoid conflicts with linux system defines
#undef major
#undef minor
constexpr Version::Version(GLuint major_, GLuint minor_)
: major(major_),
minor(minor_)
{
major = major_;
minor = minor_;
}
inline bool operator==(const Version &a, const Version &b)
{
return a.major == b.major && a.minor == b.minor;
return std::tie(a.major, a.minor) == std::tie(b.major, b.minor);
}
inline bool operator!=(const Version &a, const Version &b)
{
return !(a == b);
return std::tie(a.major, a.minor) != std::tie(b.major, b.minor);
}
inline bool operator>=(const Version &a, const Version &b)
{
return a.major > b.major || (a.major == b.major && a.minor >= b.minor);
return std::tie(a.major, a.minor) >= std::tie(b.major, b.minor);
}
inline bool operator<=(const Version &a, const Version &b)
{
return std::tie(a.major, a.minor) <= std::tie(b.major, b.minor);
}
inline bool operator<(const Version &a, const Version &b)
{
return !(a >= b);
return std::tie(a.major, a.minor) < std::tie(b.major, b.minor);
}
inline bool operator>(const Version &a, const Version &b)
{
return std::tie(a.major, a.minor) > std::tie(b.major, b.minor);
}
}
......@@ -71,20 +71,20 @@ bool operator<(const Type& a, const Type& b)
}
// Information about internal formats
static bool AlwaysSupported(GLuint, const Extensions &)
static bool AlwaysSupported(const Version &, const Extensions &)
{
return true;
}
static bool NeverSupported(GLuint, const Extensions &)
static bool NeverSupported(const Version &, const Extensions &)
{
return false;
}
template <GLuint minCoreGLVersion>
static bool RequireES(GLuint clientVersion, const Extensions &)
template <GLuint minCoreGLMajorVersion, GLuint minCoreGLMinorVersion>
static bool RequireES(const Version &clientVersion, const Extensions &)
{
return clientVersion >= minCoreGLVersion;
return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion);
}
// Pointer to a boolean memeber of the Extensions struct
......@@ -92,92 +92,101 @@ typedef bool(Extensions::*ExtensionBool);
// Check support for a single extension
template <ExtensionBool bool1>
static bool RequireExt(GLuint, const Extensions & extensions)
static bool RequireExt(const Version &, const Extensions &extensions)
{
return extensions.*bool1;
}
// Check for a minimum client version or a single extension
template <GLuint minCoreGLVersion, ExtensionBool bool1>
static bool RequireESOrExt(GLuint clientVersion, const Extensions &extensions)
template <GLuint minCoreGLMajorVersion, GLuint minCoreGLMinorVersion, ExtensionBool bool1>
static bool RequireESOrExt(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= minCoreGLVersion || extensions.*bool1;
return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
extensions.*bool1;
}
// Check for a minimum client version or two extensions
template <GLuint minCoreGLVersion, ExtensionBool bool1, ExtensionBool bool2>
static bool RequireESOrExtAndExt(GLuint clientVersion, const Extensions &extensions)
template <GLuint minCoreGLMajorVersion,
GLuint minCoreGLMinorVersion,
ExtensionBool bool1,
ExtensionBool bool2>
static bool RequireESOrExtAndExt(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= minCoreGLVersion || (extensions.*bool1 && extensions.*bool2);
return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
(extensions.*bool1 && extensions.*bool2);
}
// Check for a minimum client version or at least one of two extensions
template <GLuint minCoreGLVersion, ExtensionBool bool1, ExtensionBool bool2>
static bool RequireESOrExtOrExt(GLuint clientVersion, const Extensions &extensions)
template <GLuint minCoreGLMajorVersion,
GLuint minCoreGLMinorVersion,
ExtensionBool bool1,
ExtensionBool bool2>
static bool RequireESOrExtOrExt(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= minCoreGLVersion || extensions.*bool1 || extensions.*bool2;
return clientVersion >= Version(minCoreGLMajorVersion, minCoreGLMinorVersion) ||
extensions.*bool1 || extensions.*bool2;
}
// Check support for two extensions
template <ExtensionBool bool1, ExtensionBool bool2>
static bool RequireExtAndExt(GLuint, const Extensions &extensions)
static bool RequireExtAndExt(const Version &, const Extensions &extensions)
{
return extensions.*bool1 && extensions.*bool2;
}
// Check support for either of two extensions
template <ExtensionBool bool1, ExtensionBool bool2>
static bool RequireExtOrExt(GLuint, const Extensions &extensions)
static bool RequireExtOrExt(const Version &, const Extensions &extensions)
{
return extensions.*bool1 || extensions.*bool2;
}
// Special function for half float formats with three or four channels.
static bool HalfFloatSupport(GLuint clientVersion, const Extensions &extensions)
static bool HalfFloatSupport(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= 3 || extensions.textureHalfFloat;
return clientVersion >= Version(3, 0) || extensions.textureHalfFloat;
}
static bool HalfFloatRenderableSupport(GLuint clientVersion, const Extensions &extensions)
static bool HalfFloatRenderableSupport(const Version &clientVersion, const Extensions &extensions)
{
return HalfFloatSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
}
// Special function for half float formats with one or two channels.
static bool HalfFloatSupportRG(GLuint clientVersion, const Extensions &extensions)
static bool HalfFloatSupportRG(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= 3 || (extensions.textureHalfFloat && extensions.textureRG);
return clientVersion >= Version(3, 0) || (extensions.textureHalfFloat && extensions.textureRG);
}
static bool HalfFloatRenderableSupportRG(GLuint clientVersion, const Extensions &extensions)
static bool HalfFloatRenderableSupportRG(const Version &clientVersion, const Extensions &extensions)
{
return HalfFloatSupportRG(clientVersion, extensions) && extensions.colorBufferHalfFloat;
}
// Special function for float formats with three or four channels.
static bool FloatSupport(GLuint clientVersion, const Extensions &extensions)
static bool FloatSupport(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= 3 || extensions.textureFloat;
return clientVersion >= Version(3, 0) || extensions.textureFloat;
}
static bool FloatRenderableSupport(GLuint clientVersion, const Extensions &extensions)
static bool FloatRenderableSupport(const Version &clientVersion, const Extensions &extensions)
{
// We don't expose colorBufferFloat in ES2, but we silently support rendering to float.
return FloatSupport(clientVersion, extensions) &&
(extensions.colorBufferFloat || clientVersion == 2);
(extensions.colorBufferFloat || clientVersion == Version(2, 0));
}
// Special function for float formats with one or two channels.
static bool FloatSupportRG(GLuint clientVersion, const Extensions &extensions)
static bool FloatSupportRG(const Version &clientVersion, const Extensions &extensions)
{
return clientVersion >= 3 || (extensions.textureFloat && extensions.textureRG);
return clientVersion >= Version(3, 0) || (extensions.textureFloat && extensions.textureRG);
}
static bool FloatRenderableSupportRG(GLuint clientVersion, const Extensions &extensions)
static bool FloatRenderableSupportRG(const Version &clientVersion, const Extensions &extensions)
{
// We don't expose colorBufferFloat in ES2, but we silently support rendering to float.
return FloatSupportRG(clientVersion, extensions) &&
(extensions.colorBufferFloat || clientVersion == 2);
(extensions.colorBufferFloat || clientVersion == Version(2, 0));
}
InternalFormat::InternalFormat()
......@@ -425,48 +434,48 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
// clang-format off
// | Internal format | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Renderable | Filterable |
AddRGBAFormat(&map, GL_R8, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, &Extensions::textureRG>, RequireESOrExt<3, &Extensions::textureRG>, AlwaysSupported);
AddRGBAFormat(&map, GL_R8_SNORM, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RG8, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, &Extensions::textureRG>, RequireESOrExt<3, &Extensions::textureRG>, AlwaysSupported);
AddRGBAFormat(&map, GL_RG8_SNORM, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB8, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, &Extensions::rgb8rgba8>, RequireESOrExt<3, &Extensions::rgb8rgba8>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB8_SNORM, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB565, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2>, RequireES<2>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA4, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2>, RequireES<2>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB5_A1, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2>, RequireES<2>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA8, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, &Extensions::rgb8rgba8>, RequireESOrExt<3, &Extensions::rgb8rgba8>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA8_SNORM, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB10_A2, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<3>, RequireES<3>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB10_A2UI, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_SRGB8, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, &Extensions::sRGB>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_SRGB8_ALPHA8, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, &Extensions::sRGB>, RequireESOrExt<3, &Extensions::sRGB>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB9_E5, 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT, false, RequireES<3>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_R8I, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R8UI, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R16I, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R16UI, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R32I, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R32UI, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RG8I, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RG8UI, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RG16I, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RG16UI, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RG32I, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_R11F_G11F_B10F, 11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT, false, RequireES<3>, RequireExt<&Extensions::colorBufferFloat>, AlwaysSupported);
AddRGBAFormat(&map, GL_RG32UI, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGB8I, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB8UI, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB16I, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB16UI, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB32I, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB32UI, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGBA8I, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA8UI, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA16I, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA16UI, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA32I, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA32UI, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3>, RequireES<3>, NeverSupported);
// | Internal format | R | G | B | A |S | Format | Type | Component type | SRGB | Texture supported | Renderable | Filterable |
AddRGBAFormat(&map, GL_R8, 8, 0, 0, 0, 0, GL_RED, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureRG>, RequireESOrExt<3, 0, &Extensions::textureRG>, AlwaysSupported);
AddRGBAFormat(&map, GL_R8_SNORM, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RG8, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::textureRG>, RequireESOrExt<3, 0, &Extensions::textureRG>, AlwaysSupported);
AddRGBAFormat(&map, GL_RG8_SNORM, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB8, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB8_SNORM, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB565, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA4, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB5_A1, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA8, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGBA8_SNORM, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB10_A2, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<3, 0>, RequireES<3, 0>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB10_A2UI, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_SRGB8, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, 0, &Extensions::sRGB>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_SRGB8_ALPHA8, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireESOrExt<3, 0, &Extensions::sRGB>, RequireESOrExt<3, 0, &Extensions::sRGB>, AlwaysSupported);
AddRGBAFormat(&map, GL_RGB9_E5, 9, 9, 9, 0, 5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_FLOAT, false, RequireES<3, 0>, NeverSupported, AlwaysSupported);
AddRGBAFormat(&map, GL_R8I, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R8UI, 8, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R16I, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R16UI, 16, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R32I, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R32UI, 32, 0, 0, 0, 0, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RG8I, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RG8UI, 8, 8, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RG16I, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RG16UI, 16, 16, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RG32I, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_R11F_G11F_B10F, 11, 11, 10, 0, 0, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_FLOAT, false, RequireES<3, 0>, RequireExt<&Extensions::colorBufferFloat>, AlwaysSupported);
AddRGBAFormat(&map, GL_RG32UI, 32, 32, 0, 0, 0, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGB8I, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB8UI, 8, 8, 8, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB16I, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB16UI, 16, 16, 16, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB32I, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGB32UI, 32, 32, 32, 0, 0, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
AddRGBAFormat(&map, GL_RGBA8I, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_BYTE, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA8UI, 8, 8, 8, 8, 0, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA16I, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_SHORT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA16UI, 16, 16, 16, 16, 0, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA32I, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_INT, GL_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_RGBA32UI, 32, 32, 32, 32, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_UNSIGNED_INT, false, RequireES<3, 0>, RequireES<3, 0>, NeverSupported);
AddRGBAFormat(&map, GL_BGRA8_EXT, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
AddRGBAFormat(&map, GL_BGRA4_ANGLEX, 4, 4, 4, 4, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
......@@ -488,13 +497,13 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddRGBAFormat(&map, GL_RGBA32F, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
// Depth stencil formats
// | Internal format | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2>, RequireES<2>, RequireESOrExt<3, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT24, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<3>, RequireES<3>, RequireESOrExt<3, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32F, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<3>, RequireES<3>, RequireESOrExt<3, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32_OES, 32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, AlwaysSupported );
AddDepthStencilFormat(&map, GL_DEPTH24_STENCIL8, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, &Extensions::depthTextures>, RequireESOrExtOrExt<3, &Extensions::depthTextures, &Extensions::packedDepthStencil>, AlwaysSupported );
AddDepthStencilFormat(&map, GL_DEPTH32F_STENCIL8, 32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, RequireES<3>, RequireES<3>, AlwaysSupported );
// | Internal format | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT24, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32F, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>);
AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32_OES, 32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, AlwaysSupported );
AddDepthStencilFormat(&map, GL_DEPTH24_STENCIL8, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, 0, &Extensions::depthTextures>, RequireESOrExtOrExt<3, 0, &Extensions::depthTextures, &Extensions::packedDepthStencil>, AlwaysSupported );
AddDepthStencilFormat(&map, GL_DEPTH32F_STENCIL8, 32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, RequireES<3, 0>, RequireES<3, 0>, AlwaysSupported );
// STENCIL_INDEX8 is special-cased, see around the bottom of the list.
// Luminance alpha formats
......@@ -510,36 +519,36 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA16F_EXT, LUMAFormat(16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, AlwaysSupported)));
// Unsized formats
// | Internal format | Format | Supported | Renderable | Filterable |
AddUnsizedFormat(&map, GL_ALPHA, GL_ALPHA, RequireES<2>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_LUMINANCE, GL_LUMINANCE, RequireES<2>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, RequireES<2>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RED, GL_RED, RequireESOrExt<3, &Extensions::textureRG>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RG, GL_RG, RequireESOrExt<3, &Extensions::textureRG>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RGB, GL_RGB, RequireES<2>, RequireES<2>, AlwaysSupported);
AddUnsizedFormat(&map, GL_RGBA, GL_RGBA, RequireES<2>, RequireES<2>, AlwaysSupported);
AddUnsizedFormat(&map, GL_RED_INTEGER, GL_RED_INTEGER, RequireES<3>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RG_INTEGER, GL_RG_INTEGER, RequireES<3>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RGB_INTEGER, GL_RGB_INTEGER, RequireES<3>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RGBA_INTEGER, GL_RGBA_INTEGER, RequireES<3>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_BGRA_EXT, GL_BGRA_EXT, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
AddUnsizedFormat(&map, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, RequireES<2>, RequireES<2>, AlwaysSupported);
AddUnsizedFormat(&map, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, RequireESOrExt<3, &Extensions::packedDepthStencil>, RequireESOrExt<3, &Extensions::packedDepthStencil>, AlwaysSupported);
AddUnsizedFormat(&map, GL_SRGB_EXT, GL_RGB, RequireESOrExt<3, &Extensions::sRGB>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_SRGB_ALPHA_EXT, GL_RGBA, RequireESOrExt<3, &Extensions::sRGB>, RequireESOrExt<3, &Extensions::sRGB>, AlwaysSupported);
// | Internal format | Format | Supported | Renderable | Filterable |
AddUnsizedFormat(&map, GL_ALPHA, GL_ALPHA, RequireES<2, 0>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_LUMINANCE, GL_LUMINANCE, RequireES<2, 0>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, RequireES<2, 0>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RED, GL_RED, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RG, GL_RG, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_RGB, GL_RGB, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddUnsizedFormat(&map, GL_RGBA, GL_RGBA, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddUnsizedFormat(&map, GL_RED_INTEGER, GL_RED_INTEGER, RequireES<3, 0>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RG_INTEGER, GL_RG_INTEGER, RequireES<3, 0>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RGB_INTEGER, GL_RGB_INTEGER, RequireES<3, 0>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_RGBA_INTEGER, GL_RGBA_INTEGER, RequireES<3, 0>, NeverSupported, NeverSupported );
AddUnsizedFormat(&map, GL_BGRA_EXT, GL_BGRA_EXT, RequireExt<&Extensions::textureFormatBGRA8888>, RequireExt<&Extensions::textureFormatBGRA8888>, AlwaysSupported);
AddUnsizedFormat(&map, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported);
AddUnsizedFormat(&map, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported);
AddUnsizedFormat(&map, GL_SRGB_EXT, GL_RGB, RequireESOrExt<3, 0, &Extensions::sRGB>, NeverSupported, AlwaysSupported);
AddUnsizedFormat(&map, GL_SRGB_ALPHA_EXT, GL_RGBA, RequireESOrExt<3, 0, &Extensions::sRGB>, RequireESOrExt<3, 0, &Extensions::sRGB>, AlwaysSupported);
// Compressed formats, From ES 3.0.1 spec, table 3.16
// | Internal format | |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
map.insert(InternalFormatInfoPair(GL_COMPRESSED_R11_EAC, CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_R11_EAC, CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RG11_EAC, CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_RG11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_RG11_EAC, CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_SIGNED_RG11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_ETC2, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_ETC2, GL_UNSIGNED_BYTE, true, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, true, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA8_ETC2_EAC, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNSIGNED_BYTE, false, RequireES<3>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_BYTE, true, RequireES<3>, NeverSupported, AlwaysSupported)));
// | Internal format | |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
map.insert(InternalFormatInfoPair(GL_COMPRESSED_R11_EAC, CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_R11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_R11_EAC, CompressedFormat(4, 4, 64, 1, GL_COMPRESSED_SIGNED_R11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RG11_EAC, CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_RG11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SIGNED_RG11_EAC, CompressedFormat(4, 4, 128, 2, GL_COMPRESSED_SIGNED_RG11_EAC, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_ETC2, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_ETC2, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, CompressedFormat(4, 4, 64, 3, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_RGBA8_ETC2_EAC, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_UNSIGNED_BYTE, false, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, CompressedFormat(4, 4, 128, 4, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_UNSIGNED_BYTE, true, RequireES<3, 0>, NeverSupported, AlwaysSupported)));
// From GL_EXT_texture_compression_dxt1
// | Internal format | |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
......@@ -591,8 +600,8 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
// - Multisampled buffer are disallowed for non-normalized integer component types and we want to support it for STENCIL_INDEX8
// - All other stencil formats (all depth-stencil) are either float or normalized
// - It affects only validation of internalformat in RenderbufferStorageMultisample.
// | Internal format |D |S |X | Format | Type | Component type | Supported | Renderable | Filterable |
AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2>, RequireES<2>, NeverSupported);
// | Internal format |D |S |X | Format | Type | Component type | Supported | Renderable | Filterable |
AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, NeverSupported);
// From GL_ANGLE_lossy_etc_decode
map.insert(InternalFormatInfoPair(GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, CompressedFormat(4, 4, 64, 3, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, GL_UNSIGNED_BYTE, false, RequireExt<&Extensions::lossyETCDecode>, NeverSupported, AlwaysSupported)));
......
......@@ -15,6 +15,7 @@
#include "angle_gl.h"
#include "libANGLE/Caps.h"
#include "libANGLE/Error.h"
#include "libANGLE/Version.h"
#include "libANGLE/angletypes.h"
namespace gl
......@@ -111,7 +112,7 @@ struct InternalFormat
GLenum componentType;
GLenum colorEncoding;
typedef bool (*SupportCheckFunction)(GLuint, const Extensions &);
typedef bool (*SupportCheckFunction)(const Version &, const Extensions &);
SupportCheckFunction textureSupport;
SupportCheckFunction renderSupport;
SupportCheckFunction filterSupport;
......
......@@ -2882,7 +2882,7 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context,
return false;
}
if (!formatInfo.textureSupport(context->getClientMajorVersion(), context->getExtensions()))
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->handleError(Error(GL_INVALID_ENUM));
return false;
......
......@@ -3413,13 +3413,18 @@ bool ValidateCreateShader(Context *context, GLenum type)
case GL_VERTEX_SHADER:
case GL_FRAGMENT_SHADER:
break;
case GL_COMPUTE_SHADER:
if (context->getGLVersion().isES31())
if (context->getClientVersion() < Version(3, 1))
{
break;
context->handleError(
Error(GL_INVALID_ENUM, "GL_COMPUTE_SHADER requires OpenGL ES 3.1."));
return false;
}
break;
default:
context->handleError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM, "Unknown shader type."));
return false;
}
......
......@@ -31,7 +31,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
// error instead of a GL_INVALID_ENUM error. As this validation function is only called in
// the validation codepaths for glTexImage2D/3D, we record a GL_INVALID_VALUE error.
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
if (!formatInfo.textureSupport(context->getClientMajorVersion(), context->getExtensions()))
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->handleError(Error(GL_INVALID_VALUE));
return false;
......@@ -184,8 +184,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
return false;
}
if (!actualFormatInfo.textureSupport(context->getClientMajorVersion(),
context->getExtensions()))
if (!actualFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->handleError(Error(GL_INVALID_ENUM));
return false;
......@@ -865,7 +864,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
}
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
if (!formatInfo.textureSupport(context->getClientMajorVersion(), context->getExtensions()))
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->handleError(Error(GL_INVALID_ENUM));
return false;
......@@ -1922,7 +1921,7 @@ bool ValidateIndexedStateQuery(ValidationContext *context,
bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data)
{
if (!context->getGLVersion().isES3OrGreater())
if (context->getClientVersion() < ES_3_0)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false;
......@@ -1937,7 +1936,7 @@ bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
GLsizei *length,
GLint *data)
{
if (!context->getGLVersion().isES3OrGreater())
if (context->getClientVersion() < ES_3_0)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false;
......@@ -1963,7 +1962,7 @@ bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context,
bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data)
{
if (!context->getGLVersion().isES3OrGreater())
if (context->getClientVersion() < ES_3_0)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false;
......@@ -1978,7 +1977,7 @@ bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
GLsizei *length,
GLint64 *data)
{
if (!context->getGLVersion().isES3OrGreater())
if (context->getClientVersion() < ES_3_0)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false;
......
......@@ -19,7 +19,7 @@ namespace gl
bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data)
{
if (!context->getGLVersion().isES31())
if (context->getClientVersion() < ES_3_1)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1"));
return false;
......@@ -40,7 +40,7 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context,
GLsizei *length,
GLboolean *data)
{
if (!context->getGLVersion().isES31())
if (context->getClientVersion() < ES_3_1)
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1"));
return false;
......
......@@ -29,8 +29,7 @@ namespace
class MockValidationContext : public ValidationContext
{
public:
MockValidationContext(GLint majorClientVersion,
GLint minorClientVersion,
MockValidationContext(const Version &version,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
......@@ -42,8 +41,7 @@ class MockValidationContext : public ValidationContext
MOCK_METHOD1(handleError, void(const Error &));
};
MockValidationContext::MockValidationContext(GLint majorClientVersion,
GLint minorClientVersion,
MockValidationContext::MockValidationContext(const Version &version,
State *state,
const Caps &caps,
const TextureCapsMap &textureCaps,
......@@ -51,8 +49,7 @@ MockValidationContext::MockValidationContext(GLint majorClientVersion,
const ResourceManager *resourceManager,
const Limitations &limitations,
bool skipValidation)
: ValidationContext(majorClientVersion,
minorClientVersion,
: ValidationContext(version,
state,
caps,
textureCaps,
......@@ -87,7 +84,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
caps.maxElementIndex = 100;
caps.maxDrawBuffers = 1;
caps.maxColorAttachments = 1;
state.initialize(caps, extensions, 3, false, true);
state.initialize(caps, extensions, Version(3, 0), false, true);
NiceMock<MockTextureImpl> *textureImpl = new NiceMock<MockTextureImpl>();
EXPECT_CALL(mockFactory, createTexture(_)).WillOnce(Return(textureImpl));
......@@ -108,8 +105,8 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
state.setDrawFramebufferBinding(framebuffer);
state.setProgram(program);
NiceMock<MockValidationContext> testContext(3, 0, &state, caps, textureCaps, extensions,
nullptr, limitations, false);
NiceMock<MockValidationContext> testContext(Version(3, 0), &state, caps, textureCaps,
extensions, nullptr, limitations, false);
// Set the expectation for the validation error here.
Error expectedError(GL_INVALID_OPERATION, g_ExceedsMaxElementErrorMessage);
......
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