Commit fd03e16d 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.

Add inline data for a trivial test shader. Add code to modify the
bitcode, to defeat caching.

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

TBR=jvanverth

Bug: 974219
Change-Id: I35e688c3758af2e03f893a1ccbef7aef6b778b23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2015486Reviewed-by: default avatarccameron <ccameron@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734645}
parent 39c04073
......@@ -12,6 +12,13 @@
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 {
// Not attempted (e.g, because macOS version does not support Metal).
kNotAttempted,
......@@ -37,7 +44,7 @@ constexpr base::TimeDelta kTestShaderTimeForever =
base::TimeDelta::FromMinutes(3);
// 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,
// then compile synchronously, otherwise, post a delayed task to do the compile.
......@@ -51,7 +58,8 @@ constexpr base::TimeDelta kTestShaderDelay = base::TimeDelta::FromSeconds(90);
void METAL_UTIL_EXPORT
TestShader(TestShaderCallback callback,
const base::TimeDelta& delay = kTestShaderDelay,
const base::TimeDelta& timeout = kTestShaderTimeout);
const base::TimeDelta& timeout = kTestShaderTimeout,
TestShaderComponent component = TestShaderComponent::kLink);
} // 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