Commit 6fcc0bb8 by Le Hoang Quyen Committed by Commit Bot

Metal: Re-add end2end test configs (running test is still disabled)

angle_test_instantiate.cpp & angle_test_instantiate_apple.mm: - Disabled metal platform selection on pre-10.13 mac devices for Bug: angleproject:4153 Explicitly disabled tests on metal: - DifferentStencilMasksTest.DrawWithDifferentMask - PointSpritesTest.PointSizeAboveMaxIsClamped - WebGL2ReadOutsideFramebufferTest.CopyTexSubImage3D This requires the crash fix in http://crrev.com/c/1924101 Bug: angleproject:4153 Bug: angleproject:2634 Change-Id: I95046d731a8ba7414cf1a1f4b6f2940282725872 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1926389 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 84c074cf
......@@ -274,7 +274,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;
......
......@@ -179,6 +179,10 @@ if (is_win || is_linux || is_mac || is_android) {
sources += angle_white_box_tests_vulkan_sources
}
if (is_mac) {
sources += angle_white_box_tests_mac_sources
}
configs += [
"${angle_root}:libANGLE_config",
"${angle_root}:library_name_config",
......@@ -488,6 +492,12 @@ if (build_angle_gles1_conform_tests) {
"test_utils/angle_test_instantiate.h",
"test_utils/gl_raii.h",
]
if (is_mac) {
sources += [
"test_utils/angle_test_instantiate_apple.h",
"test_utils/angle_test_instantiate_apple.mm",
]
}
main = "angle_end2end_tests_main"
configs += [
......
......@@ -164,6 +164,8 @@ angle_end2end_tests_sources = [
angle_end2end_tests_mac_sources = [
"egl_tests/EGLDeviceCGLTest.cpp",
"egl_tests/EGLIOSurfaceClientBufferTest.cpp",
"test_utils/angle_test_instantiate_apple.mm",
"test_utils/angle_test_instantiate_apple.h",
]
angle_end2end_tests_win_sources = [
"gl_tests/D3DImageFormatConversionTest.cpp",
......
......@@ -19,6 +19,13 @@ _angle_perf_test_common_sources = [
"test_utils/gl_raii.h",
]
if (is_mac) {
_angle_perf_test_common_sources += [
"test_utils/angle_test_instantiate_apple.mm",
"test_utils/angle_test_instantiate_apple.h",
]
}
angle_perf_tests_sources = _angle_perf_test_common_sources + [
"perf_tests/BlitFramebufferPerf.cpp",
"perf_tests/BindingPerf.cpp",
......
......@@ -25,3 +25,7 @@ angle_white_box_tests_vulkan_sources = [
"gl_tests/VulkanFormatTablesTest.cpp",
"gl_tests/VulkanUniformUpdatesTest.cpp",
]
angle_white_box_tests_mac_sources = [
"test_utils/angle_test_instantiate_apple.mm",
"test_utils/angle_test_instantiate_apple.h",
]
......@@ -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
......
......@@ -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);
......
......@@ -6161,6 +6161,7 @@ void main()
static_cast<GLfloat>(getWindowHeight()));
// Draw to backbuffer.
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_POINTS, 0, 1);
ASSERT_GL_NO_ERROR();
......@@ -6180,6 +6181,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();
......
......@@ -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];
......
......@@ -2252,6 +2252,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);
......@@ -2318,6 +2320,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.
......
......@@ -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)
......
......@@ -587,6 +587,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
......@@ -710,6 +718,21 @@ PlatformParameters ES31_VULKAN_SWIFTSHADER()
return PlatformParameters(3, 1, egl_platform::VULKAN_SWIFTSHADER());
}
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);
......
......@@ -185,6 +185,10 @@ PlatformParameters ES31_VULKAN();
PlatformParameters ES31_VULKAN_NULL();
PlatformParameters ES31_VULKAN_SWIFTSHADER();
PlatformParameters ES1_METAL();
PlatformParameters ES2_METAL();
PlatformParameters ES3_METAL();
PlatformParameters ES2_WGL();
PlatformParameters ES3_WGL();
......
......@@ -26,6 +26,10 @@
# include "util/windows/WGLWindow.h"
#endif // defined(ANGLE_PLATFORM_WINDOWS)
#if defined(ANGLE_PLATFORM_APPLE)
# include "test_utils/angle_test_instantiate_apple.h"
#endif
namespace angle
{
namespace
......@@ -300,6 +304,7 @@ bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters
}
}
#if defined(ANGLE_PLATFORM_APPLE)
if (IsOSX())
{
// We do not support non-ANGLE bindings on OSX.
......@@ -314,9 +319,19 @@ 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 &&
(!IsMetalRendererAvailable() || 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);
}
#endif // #if defined(ANGLE_PLATFORM_APPLE)
if (IsFuchsia())
{
......@@ -467,6 +482,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;
......
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file includes APIs to detect whether certain Apple renderer is availabe for testing.
//
#ifndef ANGLE_TEST_INSTANTIATE_APPLE_H_
#define ANGLE_TEST_INSTANTIATE_APPLE_H_
namespace angle
{
bool IsMetalRendererAvailable();
} // namespace angle
#endif // ANGLE_TEST_INSTANTIATE_APPLE_H_
//
// Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file includes APIs to detect whether certain Apple renderer is availabe for testing.
//
#include "test_utils/angle_test_instantiate_apple.h"
#include "common/apple_platform_utils.h"
namespace angle
{
bool IsMetalRendererAvailable()
{
// NOTE(hqle): This code is currently duplicated with rx::IsMetalDisplayAvailable().
// Consider move it to a common source code accessible to both libANGLE and test apps.
if (ANGLE_APPLE_AVAILABLE_XCI(10.13, 13.0, 11))
{
return true;
}
return false;
}
} // namespace angle
......@@ -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