Commit 510c81be authored by Robert Sesek's avatar Robert Sesek Committed by Chromium LUCI CQ

mac: Remove code to support OS X 10.10 in //components/metal_util

Bug: 1153883
Change-Id: Ieb2ee69ba93e0469cbe307dfb1f12687a0a1a702
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572379
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833778}
parent 79872ef1
...@@ -12,28 +12,23 @@ ...@@ -12,28 +12,23 @@
namespace metal { namespace metal {
MTLDevicePtr CreateDefaultDevice() { MTLDevicePtr CreateDefaultDevice() {
if (@available(macOS 10.11, *)) { // First attempt to find a low power device to use.
// First attempt to find a low power device to use. base::scoped_nsprotocol<id<MTLDevice>> device_to_use;
base::scoped_nsprotocol<id<MTLDevice>> device_to_use; base::scoped_nsobject<NSArray<id<MTLDevice>>> devices(MTLCopyAllDevices());
base::scoped_nsobject<NSArray<id<MTLDevice>>> devices(MTLCopyAllDevices()); for (id<MTLDevice> device in devices.get()) {
for (id<MTLDevice> device in devices.get()) { if ([device isLowPower]) {
if ([device isLowPower]) { device_to_use.reset(device, base::scoped_policy::RETAIN);
device_to_use.reset(device, base::scoped_policy::RETAIN); break;
break;
}
} }
// Failing that, use the system default device.
if (!device_to_use)
device_to_use.reset(MTLCreateSystemDefaultDevice());
if (!device_to_use) {
DLOG(ERROR) << "Failed to find MTLDevice.";
return nullptr;
}
return device_to_use.release();
} }
// If no device was found, or if the macOS version is too old for Metal, // Failing that, use the system default device.
// return no context provider. if (!device_to_use)
return nullptr; device_to_use.reset(MTLCreateSystemDefaultDevice());
if (!device_to_use) {
DLOG(ERROR) << "Failed to find MTLDevice.";
return nullptr;
}
return device_to_use.release();
} }
} // namespace metal } // namespace metal
...@@ -697,8 +697,7 @@ base::ScopedDispatchObject<dispatch_data_t> GetLibraryData() { ...@@ -697,8 +697,7 @@ base::ScopedDispatchObject<dispatch_data_t> GetLibraryData() {
} }
// State shared between the compiler callback and the caller. // State shared between the compiler callback and the caller.
class API_AVAILABLE(macos(10.11)) TestShaderState class TestShaderState : public base::RefCountedThreadSafe<TestShaderState> {
: public base::RefCountedThreadSafe<TestShaderState> {
public: public:
TestShaderState(TestShaderCallback callback, TestShaderState(TestShaderCallback callback,
TestShaderComponent component, TestShaderComponent component,
......
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