blob: 97a9c01f6261d6d97deec8bdf895d05444bfcdf7 [file] [log] [blame]
Avi Drissman05dfbc822022-09-13 21:25:341// Copyright 2017 The Chromium Authors
ericrk41a1579e2017-02-10 20:56:282// 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/gpu_feature_info.h"
6
Peter Kastingfb15d032022-09-29 03:06:577#include "base/containers/contains.h"
Chris Blume29bf5362019-09-06 02:34:458#include "gpu/config/gpu_blocklist.h"
Zhenyao Mo2eb1fe52018-01-13 05:49:259#include "gpu/config/gpu_driver_bug_list.h"
Zhenyao Mo08c91492017-08-24 22:57:5710#include "ui/gl/gl_context.h"
11
ericrk41a1579e2017-02-10 20:56:2812namespace gpu {
13
14GpuFeatureInfo::GpuFeatureInfo() {
15 for (auto& status : status_values)
16 status = kGpuFeatureStatusUndefined;
17}
18
Zhenyao Mod4dba1052017-07-27 23:02:3919GpuFeatureInfo::GpuFeatureInfo(const GpuFeatureInfo&) = default;
20
21GpuFeatureInfo::GpuFeatureInfo(GpuFeatureInfo&&) = default;
22
Chris Watkins81030772017-12-07 01:20:5623GpuFeatureInfo::~GpuFeatureInfo() = default;
Zhenyao Mod4dba1052017-07-27 23:02:3924
25GpuFeatureInfo& GpuFeatureInfo::operator=(const GpuFeatureInfo&) = default;
26
27GpuFeatureInfo& GpuFeatureInfo::operator=(GpuFeatureInfo&&) = default;
28
Zhenyao Mo08c91492017-08-24 22:57:5729void GpuFeatureInfo::ApplyToGLContext(gl::GLContext* gl_context) const {
30 DCHECK(gl_context);
Zhenyao Mo08c91492017-08-24 22:57:5731 gl_context->SetDisabledGLExtensions(this->disabled_extensions);
32}
33
34bool GpuFeatureInfo::IsWorkaroundEnabled(int32_t workaround) const {
Peter Kastingfb15d032022-09-29 03:06:5735 return base::Contains(this->enabled_gpu_driver_bug_workarounds, workaround);
Zhenyao Mo08c91492017-08-24 22:57:5736}
37
Zhenyao Mo2eb1fe52018-01-13 05:49:2538bool GpuFeatureInfo::IsInitialized() const {
Zhenyao Mof920e132017-12-19 20:16:5039 // Check if any feature status is undefined.
Sean Gilhuly1e54ddb2019-11-28 18:52:2840 return status_values[GPU_FEATURE_TYPE_ACCELERATED_GL] !=
Zhenyao Mof920e132017-12-19 20:16:5041 kGpuFeatureStatusUndefined;
42}
43
ericrk41a1579e2017-02-10 20:56:2844} // namespace gpu