gpu_feature_info.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Copyright (c) 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef GPU_CONFIG_GPU_FEATURE_INFO_H_
  5. #define GPU_CONFIG_GPU_FEATURE_INFO_H_
  6. #include <string>
  7. #include <vector>
  8. #include "gpu/config/gpu_feature_type.h"
  9. #include "gpu/gpu_export.h"
  10. namespace gfx {
  11. enum class BufferFormat;
  12. }
  13. namespace gl {
  14. class GLContext;
  15. } // namespace gl
  16. namespace gpu {
  17. // Flags indicating the status of a GPU feature (see gpu_feature_type.h).
  18. enum GpuFeatureStatus {
  19. kGpuFeatureStatusEnabled,
  20. kGpuFeatureStatusBlocklisted,
  21. kGpuFeatureStatusDisabled,
  22. kGpuFeatureStatusSoftware,
  23. kGpuFeatureStatusUndefined,
  24. kGpuFeatureStatusMax
  25. };
  26. struct GPU_EXPORT GpuFeatureInfo {
  27. GpuFeatureInfo();
  28. GpuFeatureInfo(const GpuFeatureInfo&);
  29. GpuFeatureInfo(GpuFeatureInfo&&);
  30. ~GpuFeatureInfo();
  31. // Set the GL workarounds and disabled GL extensions to the context.
  32. void ApplyToGLContext(gl::GLContext* context) const;
  33. bool IsWorkaroundEnabled(int32_t workaround) const;
  34. // Return true if GpuFeatureInfo is computed.
  35. bool IsInitialized() const;
  36. GpuFeatureInfo& operator=(const GpuFeatureInfo&);
  37. GpuFeatureInfo& operator=(GpuFeatureInfo&&);
  38. // A vector of GpuFeatureStatus values, one per GpuFeatureType.
  39. // By default, all features are disabled.
  40. GpuFeatureStatus status_values[NUMBER_OF_GPU_FEATURE_TYPES];
  41. // Active gpu driver bug workaround IDs.
  42. // See gpu/config/gpu_driver_bug_workaround_type.h for ID mappings.
  43. std::vector<int32_t> enabled_gpu_driver_bug_workarounds;
  44. // Disabled extensions separated by whitespaces.
  45. std::string disabled_extensions;
  46. // Disabled WebGL extensions separated by whitespaces.
  47. std::string disabled_webgl_extensions;
  48. // Applied gpu blocklist entry indices.
  49. std::vector<uint32_t> applied_gpu_blocklist_entries;
  50. // Applied gpu driver bug list entry indices.
  51. std::vector<uint32_t> applied_gpu_driver_bug_list_entries;
  52. // BufferFormats that can be allocated and then bound, if known and provided
  53. // by the platform.
  54. std::vector<gfx::BufferFormat>
  55. supported_buffer_formats_for_allocation_and_texturing;
  56. };
  57. } // namespace gpu
  58. #endif // GPU_CONFIG_GPU_FEATURE_INFO_H_