#ifndef GPU_CONFIG_GPU_TEST_CONFIG_H_
#define GPU_CONFIG_GPU_TEST_CONFIG_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "gpu/config/gpu_config_export.h"
namespace gpu {
struct GPUInfo;
class GPU_CONFIG_EXPORT GPUTestConfig {
public:
enum OS {
kOsUnknown = 0,
kOsWin10 = 1 << 1,
kOsWin = kOsWin10,
kOsMacSequoia = 1 << 10,
kOsMacSnowLeopard = 1 << 11,
kOsMacLion = 1 << 12,
kOsMacMountainLion = 1 << 13,
kOsMacMavericks = 1 << 14,
kOsMacYosemite = 1 << 15,
kOsMacElCapitan = 1 << 16,
kOsMacSierra = 1 << 17,
kOsMacHighSierra = 1 << 18,
kOsMacMojave = 1 << 19,
kOsMacCatalina = 1 << 20,
kOsMacBigSur = 1 << 21,
kOsMacMonterey = 1 << 22,
kOsMacVentura = 1 << 23,
kOsMacSonoma = 1 << 24,
kOsMac = kOsMacSequoia | kOsMacSnowLeopard | kOsMacLion |
kOsMacMountainLion | kOsMacMavericks | kOsMacYosemite |
kOsMacElCapitan | kOsMacSierra | kOsMacHighSierra | kOsMacMojave |
kOsMacCatalina | kOsMacBigSur | kOsMacMonterey | kOsMacVentura |
kOsMacSonoma,
kOsLinux = 1 << 25,
kOsChromeOS = 1 << 26,
kOsAndroid = 1 << 27,
kOsFuchsia = 1 << 28,
kOsIOS = 1 << 29,
};
enum BuildType {
kBuildTypeUnknown = 0,
kBuildTypeRelease = 1 << 0,
kBuildTypeDebug = 1 << 1,
};
enum API {
kAPIUnknown = 0,
kAPID3D9 = 1 << 0,
kAPID3D11 = 1 << 1,
kAPIGLDesktop = 1 << 2,
kAPIGLES = 1 << 3,
};
enum CommandDecoder {
kCommandDecoderUnknown,
kCommandDecoderPassthrough = 1 << 0,
kCommandDecoderValidating = 1 << 1,
};
GPUTestConfig();
GPUTestConfig(const GPUTestConfig& other);
virtual ~GPUTestConfig();
void set_os(int32_t os);
void set_gpu_device_id(uint32_t id);
void set_build_type(int32_t build_type);
void set_api(int32_t api);
void set_command_decoder(int32_t command_decoder);
virtual void AddGPUVendor(uint32_t gpu_vendor);
int32_t os() const { return os_; }
const std::vector<uint32_t>& gpu_vendor() const { return gpu_vendor_; }
uint32_t gpu_device_id() const { return gpu_device_id_; }
int32_t build_type() const { return build_type_; }
int32_t api() const { return api_; }
int32_t command_decoder() const { return command_decoder_; }
virtual bool IsValid() const;
bool OverlapsWith(const GPUTestConfig& config) const;
protected:
void ClearGPUVendor();
private:
int32_t os_;
std::vector<uint32_t> gpu_vendor_;
uint32_t gpu_device_id_;
int32_t build_type_;
int32_t api_;
int32_t command_decoder_;
};
class GPU_CONFIG_EXPORT GPUTestBotConfig : public GPUTestConfig {
public:
GPUTestBotConfig() = default;
~GPUTestBotConfig() override;
void AddGPUVendor(uint32_t gpu_vendor) override;
bool SetGPUInfo(const GPUInfo& gpu_info);
bool IsValid() const override;
bool Matches(const GPUTestConfig& config) const;
bool Matches(const std::string& config_data) const;
bool LoadCurrentConfig(const GPUInfo* gpu_info);
static bool CurrentConfigMatches(const std::string& config_data);
static bool CurrentConfigMatches(const std::vector<std::string>& configs);
static bool GpuBlocklistedOnBot();
};
}
#endif