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,27 +702,17 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -708,27 +702,17 @@ 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,27 +744,17 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) ...@@ -760,27 +744,17 @@ 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)
{ {
......
...@@ -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] =
......
...@@ -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