Add table entries for almost all the remaining GL texture formats.
BUG=angleproject:884
BUG=angleproject:967
Change-Id: I0b05841272f4410c33ee4e4c3654846f07b7c39b
Reviewed-on: https://chromium-review.googlesource.com/270275
Reviewed-by: Brandon Jones <bajones@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/renderer/gl/FunctionsGL.cpp b/src/libANGLE/renderer/gl/FunctionsGL.cpp
index a06274d..035dde6 100644
--- a/src/libANGLE/renderer/gl/FunctionsGL.cpp
+++ b/src/libANGLE/renderer/gl/FunctionsGL.cpp
@@ -1580,4 +1580,9 @@
}
}
+bool FunctionsGL::hasExtension(const std::string &ext) const
+{
+ return std::find(extensions.begin(), extensions.end(), ext) != extensions.end();
+}
+
}
diff --git a/src/libANGLE/renderer/gl/FunctionsGL.h b/src/libANGLE/renderer/gl/FunctionsGL.h
index 4a0d5e0..297d8b1 100644
--- a/src/libANGLE/renderer/gl/FunctionsGL.h
+++ b/src/libANGLE/renderer/gl/FunctionsGL.h
@@ -31,6 +31,7 @@
// Extensions
std::vector<std::string> extensions;
+ bool hasExtension(const std::string &ext) const;
// Entry Points
// 1.0
diff --git a/src/libANGLE/renderer/gl/formatutilsgl.cpp b/src/libANGLE/renderer/gl/formatutilsgl.cpp
index 299622e..e96de7c 100644
--- a/src/libANGLE/renderer/gl/formatutilsgl.cpp
+++ b/src/libANGLE/renderer/gl/formatutilsgl.cpp
@@ -11,55 +11,112 @@
#include <map>
+#include "common/string_utils.h"
+
namespace rx
{
namespace nativegl
{
-// Information about internal formats
-static bool AlwaysSupported(GLuint, GLuint, const std::vector<std::string> &)
+SupportRequirement::SupportRequirement()
+ : majorVersion(std::numeric_limits<GLuint>::max()),
+ minorVersion(std::numeric_limits<GLuint>::max()),
+ versionExtensions(),
+ requiredExtensions()
{
- return true;
}
-static bool UnimplementedSupport(GLuint, GLuint, const std::vector<std::string> &)
-{
- return false;
-}
-
-static bool NeverSupported(GLuint, GLuint, const std::vector<std::string> &)
-{
- return false;
-}
-
-template <GLuint minMajorVersion, GLuint minMinorVersion>
-static bool RequireGL(GLuint major, GLuint minor, const std::vector<std::string> &)
-{
- return major > minMajorVersion || (major == minMajorVersion && minor >= minMinorVersion);
-}
-
-
InternalFormat::InternalFormat()
- : textureSupport(NeverSupported),
- renderSupport(NeverSupported),
- filterSupport(NeverSupported)
+ : texture(),
+ filter(),
+ renderbuffer(),
+ framebufferAttachment()
{
}
-typedef std::pair<GLenum, InternalFormat> InternalFormatInfoPair;
-typedef std::map<GLenum, InternalFormat> InternalFormatInfoMap;
+static inline SupportRequirement VersionOrExts(GLuint major, GLuint minor, const std::string &versionExt)
+{
+ SupportRequirement requirement;
+ requirement.majorVersion = major;
+ requirement.minorVersion = minor;
+ angle::SplitStringAlongWhitespace(versionExt, &requirement.versionExtensions);
+ return requirement;
+}
+
+static inline SupportRequirement VersionAndExts(GLuint major, GLuint minor, const std::string &requiredExt)
+{
+ SupportRequirement requirement;
+ requirement.majorVersion = major;
+ requirement.minorVersion = minor;
+ angle::SplitStringAlongWhitespace(requiredExt, &requirement.requiredExtensions);
+ return requirement;
+}
+
+static inline SupportRequirement VersionOrExtsAndExts(GLuint major, GLuint minor, const std::string &versionExt,
+ const std::string &requiredExt)
+{ SupportRequirement requirement;
+ requirement.majorVersion = major;
+ requirement.minorVersion = minor;
+ angle::SplitStringAlongWhitespace(versionExt, &requirement.versionExtensions);
+ angle::SplitStringAlongWhitespace(requiredExt, &requirement.requiredExtensions);
+ return requirement;
+}
+
+static inline SupportRequirement VersionOnly(GLuint major, GLuint minor)
+{
+ SupportRequirement requirement;
+ requirement.majorVersion = major;
+ requirement.minorVersion = minor;
+ return requirement;
+}
+
+static inline SupportRequirement ExtsOnly(const std::string &ext)
+{
+ SupportRequirement requirement;
+ angle::SplitStringAlongWhitespace(ext, &requirement.requiredExtensions);
+ return requirement;
+}
+
+static inline SupportRequirement Always()
+{
+ SupportRequirement requirement;
+ requirement.majorVersion = 0;
+ requirement.minorVersion = 0;
+ return requirement;
+}
+
+static inline SupportRequirement Never()
+{
+ SupportRequirement requirement;
+ requirement.majorVersion = std::numeric_limits<GLuint>::max();
+ requirement.minorVersion = std::numeric_limits<GLuint>::max();
+ return requirement;
+}
+
+struct InternalFormatInfo
+{
+ InternalFormat glesInfo;
+ InternalFormat glInfo;
+};
+
+typedef std::pair<GLenum, InternalFormatInfo> InternalFormatInfoPair;
+typedef std::map<GLenum, InternalFormatInfo> InternalFormatInfoMap;
// A helper function to insert data into the format map with fewer characters.
static inline void InsertFormatMapping(InternalFormatInfoMap *map, GLenum internalFormat,
- InternalFormat::SupportCheckFunction textureSupport,
- InternalFormat::SupportCheckFunction renderSupport,
- InternalFormat::SupportCheckFunction filterSupport)
+ const SupportRequirement &desktopTexture, const SupportRequirement &desktopFilter, const SupportRequirement &desktopRender,
+ const SupportRequirement &esTexture, const SupportRequirement &esFilter, const SupportRequirement &esRender)
{
- InternalFormat formatInfo;
- formatInfo.textureSupport = textureSupport;
- formatInfo.renderSupport = renderSupport;
- formatInfo.filterSupport = filterSupport;
+ InternalFormatInfo formatInfo;
+ formatInfo.glInfo.texture = desktopTexture;
+ formatInfo.glInfo.filter = desktopFilter;
+ formatInfo.glInfo.renderbuffer = desktopRender;
+ formatInfo.glInfo.framebufferAttachment = desktopRender;
+ formatInfo.glesInfo.texture = esTexture;
+ formatInfo.glesInfo.filter = esTexture;
+ formatInfo.glesInfo.renderbuffer = esFilter;
+ formatInfo.glesInfo.framebufferAttachment = esRender;
map->insert(std::make_pair(internalFormat, formatInfo));
}
@@ -67,129 +124,105 @@
{
InternalFormatInfoMap map;
- // From ES 3.0.1 spec, table 3.12
- InsertFormatMapping(&map, GL_NONE, NeverSupported, NeverSupported, NeverSupported);
-
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_R8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB8, AlwaysSupported, AlwaysSupported, AlwaysSupported );
- InsertFormatMapping(&map, GL_RGB8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB565, AlwaysSupported, AlwaysSupported, AlwaysSupported );
- InsertFormatMapping(&map, GL_RGBA4, AlwaysSupported, AlwaysSupported, AlwaysSupported );
- InsertFormatMapping(&map, GL_RGB5_A1, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA8, AlwaysSupported, AlwaysSupported, AlwaysSupported );
- InsertFormatMapping(&map, GL_RGBA8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB10_A2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB10_A2UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_SRGB8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_SRGB8_ALPHA8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R11F_G11F_B10F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB9_E5, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
-
- InsertFormatMapping(&map, GL_BGRA8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
-
- // Floating point formats
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_R16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_R32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
-
- // Depth stencil formats
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_DEPTH_COMPONENT16, AlwaysSupported, AlwaysSupported, NeverSupported );
- InsertFormatMapping(&map, GL_DEPTH_COMPONENT24, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH_COMPONENT32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH_COMPONENT32_OES, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH24_STENCIL8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH32F_STENCIL8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_STENCIL_INDEX8, AlwaysSupported, AlwaysSupported, NeverSupported );
-
- // Luminance alpha formats
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_ALPHA8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_ALPHA32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_ALPHA16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
-
- // Unsized formats
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_ALPHA, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RED, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RED_INTEGER, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RG_INTEGER, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGB_INTEGER, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_RGBA_INTEGER, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_BGRA_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH_COMPONENT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_DEPTH_STENCIL, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_SRGB_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_SRGB_ALPHA_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
-
- // Compressed formats, From ES 3.0.1 spec, table 3.16
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+ // | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support |
+ InsertFormatMapping(&map, GL_R8, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Always(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOrExts(3, 0, "GL_EXT_texture_rg"), Always(), VersionOrExts(3, 0, "GL_EXT_texture_rg") );
+ InsertFormatMapping(&map, GL_R8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() );
+ InsertFormatMapping(&map, GL_RG8, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Always(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOrExts(3, 0, "GL_EXT_texture_rg"), Always(), VersionOrExts(3, 0, "GL_ARB_texture_rg") );
+ InsertFormatMapping(&map, GL_RG8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() );
+ InsertFormatMapping(&map, GL_RGB8, Always(), Always(), Always(), VersionOrExts(3, 0, "GL_OES_rgb8_rgba8"), Always(), Always() );
+ InsertFormatMapping(&map, GL_RG8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() );
+ InsertFormatMapping(&map, GL_RGB565, Always(), Always(), Always(), Always(), Always(), Always() );
+ InsertFormatMapping(&map, GL_RGBA4, Always(), Always(), Always(), Always(), Always(), Always() );
+ InsertFormatMapping(&map, GL_RGB5_A1, Always(), Always(), Always(), Always(), Always(), Always() );
+ InsertFormatMapping(&map, GL_RGBA8, Always(), Always(), Always(), VersionOrExts(3, 0, "GL_OES_rgb8_rgba8"), Always(), VersionOrExts(3, 0, "GL_OES_rgb8_rgba8") );
+ InsertFormatMapping(&map, GL_RGBA8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() );
+ InsertFormatMapping(&map, GL_RGB10_A2, Always(), Always(), Always(), VersionOnly(3, 0), Always(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGB10_A2UI, VersionOrExts(3, 3, "GL_ARB_texture_rgb10_a2ui"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_SRGB8, VersionOrExts(2, 1, "GL_EXT_texture_sRGB"), Always(), VersionOrExts(2, 1, "GL_EXT_texture_sRGB"), VersionOrExts(3, 0, "GL_EXT_texture_sRGB"), Always(), VersionOrExts(3, 0, "GL_EXT_texture_sRGB"));
+ InsertFormatMapping(&map, GL_SRGB8_ALPHA8, VersionOrExts(2, 1, "GL_EXT_texture_sRGB"), Always(), VersionOrExts(2, 1, "GL_EXT_texture_sRGB"), VersionOrExts(3, 0, "GL_EXT_texture_sRGB"), Always(), VersionOrExts(3, 0, "GL_EXT_texture_sRGB"));
+ InsertFormatMapping(&map, GL_R8I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_R8UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_R16I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_R16UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_R32I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_R32UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG8I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG8UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG16I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG16UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG32I, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RG32UI, VersionOrExts(3, 0, "GL_ARB_texture_rg"), Never(), VersionOrExts(3, 0, "GL_ARB_texture_rg"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGB8I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGB8UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGB16I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGB16UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGB32I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGB32UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() );
+ InsertFormatMapping(&map, GL_RGBA8I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGBA8UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGBA16I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGBA16UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGBA32I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_RGBA32UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), VersionOrExts(3, 0, "GL_EXT_texture_integer"), VersionOnly(3, 0), Never(), VersionOnly(3, 0) );
// From GL_EXT_texture_compression_dxt1
- // | Internal format | Texture support | Render support | Filter support |
- InsertFormatMapping(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
- InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+ InsertFormatMapping(&map, GL_BGRA8_EXT, Never(), Never(), Never(), ExtsOnly("GL_EXT_texture_format_BGRA8888"), Always(), ExtsOnly("GL_EXT_texture_format_BGRA8888"));
+
+ // Floating point formats
+ // | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support |
+ InsertFormatMapping(&map, GL_R11F_G11F_B10F, VersionOrExts(3, 0, "GL_EXT_packed_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_EXT_packed_float", "GL_ARB_color_buffer_float"), VersionOnly(3, 0), Always(), VersionAndExts(3, 0, "GL_EXT_color_buffer_float") );
+ InsertFormatMapping(&map, GL_RGB9_E5, VersionOrExts(3, 0, "GL_EXT_texture_shared_exponent"), Always(), VersionOrExtsAndExts(3, 0, "GL_EXT_texture_shared_exponent", "GL_ARB_color_buffer_float"), VersionOnly(3, 0), Always(), VersionAndExts(3, 0, "GL_EXT_color_buffer_float") );
+ InsertFormatMapping(&map, GL_R16F, VersionOrExts(3, 0, "GL_ARB_texture_rg ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float GL_EXT_texture_rg"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_half_float GL_EXT_texture_rg"));
+ InsertFormatMapping(&map, GL_RG16F, VersionOrExts(3, 0, "GL_ARB_texture_rg ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float GL_EXT_texture_rg"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_half_float GL_EXT_texture_rg"));
+ InsertFormatMapping(&map, GL_RGB16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_half_float") );
+ InsertFormatMapping(&map, GL_RGBA16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_half_float") );
+ InsertFormatMapping(&map, GL_R32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float GL_EXT_texture_rg"), VersionOrExts(3, 0, "GL_OES_texture_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_float GL_EXT_texture_rg") );
+ InsertFormatMapping(&map, GL_RG32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float GL_EXT_texture_rg"), VersionOrExts(3, 0, "GL_OES_texture_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_float GL_EXT_texture_rg") );
+ InsertFormatMapping(&map, GL_RGB32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float"), VersionOrExts(3, 0, "GL_OES_texture_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_float") );
+ InsertFormatMapping(&map, GL_RGBA32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), Always(), VersionOrExtsAndExts(3, 0, "GL_ARB_texture_float", "GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float"), VersionOrExts(3, 0, "GL_OES_texture_float_linear"), VersionOrExts(3, 0, "GL_OES_texture_float") );
+
+ // Depth stencil formats
+ // | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support |
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT16, VersionOnly(1, 5), VersionOrExts(1, 5, "GL_ARB_depth_texture"), VersionOnly(1, 5), VersionOnly(2, 0), VersionOrExts(3, 0, "GL_OES_depth_texture"), VersionOnly(2, 0) );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT24, VersionOnly(1, 5), VersionOrExts(1, 5, "GL_ARB_depth_texture"), VersionOnly(1, 5), VersionOnly(2, 0), VersionOrExts(3, 0, "GL_OES_depth_texture"), VersionOnly(2, 0) );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT32_OES, VersionOnly(1, 5), VersionOrExts(1, 5, "GL_ARB_depth_texture"), VersionOnly(1, 5), ExtsOnly("GL_OES_depth_texture"), Always(), ExtsOnly("GL_OES_depth_texture") );
+ InsertFormatMapping(&map, GL_DEPTH_COMPONENT32F, VersionOrExts(3, 0, "GL_ARB_depth_buffer_float"), Always(), VersionOrExts(3, 0, "GL_ARB_depth_buffer_float"), VersionOnly(3, 0), VersionOrExts(3, 0, "GL_OES_depth_texture"), VersionOnly(3, 0) );
+ InsertFormatMapping(&map, GL_DEPTH24_STENCIL8, VersionOrExts(3, 0, "GL_ARB_framebuffer_object"), VersionOrExts(3, 0, "GL_ARB_depth_texture"), VersionOrExts(3, 0, "GL_ARB_framebuffer_object"), VersionOrExts(3, 0, "GL_OES_depth_texture"), Always(), VersionOrExts(3, 0, "GL_OES_depth_texture GL_OES_packed_depth_stencil"));
+ InsertFormatMapping(&map, GL_DEPTH32F_STENCIL8, VersionOrExts(3, 0, "GL_ARB_depth_buffer_float"), Always(), VersionOrExts(3, 0, "GL_ARB_depth_buffer_float"), VersionOnly(3, 0), Always(), VersionOnly(3, 0) );
+
+ // Luminance alpha formats (TODO)
+ InsertFormatMapping(&map, GL_ALPHA8_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE8_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_ALPHA32F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_ALPHA16F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, Never(), Never(), Never(), Never(), Never(), Never());
+
+ // Compressed formats, From ES 3.0.1 spec, table 3.16
+ InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, Never(), Never(), Never(), Never(), Never(), Never());
+
+ // From GL_EXT_texture_compression_dxt1
+ // | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render |
+ InsertFormatMapping(&map, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_EXT_texture_compression_dxt1"), Always(), Never());
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_EXT_texture_compression_dxt1"), Always(), Never());
// From GL_ANGLE_texture_compression_dxt3
- InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_ANGLE_texture_compression_dxt3"), Always(), Never());
// From GL_ANGLE_texture_compression_dxt5
- InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
+ InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_ANGLE_texture_compression_dxt5"), Always(), Never());
return map;
}
@@ -200,13 +233,14 @@
return formatMap;
}
-const InternalFormat &GetInternalFormatInfo(GLenum internalFormat)
+const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, bool es)
{
const InternalFormatInfoMap &formatMap = GetInternalFormatMap();
InternalFormatInfoMap::const_iterator iter = formatMap.find(internalFormat);
if (iter != formatMap.end())
{
- return iter->second;
+ const InternalFormatInfo &info = iter->second;
+ return es ? info.glesInfo : info.glInfo;
}
else
{
diff --git a/src/libANGLE/renderer/gl/formatutilsgl.h b/src/libANGLE/renderer/gl/formatutilsgl.h
index 8e45673..51f1976 100644
--- a/src/libANGLE/renderer/gl/formatutilsgl.h
+++ b/src/libANGLE/renderer/gl/formatutilsgl.h
@@ -21,17 +21,31 @@
namespace nativegl
{
+struct SupportRequirement
+{
+ SupportRequirement();
+
+ // Version that this format became supported without extensions
+ GLuint majorVersion;
+ GLuint minorVersion;
+
+ // Extensions that are required if the minimum version is not met
+ std::vector<std::string> versionExtensions;
+
+ // Extensions that are always required to support this format
+ std::vector<std::string> requiredExtensions;
+};
+
struct InternalFormat
{
InternalFormat();
- typedef bool(*SupportCheckFunction)(GLuint majorVersion, GLuint minorVersion,
- const std::vector<std::string> &extensions);
- SupportCheckFunction textureSupport;
- SupportCheckFunction renderSupport;
- SupportCheckFunction filterSupport;
+ SupportRequirement texture;
+ SupportRequirement filter;
+ SupportRequirement renderbuffer;
+ SupportRequirement framebufferAttachment;
};
-const InternalFormat &GetInternalFormatInfo(GLenum internalFormat);
+const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, bool es);
}
diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp
index 7f635e2..7293b42 100644
--- a/src/libANGLE/renderer/gl/renderergl_utils.cpp
+++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp
@@ -25,14 +25,46 @@
namespace nativegl_gl
{
+static bool MeetsRequirements(const FunctionsGL *functions, const nativegl::SupportRequirement &requirements)
+{
+ for (const std::string &extension : requirements.requiredExtensions)
+ {
+ if (!functions->hasExtension(extension))
+ {
+ return false;
+ }
+ }
+
+ if (functions->majorVersion > requirements.majorVersion ||
+ (functions->majorVersion == requirements.majorVersion && functions->minorVersion >= requirements.minorVersion))
+ {
+ return true;
+ }
+ else if (!requirements.versionExtensions.empty())
+ {
+ for (const std::string &extension : requirements.versionExtensions)
+ {
+ if (!functions->hasExtension(extension))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, GLenum internalFormat)
{
gl::TextureCaps textureCaps;
- const nativegl::InternalFormat &formatInfo = nativegl::GetInternalFormatInfo(internalFormat);
- textureCaps.texturable = formatInfo.textureSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
- textureCaps.renderable = formatInfo.renderSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
- textureCaps.filterable = formatInfo.filterSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
+ const nativegl::InternalFormat &formatInfo = nativegl::GetInternalFormatInfo(internalFormat, functions->openGLES);
+ textureCaps.texturable = MeetsRequirements(functions, formatInfo.texture);
+ textureCaps.filterable = textureCaps.texturable && MeetsRequirements(functions, formatInfo.filter);
+ textureCaps.renderable = MeetsRequirements(functions, formatInfo.framebufferAttachment);
// glGetInternalformativ is not available until version 4.2 but may be available through the 3.0
// extension GL_ARB_internalformat_query
diff --git a/src/tests/gl_tests/BlendMinMaxTest.cpp b/src/tests/gl_tests/BlendMinMaxTest.cpp
index 260f45a..79d9113 100644
--- a/src/tests/gl_tests/BlendMinMaxTest.cpp
+++ b/src/tests/gl_tests/BlendMinMaxTest.cpp
@@ -36,7 +36,7 @@
return blendMin ? std::min<GLubyte>(curAsUbyte, prevColor) : std::max<GLubyte>(curAsUbyte, prevColor);
}
- void runTest()
+ void runTest(GLenum colorFormat)
{
if (getClientVersion() < 3 && !extensionEnabled("GL_EXT_blend_minmax"))
{
@@ -44,6 +44,8 @@
return;
}
+ SetUpFramebuffer(colorFormat);
+
const size_t colorCount = 1024;
Color colors[colorCount];
for (size_t i = 0; i < colorCount; i++)
@@ -152,8 +154,7 @@
TEST_P(BlendMinMaxTest, RGBA8)
{
- SetUpFramebuffer(GL_RGBA8);
- runTest();
+ runTest(GL_RGBA8);
}
TEST_P(BlendMinMaxTest, RGBA32f)
@@ -164,8 +165,7 @@
return;
}
- SetUpFramebuffer(GL_RGBA32F);
- runTest();
+ runTest(GL_RGBA32F);
}
TEST_P(BlendMinMaxTest, RGBA16F)
@@ -176,8 +176,7 @@
return;
}
- SetUpFramebuffer(GL_RGBA16F);
- runTest();
+ runTest(GL_RGBA16F);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
diff --git a/src/tests/gl_tests/CubeMapTextureTest.cpp b/src/tests/gl_tests/CubeMapTextureTest.cpp
index f6e90ad..aec09a9 100644
--- a/src/tests/gl_tests/CubeMapTextureTest.cpp
+++ b/src/tests/gl_tests/CubeMapTextureTest.cpp
@@ -129,4 +129,4 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(CubeMapTextureTest, ES2_D3D11(), ES2_D3D11_FL9_3());
+ANGLE_INSTANTIATE_TEST(CubeMapTextureTest, ES2_D3D11(), ES2_D3D11_FL9_3(), ES2_OPENGL(), ES3_OPENGL());
diff --git a/src/tests/gl_tests/DepthStencilFormatsTest.cpp b/src/tests/gl_tests/DepthStencilFormatsTest.cpp
index 2dd61b3..3e44ae1 100644
--- a/src/tests/gl_tests/DepthStencilFormatsTest.cpp
+++ b/src/tests/gl_tests/DepthStencilFormatsTest.cpp
@@ -174,9 +174,15 @@
ASSERT_GL_NO_ERROR();
- EXPECT_PIXEL_NEAR(0, 0, 255, 0, 0, 255, 2.0);
+ GLubyte pixel[4];
+ glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
+
+ // Only require the red and alpha channels have the correct values, the depth texture extensions
+ // leave the green and blue channels undefined
+ ASSERT_NEAR(255, pixel[0], 2.0);
+ ASSERT_EQ(255, pixel[3]);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTest, ES2_D3D9(), ES2_D3D11());
-ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTestES3, ES3_D3D11());
+ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTest, ES2_D3D9(), ES2_D3D11(), ES2_OPENGL());
+ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTestES3, ES3_D3D11(), ES3_OPENGL());
diff --git a/src/tests/gl_tests/FramebufferFormatsTest.cpp b/src/tests/gl_tests/FramebufferFormatsTest.cpp
index 1045de0..495e960 100644
--- a/src/tests/gl_tests/FramebufferFormatsTest.cpp
+++ b/src/tests/gl_tests/FramebufferFormatsTest.cpp
@@ -142,16 +142,34 @@
TEST_P(FramebufferFormatsTest, RGB8)
{
+ if (getClientVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8"))
+ {
+ std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl;
+ return;
+ }
+
testTextureFormat(GL_RGB8_OES, 8, 8, 8, 0);
}
TEST_P(FramebufferFormatsTest, BGRA8)
{
+ if (!extensionEnabled("GL_EXT_texture_format_BGRA8888"))
+ {
+ std::cout << "Test skipped due to missing GL_EXT_texture_format_BGRA8888." << std::endl;
+ return;
+ }
+
testTextureFormat(GL_BGRA8_EXT, 8, 8, 8, 8);
}
TEST_P(FramebufferFormatsTest, RGBA8)
{
+ if (getClientVersion() < 3 && !extensionEnabled("GL_OES_rgb8_rgba8"))
+ {
+ std::cout << "Test skipped due to missing ES3 or GL_OES_rgb8_rgba8." << std::endl;
+ return;
+ }
+
testTextureFormat(GL_RGBA8_OES, 8, 8, 8, 8);
}
@@ -167,6 +185,12 @@
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F)
{
+ if (getClientVersion() < 3)
+ {
+ std::cout << "Test skipped due to missing ES3." << std::endl;
+ return;
+ }
+
testRenderbufferMultisampleFormat(3, GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT32F);
}
@@ -177,13 +201,26 @@
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F_STENCIL8)
{
+ if (getClientVersion() < 3)
+ {
+ std::cout << "Test skipped due to missing ES3." << std::endl;
+ return;
+ }
+
testRenderbufferMultisampleFormat(3, GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH32F_STENCIL8);
}
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_STENCIL_INDEX8)
{
+ // TODO(geofflang): Figure out how to support GLSTENCIL_INDEX8 on desktop GL
+ if (GetParam().mEGLPlatformParameters.renderer == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE)
+ {
+ std::cout << "Test skipped on Desktop OpenGL." << std::endl;
+ return;
+ }
+
testRenderbufferMultisampleFormat(2, GL_STENCIL_ATTACHMENT, GL_STENCIL_INDEX8);
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(FramebufferFormatsTest, ES2_D3D9(), ES2_D3D11(), ES3_D3D11());
+ANGLE_INSTANTIATE_TEST(FramebufferFormatsTest, ES2_D3D9(), ES2_D3D11(), ES3_D3D11(), ES2_OPENGL(), ES3_OPENGL());
diff --git a/src/tests/gl_tests/IncompleteTextureTest.cpp b/src/tests/gl_tests/IncompleteTextureTest.cpp
index 50df9a0..24025cf 100644
--- a/src/tests/gl_tests/IncompleteTextureTest.cpp
+++ b/src/tests/gl_tests/IncompleteTextureTest.cpp
@@ -163,4 +163,4 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(IncompleteTextureTest, ES2_D3D9(), ES2_D3D11());
+ANGLE_INSTANTIATE_TEST(IncompleteTextureTest, ES2_D3D9(), ES2_D3D11(), ES2_OPENGL());
diff --git a/src/tests/gl_tests/IndexedPointsTest.cpp b/src/tests/gl_tests/IndexedPointsTest.cpp
index c02a033..e7f82e7 100644
--- a/src/tests/gl_tests/IndexedPointsTest.cpp
+++ b/src/tests/gl_tests/IndexedPointsTest.cpp
@@ -216,6 +216,6 @@
runTest(3);
}
-ANGLE_INSTANTIATE_TEST(IndexedPointsTestUByte, ES2_D3D11());
-ANGLE_INSTANTIATE_TEST(IndexedPointsTestUShort, ES2_D3D11());
-ANGLE_INSTANTIATE_TEST(IndexedPointsTestUInt, ES2_D3D11());
+ANGLE_INSTANTIATE_TEST(IndexedPointsTestUByte, ES2_D3D11(), ES2_OPENGL());
+ANGLE_INSTANTIATE_TEST(IndexedPointsTestUShort, ES2_D3D11(), ES2_OPENGL());
+ANGLE_INSTANTIATE_TEST(IndexedPointsTestUInt, ES2_D3D11(), ES2_OPENGL());
diff --git a/src/tests/gl_tests/LineLoopTest.cpp b/src/tests/gl_tests/LineLoopTest.cpp
index 85be69d..305155b 100644
--- a/src/tests/gl_tests/LineLoopTest.cpp
+++ b/src/tests/gl_tests/LineLoopTest.cpp
@@ -28,20 +28,16 @@
const std::string vsSource = SHADER_SOURCE
(
attribute highp vec4 position;
- attribute highp vec4 in_color;
-
- varying highp vec4 color;
void main(void)
{
gl_Position = position;
- color = in_color;
}
);
const std::string fsSource = SHADER_SOURCE
(
- varying highp vec4 color;
+ uniform highp vec4 color;
void main(void)
{
gl_FragColor = color;
@@ -55,7 +51,7 @@
}
mPositionLocation = glGetAttribLocation(mProgram, "position");
- mColorLocation = glGetAttribLocation(mProgram, "in_color");
+ mColorLocation = glGetUniformLocation(mProgram, "in_color");
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND);
@@ -205,4 +201,4 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(LineLoopTest, ES2_D3D9(), ES2_D3D11());
+ANGLE_INSTANTIATE_TEST(LineLoopTest, ES2_D3D9(), ES2_D3D11(), ES2_OPENGL());
diff --git a/src/tests/gl_tests/SwizzleTest.cpp b/src/tests/gl_tests/SwizzleTest.cpp
index 06e2a05..92cafd9 100644
--- a/src/tests/gl_tests/SwizzleTest.cpp
+++ b/src/tests/gl_tests/SwizzleTest.cpp
@@ -274,6 +274,7 @@
{
if (!extensionEnabled("GL_EXT_texture_compression_dxt1"))
{
+ std::cout << "Test skipped due to missing GL_EXT_texture_compression_dxt1." << std::endl;
return;
}
@@ -282,6 +283,6 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11());
+ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11(), ES3_OPENGL());
} // namespace
diff --git a/src/tests/gl_tests/TextureTest.cpp b/src/tests/gl_tests/TextureTest.cpp
index 66403b6..0742377 100644
--- a/src/tests/gl_tests/TextureTest.cpp
+++ b/src/tests/gl_tests/TextureTest.cpp
@@ -610,6 +610,6 @@
}
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
-ANGLE_INSTANTIATE_TEST(TextureTest, ES2_D3D9(), ES2_D3D11(), ES2_D3D11_FL9_3());
+ANGLE_INSTANTIATE_TEST(TextureTest, ES2_D3D9(), ES2_D3D11(), ES2_D3D11_FL9_3(), ES2_OPENGL());
} // namespace