Commit 83dc2c4b authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

Metal: Test offline-compiled shader link time

Change metal_util::TestShader to test either compile or link, and
change the default behavior to link.

Ensure that the Metal calls for the test are invoked on a thread
that has base::TaskPriority::HIGHEST.

Bug: 974219
Change-Id: I6d2db6c40182286a4af3489968a995dca73e7944
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024922Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736148}
parent 29fe082f
...@@ -20,7 +20,10 @@ component("metal_util") { ...@@ -20,7 +20,10 @@ component("metal_util") {
"types.h", "types.h",
] ]
deps = [ "//base" ] deps = [
"//base",
"//components/crash/core/common:crash_key",
]
libs = [ libs = [
"Cocoa.framework", "Cocoa.framework",
......
include_rules = [ include_rules = [
"+components/crash/core/common/crash_key.h",
] ]
...@@ -12,6 +12,13 @@ ...@@ -12,6 +12,13 @@
namespace metal { namespace metal {
enum class METAL_UTIL_EXPORT TestShaderComponent {
// Test a shader compile from source.
kCompile,
// Test linking a precompiled shader.
kLink,
};
enum class METAL_UTIL_EXPORT TestShaderResult { enum class METAL_UTIL_EXPORT TestShaderResult {
// Not attempted (e.g, because macOS version does not support Metal). // Not attempted (e.g, because macOS version does not support Metal).
kNotAttempted, kNotAttempted,
...@@ -37,7 +44,7 @@ constexpr base::TimeDelta kTestShaderTimeForever = ...@@ -37,7 +44,7 @@ constexpr base::TimeDelta kTestShaderTimeForever =
base::TimeDelta::FromMinutes(3); base::TimeDelta::FromMinutes(3);
// A default delay before attempting to compile the test shader. // A default delay before attempting to compile the test shader.
constexpr base::TimeDelta kTestShaderDelay = base::TimeDelta::FromSeconds(90); constexpr base::TimeDelta kTestShaderDelay = base::TimeDelta::FromMinutes(3);
// Attempt to asynchronously compile a trivial Metal shader. If |delay| is zero, // Attempt to asynchronously compile a trivial Metal shader. If |delay| is zero,
// then compile synchronously, otherwise, post a delayed task to do the compile. // then compile synchronously, otherwise, post a delayed task to do the compile.
...@@ -51,7 +58,8 @@ constexpr base::TimeDelta kTestShaderDelay = base::TimeDelta::FromSeconds(90); ...@@ -51,7 +58,8 @@ constexpr base::TimeDelta kTestShaderDelay = base::TimeDelta::FromSeconds(90);
void METAL_UTIL_EXPORT void METAL_UTIL_EXPORT
TestShader(TestShaderCallback callback, TestShader(TestShaderCallback callback,
const base::TimeDelta& delay = kTestShaderDelay, const base::TimeDelta& delay = kTestShaderDelay,
const base::TimeDelta& timeout = kTestShaderTimeout); const base::TimeDelta& timeout = kTestShaderTimeout,
TestShaderComponent component = TestShaderComponent::kLink);
} // namespace metal } // namespace metal
......
This diff is collapsed.
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