Commit 859dcb88 by Geoff Lang

Revert "Add table entries for almost all the remaining GL texture formats."

Missing include of <limits> for linux. This reverts commit aa3a5fad. Change-Id: Iafebfbc6154b4fe3a94e3f8b91b5ff496631c1f1 Reviewed-on: https://chromium-review.googlesource.com/273134Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent db39e7f5
...@@ -1580,9 +1580,4 @@ void FunctionsGL::initialize() ...@@ -1580,9 +1580,4 @@ void FunctionsGL::initialize()
} }
} }
bool FunctionsGL::hasExtension(const std::string &ext) const
{
return std::find(extensions.begin(), extensions.end(), ext) != extensions.end();
}
} }
...@@ -31,7 +31,6 @@ class FunctionsGL ...@@ -31,7 +31,6 @@ class FunctionsGL
// Extensions // Extensions
std::vector<std::string> extensions; std::vector<std::string> extensions;
bool hasExtension(const std::string &ext) const;
// Entry Points // Entry Points
// 1.0 // 1.0
......
...@@ -11,112 +11,55 @@ ...@@ -11,112 +11,55 @@
#include <map> #include <map>
#include "common/string_utils.h"
namespace rx namespace rx
{ {
namespace nativegl namespace nativegl
{ {
SupportRequirement::SupportRequirement() // Information about internal formats
: majorVersion(std::numeric_limits<GLuint>::max()), static bool AlwaysSupported(GLuint, GLuint, const std::vector<std::string> &)
minorVersion(std::numeric_limits<GLuint>::max()),
versionExtensions(),
requiredExtensions()
{ {
return true;
} }
InternalFormat::InternalFormat() static bool UnimplementedSupport(GLuint, GLuint, const std::vector<std::string> &)
: texture(),
filter(),
renderbuffer(),
framebufferAttachment()
{ {
return false;
} }
static inline SupportRequirement VersionOrExts(GLuint major, GLuint minor, const std::string &versionExt) static bool NeverSupported(GLuint, GLuint, const std::vector<std::string> &)
{ {
SupportRequirement requirement; return false;
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) template <GLuint minMajorVersion, GLuint minMinorVersion>
static bool RequireGL(GLuint major, GLuint minor, const std::vector<std::string> &)
{ {
SupportRequirement requirement; return major > minMajorVersion || (major == minMajorVersion && minor >= minMinorVersion);
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() InternalFormat::InternalFormat()
{ : textureSupport(NeverSupported),
SupportRequirement requirement; renderSupport(NeverSupported),
requirement.majorVersion = 0; filterSupport(NeverSupported)
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 typedef std::pair<GLenum, InternalFormat> InternalFormatInfoPair;
{ typedef std::map<GLenum, InternalFormat> InternalFormatInfoMap;
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. // A helper function to insert data into the format map with fewer characters.
static inline void InsertFormatMapping(InternalFormatInfoMap *map, GLenum internalFormat, static inline void InsertFormatMapping(InternalFormatInfoMap *map, GLenum internalFormat,
const SupportRequirement &desktopTexture, const SupportRequirement &desktopFilter, const SupportRequirement &desktopRender, InternalFormat::SupportCheckFunction textureSupport,
const SupportRequirement &esTexture, const SupportRequirement &esFilter, const SupportRequirement &esRender) InternalFormat::SupportCheckFunction renderSupport,
InternalFormat::SupportCheckFunction filterSupport)
{ {
InternalFormatInfo formatInfo; InternalFormat formatInfo;
formatInfo.glInfo.texture = desktopTexture; formatInfo.textureSupport = textureSupport;
formatInfo.glInfo.filter = desktopFilter; formatInfo.renderSupport = renderSupport;
formatInfo.glInfo.renderbuffer = desktopRender; formatInfo.filterSupport = filterSupport;
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)); map->insert(std::make_pair(internalFormat, formatInfo));
} }
...@@ -124,105 +67,129 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -124,105 +67,129 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
{ {
InternalFormatInfoMap map; InternalFormatInfoMap map;
// | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support | // From ES 3.0.1 spec, table 3.12
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_NONE, NeverSupported, NeverSupported, NeverSupported);
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") ); // | Internal format | Texture support | Render support | Filter support |
InsertFormatMapping(&map, GL_RG8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() ); InsertFormatMapping(&map, GL_R8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB8, Always(), Always(), Always(), VersionOrExts(3, 0, "GL_OES_rgb8_rgba8"), Always(), Always() ); InsertFormatMapping(&map, GL_R8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RG8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() ); InsertFormatMapping(&map, GL_RG8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB565, Always(), Always(), Always(), Always(), Always(), Always() ); InsertFormatMapping(&map, GL_RG8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGBA4, Always(), Always(), Always(), Always(), Always(), Always() ); InsertFormatMapping(&map, GL_RGB8, AlwaysSupported, AlwaysSupported, AlwaysSupported );
InsertFormatMapping(&map, GL_RGB5_A1, Always(), Always(), Always(), Always(), Always(), Always() ); InsertFormatMapping(&map, GL_RGB8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB565, AlwaysSupported, AlwaysSupported, AlwaysSupported );
InsertFormatMapping(&map, GL_RGBA8_SNORM, VersionOnly(3, 1), Always(), Never(), VersionOnly(3, 0), Always(), Never() ); InsertFormatMapping(&map, GL_RGBA4, AlwaysSupported, AlwaysSupported, AlwaysSupported );
InsertFormatMapping(&map, GL_RGB10_A2, Always(), Always(), Always(), VersionOnly(3, 0), Always(), VersionOnly(3, 0) ); InsertFormatMapping(&map, GL_RGB5_A1, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB10_A2UI, VersionOrExts(3, 3, "GL_ARB_texture_rgb10_a2ui"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RGBA8, AlwaysSupported, AlwaysSupported, AlwaysSupported );
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_RGBA8_SNORM, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB10_A2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB10_A2UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_SRGB8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_SRGB8_ALPHA8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R11F_G11F_B10F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB9_E5, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RG8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB8I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RG8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB8UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RG16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB16I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RG16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB16UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RG32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB32I, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RG32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGB32UI, VersionOrExts(3, 0, "GL_EXT_texture_integer"), Never(), Never(), VersionOnly(3, 0), Never(), Never() ); InsertFormatMapping(&map, GL_RGB8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB16UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB32I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB32UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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) ); InsertFormatMapping(&map, GL_RGBA8I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_RGBA8UI, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
// From GL_EXT_texture_compression_dxt1 InsertFormatMapping(&map, GL_RGBA16I, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_BGRA8_EXT, Never(), Never(), Never(), ExtsOnly("GL_EXT_texture_format_BGRA8888"), Always(), ExtsOnly("GL_EXT_texture_format_BGRA8888")); 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 // Floating point formats
// | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support | // | Internal format | Texture support | Render support | Filter 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_R16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RG16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGBA16F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_R32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RG32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGB32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_RGBA32F, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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 // Depth stencil formats
// | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support | // | Internal format | Texture support | Render support | Filter 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_COMPONENT16, AlwaysSupported, AlwaysSupported, NeverSupported );
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_COMPONENT24, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_DEPTH_COMPONENT32_OES, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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_DEPTH24_STENCIL8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
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) ); InsertFormatMapping(&map, GL_DEPTH32F_STENCIL8, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_STENCIL_INDEX8, AlwaysSupported, AlwaysSupported, NeverSupported );
// Luminance alpha formats (TODO)
InsertFormatMapping(&map, GL_ALPHA8_EXT, Never(), Never(), Never(), Never(), Never(), Never()); // Luminance alpha formats
InsertFormatMapping(&map, GL_LUMINANCE8_EXT, Never(), Never(), Never(), Never(), Never(), Never()); // | Internal format | Texture support | Render support | Filter support |
InsertFormatMapping(&map, GL_ALPHA32F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_ALPHA8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_LUMINANCE8_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_ALPHA16F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_ALPHA32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_ALPHA16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, Never(), Never(), Never(), Never(), Never(), Never()); 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 // Compressed formats, From ES 3.0.1 spec, table 3.16
InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, Never(), Never(), Never(), Never(), Never(), Never()); // | Internal format | Texture support | Render support | Filter support |
InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_R11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RG11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_SIGNED_RG11_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RGB8_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, Never(), Never(), Never(), Never(), Never(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RGBA8_ETC2_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
// From GL_EXT_texture_compression_dxt1 // From GL_EXT_texture_compression_dxt1
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render | // | Internal format | Texture support | Render support | Filter support |
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_RGB_S3TC_DXT1_EXT, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
InsertFormatMapping(&map, GL_COMPRESSED_RGBA_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, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
// From GL_ANGLE_texture_compression_dxt3 // From GL_ANGLE_texture_compression_dxt3
InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_ANGLE_texture_compression_dxt3"), Always(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
// From GL_ANGLE_texture_compression_dxt5 // From GL_ANGLE_texture_compression_dxt5
InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, ExtsOnly("GL_EXT_texture_compression_s3tc"), Always(), Never(), ExtsOnly("GL_ANGLE_texture_compression_dxt5"), Always(), Never()); InsertFormatMapping(&map, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, UnimplementedSupport, UnimplementedSupport, UnimplementedSupport);
return map; return map;
} }
...@@ -233,14 +200,13 @@ static const InternalFormatInfoMap &GetInternalFormatMap() ...@@ -233,14 +200,13 @@ static const InternalFormatInfoMap &GetInternalFormatMap()
return formatMap; return formatMap;
} }
const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, bool es) const InternalFormat &GetInternalFormatInfo(GLenum internalFormat)
{ {
const InternalFormatInfoMap &formatMap = GetInternalFormatMap(); const InternalFormatInfoMap &formatMap = GetInternalFormatMap();
InternalFormatInfoMap::const_iterator iter = formatMap.find(internalFormat); InternalFormatInfoMap::const_iterator iter = formatMap.find(internalFormat);
if (iter != formatMap.end()) if (iter != formatMap.end())
{ {
const InternalFormatInfo &info = iter->second; return iter->second;
return es ? info.glesInfo : info.glInfo;
} }
else else
{ {
......
...@@ -21,31 +21,17 @@ namespace rx ...@@ -21,31 +21,17 @@ namespace rx
namespace nativegl 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 struct InternalFormat
{ {
InternalFormat(); InternalFormat();
SupportRequirement texture; typedef bool(*SupportCheckFunction)(GLuint majorVersion, GLuint minorVersion,
SupportRequirement filter; const std::vector<std::string> &extensions);
SupportRequirement renderbuffer; SupportCheckFunction textureSupport;
SupportRequirement framebufferAttachment; SupportCheckFunction renderSupport;
SupportCheckFunction filterSupport;
}; };
const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, bool es); const InternalFormat &GetInternalFormatInfo(GLenum internalFormat);
} }
......
...@@ -25,46 +25,14 @@ namespace rx ...@@ -25,46 +25,14 @@ namespace rx
namespace nativegl_gl 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) static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, GLenum internalFormat)
{ {
gl::TextureCaps textureCaps; gl::TextureCaps textureCaps;
const nativegl::InternalFormat &formatInfo = nativegl::GetInternalFormatInfo(internalFormat, functions->openGLES); const nativegl::InternalFormat &formatInfo = nativegl::GetInternalFormatInfo(internalFormat);
textureCaps.texturable = MeetsRequirements(functions, formatInfo.texture); textureCaps.texturable = formatInfo.textureSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
textureCaps.filterable = textureCaps.texturable && MeetsRequirements(functions, formatInfo.filter); textureCaps.renderable = formatInfo.renderSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
textureCaps.renderable = MeetsRequirements(functions, formatInfo.framebufferAttachment); textureCaps.filterable = formatInfo.filterSupport(functions->majorVersion, functions->minorVersion, functions->extensions);
// glGetInternalformativ is not available until version 4.2 but may be available through the 3.0 // glGetInternalformativ is not available until version 4.2 but may be available through the 3.0
// extension GL_ARB_internalformat_query // extension GL_ARB_internalformat_query
......
...@@ -36,7 +36,7 @@ class BlendMinMaxTest : public ANGLETest ...@@ -36,7 +36,7 @@ class BlendMinMaxTest : public ANGLETest
return blendMin ? std::min<GLubyte>(curAsUbyte, prevColor) : std::max<GLubyte>(curAsUbyte, prevColor); return blendMin ? std::min<GLubyte>(curAsUbyte, prevColor) : std::max<GLubyte>(curAsUbyte, prevColor);
} }
void runTest(GLenum colorFormat) void runTest()
{ {
if (getClientVersion() < 3 && !extensionEnabled("GL_EXT_blend_minmax")) if (getClientVersion() < 3 && !extensionEnabled("GL_EXT_blend_minmax"))
{ {
...@@ -44,8 +44,6 @@ class BlendMinMaxTest : public ANGLETest ...@@ -44,8 +44,6 @@ class BlendMinMaxTest : public ANGLETest
return; return;
} }
SetUpFramebuffer(colorFormat);
const size_t colorCount = 1024; const size_t colorCount = 1024;
Color colors[colorCount]; Color colors[colorCount];
for (size_t i = 0; i < colorCount; i++) for (size_t i = 0; i < colorCount; i++)
...@@ -154,7 +152,8 @@ class BlendMinMaxTest : public ANGLETest ...@@ -154,7 +152,8 @@ class BlendMinMaxTest : public ANGLETest
TEST_P(BlendMinMaxTest, RGBA8) TEST_P(BlendMinMaxTest, RGBA8)
{ {
runTest(GL_RGBA8); SetUpFramebuffer(GL_RGBA8);
runTest();
} }
TEST_P(BlendMinMaxTest, RGBA32f) TEST_P(BlendMinMaxTest, RGBA32f)
...@@ -165,7 +164,8 @@ TEST_P(BlendMinMaxTest, RGBA32f) ...@@ -165,7 +164,8 @@ TEST_P(BlendMinMaxTest, RGBA32f)
return; return;
} }
runTest(GL_RGBA32F); SetUpFramebuffer(GL_RGBA32F);
runTest();
} }
TEST_P(BlendMinMaxTest, RGBA16F) TEST_P(BlendMinMaxTest, RGBA16F)
...@@ -176,7 +176,8 @@ TEST_P(BlendMinMaxTest, RGBA16F) ...@@ -176,7 +176,8 @@ TEST_P(BlendMinMaxTest, RGBA16F)
return; return;
} }
runTest(GL_RGBA16F); SetUpFramebuffer(GL_RGBA16F);
runTest();
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
......
...@@ -129,4 +129,4 @@ TEST_P(CubeMapTextureTest, RenderToFacesConsecutively) ...@@ -129,4 +129,4 @@ TEST_P(CubeMapTextureTest, RenderToFacesConsecutively)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // 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(), ES2_OPENGL(), ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(CubeMapTextureTest, ES2_D3D11(), ES2_D3D11_FL9_3());
...@@ -174,15 +174,9 @@ TEST_P(DepthStencilFormatsTestES3, DrawWithDepthStencil) ...@@ -174,15 +174,9 @@ TEST_P(DepthStencilFormatsTestES3, DrawWithDepthStencil)
ASSERT_GL_NO_ERROR(); ASSERT_GL_NO_ERROR();
GLubyte pixel[4]; EXPECT_PIXEL_NEAR(0, 0, 255, 0, 0, 255, 2.0);
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. // 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(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTest, ES2_D3D9(), ES2_D3D11());
ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTestES3, ES3_D3D11(), ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(DepthStencilFormatsTestES3, ES3_D3D11());
...@@ -142,34 +142,16 @@ TEST_P(FramebufferFormatsTest, RGB565) ...@@ -142,34 +142,16 @@ TEST_P(FramebufferFormatsTest, RGB565)
TEST_P(FramebufferFormatsTest, RGB8) 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); testTextureFormat(GL_RGB8_OES, 8, 8, 8, 0);
} }
TEST_P(FramebufferFormatsTest, BGRA8) 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); testTextureFormat(GL_BGRA8_EXT, 8, 8, 8, 8);
} }
TEST_P(FramebufferFormatsTest, RGBA8) 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); testTextureFormat(GL_RGBA8_OES, 8, 8, 8, 8);
} }
...@@ -185,12 +167,6 @@ TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24) ...@@ -185,12 +167,6 @@ TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24)
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F) 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); testRenderbufferMultisampleFormat(3, GL_DEPTH_ATTACHMENT, GL_DEPTH_COMPONENT32F);
} }
...@@ -201,26 +177,13 @@ TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24_STENCIL8) ...@@ -201,26 +177,13 @@ TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH24_STENCIL8)
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_DEPTH32F_STENCIL8) 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); testRenderbufferMultisampleFormat(3, GL_DEPTH_STENCIL_ATTACHMENT, GL_DEPTH32F_STENCIL8);
} }
TEST_P(FramebufferFormatsTest, RenderbufferMultisample_STENCIL_INDEX8) 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); 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. // 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(), ES2_OPENGL(), ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(FramebufferFormatsTest, ES2_D3D9(), ES2_D3D11(), ES3_D3D11());
...@@ -163,4 +163,4 @@ TEST_P(IncompleteTextureTest, UpdateTexture) ...@@ -163,4 +163,4 @@ TEST_P(IncompleteTextureTest, UpdateTexture)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // 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(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(IncompleteTextureTest, ES2_D3D9(), ES2_D3D11());
...@@ -216,6 +216,6 @@ TEST_P(IndexedPointsTestUInt, UnsignedIntOffset3) ...@@ -216,6 +216,6 @@ TEST_P(IndexedPointsTestUInt, UnsignedIntOffset3)
runTest(3); runTest(3);
} }
ANGLE_INSTANTIATE_TEST(IndexedPointsTestUByte, ES2_D3D11(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(IndexedPointsTestUByte, ES2_D3D11());
ANGLE_INSTANTIATE_TEST(IndexedPointsTestUShort, ES2_D3D11(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(IndexedPointsTestUShort, ES2_D3D11());
ANGLE_INSTANTIATE_TEST(IndexedPointsTestUInt, ES2_D3D11(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(IndexedPointsTestUInt, ES2_D3D11());
...@@ -28,16 +28,20 @@ class LineLoopTest : public ANGLETest ...@@ -28,16 +28,20 @@ class LineLoopTest : public ANGLETest
const std::string vsSource = SHADER_SOURCE const std::string vsSource = SHADER_SOURCE
( (
attribute highp vec4 position; attribute highp vec4 position;
attribute highp vec4 in_color;
varying highp vec4 color;
void main(void) void main(void)
{ {
gl_Position = position; gl_Position = position;
color = in_color;
} }
); );
const std::string fsSource = SHADER_SOURCE const std::string fsSource = SHADER_SOURCE
( (
uniform highp vec4 color; varying highp vec4 color;
void main(void) void main(void)
{ {
gl_FragColor = color; gl_FragColor = color;
...@@ -51,7 +55,7 @@ class LineLoopTest : public ANGLETest ...@@ -51,7 +55,7 @@ class LineLoopTest : public ANGLETest
} }
mPositionLocation = glGetAttribLocation(mProgram, "position"); mPositionLocation = glGetAttribLocation(mProgram, "position");
mColorLocation = glGetUniformLocation(mProgram, "in_color"); mColorLocation = glGetAttribLocation(mProgram, "in_color");
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_BLEND); glEnable(GL_BLEND);
...@@ -201,4 +205,4 @@ TEST_P(LineLoopTest, LineLoopUIntIndexBuffer) ...@@ -201,4 +205,4 @@ TEST_P(LineLoopTest, LineLoopUIntIndexBuffer)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // 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(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(LineLoopTest, ES2_D3D9(), ES2_D3D11());
...@@ -274,7 +274,6 @@ TEST_P(SwizzleTest, CompressedDXT_2D) ...@@ -274,7 +274,6 @@ TEST_P(SwizzleTest, CompressedDXT_2D)
{ {
if (!extensionEnabled("GL_EXT_texture_compression_dxt1")) if (!extensionEnabled("GL_EXT_texture_compression_dxt1"))
{ {
std::cout << "Test skipped due to missing GL_EXT_texture_compression_dxt1." << std::endl;
return; return;
} }
...@@ -283,6 +282,6 @@ TEST_P(SwizzleTest, CompressedDXT_2D) ...@@ -283,6 +282,6 @@ TEST_P(SwizzleTest, CompressedDXT_2D)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // 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(), ES3_OPENGL()); ANGLE_INSTANTIATE_TEST(SwizzleTest, ES3_D3D11());
} // namespace } // namespace
...@@ -610,6 +610,6 @@ TEST_P(TextureTest, TextureNPOT_GL_ALPHA_UBYTE) ...@@ -610,6 +610,6 @@ TEST_P(TextureTest, TextureNPOT_GL_ALPHA_UBYTE)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // 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(), ES2_OPENGL()); ANGLE_INSTANTIATE_TEST(TextureTest, ES2_D3D9(), ES2_D3D11(), ES2_D3D11_FL9_3());
} // namespace } // namespace
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