| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "../igpuinfo.h" |
| 7 | #include "core/idatasource.h" |
| 8 | #include <cstddef> |
| 9 | #include <memory> |
| 10 | #include <string> |
| 11 | #include <string_view> |
| 12 | #include <vector> |
| 13 | |
| 14 | class GPUInfoOpenGL final : public IGPUInfo::IProvider |
| 15 | { |
| 16 | public: |
| 17 | struct Keys |
| 18 | { |
| 19 | static constexpr std::string_view coreVersion{"glcorev"}; |
| 20 | static constexpr std::string_view compatVersion{"glcompv"}; |
| 21 | }; |
| 22 | |
| 23 | GPUInfoOpenGL( |
| 24 | std::unique_ptr<IDataSource<std::string, int const>> &&dataSource) noexcept; |
| 25 | |
| 26 | std::vector<std::pair<std::string, std::string>> |
| 27 | provideInfo(Vendor vendor, int gpuIndex, IGPUInfo::Path const &path, |
| 28 | IHWIDTranslator const &hwIDTranslator) const override; |
| 29 | |
| 30 | std::vector<std::string> |
| 31 | provideCapabilities(Vendor vendor, int, |
| 32 | IGPUInfo::Path const &path) const override; |
| 33 | |
| 34 | private: |
| 35 | std::string findItem(std::string const &src, std::string_view itemStr, |
| 36 | size_t pos) const; |
| 37 | |
| 38 | std::unique_ptr<IDataSource<std::string, int const>> const dataSource_; |
| 39 | static bool registered_; |
| 40 | }; |