Set Metal minimum version for iOS to 9.0.

Flutter uses a minimum deployment version of 9.0, and we keep breaking
their roll with unguarded features. This will help catch those sooner.

Change-Id: Idd98b2ac985c36f5c793ff27b5a4b59014875ee5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448257
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Erik Rose <erikrose@google.com>
This commit is contained in:
Jim Van Verth 2021-09-14 08:36:55 -04:00 committed by SkCQ
parent eae4ad9bc0
commit 8d9e313db8
4 changed files with 55 additions and 52 deletions

View File

@ -133,8 +133,9 @@ def compile_fn(api, checkout_root, out_dir):
api.step('select xcode', [
'sudo', 'xcode-select', '-switch', xcode_app_path])
if 'iOS' in extra_tokens:
# Can't compile for Metal before 11.0.
env['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
# Need to verify compilation for Metal on 9.0 and above
env['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
args['ios_min_target'] = '"9.0"'
else:
# We have some bots on 10.13.
env['MACOSX_DEPLOYMENT_TARGET'] = '10.13'

View File

@ -60,7 +60,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ccache stats-start"
@ -70,7 +70,7 @@
"[START_DIR]/cache/work/skia/bin/gn",
"gen",
"[START_DIR]/cache/work/skia/out/Build-Mac-Clang-arm64-Debug-iOS/Debug",
"--args=cc=\"clang\" cc_wrapper=\"[START_DIR]/ccache_mac/bin/ccache\" cxx=\"clang++\" extra_cflags=[\"-DREBUILD_IF_CHANGED_xcode_build_version=12c33\", \"-O1\"] skia_ios_identity=\".*GS9WA.*\" skia_ios_profile=\"[START_DIR]/provisioning_profile_ios/Upstream_Testing_Provisioning_Profile.mobileprovision\" target_cpu=\"arm64\" target_os=\"ios\" werror=true"
"--args=cc=\"clang\" cc_wrapper=\"[START_DIR]/ccache_mac/bin/ccache\" cxx=\"clang++\" extra_cflags=[\"-DREBUILD_IF_CHANGED_xcode_build_version=12c33\", \"-O1\"] ios_min_target=\"9.0\" skia_ios_identity=\".*GS9WA.*\" skia_ios_profile=\"[START_DIR]/provisioning_profile_ios/Upstream_Testing_Provisioning_Profile.mobileprovision\" target_cpu=\"arm64\" target_os=\"ios\" werror=true"
],
"cwd": "[START_DIR]/cache/work/skia",
"env": {
@ -79,7 +79,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "gn gen"
@ -97,7 +97,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ninja"
@ -114,7 +114,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ccache stats-end"

View File

@ -60,7 +60,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ccache stats-start"
@ -70,7 +70,7 @@
"[START_DIR]/cache/work/skia/bin/gn",
"gen",
"[START_DIR]/cache/work/skia/out/Build-Mac-Xcode11.4.1-arm64-Debug-iOS/Debug",
"--args=cc_wrapper=\"[START_DIR]/ccache_mac/bin/ccache\" extra_cflags=[\"-DREBUILD_IF_CHANGED_xcode_build_version=11e503a\", \"-O1\"] skia_ios_identity=\".*GS9WA.*\" skia_ios_profile=\"[START_DIR]/provisioning_profile_ios/Upstream_Testing_Provisioning_Profile.mobileprovision\" target_cpu=\"arm64\" target_os=\"ios\" werror=true"
"--args=cc_wrapper=\"[START_DIR]/ccache_mac/bin/ccache\" extra_cflags=[\"-DREBUILD_IF_CHANGED_xcode_build_version=11e503a\", \"-O1\"] ios_min_target=\"9.0\" skia_ios_identity=\".*GS9WA.*\" skia_ios_profile=\"[START_DIR]/provisioning_profile_ios/Upstream_Testing_Provisioning_Profile.mobileprovision\" target_cpu=\"arm64\" target_os=\"ios\" werror=true"
],
"cwd": "[START_DIR]/cache/work/skia",
"env": {
@ -79,7 +79,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "gn gen"
@ -97,7 +97,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ninja"
@ -114,7 +114,7 @@
"CCACHE_MAXFILES": "0",
"CCACHE_MAXSIZE": "50G",
"CHROME_HEADLESS": "1",
"IPHONEOS_DEPLOYMENT_TARGET": "11.0",
"IPHONEOS_DEPLOYMENT_TARGET": "9.0",
"PATH": "<PATH>:RECIPE_REPO[depot_tools]"
},
"name": "ccache stats-end"

View File

@ -19,53 +19,55 @@
#include "src/gpu/mtl/GrMtlTextureRenderTarget.h"
DEF_GPUTEST_FOR_METAL_CONTEXT(MtlCopySurfaceTest, reporter, ctxInfo) {
static const int kWidth = 1024;
static const int kHeight = 768;
if (@available(macOS 11.0, iOS 9.0, *)) {
static const int kWidth = 1024;
static const int kHeight = 768;
auto context = ctxInfo.directContext();
auto context = ctxInfo.directContext();
// This is a bit weird, but it's the only way to get a framebufferOnly surface
GrMtlGpu* gpu = (GrMtlGpu*) context->priv().getGpu();
// This is a bit weird, but it's the only way to get a framebufferOnly surface
GrMtlGpu* gpu = (GrMtlGpu*) context->priv().getGpu();
MTKView* view = [[MTKView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)
device:gpu->device()];
id<CAMetalDrawable> drawable = [view currentDrawable];
REPORTER_ASSERT(reporter, drawable.texture.framebufferOnly);
REPORTER_ASSERT(reporter, drawable.texture.usage & MTLTextureUsageRenderTarget);
MTKView* view = [[MTKView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)
device:gpu->device()];
id<CAMetalDrawable> drawable = [view currentDrawable];
REPORTER_ASSERT(reporter, drawable.texture.framebufferOnly);
REPORTER_ASSERT(reporter, drawable.texture.usage & MTLTextureUsageRenderTarget);
// Test to see if we can initiate a copy via GrSurfaceProxys
SkSurfaceProps props(0, kRGB_H_SkPixelGeometry);
// Test to see if we can initiate a copy via GrSurfaceProxys
SkSurfaceProps props(0, kRGB_H_SkPixelGeometry);
// TODO: check multisampled RT as well
GrMtlTextureInfo fbInfo;
fbInfo.fTexture.retain((__bridge const void*)(drawable.texture));
GrBackendRenderTarget backendRT(kWidth, kHeight, fbInfo);
// TODO: check multisampled RT as well
GrMtlTextureInfo fbInfo;
fbInfo.fTexture.retain((__bridge const void*)(drawable.texture));
GrBackendRenderTarget backendRT(kWidth, kHeight, fbInfo);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrSurfaceProxy> srcProxy = proxyProvider->wrapBackendRenderTarget(backendRT, nullptr);
GrProxyProvider* proxyProvider = context->priv().proxyProvider();
sk_sp<GrSurfaceProxy> srcProxy = proxyProvider->wrapBackendRenderTarget(backendRT, nullptr);
auto dstProxy = GrSurfaceProxy::Copy(context,
srcProxy,
kTopLeft_GrSurfaceOrigin,
GrMipmapped::kNo,
SkBackingFit::kExact,
SkBudgeted::kYes);
auto dstProxy = GrSurfaceProxy::Copy(context,
srcProxy,
kTopLeft_GrSurfaceOrigin,
GrMipmapped::kNo,
SkBackingFit::kExact,
SkBudgeted::kYes);
// TODO: GrSurfaceProxy::Copy doesn't check to see if the framebufferOnly bit is set yet.
// Update this when it does -- it should fail.
if (!dstProxy) {
ERRORF(reporter, "Expected copy to succeed");
// TODO: GrSurfaceProxy::Copy doesn't check to see if the framebufferOnly bit is set yet.
// Update this when it does -- it should fail.
if (!dstProxy) {
ERRORF(reporter, "Expected copy to succeed");
}
// Try direct copy via GPU (should fail)
GrBackendFormat backendFormat = GrBackendFormat::MakeMtl(drawable.texture.pixelFormat);
GrSurface* src = srcProxy->peekSurface();
sk_sp<GrTexture> dst =
gpu->createTexture({kWidth, kHeight}, backendFormat, GrTextureType::k2D,
GrRenderable::kNo, 1, GrMipmapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
bool result = gpu->copySurface(dst.get(), src, SkIRect::MakeXYWH(0, 0, kWidth, kHeight),
SkIPoint::Make(0, 0));
REPORTER_ASSERT(reporter, !result);
}
// Try direct copy via GPU (should fail)
GrBackendFormat backendFormat = GrBackendFormat::MakeMtl(drawable.texture.pixelFormat);
GrSurface* src = srcProxy->peekSurface();
sk_sp<GrTexture> dst =
gpu->createTexture({kWidth, kHeight}, backendFormat, GrTextureType::k2D,
GrRenderable::kNo, 1, GrMipmapped::kNo, SkBudgeted::kNo,
GrProtected::kNo);
bool result = gpu->copySurface(dst.get(), src, SkIRect::MakeXYWH(0, 0, kWidth, kHeight),
SkIPoint::Make(0, 0));
REPORTER_ASSERT(reporter, !result);
}