Commit 677bb6ff by Geoff Lang Committed by Commit Bot

Update checks for floating point renderability.

* Expose GL_CHROMIUM_color_buffer_float_rgb and GL_CHROMIUM_color_buffer_float_rgba * Fix many texture formats that were incorrectly checking the wrong extension for support or renderability. * Make all floating point texture extensions dynamically enableable. BUG=angleproject:1958 BUG=angleproject:1715 Change-Id: Iefccc8b5ae5edd97623affa9de05b1d9af5c9598 Reviewed-on: https://chromium-review.googlesource.com/468450Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent bb7e5a7c
...@@ -208,6 +208,8 @@ Extensions::Extensions() ...@@ -208,6 +208,8 @@ Extensions::Extensions()
robustClientMemory(false), robustClientMemory(false),
textureSRGBDecode(false), textureSRGBDecode(false),
sRGBWriteControl(false), sRGBWriteControl(false),
colorBufferFloatRGB(false),
colorBufferFloatRGBA(false),
colorBufferFloat(false), colorBufferFloat(false),
multisampleCompatibility(false), multisampleCompatibility(false),
framebufferMixedSamples(false), framebufferMixedSamples(false),
...@@ -332,7 +334,7 @@ static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps) ...@@ -332,7 +334,7 @@ static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
GL_RGB16F, GL_RGBA16F, GL_RGB16F, GL_RGBA16F,
}; };
return GetFormatSupport(textureCaps, requiredFormats, true, false, true); return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
} }
// Checks for GL_OES_texture_half_float_linear support // Checks for GL_OES_texture_half_float_linear support
...@@ -353,7 +355,7 @@ static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps) ...@@ -353,7 +355,7 @@ static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
GL_RGB32F, GL_RGBA32F, GL_RGB32F, GL_RGBA32F,
}; };
return GetFormatSupport(textureCaps, requiredFormats, true, false, true); return GetFormatSupport(textureCaps, requiredFormats, true, false, false);
} }
// Checks for GL_OES_texture_float_linear support // Checks for GL_OES_texture_float_linear support
...@@ -511,6 +513,26 @@ static bool DetermineDepth32Support(const TextureCapsMap &textureCaps) ...@@ -511,6 +513,26 @@ static bool DetermineDepth32Support(const TextureCapsMap &textureCaps)
return GetFormatSupport(textureCaps, requiredFormats, false, false, true); return GetFormatSupport(textureCaps, requiredFormats, false, false, true);
} }
// Check for GL_CHROMIUM_color_buffer_float_rgb
static bool DetermineColorBufferFloatRGBSupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_RGB32F,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
}
// Check for GL_CHROMIUM_color_buffer_float_rgba
static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCaps)
{
constexpr GLenum requiredFormats[] = {
GL_RGBA32F,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, true);
}
// Check for GL_EXT_color_buffer_float // Check for GL_EXT_color_buffer_float
static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps) static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
{ {
...@@ -558,6 +580,8 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps) ...@@ -558,6 +580,8 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
sRGB = DetermineSRGBTextureSupport(textureCaps); sRGB = DetermineSRGBTextureSupport(textureCaps);
depthTextures = DetermineDepthTextureSupport(textureCaps); depthTextures = DetermineDepthTextureSupport(textureCaps);
depth32 = DetermineDepth32Support(textureCaps); depth32 = DetermineDepth32Support(textureCaps);
colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps); colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
textureNorm16 = DetermineTextureNorm16Support(textureCaps); textureNorm16 = DetermineTextureNorm16Support(textureCaps);
} }
...@@ -589,11 +613,11 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -589,11 +613,11 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_NV_pixel_buffer_object"] = esOnlyExtension(&Extensions::pixelBufferObject); map["GL_NV_pixel_buffer_object"] = esOnlyExtension(&Extensions::pixelBufferObject);
map["GL_OES_mapbuffer"] = esOnlyExtension(&Extensions::mapBuffer); map["GL_OES_mapbuffer"] = esOnlyExtension(&Extensions::mapBuffer);
map["GL_EXT_map_buffer_range"] = esOnlyExtension(&Extensions::mapBufferRange); map["GL_EXT_map_buffer_range"] = esOnlyExtension(&Extensions::mapBufferRange);
map["GL_EXT_color_buffer_half_float"] = esOnlyExtension(&Extensions::colorBufferHalfFloat); map["GL_EXT_color_buffer_half_float"] = enableableExtension(&Extensions::colorBufferHalfFloat);
map["GL_OES_texture_half_float"] = esOnlyExtension(&Extensions::textureHalfFloat); map["GL_OES_texture_half_float"] = enableableExtension(&Extensions::textureHalfFloat);
map["GL_OES_texture_half_float_linear"] = esOnlyExtension(&Extensions::textureHalfFloatLinear); map["GL_OES_texture_half_float_linear"] = enableableExtension(&Extensions::textureHalfFloatLinear);
map["GL_OES_texture_float"] = esOnlyExtension(&Extensions::textureFloat); map["GL_OES_texture_float"] = enableableExtension(&Extensions::textureFloat);
map["GL_OES_texture_float_linear"] = esOnlyExtension(&Extensions::textureFloatLinear); map["GL_OES_texture_float_linear"] = enableableExtension(&Extensions::textureFloatLinear);
map["GL_EXT_texture_rg"] = esOnlyExtension(&Extensions::textureRG); map["GL_EXT_texture_rg"] = esOnlyExtension(&Extensions::textureRG);
map["GL_EXT_texture_compression_dxt1"] = esOnlyExtension(&Extensions::textureCompressionDXT1); map["GL_EXT_texture_compression_dxt1"] = esOnlyExtension(&Extensions::textureCompressionDXT1);
map["GL_ANGLE_texture_compression_dxt3"] = esOnlyExtension(&Extensions::textureCompressionDXT3); map["GL_ANGLE_texture_compression_dxt3"] = esOnlyExtension(&Extensions::textureCompressionDXT3);
...@@ -636,7 +660,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -636,7 +660,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_NV_EGL_stream_consumer_external"] = esOnlyExtension(&Extensions::eglStreamConsumerExternal); map["GL_NV_EGL_stream_consumer_external"] = esOnlyExtension(&Extensions::eglStreamConsumerExternal);
map["GL_EXT_unpack_subimage"] = esOnlyExtension(&Extensions::unpackSubimage); map["GL_EXT_unpack_subimage"] = esOnlyExtension(&Extensions::unpackSubimage);
map["GL_NV_pack_subimage"] = esOnlyExtension(&Extensions::packSubimage); map["GL_NV_pack_subimage"] = esOnlyExtension(&Extensions::packSubimage);
map["GL_EXT_color_buffer_float"] = esOnlyExtension(&Extensions::colorBufferFloat); map["GL_EXT_color_buffer_float"] = enableableExtension(&Extensions::colorBufferFloat);
map["GL_OES_vertex_array_object"] = esOnlyExtension(&Extensions::vertexArrayObject); map["GL_OES_vertex_array_object"] = esOnlyExtension(&Extensions::vertexArrayObject);
map["GL_KHR_debug"] = esOnlyExtension(&Extensions::debug); map["GL_KHR_debug"] = esOnlyExtension(&Extensions::debug);
// TODO(jmadill): Enable this when complete. // TODO(jmadill): Enable this when complete.
...@@ -652,6 +676,8 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -652,6 +676,8 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_ANGLE_robust_client_memory"] = esOnlyExtension(&Extensions::robustClientMemory); map["GL_ANGLE_robust_client_memory"] = esOnlyExtension(&Extensions::robustClientMemory);
map["GL_EXT_texture_sRGB_decode"] = esOnlyExtension(&Extensions::textureSRGBDecode); map["GL_EXT_texture_sRGB_decode"] = esOnlyExtension(&Extensions::textureSRGBDecode);
map["GL_EXT_sRGB_write_control"] = esOnlyExtension(&Extensions::sRGBWriteControl); map["GL_EXT_sRGB_write_control"] = esOnlyExtension(&Extensions::sRGBWriteControl);
map["GL_CHROMIUM_color_buffer_float_rgb"] = enableableExtension(&Extensions::colorBufferFloatRGB);
map["GL_CHROMIUM_color_buffer_float_rgba"] = enableableExtension(&Extensions::colorBufferFloatRGBA);
map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility); map["GL_EXT_multisample_compatibility"] = esOnlyExtension(&Extensions::multisampleCompatibility);
map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples); map["GL_CHROMIUM_framebuffer_mixed_samples"] = esOnlyExtension(&Extensions::framebufferMixedSamples);
map["GL_EXT_texture_norm16"] = esOnlyExtension(&Extensions::textureNorm16); map["GL_EXT_texture_norm16"] = esOnlyExtension(&Extensions::textureNorm16);
......
...@@ -330,6 +330,12 @@ struct Extensions ...@@ -330,6 +330,12 @@ struct Extensions
// GL_EXT_sRGB_write_control // GL_EXT_sRGB_write_control
bool sRGBWriteControl; bool sRGBWriteControl;
// GL_CHROMIUM_color_buffer_float_rgb
bool colorBufferFloatRGB;
// GL_CHROMIUM_color_buffer_float_rgba
bool colorBufferFloatRGBA;
// ES3 Extension support // ES3 Extension support
// GL_EXT_color_buffer_float // GL_EXT_color_buffer_float
......
...@@ -617,20 +617,19 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -617,20 +617,19 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
const Format &format = colorAttachment.getFormat(); const InternalFormat &format = *colorAttachment.getFormat().info;
const TextureCaps &formatCaps = state.getTextureCap(format.info->sizedInternalFormat); if (!format.renderSupport(context->getClientVersion(), context->getExtensions()))
if (colorAttachment.type() == GL_TEXTURE)
{ {
if (!formatCaps.renderable) return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
{ }
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (format.info->depthBits > 0 || format.info->stencilBits > 0) if (format.depthBits > 0 || format.stencilBits > 0)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
if (colorAttachment.type() == GL_TEXTURE)
{
if (colorAttachment.layer() >= size.depth) if (colorAttachment.layer() >= size.depth)
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
...@@ -664,11 +663,6 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -664,11 +663,6 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
else if (colorAttachment.type() == GL_RENDERBUFFER) else if (colorAttachment.type() == GL_RENDERBUFFER)
{ {
hasRenderbuffer = true; hasRenderbuffer = true;
if (!formatCaps.renderable || format.info->depthBits > 0 ||
format.info->stencilBits > 0)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
} }
if (!missingAttachment) if (!missingAttachment)
...@@ -684,7 +678,7 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -684,7 +678,7 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
// in GLES 3.0, there is no such restriction // in GLES 3.0, there is no such restriction
if (state.getClientMajorVersion() < 3) if (state.getClientMajorVersion() < 3)
{ {
if (format.info->pixelBytes != colorbufferSize) if (format.pixelBytes != colorbufferSize)
{ {
return GL_FRAMEBUFFER_UNSUPPORTED; return GL_FRAMEBUFFER_UNSUPPORTED;
} }
...@@ -693,7 +687,7 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -693,7 +687,7 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
else else
{ {
samples = colorAttachment.getSamples(); samples = colorAttachment.getSamples();
colorbufferSize = format.info->pixelBytes; colorbufferSize = format.pixelBytes;
missingAttachment = false; missingAttachment = false;
} }
} }
...@@ -708,26 +702,16 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -708,26 +702,16 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
const Format &format = depthAttachment.getFormat(); const InternalFormat &format = *depthAttachment.getFormat().info;
const TextureCaps &formatCaps = state.getTextureCap(format.info->sizedInternalFormat);
if (depthAttachment.type() == GL_TEXTURE)
{
if (!formatCaps.renderable)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (format.info->depthBits == 0) if (!format.renderSupport(context->getClientVersion(), context->getExtensions()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
} }
else if (depthAttachment.type() == GL_RENDERBUFFER)
if (format.depthBits == 0)
{ {
if (!formatCaps.renderable || format.info->depthBits == 0) return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
} }
if (missingAttachment) if (missingAttachment)
...@@ -760,26 +744,16 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -760,26 +744,16 @@ GLenum Framebuffer::checkStatusImpl(const Context *context)
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
} }
const Format &format = stencilAttachment.getFormat(); const InternalFormat &format = *stencilAttachment.getFormat().info;
const TextureCaps &formatCaps = state.getTextureCap(format.info->sizedInternalFormat);
if (stencilAttachment.type() == GL_TEXTURE)
{
if (!formatCaps.renderable)
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
if (format.info->stencilBits == 0) if (!format.renderSupport(context->getClientVersion(), context->getExtensions()))
{ {
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
} }
else if (stencilAttachment.type() == GL_RENDERBUFFER)
if (format.stencilBits == 0)
{ {
if (!formatCaps.renderable || format.info->stencilBits == 0) return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
{
return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
}
} }
if (missingAttachment) if (missingAttachment)
......
...@@ -148,46 +148,130 @@ static bool HalfFloatSupport(const Version &clientVersion, const Extensions &ext ...@@ -148,46 +148,130 @@ static bool HalfFloatSupport(const Version &clientVersion, const Extensions &ext
return clientVersion >= Version(3, 0) || extensions.textureHalfFloat; return clientVersion >= Version(3, 0) || extensions.textureHalfFloat;
} }
static bool HalfFloatRenderableSupport(const Version &clientVersion, const Extensions &extensions) static bool HalfFloatRGBRenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{ {
return HalfFloatSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat; return HalfFloatSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
} }
static bool HalfFloatRGBARenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{
return HalfFloatSupport(clientVersion, extensions) &&
(extensions.colorBufferHalfFloat || extensions.colorBufferFloat);
}
// Special function for half float formats with one or two channels. // Special function for half float formats with one or two channels.
static bool HalfFloatSupportRG(const Version &clientVersion, const Extensions &extensions)
// R16F, RG16F
static bool HalfFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
{ {
return clientVersion >= Version(3, 0) || (extensions.textureHalfFloat && extensions.textureRG); return clientVersion >= Version(3, 0) || (extensions.textureHalfFloat && extensions.textureRG);
} }
static bool HalfFloatRenderableSupportRG(const Version &clientVersion, const Extensions &extensions) // R16F, RG16F
static bool HalfFloatRGRenderableSupport(const Version &clientVersion, const Extensions &extensions)
{
// It's unclear if EXT_color_buffer_half_float gives renderability to non-OES half float
// textures
return HalfFloatRGSupport(clientVersion, extensions) &&
(extensions.colorBufferHalfFloat || extensions.colorBufferFloat);
}
// RED + HALF_FLOAT_OES, RG + HALF_FLOAT_OES
static bool UnsizedHalfFloatOESRGSupport(const Version &, const Extensions &extensions)
{
return extensions.textureHalfFloat && extensions.textureRG;
}
// RED + HALF_FLOAT_OES, RG + HALF_FLOAT_OES
static bool UnsizedHalfFloatOESRGRenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{ {
return HalfFloatSupportRG(clientVersion, extensions) && extensions.colorBufferHalfFloat; return UnsizedHalfFloatOESRGSupport(clientVersion, extensions) &&
extensions.colorBufferHalfFloat;
}
// RGB + HALF_FLOAT_OES, RGBA + HALF_FLOAT_OES
static bool UnsizedHalfFloatOESSupport(const Version &clientVersion, const Extensions &extensions)
{
return extensions.textureHalfFloat;
}
// RGB + HALF_FLOAT_OES, RGBA + HALF_FLOAT_OES
static bool UnsizedHalfFloatOESRenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{
return UnsizedHalfFloatOESSupport(clientVersion, extensions) && extensions.colorBufferHalfFloat;
} }
// Special function for float formats with three or four channels. // Special function for float formats with three or four channels.
// RGB32F, RGBA32F
static bool FloatSupport(const Version &clientVersion, const Extensions &extensions) static bool FloatSupport(const Version &clientVersion, const Extensions &extensions)
{ {
return clientVersion >= Version(3, 0) || extensions.textureFloat; return clientVersion >= Version(3, 0) || extensions.textureFloat;
} }
static bool FloatRenderableSupport(const Version &clientVersion, const Extensions &extensions) // RGB32F
static bool FloatRGBRenderableSupport(const Version &clientVersion, const Extensions &extensions)
{
return FloatSupport(clientVersion, extensions) && extensions.colorBufferFloatRGB;
}
// RGBA32F
static bool FloatRGBARenderableSupport(const Version &clientVersion, const Extensions &extensions)
{ {
// We don't expose colorBufferFloat in ES2, but we silently support rendering to float.
return FloatSupport(clientVersion, extensions) && return FloatSupport(clientVersion, extensions) &&
(extensions.colorBufferFloat || clientVersion == Version(2, 0)); (extensions.colorBufferFloat || extensions.colorBufferFloatRGBA);
}
// RGB + FLOAT, RGBA + FLOAT
static bool UnsizedFloatSupport(const Version &clientVersion, const Extensions &extensions)
{
return extensions.textureFloat;
}
// RGB + FLOAT
static bool UnsizedFloatRGBRenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{
return UnsizedFloatSupport(clientVersion, extensions) && extensions.colorBufferFloatRGB;
}
// RGBA + FLOAT
static bool UnsizedFloatRGBARenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{
return UnsizedFloatSupport(clientVersion, extensions) &&
(extensions.colorBufferFloatRGBA || extensions.colorBufferFloat);
} }
// Special function for float formats with one or two channels. // Special function for float formats with one or two channels.
static bool FloatSupportRG(const Version &clientVersion, const Extensions &extensions)
// R32F, RG32F
static bool FloatRGSupport(const Version &clientVersion, const Extensions &extensions)
{ {
return clientVersion >= Version(3, 0) || (extensions.textureFloat && extensions.textureRG); return clientVersion >= Version(3, 0) || (extensions.textureFloat && extensions.textureRG);
} }
static bool FloatRenderableSupportRG(const Version &clientVersion, const Extensions &extensions) // R32F, RG32F
static bool FloatRGRenderableSupport(const Version &clientVersion, const Extensions &extensions)
{
return FloatRGSupport(clientVersion, extensions) && extensions.colorBufferFloat;
}
// RED + FLOAT, RG + FLOAT
static bool UnsizedFloatRGSupport(const Version &clientVersion, const Extensions &extensions)
{
return extensions.textureFloat && extensions.textureRG;
}
// RED + FLOAT, RG + FLOAT
static bool UnsizedFloatRGRenderableSupport(const Version &clientVersion,
const Extensions &extensions)
{ {
// We don't expose colorBufferFloat in ES2, but we silently support rendering to float. return FloatRGSupport(clientVersion, extensions) && extensions.colorBufferFloat;
return FloatSupportRG(clientVersion, extensions) &&
(extensions.colorBufferFloat || clientVersion == Version(2, 0));
} }
InternalFormat::InternalFormat() InternalFormat::InternalFormat()
...@@ -499,16 +583,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -499,16 +583,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddRGBAFormat(&map, GL_BGR565_ANGLEX, true, 5, 6, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported); AddRGBAFormat(&map, GL_BGR565_ANGLEX, true, 5, 6, 5, 1, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported);
// Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float // Floating point renderability and filtering is provided by OES_texture_float and OES_texture_half_float
// | Internal format |sized| D |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable | // | Internal format |sized| D |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable |
// | | | | | | | type | | | | | // | | | | | | | type | | | | |
AddRGBAFormat(&map, GL_R16F, true, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupportRG, HalfFloatRenderableSupportRG, RequireExt<&Extensions::textureHalfFloatLinear>); AddRGBAFormat(&map, GL_R16F, true, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatRGSupport, HalfFloatRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RG16F, true, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupportRG, HalfFloatRenderableSupportRG, RequireExt<&Extensions::textureHalfFloatLinear>); AddRGBAFormat(&map, GL_RG16F, true, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatRGSupport, HalfFloatRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RGB16F, true, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRenderableSupport, RequireExt<&Extensions::textureHalfFloatLinear>); AddRGBAFormat(&map, GL_RGB16F, true, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRGBRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RGBA16F, true, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRenderableSupport, RequireExt<&Extensions::textureHalfFloatLinear>); AddRGBAFormat(&map, GL_RGBA16F, true, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, HalfFloatSupport, HalfFloatRGBARenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_R32F, true, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, FloatSupportRG, FloatRenderableSupportRG, RequireExt<&Extensions::textureFloatLinear> ); AddRGBAFormat(&map, GL_R32F, true, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, FloatRGSupport, FloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RG32F, true, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, FloatSupportRG, FloatRenderableSupportRG, RequireExt<&Extensions::textureFloatLinear> ); AddRGBAFormat(&map, GL_RG32F, true, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, FloatRGSupport, FloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RGB32F, true, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRenderableSupport, RequireExt<&Extensions::textureFloatLinear> ); AddRGBAFormat(&map, GL_RGB32F, true, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRGBRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RGBA32F, true, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRenderableSupport, RequireExt<&Extensions::textureFloatLinear> ); AddRGBAFormat(&map, GL_RGBA32F, true, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, FloatSupport, FloatRGBARenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
// Depth stencil formats // Depth stencil formats
// | Internal format |sized| D |S | X | Format | Type | Component type | Supported | Renderable | Filterable | // | Internal format |sized| D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
...@@ -521,16 +605,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -521,16 +605,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
// STENCIL_INDEX8 is special-cased, see around the bottom of the list. // STENCIL_INDEX8 is special-cased, see around the bottom of the list.
// Luminance alpha formats // Luminance alpha formats
// | Internal format |sized| L | A | Format | Type | Component type | Supported | Renderable | Filterable | // | Internal format |sized| L | A | Format | Type | Component type | Supported | Renderable | Filterable |
AddLUMAFormat(&map, GL_ALPHA8_EXT, true, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA8_EXT, true, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
AddLUMAFormat(&map, GL_LUMINANCE8_EXT, true, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE8_EXT, true, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
AddLUMAFormat(&map, GL_ALPHA32F_EXT, true, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE8_ALPHA8_EXT, true, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported);
AddLUMAFormat(&map, GL_LUMINANCE32F_EXT, true, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA16F_EXT, true, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_ALPHA16F_EXT, true, 0, 16, GL_ALPHA, GL_HALF_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE16F_EXT, true, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE16F_EXT, true, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA16F_EXT, true, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE8_ALPHA8_EXT, true, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireExt<&Extensions::textureStorage>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA32F_EXT, true, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE32F_EXT, true, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA16F_EXT, true, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureHalfFloat>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA32F_EXT, true, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExtAndExt<&Extensions::textureStorage, &Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear>);
// Compressed formats, From ES 3.0.1 spec, table 3.16 // Compressed formats, From ES 3.0.1 spec, table 3.16
// | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable | // | Internal format |W |H | BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable |
...@@ -668,31 +752,31 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -668,31 +752,31 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported); AddRGBAFormat(&map, GL_RGBA_INTEGER, false, 10, 10, 10, 2, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_INT, false, RequireES<3, 0>, NeverSupported, NeverSupported);
// Unsized floating point formats // Unsized floating point formats
// |Internal format |sized | R | G | B | A |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable | // |Internal format |sized | R | G | B | A |S | Format | Type | Comp | SRGB | Texture supported | Renderable | Filterable |
AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT, GL_FLOAT, false, NeverSupported, NeverSupported, NeverSupported );
AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RED, false, 16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESRGSupport, UnsizedHalfFloatOESRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RG, false, 16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESRGSupport, UnsizedHalfFloatOESRGRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGB, false, 16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESSupport, UnsizedHalfFloatOESRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA, false, 16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, UnsizedHalfFloatOESSupport, UnsizedHalfFloatOESRenderableSupport, RequireESOrExt<3, 0, &Extensions::textureHalfFloatLinear>);
AddRGBAFormat(&map, GL_RED, false, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RED, false, 32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, UnsizedFloatRGSupport, UnsizedFloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RG, false, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, RequireESOrExt<3, 0, &Extensions::textureRG>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RG, false, 32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, UnsizedFloatRGSupport, UnsizedFloatRGRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RGB, false, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGB, false, 32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, UnsizedFloatSupport, UnsizedFloatRGBRenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
AddRGBAFormat(&map, GL_RGBA, false, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA, false, 32, 32, 32, 32, 0, GL_RGBA, GL_FLOAT, GL_FLOAT, false, UnsizedFloatSupport, UnsizedFloatRGBARenderableSupport, RequireExt<&Extensions::textureFloatLinear> );
// Unsized luminance alpha formats // Unsized luminance alpha formats
// | Internal format |sized | L | A | Format | Type | Component type | Supported | Renderable | Filterable | // | Internal format |sized | L | A | Format | Type | Component type | Supported | Renderable | Filterable |
AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported );
AddLUMAFormat(&map, GL_ALPHA, false, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA, false, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE, false, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE, false, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA ,false, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA ,false, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>);
AddLUMAFormat(&map, GL_ALPHA, false, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_ALPHA, false, 0, 32, GL_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
AddLUMAFormat(&map, GL_LUMINANCE, false, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE, false, 32, 0, GL_LUMINANCE, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireES<2, 0>, NeverSupported, AlwaysSupported); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 32, 32, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_FLOAT, RequireExt<&Extensions::textureFloat>, NeverSupported, RequireExt<&Extensions::textureFloatLinear> );
// Unsized depth stencil formats // Unsized depth stencil formats
// | Internal format |sized | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable | // | Internal format |sized | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable |
......
...@@ -195,10 +195,10 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -195,10 +195,10 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_RG16F, VersionOrExts(3, 0, "GL_ARB_texture_rg ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), VersionOrExtsAndExts(3, 0, "GL_EXT_texture_rg", "GL_EXT_color_buffer_half_float")); InsertFormatMapping(&map, GL_RG16F, VersionOrExts(3, 0, "GL_ARB_texture_rg ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), VersionOrExtsAndExts(3, 0, "GL_EXT_texture_rg", "GL_EXT_color_buffer_half_float"));
InsertFormatMapping(&map, GL_RGB16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_half_float") ); InsertFormatMapping(&map, GL_RGB16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_half_float") );
InsertFormatMapping(&map, GL_RGBA16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_half_float") ); InsertFormatMapping(&map, GL_RGBA16F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_half_float") );
InsertFormatMapping(&map, GL_R32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_float") ); InsertFormatMapping(&map, GL_R32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_OES_texture_float_linear"), ExtsOnly("GL_EXT_color_buffer_float") );
InsertFormatMapping(&map, GL_RG32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_float") ); InsertFormatMapping(&map, GL_RG32F, VersionOrExts(3, 0, "GL_ARB_texture_rg GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_OES_texture_float_linear"), ExtsOnly("GL_EXT_color_buffer_float") );
InsertFormatMapping(&map, GL_RGB32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), NeverSupported() ); InsertFormatMapping(&map, GL_RGB32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(3, 0, "GL_ARB_texture_float GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported() );
InsertFormatMapping(&map, GL_RGBA32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(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"), ExtsOnly("GL_EXT_color_buffer_float") ); InsertFormatMapping(&map, GL_RGBA32F, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), VersionOrExts(3, 0, "GL_ARB_texture_float GL_ARB_color_buffer_float"), VersionOrExts(3, 0, "GL_OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), ExtsOnly("GL_EXT_color_buffer_float") );
// Depth stencil formats // Depth stencil formats
// | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support | // | Format | OpenGL texture support | Filter | OpenGL render support | OpenGL ES texture support | Filter | OpenGL ES render support |
...@@ -213,16 +213,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -213,16 +213,16 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
InsertFormatMapping(&map, GL_DEPTH_STENCIL, 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_STENCIL, 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) );
// Luminance alpha formats // Luminance alpha formats
// | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render | // | Format | OpenGL texture support | Filter | Render | OpenGL ES texture support | Filter | Render |
InsertFormatMapping(&map, GL_ALPHA8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_ALPHA8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_half_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), NeverSupported());
InsertFormatMapping(&map, GL_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_half_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_half_float"), VersionOrExts(3, 0, "GL_OES_texture_half_float_linear"), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE8_ALPHA8_EXT, AlwaysSupported(), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported());
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA16F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage"), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_LUMINANCE_ALPHA32F_EXT, VersionOrExts(3, 0, "GL_ARB_texture_float"), AlwaysSupported(), NeverSupported(), ExtsOnly("GL_EXT_texture_storage OES_texture_float"), ExtsOnly("GL_OES_texture_float_linear"), NeverSupported());
// 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, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported()); InsertFormatMapping(&map, GL_COMPRESSED_R11_EAC, VersionOrExts(4, 3, "GL_ARB_ES3_compatibility"), AlwaysSupported(), NeverSupported(), VersionOnly(3, 0), AlwaysSupported(), NeverSupported());
...@@ -338,6 +338,15 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions, ...@@ -338,6 +338,15 @@ static GLenum GetNativeInternalFormat(const FunctionsGL *functions,
} }
} }
} }
else if (functions->isAtLeastGLES(gl::Version(3, 0)))
{
if (internalFormat.componentType == GL_FLOAT && !internalFormat.isLUMA())
{
// Use sized internal formats for floating point textures. Extensions such as
// EXT_color_buffer_float require the sized formats to be renderable.
result = internalFormat.sizedInternalFormat;
}
}
return result; return result;
} }
......
...@@ -813,7 +813,8 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -813,7 +813,8 @@ void GenerateCaps(const FunctionsGL *functions,
extensions->drawBuffers = functions->isAtLeastGL(gl::Version(2, 0)) || extensions->drawBuffers = functions->isAtLeastGL(gl::Version(2, 0)) ||
functions->hasGLExtension("ARB_draw_buffers") || functions->hasGLExtension("ARB_draw_buffers") ||
functions->hasGLESExtension("GL_EXT_draw_buffers"); functions->hasGLESExtension("GL_EXT_draw_buffers");
extensions->textureStorage = true; extensions->textureStorage = functions->standard == STANDARD_GL_DESKTOP ||
functions->hasGLESExtension("GL_EXT_texture_storage");
extensions->textureFilterAnisotropic = functions->hasGLExtension("GL_EXT_texture_filter_anisotropic") || functions->hasGLESExtension("GL_EXT_texture_filter_anisotropic"); extensions->textureFilterAnisotropic = functions->hasGLExtension("GL_EXT_texture_filter_anisotropic") || functions->hasGLESExtension("GL_EXT_texture_filter_anisotropic");
extensions->occlusionQueryBoolean = nativegl::SupportsOcclusionQueries(functions); extensions->occlusionQueryBoolean = nativegl::SupportsOcclusionQueries(functions);
extensions->maxTextureAnisotropy = extensions->textureFilterAnisotropic ? QuerySingleGLFloat(functions, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0.0f; extensions->maxTextureAnisotropy = extensions->textureFilterAnisotropic ? QuerySingleGLFloat(functions, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0.0f;
......
...@@ -1290,11 +1290,23 @@ bool ValidateES2TexStorageParameters(Context *context, ...@@ -1290,11 +1290,23 @@ bool ValidateES2TexStorageParameters(Context *context,
break; break;
case GL_R8_EXT: case GL_R8_EXT:
case GL_RG8_EXT: case GL_RG8_EXT:
if (!context->getExtensions().textureRG)
{
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
break;
case GL_R16F_EXT: case GL_R16F_EXT:
case GL_RG16F_EXT: case GL_RG16F_EXT:
if (!context->getExtensions().textureRG || !context->getExtensions().textureHalfFloat)
{
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
break;
case GL_R32F_EXT: case GL_R32F_EXT:
case GL_RG32F_EXT: case GL_RG32F_EXT:
if (!context->getExtensions().textureRG) if (!context->getExtensions().textureRG || !context->getExtensions().textureFloat)
{ {
context->handleError(Error(GL_INVALID_ENUM)); context->handleError(Error(GL_INVALID_ENUM));
return false; return false;
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
1097 WIN : dEQP-GLES3.functional.fbo.completeness.size.distinct = FAIL 1097 WIN : dEQP-GLES3.functional.fbo.completeness.size.distinct = FAIL
// Fail because we support these formats through the ANGLE_depth_texture extension instead of OES_depth_texture // Fail because we support these formats through the ANGLE_depth_texture extension instead of OES_depth_texture
605754 MAC WIN LINUX : dEQP-GLES3.functional.fbo.completeness.renderable.texture.depth.depth_component_unsigned_short = FAIL 605754 MAC WIN LINUX ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.depth.depth_component_unsigned_short = FAIL
605754 MAC WIN LINUX : dEQP-GLES3.functional.fbo.completeness.renderable.texture.depth.depth_component_unsigned_int = FAIL 605754 MAC WIN LINUX ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.depth.depth_component_unsigned_int = FAIL
// Tests that we fail because they're not in line with the WebGL spec // Tests that we fail because they're not in line with the WebGL spec
1335 MAC WIN LINUX : dEQP-GLES3.functional.shaders.preprocessor.conditional_inclusion.basic_2* = FAIL 1335 MAC WIN LINUX : dEQP-GLES3.functional.shaders.preprocessor.conditional_inclusion.basic_2* = FAIL
...@@ -332,7 +332,6 @@ ...@@ -332,7 +332,6 @@
// Android only failures // Android only failures
1487 ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.color0.red_half_float_oes = FAIL 1487 ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.color0.red_half_float_oes = FAIL
1487 ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.color0.rg_half_float_oes = FAIL 1487 ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.color0.rg_half_float_oes = FAIL
1961 ANDROID : dEQP-GLES3.functional.fbo.completeness.renderable.texture.depth.depth_component_unsigned_short = FAIL
1527 ANDROID : dEQP-GLES3.functional.flush_finish.* = SKIP 1527 ANDROID : dEQP-GLES3.functional.flush_finish.* = SKIP
1530 ANDROID : dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage2d = FAIL 1530 ANDROID : dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage2d = FAIL
1530 ANDROID : dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage2d_invalid_size = FAIL 1530 ANDROID : dEQP-GLES3.functional.negative_api.texture.compressedtexsubimage2d_invalid_size = FAIL
......
...@@ -208,6 +208,43 @@ class Texture2DTest : public TexCoordDrawTest ...@@ -208,6 +208,43 @@ class Texture2DTest : public TexCoordDrawTest
std::cout << "Test skipped due to missing GL_EXT_texture_rg." << std::endl; std::cout << "Test skipped due to missing GL_EXT_texture_rg." << std::endl;
return; return;
} }
if (destImageChannels == 3 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"))
{
std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
<< std::endl;
return;
}
if (destImageChannels == 4 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgba"))
{
std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
<< std::endl;
return;
}
if (destImageChannels <= 2)
{
std::cout << "Test skipped because no extensions grant renderability to 1 and 2 "
"channel floating point textures."
<< std::endl;
return;
}
}
else
{
if (!extensionEnabled("GL_color_buffer_float"))
{
std::cout << "Test skipped due to missing GL_color_buffer_float." << std::endl;
return;
}
if (destImageChannels == 3 && !extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb"))
{
std::cout << "Test skipped due to missing GL_CHROMIUM_color_buffer_float_rgb."
<< std::endl;
return;
}
} }
GLfloat sourceImageData[4][16] = GLfloat sourceImageData[4][16] =
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "test_utils/ANGLETest.h" #include "test_utils/ANGLETest.h"
#include "common/mathutil.h"
#include "test_utils/gl_raii.h" #include "test_utils/gl_raii.h"
namespace namespace
...@@ -32,6 +33,20 @@ void CheckBlendFunctions(GLenum src, GLenum dst) ...@@ -32,6 +33,20 @@ void CheckBlendFunctions(GLenum src, GLenum dst)
} }
} }
// Extensions that affect the ability to use floating point textures
constexpr const char *FloatingPointTextureExtensions[] = {
"",
"GL_EXT_texture_storage",
"GL_OES_texture_float",
"GL_OES_texture_float_linear",
"GL_OES_texture_half_float",
"GL_OES_texture_half_float_linear",
"GL_EXT_color_buffer_half_float",
"GL_EXT_color_buffer_float",
"GL_CHROMIUM_color_buffer_float_rgba",
"GL_CHROMIUM_color_buffer_float_rgb",
};
} // namespace } // namespace
namespace angle namespace angle
...@@ -58,6 +73,150 @@ class WebGLCompatibilityTest : public ANGLETest ...@@ -58,6 +73,150 @@ class WebGLCompatibilityTest : public ANGLETest
eglGetProcAddress("glRequestExtensionANGLE")); eglGetProcAddress("glRequestExtensionANGLE"));
} }
template <typename T>
void TestFloatTextureFormat(GLenum internalFormat,
GLenum format,
GLenum type,
bool texturingEnabled,
bool linearSamplingEnabled,
bool renderingEnabled,
const T textureData[4],
const float floatData[4])
{
ASSERT_GL_NO_ERROR();
const std::string samplingVs =
"attribute vec4 position;\n"
"varying vec2 texcoord;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(position.xy, 0.0, 1.0);\n"
" texcoord = (position.xy * 0.5) + 0.5;\n"
"}\n";
const std::string samplingFs =
"precision mediump float;\n"
"uniform sampler2D tex;\n"
"uniform vec4 subtractor;\n"
"varying vec2 texcoord;\n"
"void main()\n"
"{\n"
" vec4 color = texture2D(tex, texcoord);\n"
" if (abs(color.r - subtractor.r) +\n"
" abs(color.g - subtractor.g) +\n"
" abs(color.b - subtractor.b) +\n"
" abs(color.a - subtractor.a) < 8.0)\n"
" {\n"
" gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n"
" }\n"
" else\n"
" {\n"
" gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n"
" }\n"
"}\n";
ANGLE_GL_PROGRAM(samplingProgram, samplingVs, samplingFs);
glUseProgram(samplingProgram.get());
GLRenderbuffer rbo;
glBindRenderbuffer(GL_RENDERBUFFER, rbo.get());
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, 1, 1);
GLFramebuffer fbo;
glBindFramebuffer(GL_FRAMEBUFFER, fbo.get());
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, rbo.get());
GLTexture texture;
glBindTexture(GL_TEXTURE_2D, texture.get());
if (internalFormat == format)
{
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, 1, 1, 0, format, type, textureData);
}
else
{
if (getClientMajorVersion() >= 3)
{
glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
}
else
{
ASSERT_TRUE(extensionEnabled("GL_EXT_texture_storage"));
glTexStorage2DEXT(GL_TEXTURE_2D, 1, internalFormat, 1, 1);
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 1, 1, format, type, textureData);
}
if (!texturingEnabled)
{
// Depending on the entry point and client version, different errors may be generated
ASSERT_GLENUM_NE(GL_NO_ERROR, glGetError());
// Two errors may be generated in the glTexStorage + glTexSubImage case, clear the
// second error
glGetError();
return;
}
ASSERT_GL_NO_ERROR();
glUniform1i(glGetUniformLocation(samplingProgram.get(), "tex"), 0);
glUniform4fv(glGetUniformLocation(samplingProgram.get(), "subtractor"), 1, floatData);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
drawQuad(samplingProgram.get(), "position", 0.5f, 1.0f, true);
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
drawQuad(samplingProgram.get(), "position", 0.5f, 1.0f, true);
if (linearSamplingEnabled)
{
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::green);
}
else
{
EXPECT_PIXEL_COLOR_EQ(0, 0, GLColor::red);
}
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture.get(),
0);
glBindTexture(GL_TEXTURE_2D, 0);
if (!renderingEnabled)
{
EXPECT_GLENUM_EQ(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT,
glCheckFramebufferStatus(GL_FRAMEBUFFER));
return;
}
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
const std::string renderingVs =
"attribute vec4 position;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(position.xy, 0.0, 1.0);\n"
"}\n";
const std::string renderingFs =
"precision mediump float;\n"
"uniform vec4 writeValue;\n"
"void main()\n"
"{\n"
" gl_FragColor = writeValue;\n"
"}\n";
ANGLE_GL_PROGRAM(renderingProgram, renderingVs, renderingFs);
glUseProgram(renderingProgram.get());
glUniform4fv(glGetUniformLocation(renderingProgram.get(), "writeValue"), 1, floatData);
drawQuad(renderingProgram.get(), "position", 0.5f, 1.0f, true);
EXPECT_PIXEL_COLOR32F_NEAR(
0, 0, GLColor32F(floatData[0], floatData[1], floatData[2], floatData[3]), 1.0f);
}
// Called from RenderingFeedbackLoopWithDrawBuffersEXT. // Called from RenderingFeedbackLoopWithDrawBuffersEXT.
void drawBuffersEXTFeedbackLoop(GLuint program, void drawBuffersEXTFeedbackLoop(GLuint program,
const std::array<GLenum, 2> &drawBuffers, const std::array<GLenum, 2> &drawBuffers,
...@@ -1341,6 +1500,447 @@ TEST_P(WebGLCompatibilityTest, CompressedTextureS3TC) ...@@ -1341,6 +1500,447 @@ TEST_P(WebGLCompatibilityTest, CompressedTextureS3TC)
ASSERT_GL_ERROR(GL_INVALID_OPERATION); ASSERT_GL_ERROR(GL_INVALID_OPERATION);
} }
TEST_P(WebGLCompatibilityTest, L32FTextures)
{
constexpr float textureData[] = {15.1f, 0.0f, 0.0f, 0.0f};
constexpr float readPixelData[] = {textureData[0], textureData[0], textureData[0], 1.0f};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized L 32F
{
bool texture = extensionEnabled("GL_OES_texture_float");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT, texture, filter, render,
textureData, readPixelData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized L 32F
bool texture = extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_storage");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_LUMINANCE32F_EXT, GL_LUMINANCE, GL_FLOAT, texture, filter,
render, textureData, readPixelData);
}
}
}
TEST_P(WebGLCompatibilityTest, A32FTextures)
{
constexpr float textureData[] = {33.33f, 0.0f, 0.0f, 0.0f};
constexpr float readPixelData[] = {0.0f, 0.0f, 0.0f, textureData[0]};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized A 32F
{
bool texture = extensionEnabled("GL_OES_texture_float");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_ALPHA, GL_ALPHA, GL_FLOAT, texture, filter, render,
textureData, readPixelData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized A 32F
bool texture = extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_storage");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_ALPHA32F_EXT, GL_ALPHA, GL_FLOAT, texture, filter, render,
textureData, readPixelData);
}
}
}
TEST_P(WebGLCompatibilityTest, LA32FTextures)
{
constexpr float textureData[] = {-0.21f, 15.1f, 0.0f, 0.0f};
constexpr float readPixelData[] = {textureData[0], textureData[0], textureData[0],
textureData[1]};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized LA 32F
{
bool texture = extensionEnabled("GL_OES_texture_float");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT, texture,
filter, render, textureData, readPixelData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized LA 32F
bool texture = extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_storage");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = false;
TestFloatTextureFormat(GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA, GL_FLOAT, texture,
filter, render, textureData, readPixelData);
}
}
}
TEST_P(WebGLCompatibilityTest, R32FTextures)
{
constexpr float data[] = {1000.0f, 0.0f, 0.0f, 1.0f};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized R 32F
{
bool texture =
extensionEnabled("GL_OES_texture_float") && extensionEnabled("GL_EXT_texture_rg");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RED, GL_RED, GL_FLOAT, texture, filter, render, data, data);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized R 32F
bool texture =
(getClientMajorVersion() >= 3) || (extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_rg") &&
extensionEnabled("GL_EXT_texture_storage"));
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_R32F, GL_RED, GL_FLOAT, texture, filter, render, data, data);
}
}
}
TEST_P(WebGLCompatibilityTest, RG32FTextures)
{
constexpr float data[] = {1000.0f, -0.001f, 0.0f, 1.0f};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RG 32F
{
bool texture =
(extensionEnabled("GL_OES_texture_float") && extensionEnabled("GL_EXT_texture_rg"));
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RG, GL_RG, GL_FLOAT, texture, filter, render, data, data);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RG 32F
bool texture =
(getClientMajorVersion() >= 3) || (extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_rg") &&
extensionEnabled("GL_EXT_texture_storage"));
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RG32F, GL_RG, GL_FLOAT, texture, filter, render, data, data);
}
}
}
TEST_P(WebGLCompatibilityTest, RGB32FTextures)
{
constexpr float data[] = {1000.0f, -500.0f, 10.0f, 1.0f};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RGB 32F
{
bool texture = extensionEnabled("GL_OES_texture_float");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb");
TestFloatTextureFormat(GL_RGB, GL_RGB, GL_FLOAT, texture, filter, render, data, data);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RGBA 32F
bool texture =
(getClientMajorVersion() >= 3) || (extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_storage"));
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_CHROMIUM_color_buffer_float_rgb");
TestFloatTextureFormat(GL_RGB32F, GL_RGB, GL_FLOAT, texture, filter, render, data,
data);
}
}
}
TEST_P(WebGLCompatibilityTest, RGBA32FTextures)
{
constexpr float data[] = {7000.0f, 100.0f, 33.0f, -1.0f};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RGBA 32F
{
bool texture = extensionEnabled("GL_OES_texture_float");
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float") ||
extensionEnabled("GL_CHROMIUM_color_buffer_float_rgba");
TestFloatTextureFormat(GL_RGBA, GL_RGBA, GL_FLOAT, texture, filter, render, data, data);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RGBA 32F
bool texture =
(getClientMajorVersion() >= 3) || (extensionEnabled("GL_OES_texture_float") &&
extensionEnabled("GL_EXT_texture_storage"));
bool filter = extensionEnabled("GL_OES_texture_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_float") ||
extensionEnabled("GL_CHROMIUM_color_buffer_float_rgba");
TestFloatTextureFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT, texture, filter, render, data,
data);
}
}
}
TEST_P(WebGLCompatibilityTest, R16FTextures)
{
constexpr float readPixelsData[] = {-5000.0f, 0.0f, 0.0f, 1.0f};
const GLushort textureData[] = {
gl::float32ToFloat16(readPixelsData[0]), gl::float32ToFloat16(readPixelsData[1]),
gl::float32ToFloat16(readPixelsData[2]), gl::float32ToFloat16(readPixelsData[3])};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized R 16F (OES)
{
bool texture = extensionEnabled("GL_OES_texture_half_float") &&
extensionEnabled("GL_EXT_texture_rg");
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float");
TestFloatTextureFormat(GL_RED, GL_RED, GL_HALF_FLOAT_OES, texture, filter, render,
textureData, readPixelsData);
}
// Unsized R 16F
{
bool texture = false;
bool filter = false;
bool render = false;
TestFloatTextureFormat(GL_RED, GL_RED, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized R 16F
bool texture = getClientMajorVersion() >= 3;
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float") ||
extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_R16F, GL_RED, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
}
}
TEST_P(WebGLCompatibilityTest, RG16FTextures)
{
constexpr float readPixelsData[] = {7108.0f, -10.0f, 0.0f, 1.0f};
const GLushort textureData[] = {
gl::float32ToFloat16(readPixelsData[0]), gl::float32ToFloat16(readPixelsData[1]),
gl::float32ToFloat16(readPixelsData[2]), gl::float32ToFloat16(readPixelsData[3])};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RG 16F (OES)
{
bool texture = extensionEnabled("GL_OES_texture_half_float") &&
extensionEnabled("GL_EXT_texture_rg");
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float") &&
extensionEnabled("GL_EXT_texture_rg");
TestFloatTextureFormat(GL_RG, GL_RG, GL_HALF_FLOAT_OES, texture, filter, render,
textureData, readPixelsData);
}
// Unsized RG 16F
{
bool texture = false;
bool filter = false;
bool render = false;
TestFloatTextureFormat(GL_RG, GL_RG, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RG 16F
bool texture = getClientMajorVersion() >= 3;
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float") ||
extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RG16F, GL_RG, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
}
}
TEST_P(WebGLCompatibilityTest, RGB16FTextures)
{
constexpr float readPixelsData[] = {7000.0f, 100.0f, 33.0f, 1.0f};
const GLushort textureData[] = {
gl::float32ToFloat16(readPixelsData[0]), gl::float32ToFloat16(readPixelsData[1]),
gl::float32ToFloat16(readPixelsData[2]), gl::float32ToFloat16(readPixelsData[3])};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RGB 16F (OES)
{
bool texture = extensionEnabled("GL_OES_texture_half_float");
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float");
TestFloatTextureFormat(GL_RGB, GL_RGB, GL_HALF_FLOAT_OES, texture, filter, render,
textureData, readPixelsData);
}
// Unsized RGB 16F
{
bool texture = false;
bool filter = false;
bool render = false;
TestFloatTextureFormat(GL_RGB, GL_RGB, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RGB 16F
bool texture = getClientMajorVersion() >= 3;
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float");
TestFloatTextureFormat(GL_RGB16F, GL_RGB, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
}
}
TEST_P(WebGLCompatibilityTest, RGBA16FTextures)
{
constexpr float readPixelsData[] = {7000.0f, 100.0f, 33.0f, -1.0f};
const GLushort textureData[] = {
gl::float32ToFloat16(readPixelsData[0]), gl::float32ToFloat16(readPixelsData[1]),
gl::float32ToFloat16(readPixelsData[2]), gl::float32ToFloat16(readPixelsData[3])};
for (auto extension : FloatingPointTextureExtensions)
{
if (strlen(extension) > 0 && extensionRequestable(extension))
{
glRequestExtensionANGLE(extension);
ASSERT_GL_NO_ERROR();
}
// Unsized RGBA 16F (OES)
{
bool texture = extensionEnabled("GL_OES_texture_half_float");
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float") ||
extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES, texture, filter, render,
textureData, readPixelsData);
}
// Unsized RGBA 16F
{
bool texture = false;
bool filter = false;
bool render = false;
TestFloatTextureFormat(GL_RGBA, GL_RGBA, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
if (getClientMajorVersion() >= 3 || extensionEnabled("GL_EXT_texture_storage"))
{
// Sized RGBA 16F
bool texture = getClientMajorVersion() >= 3;
bool filter = getClientMajorVersion() >= 3 ||
extensionEnabled("GL_OES_texture_half_float_linear");
bool render = extensionEnabled("GL_EXT_color_buffer_half_float") ||
extensionEnabled("GL_EXT_color_buffer_float");
TestFloatTextureFormat(GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, texture, filter, render,
textureData, readPixelsData);
}
}
}
// This tests that rendering feedback loops works as expected with WebGL 2. // This tests that rendering feedback loops works as expected with WebGL 2.
// Based on WebGL test conformance2/rendering/rendering-sampling-feedback-loop.html // Based on WebGL test conformance2/rendering/rendering-sampling-feedback-loop.html
TEST_P(WebGL2CompatibilityTest, RenderingFeedbackLoopWithDrawBuffers) TEST_P(WebGL2CompatibilityTest, RenderingFeedbackLoopWithDrawBuffers)
...@@ -1608,20 +2208,28 @@ TEST_P(WebGL2CompatibilityTest, ClearBufferTypeCompatibity) ...@@ -1608,20 +2208,28 @@ TEST_P(WebGL2CompatibilityTest, ClearBufferTypeCompatibity)
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
// Float buffer // Float buffer
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 1, 1, 0, GL_RGBA, GL_FLOAT, nullptr); if (extensionRequestable("GL_EXT_color_buffer_float"))
ASSERT_GL_NO_ERROR(); {
glRequestExtensionANGLE("GL_EXT_color_buffer_float");
}
glClearBufferfv(GL_COLOR, 0, clearFloat); if (extensionEnabled("GL_EXT_color_buffer_float"))
EXPECT_GL_NO_ERROR(); {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 1, 1, 0, GL_RGBA, GL_FLOAT, nullptr);
ASSERT_GL_NO_ERROR();
glClearBufferiv(GL_COLOR, 0, clearInt); glClearBufferfv(GL_COLOR, 0, clearFloat);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_NO_ERROR();
glClearBufferuiv(GL_COLOR, 0, clearUint); glClearBufferiv(GL_COLOR, 0, clearInt);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glClear(GL_COLOR_BUFFER_BIT); glClearBufferuiv(GL_COLOR, 0, clearUint);
EXPECT_GL_NO_ERROR(); EXPECT_GL_ERROR(GL_INVALID_OPERATION);
glClear(GL_COLOR_BUFFER_BIT);
EXPECT_GL_NO_ERROR();
}
// Normalized uint buffer // Normalized uint buffer
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
...@@ -1713,7 +2321,6 @@ ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest, ...@@ -1713,7 +2321,6 @@ ANGLE_INSTANTIATE_TEST(WebGLCompatibilityTest,
ES2_D3D9(), ES2_D3D9(),
ES2_D3D11(), ES2_D3D11(),
ES3_D3D11(), ES3_D3D11(),
ES2_D3D11_FL9_3(),
ES2_OPENGL(), ES2_OPENGL(),
ES3_OPENGL(), ES3_OPENGL(),
ES2_OPENGLES(), ES2_OPENGLES(),
......
...@@ -600,7 +600,9 @@ void ANGLETest::checkD3D11SDKLayersMessages() ...@@ -600,7 +600,9 @@ void ANGLETest::checkD3D11SDKLayersMessages()
static bool checkExtensionExists(const char *allExtensions, const std::string &extName) static bool checkExtensionExists(const char *allExtensions, const std::string &extName)
{ {
return strstr(allExtensions, extName.c_str()) != nullptr; const std::string paddedExtensions = std::string(" ") + allExtensions + std::string(" ");
return paddedExtensions.find(std::string(" ") + extName + std::string(" ")) !=
std::string::npos;
} }
bool ANGLETest::extensionEnabled(const std::string &extName) bool ANGLETest::extensionEnabled(const std::string &extName)
......
...@@ -154,10 +154,25 @@ GLColor32F ReadColor32F(GLint x, GLint y); ...@@ -154,10 +154,25 @@ GLColor32F ReadColor32F(GLint x, GLint y);
EXPECT_NEAR((a), pixel[3], abs_error); \ EXPECT_NEAR((a), pixel[3], abs_error); \
} }
#define EXPECT_PIXEL32F_NEAR(x, y, r, g, b, a, abs_error) \
\
{ \
GLfloat pixel[4]; \
glReadPixels((x), (y), 1, 1, GL_RGBA, GL_FLOAT, pixel); \
EXPECT_GL_NO_ERROR(); \
EXPECT_NEAR((r), pixel[0], abs_error); \
EXPECT_NEAR((g), pixel[1], abs_error); \
EXPECT_NEAR((b), pixel[2], abs_error); \
EXPECT_NEAR((a), pixel[3], abs_error); \
}
// TODO(jmadill): Figure out how we can use GLColor's nice printing with EXPECT_NEAR. // TODO(jmadill): Figure out how we can use GLColor's nice printing with EXPECT_NEAR.
#define EXPECT_PIXEL_COLOR_NEAR(x, y, angleColor, abs_error) \ #define EXPECT_PIXEL_COLOR_NEAR(x, y, angleColor, abs_error) \
EXPECT_PIXEL_NEAR(x, y, angleColor.R, angleColor.G, angleColor.B, angleColor.A, abs_error) EXPECT_PIXEL_NEAR(x, y, angleColor.R, angleColor.G, angleColor.B, angleColor.A, abs_error)
#define EXPECT_PIXEL_COLOR32F_NEAR(x, y, angleColor, abs_error) \
EXPECT_PIXEL32F_NEAR(x, y, angleColor.R, angleColor.G, angleColor.B, angleColor.A, abs_error)
#define EXPECT_COLOR_NEAR(expected, actual, abs_error) \ #define EXPECT_COLOR_NEAR(expected, actual, abs_error) \
\ \
{ \ { \
......
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