Commit 0bb42e09 by Le Hoang Quyen Committed by Commit Bot

Metal: Enable end2end tests.

Explicitly disabled tests: - DifferentStencilMasksTest.DrawWithDifferentMask - PointSpritesTest.PointSizeAboveMaxIsClamped - WebGL2ReadOutsideFramebufferTest.CopyTexSubImage3D Bug: angleproject:2634 Change-Id: I76ab450c06d0e1be1e7469a8b9c6497684c3ca54 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1906607 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 1f13f5e6
......@@ -270,7 +270,7 @@ egl::ConfigSet DisplayMtl::generateConfigs()
config.bindToTextureRGB = EGL_FALSE;
config.bindToTextureRGBA = EGL_FALSE;
config.surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
config.surfaceType = EGL_WINDOW_BIT;
config.minSwapInterval = 1;
config.maxSwapInterval = 1;
......
......@@ -142,6 +142,10 @@ VertexArrayMtl::VertexArrayMtl(const gl::VertexArrayState &state, ContextMtl *co
// buffer for every conversion.
mDynamicVertexData(true)
{
for (BufferHolderMtl *&buffer : mCurrentArrayBuffers)
{
buffer = nullptr;
}
for (size_t &offset : mCurrentArrayBufferOffsets)
{
offset = 0;
......
......@@ -117,6 +117,7 @@ TEST_P(EGLChooseConfigTest, Defaults)
ANGLE_INSTANTIATE_TEST(EGLChooseConfigTest,
ES2_D3D11(),
ES2_D3D9(),
ES2_METAL(),
ES2_OPENGL(),
ES2_OPENGLES(),
ES2_VULKAN());
......@@ -102,7 +102,16 @@ class BlendMinMaxTest : public ANGLETest
{
EXPECT_NEAR(
getExpected(blendMin, color.values[componentIdx], prevColor[componentIdx]),
pixel[componentIdx], errorRange);
pixel[componentIdx], errorRange)
<< " blendMin=" << blendMin << " componentIdx=" << componentIdx << std::endl
<< " color.values[0]=" << color.values[0]
<< " prevColor[0]=" << prevColor[0] << std::endl
<< " color.values[1]=" << color.values[1]
<< " prevColor[1]=" << prevColor[1] << std::endl
<< " color.values[2]=" << color.values[2]
<< " prevColor[2]=" << prevColor[2] << std::endl
<< " color.values[3]=" << color.values[3]
<< " prevColor[3]=" << prevColor[3];
}
}
......
......@@ -428,6 +428,9 @@ TEST_P(CopyTexImageTest, CopyTexSubImageFromCubeMap)
// Calling CopyTexSubImage to a non-cube-complete texture.
TEST_P(CopyTexImageTest, CopyTexSubImageToNonCubeCompleteDestination)
{
// TODO(hqle): Find what wrong with NVIDIA GPU. http://anglebug.com/4137
ANGLE_SKIP_TEST_IF(IsNVIDIA() && IsMetal());
constexpr GLsizei kCubeMapFaceCount = 6;
// The framebuffer will be a 1x6 image with 6 different colors. Each glCopyTexSubImage2D will
......@@ -804,6 +807,7 @@ ANGLE_INSTANTIATE_TEST(CopyTexImageTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_D3D11_PRESENT_PATH_FAST(),
ES2_METAL(),
ES2_OPENGL(),
ES2_OPENGLES(),
ES2_VULKAN(),
......
......@@ -62,6 +62,9 @@ TEST_P(CubeMapTextureTest, RenderToFacesConsecutively)
// http://anglebug.com/3145
ANGLE_SKIP_TEST_IF(IsVulkan() && IsIntel() && IsFuchsia());
// TODO(hqle): Find what wrong with NVIDIA GPU. http://anglebug.com/4138
ANGLE_SKIP_TEST_IF(IsNVIDIA() && IsMetal());
const GLfloat faceColors[] = {
1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f,
1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f,
......
......@@ -67,6 +67,9 @@ TEST_P(DifferentStencilMasksTest, DrawWithSameEffectiveMask)
// Tests that effectively different front and back masks are illegal.
TEST_P(DifferentStencilMasksTest, DrawWithDifferentMask)
{
// TODO(hqle): Make this test work for Metal. http://anglebug.com/4134
ANGLE_SKIP_TEST_IF(IsMetal());
glStencilMaskSeparate(GL_FRONT, 0x0001);
glStencilMaskSeparate(GL_BACK, 0x0002);
......
......@@ -112,6 +112,7 @@ ANGLE_INSTANTIATE_TEST(ErrorMessagesTest,
ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_METAL(),
ES2_OPENGL(),
ES3_OPENGL(),
ES2_OPENGLES(),
......
......@@ -6153,6 +6153,7 @@ void main()
static_cast<GLfloat>(getWindowHeight()));
// Draw to backbuffer.
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_POINTS, 0, 1);
ASSERT_GL_NO_ERROR();
......@@ -6172,6 +6173,7 @@ void main()
ASSERT_GLENUM_EQ(GL_FRAMEBUFFER_COMPLETE, glCheckFramebufferStatus(GL_FRAMEBUFFER));
// Draw to user FBO.
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_POINTS, 0, 1);
ASSERT_GL_NO_ERROR();
......
......@@ -209,6 +209,7 @@ ANGLE_INSTANTIATE_TEST(IndexBufferOffsetTest,
ES2_D3D9(),
ES2_D3D11(),
ES3_D3D11(),
ES2_METAL(),
ES2_OPENGL(),
ES3_OPENGL(),
ES2_OPENGLES(),
......
......@@ -480,6 +480,10 @@ TEST_P(PointSpritesTest, PointSizeAboveMaxIsClamped)
// rendered at all on AMD. http://anglebug.com/2113
ANGLE_SKIP_TEST_IF(IsAMD() && IsVulkan());
// TODO(hqle): Metal on macbook also has problem with drawing point outside framebuffer.
// http://anglebug.com/4135
ANGLE_SKIP_TEST_IF(IsMetal());
GLfloat pointSizeRange[2] = {};
glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, pointSizeRange);
GLfloat maxPointSize = pointSizeRange[1];
......
......@@ -2250,6 +2250,8 @@ TEST_P(SimpleStateChangeTest, UpdateTextureInUse)
void SimpleStateChangeTest::updateTextureBoundToFramebufferHelper(UpdateFunc updateFunc)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_framebuffer_blit"));
std::vector<GLColor> red(4, GLColor::red);
std::vector<GLColor> green(4, GLColor::green);
......@@ -2316,6 +2318,8 @@ TEST_P(SimpleStateChangeTest, TexSubImageOnTextureBoundToFrambuffer)
// Tests that CopyTexSubImage updates are flushed before rendering.
TEST_P(SimpleStateChangeTest, CopyTexSubImageOnTextureBoundToFrambuffer)
{
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_ANGLE_framebuffer_blit"));
GLTexture copySource;
glBindTexture(GL_TEXTURE_2D, copySource);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
......
......@@ -377,6 +377,9 @@ TEST_P(WebGLReadOutsideFramebufferTest, CopyTexImage2D)
// the corresponding source pixel is outside the framebuffer.
TEST_P(WebGL2ReadOutsideFramebufferTest, CopyTexSubImage3D)
{
// TODO(hqle): Metal doesn't implement 3D texture yet.
// http://anglebug.com/4136 (ES2 renderer is mistakenly included in this test)
ANGLE_SKIP_TEST_IF(IsMetal());
// http://anglebug.com/4092
ANGLE_SKIP_TEST_IF(IsVulkan() || IsD3D9() || IsD3D11());
// Robust CopyTexSubImage3D behaviour is not implemented on OpenGL.
......
......@@ -149,6 +149,7 @@ TEST_P(EGLMakeCurrentPerfTest, Run)
ANGLE_INSTANTIATE_TEST(EGLMakeCurrentPerfTest,
angle::ES2_D3D9(),
angle::ES2_D3D11(),
angle::ES2_METAL(),
angle::ES2_OPENGL(),
angle::ES2_OPENGLES(),
angle::ES2_VULKAN());
......
......@@ -524,6 +524,12 @@ inline bool IsSwiftShader(const GPUTestConfig::API &api)
return (api == GPUTestConfig::kAPISwiftShader);
}
// Check whether the backend API has been set to Metal in the constructor
inline bool IsMetal(const GPUTestConfig::API &api)
{
return (api == GPUTestConfig::kAPIMetal);
}
} // anonymous namespace
// Load all conditions in the constructor since this data will not change during a test set.
......@@ -562,6 +568,7 @@ GPUTestConfig::GPUTestConfig()
mConditions[kConditionGLES] = true;
mConditions[kConditionVulkan] = true;
mConditions[kConditionSwiftShader] = true;
mConditions[kConditionMetal] = true;
mConditions[kConditionNexus5X] = IsNexus5X();
mConditions[kConditionPixel2OrXL] = IsPixel2() || IsPixel2XL();
......@@ -577,6 +584,7 @@ GPUTestConfig::GPUTestConfig(const API &api) : GPUTestConfig()
mConditions[kConditionGLES] = IsGLES(api);
mConditions[kConditionVulkan] = IsVulkan(api);
mConditions[kConditionSwiftShader] = IsSwiftShader(api);
mConditions[kConditionMetal] = IsMetal(api);
}
// Return a const reference to the list of all pre-calculated conditions.
......
......@@ -24,6 +24,7 @@ struct GPUTestConfig
kAPIGLES,
kAPIVulkan,
kAPISwiftShader,
kAPIMetal,
};
enum Condition
......@@ -59,6 +60,7 @@ struct GPUTestConfig
kConditionGLDesktop,
kConditionGLES,
kConditionVulkan,
kConditionMetal,
kConditionNexus5X,
kConditionPixel2OrXL,
kConditionNVIDIAQuadroP400,
......
......@@ -10,6 +10,8 @@
#import <Cocoa/Cocoa.h>
#include "common/apple_platform_utils.h"
// OSX 10.8 deprecates Gestalt but doesn't make the operatingSystemVersion property part of the
// public interface of NSProcessInfo until 10.10. Add a forward declaration.
#if !defined(MAC_OS_X_VERSION_10_10) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
......@@ -27,7 +29,7 @@ void GetOperatingSystemVersionNumbers(int32_t *majorVersion, int32_t *minorVersi
Gestalt(gestaltSystemVersionMajor, reinterpret_cast<SInt32 *>(majorVersion));
Gestalt(gestaltSystemVersionMinor, reinterpret_cast<SInt32 *>(minorVersion));
#else
if (@available(macOS 10.10, *))
if (ANGLE_APPLE_AVAILABLE_XC(10.10, 13.0))
{
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
*majorVersion = static_cast<int32_t>(version.majorVersion);
......
......@@ -71,6 +71,7 @@ enum Token
kConfigGLES,
kConfigVulkan,
kConfigSwiftShader,
kConfigMetal,
// Android devices
kConfigNexus5X,
kConfigPixel2,
......@@ -162,6 +163,7 @@ constexpr TokenInfo kTokenData[kNumberOfTokens] = {
{"gles", GPUTestConfig::kConditionGLES},
{"vulkan", GPUTestConfig::kConditionVulkan},
{"swiftshader", GPUTestConfig::kConditionSwiftShader},
{"metal", GPUTestConfig::kConditionMetal},
{"nexus5x", GPUTestConfig::kConditionNexus5X},
{"pixel2orxl", GPUTestConfig::kConditionPixel2OrXL},
{"quadrop400", GPUTestConfig::kConditionNVIDIAQuadroP400},
......@@ -432,6 +434,7 @@ bool GPUTestExpectationsParser::parseLine(const GPUTestConfig &config,
case kConfigGLES:
case kConfigVulkan:
case kConfigSwiftShader:
case kConfigMetal:
case kConfigNexus5X:
case kConfigPixel2:
case kConfigNVIDIAQuadroP400:
......
......@@ -43,6 +43,7 @@ class GPUTestConfigTest : public ANGLETest
bool GLDesktop = false;
bool GLES = false;
bool Vulkan = false;
bool Metal = false;
switch (api)
{
case GPUTestConfig::kAPID3D9:
......@@ -60,6 +61,9 @@ class GPUTestConfigTest : public ANGLETest
case GPUTestConfig::kAPIVulkan:
Vulkan = true;
break;
case GPUTestConfig::kAPIMetal:
Metal = true;
break;
case GPUTestConfig::kAPIUnknown:
default:
break;
......@@ -69,6 +73,7 @@ class GPUTestConfigTest : public ANGLETest
EXPECT_EQ(GLDesktop, config.getConditions()[GPUTestConfig::kConditionGLDesktop]);
EXPECT_EQ(GLES, config.getConditions()[GPUTestConfig::kConditionGLES]);
EXPECT_EQ(Vulkan, config.getConditions()[GPUTestConfig::kConditionVulkan]);
EXPECT_EQ(Metal, config.getConditions()[GPUTestConfig::kConditionMetal]);
}
};
......@@ -94,6 +99,12 @@ TEST_P(GPUTestConfigTest, GPUTestConfigConditions_D3D11)
validateConfigAPI(config, GPUTestConfig::kAPID3D11);
}
TEST_P(GPUTestConfigTest, GPUTestConfigConditions_Metal)
{
GPUTestConfig config(GPUTestConfig::kAPIMetal);
validateConfigAPI(config, GPUTestConfig::kAPIMetal);
}
TEST_P(GPUTestConfigTest, GPUTestConfigConditions_GLDesktop)
{
GPUTestConfig config(GPUTestConfig::kAPIGLDesktop);
......
......@@ -1280,6 +1280,13 @@ bool IsVulkan()
return (rendererString.find("Vulkan") != std::string::npos);
}
bool IsMetal()
{
const char *renderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
std::string rendererString(renderer);
return (rendererString.find("Metal") != std::string::npos);
}
bool IsDebug()
{
#if !defined(NDEBUG)
......
......@@ -581,6 +581,7 @@ bool IsOpenGLES();
bool IsOpenGL();
bool IsNULL();
bool IsVulkan();
bool IsMetal();
// Debug/Release
bool IsDebug();
......
......@@ -87,6 +87,9 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
stream << "D3D11";
break;
case EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE:
stream << "Metal";
break;
case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
stream << "Null";
break;
......@@ -407,6 +410,11 @@ EGLPlatformParameters VULKAN_SWIFTSHADER()
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_VULKAN_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE,
EGL_PLATFORM_ANGLE_DEVICE_TYPE_SWIFTSHADER_ANGLE);
}
EGLPlatformParameters METAL()
{
return EGLPlatformParameters(EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE);
}
} // namespace egl_platform
// ANGLE tests platforms
......@@ -690,6 +698,21 @@ PlatformParameters ES31_VULKAN_NULL()
return PlatformParameters(3, 1, egl_platform::VULKAN_NULL());
}
PlatformParameters ES1_METAL()
{
return PlatformParameters(1, 0, egl_platform::METAL());
}
PlatformParameters ES2_METAL()
{
return PlatformParameters(2, 0, egl_platform::METAL());
}
PlatformParameters ES3_METAL()
{
return PlatformParameters(3, 0, egl_platform::METAL());
}
PlatformParameters ES2_WGL()
{
return PlatformParameters(2, 0, GLESDriverType::SystemWGL);
......
......@@ -181,6 +181,10 @@ PlatformParameters ES3_VULKAN_NULL();
PlatformParameters ES31_VULKAN();
PlatformParameters ES31_VULKAN_NULL();
PlatformParameters ES1_METAL();
PlatformParameters ES2_METAL();
PlatformParameters ES3_METAL();
PlatformParameters ES2_WGL();
PlatformParameters ES3_WGL();
......
......@@ -314,8 +314,16 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters
return false;
}
// Currently we only support the OpenGL back-end on OSX.
return (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE);
if (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE && IsIntel(vendorID))
{
// TODO(hqle): Intel metal tests seem to have problems. Disable for now.
// http://anglebug.com/4133
return false;
}
// Currently we only support the OpenGL & Metal back-end on OSX.
return (param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE ||
param.getRenderer() == EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE);
}
if (IsFuchsia())
......@@ -458,6 +466,13 @@ bool IsPlatformAvailable(const PlatformParameters &param)
break;
#endif
case EGL_PLATFORM_ANGLE_TYPE_METAL_ANGLE:
#if !defined(ANGLE_ENABLE_METAL)
return false;
#else
break;
#endif
case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE:
#ifndef ANGLE_ENABLE_NULL
return false;
......
......@@ -103,7 +103,7 @@ struct CombinedPrintToStringParamName
#define ANGLE_ALL_TEST_PLATFORMS_ES1 ES1_D3D11(), ES1_OPENGL(), ES1_OPENGLES(), ES1_VULKAN()
#define ANGLE_ALL_TEST_PLATFORMS_ES2 \
ES2_D3D9(), ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN()
ES2_D3D9(), ES2_D3D11(), ES2_OPENGL(), ES2_OPENGLES(), ES2_VULKAN(), ES2_METAL()
#define ANGLE_ALL_TEST_PLATFORMS_ES3 ES3_D3D11(), ES3_OPENGL(), ES3_OPENGLES(), ES3_VULKAN()
......
......@@ -655,6 +655,11 @@ bool OSXWindow::initialize(const std::string &name, int width, int height)
}
[mView setWantsLayer:YES];
// Disable scaling for this view. If scaling is enabled, the metal backend's
// frame buffer's size will be this window's size multiplied by contentScale.
// It will cause inconsistent testing & example apps' results.
mView.layer.contentsScale = 1;
[mWindow setContentView:mView];
[mWindow setTitle:[NSString stringWithUTF8String:name.c_str()]];
[mWindow setAcceptsMouseMovedEvents:YES];
......
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