[go: nahoru, domu]

blob: 2199be12839b99a5483ed06e513061d332df5861 [file] [log] [blame]
Austin Engeb681252023-03-13 23:18:531// Copyright 2023 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "gpu/config/webgpu_blocklist.h"
6
7#include "base/metrics/field_trial_params.h"
Scott Violete9edfaa2023-11-16 02:08:588#include "build/build_config.h"
Austin Engeb681252023-03-13 23:18:539#include "gpu/config/gpu_finch_features.h"
10#include "ui/gl/buildflags.h"
11
12#if BUILDFLAG(USE_DAWN)
Scott Violete9edfaa2023-11-16 02:08:5813#include "gpu/config/webgpu_blocklist_impl.h" // nogncheck
Austin Engeb681252023-03-13 23:18:5314#endif
15
16namespace gpu {
17
18namespace {
19
Scott Violete9edfaa2023-11-16 02:08:5820#if BUILDFLAG(USE_DAWN)
Austin Engeb681252023-03-13 23:18:5321// List of patterns, delimited by |. Each pattern is of the form:
22// `vendorId(:deviceIdOrArchitecture(:driverDescription)?)?`
23// Vendor and device ids should be in hexadecimal representation, without a
24// leading `0x`.
25// The FeatureParam may be overriden via Finch config, or via the command line
26// with
Austin Eng79f5c0e2023-10-05 18:23:4527// --force-fieldtrial-params=WebGPU.Enabled:AdapterBlockList/params
Austin Engeb681252023-03-13 23:18:5328// where `params` is URL-encoded.
29const base::FeatureParam<std::string> kAdapterBlockList{
30 &features::kWebGPUService, "AdapterBlockList", ""};
Scott Violete9edfaa2023-11-16 02:08:5831#endif
Austin Engeb681252023-03-13 23:18:5332
33} // namespace
34
35bool IsWebGPUAdapterBlocklisted(const WGPUAdapterProperties& properties) {
Austin Engeb681252023-03-13 23:18:5336#if BUILDFLAG(USE_DAWN)
Scott Violete9edfaa2023-11-16 02:08:5837 return IsWebGPUAdapterBlocklisted(properties, kAdapterBlockList.Get());
Austin Engeb681252023-03-13 23:18:5338#else
39 return true;
40#endif
41}
42
43} // namespace gpu