| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/info/gpuinfo.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include "gpuinfo.h"cxx . . $ `<file>/src/core/info/gpuinfo.h`/ |
| 5 | |
| 6 | #include <algorithm> |
| 7 | #include <iterator> |
| 8 | #include <utility> |
| 9 | |
| 10 | GPUInfocxx . . $ GPUInfo#::GPUInfocxx . . $ GPUInfo#GPUInfo(88a5808916d38e5d).(Vendorcxx . . $ Vendor# vendor, int index, IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# &&path) noexcept |
| 11 | : vendor_cxx . . $ GPUInfo#vendor_.(vendor) |
| 12 | , index_cxx . . $ GPUInfo#index_.(index) |
| 13 | , path_cxx . . $ GPUInfo#path_.(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(path)) |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | Vendorcxx . . $ Vendor# GPUInfocxx . . $ GPUInfo#::vendorcxx . . $ GPUInfo#vendor(f3352d101b4b8e0).() const |
| 18 | { |
| 19 | return vendor_cxx . . $ GPUInfo#vendor_.; |
| 20 | } |
| 21 | |
| 22 | int GPUInfocxx . . $ GPUInfo#::indexcxx . . $ GPUInfo#index(455f465bc33b4cdf).() const |
| 23 | { |
| 24 | return index_cxx . . $ GPUInfo#index_.; |
| 25 | } |
| 26 | |
| 27 | IGPUInfocxx . . $ IGPUInfo#::Pathcxx . . $ IGPUInfo#Path# const &GPUInfocxx . . $ GPUInfo#::pathcxx . . $ GPUInfo#path(f79b37054f6b84d7).() const |
| 28 | { |
| 29 | return path_cxx . . $ GPUInfo#path_.; |
| 30 | } |
| 31 | |
| 32 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> GPUInfocxx . . $ GPUInfo#::keyscxx . . $ GPUInfo#keys(491c255a7e496038).() const |
| 33 | { |
| 34 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> keyscxx . . $ std/vector#vector(49f6e7a06ebc5aa8).; |
| 35 | keys.reservecxx . . $ std/vector#reserve(2c44cd906ae4e829).(info_cxx . . $ GPUInfo#info_..sizecxx . . $ std/unordered_map#size(fe713de6d184c8a).()); |
| 36 | |
| 37 | auto const keySelector = [](auto const &pair) { return pair.first; }; |
| 38 | stdcxx . . $ std/::transformcxx . . $ std/transform(da30451c4a040264).(info_cxx . . $ GPUInfo#info_..cbegincxx . . $ std/unordered_map#cbegin(f3c6e12ee1fe7252).(), info_cxx . . $ GPUInfo#info_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).(), stdcxx . . $ std/::back_insertercxx . . $ std/back_inserter(7b559d6bdd90ff74).(keys), |
| 39 | keySelector); |
| 40 | |
| 41 | return keyscxx . . $ std/vector#vector(6f559d22b039ccdb).; |
| 42 | } |
| 43 | |
| 44 | stdcxx . . $ std/::stringcxx . . $ std/string# GPUInfocxx . . $ GPUInfo#::infocxx . . $ GPUInfo#info(3654cd48a63d288).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# key) const |
| 45 | { |
| 46 | auto const dataIt = info_cxx . . $ GPUInfo#info_..findcxx . . $ std/unordered_map#find(f39fe4bedfa7a693).(stdcxx . . $ std/::stringcxx . . $ std/string#(key)); |
| 47 | if (dataIt != info_cxx . . $ GPUInfo#info_..cendcxx . . $ std/unordered_map#cend(f3c6e12ee1fe7252).()) |
| 48 | return dataItcxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).->cxx . . $ std/__detail/_Node_const_iterator#`operator->`(8e614c7de0b1573e).secondcxx . . $ std/pair#second.; |
| 49 | |
| 50 | return stdcxx . . $ std/__cxx11/basic_string#basic_string(925dcc5e17f50391).::stringcxx . . $ std/string#{}; |
| 51 | } |
| 52 | |
| 53 | bool GPUInfocxx . . $ GPUInfo#::hasCapabilitycxx . . $ GPUInfo#hasCapability(aa6d140991badc75).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# name) const |
| 54 | { |
| 55 | return capabilities_cxx . . $ GPUInfo#capabilities_..countcxx . . $ std/unordered_set#count(2f4fc31398af827b).(stdcxx . . $ std/::stringcxx . . $ std/string#(name)) > 0; |
| 56 | } |
| 57 | |
| 58 | void GPUInfocxx . . $ GPUInfo#::initializecxx . . $ GPUInfo#initialize(c158fff4aa1693ae).( |
| 59 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<IGPUInfocxx . . $ IGPUInfo#::IProvidercxx . . $ IGPUInfo#IProvider#>> const &providers, |
| 60 | IHWIDTranslatorcxx . . $ IHWIDTranslator# const &hwidTranslator) |
| 61 | { |
| 62 | for (auto const &provider : providers) { |
| 63 | auto infos = provider->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).provideInfocxx . . $ IGPUInfo#IProvider#provideInfo(5b65f7e996e13d80).(vendor_cxx . . $ GPUInfo#vendor_., index_cxx . . $ GPUInfo#index_., path_cxx . . $ GPUInfo#path_., hwidTranslator); |
| 64 | for (auto &info : infos) |
| 65 | info_cxx . . $ GPUInfo#info_..emplacecxx . . $ std/unordered_map#emplace(8e800962ae7274b6).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(info)); |
| 66 | |
| 67 | auto capabilities = provider->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).provideCapabilitiescxx . . $ IGPUInfo#IProvider#provideCapabilities(da28437f5803dad2).(vendor_cxx . . $ GPUInfo#vendor_., index_cxx . . $ GPUInfo#index_., path_cxx . . $ GPUInfo#path_.); |
| 68 | for (auto &capability : capabilities) |
| 69 | capabilities_cxx . . $ GPUInfo#capabilities_..emplacecxx . . $ std/unordered_set#emplace(422e73f5886d780d).(stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26).(capability)); |
| 70 | } |
| 71 | } |