| 869 | } |
| 870 | |
| 871 | bool RgVulkanBackend::Build() |
| 872 | { |
| 873 | std::vector<std::string> target_names; |
| 874 | bool status = GetTargetGPUNames(target_names); |
| 875 | if (status) |
| 876 | { |
| 877 | // If target GPU is not specified, build for the 1st physical adapter installed on the system. |
| 878 | // Otherwise, build for the GPU specified by user. |
| 879 | if (config_.target_gpu.empty()) |
| 880 | { |
| 881 | status = BuildForDevice(""); |
| 882 | } |
| 883 | else |
| 884 | { |
| 885 | auto target_gpu = std::find_if(target_names.cbegin(), target_names.cend(), |
| 886 | [&](const std::string& s) {return IsSubstringIgnoreCase(s, config_.target_gpu); }); |
| 887 | |
| 888 | if (target_gpu != target_names.cend()) |
| 889 | { |
| 890 | // Set the DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1 |
| 891 | // environment variable to enable the RGA driver stack on APUs. |
| 892 | EnvVar var_apu_workaround(kStrVulkanEnvVarDisableLayerAmdSwitchableGraphicsName, |
| 893 | kStrVulkanEnvVarDisableLayerAmdSwitchableGraphicsValue); |
| 894 | |
| 895 | // Set "AMDVLK_NULL_GPU = target_gpu_name" environment variable. |
| 896 | EnvVar var(kStrVulkanEnvVarAllGpuName, *target_gpu); |
| 897 | |
| 898 | status = BuildForDevice(*target_gpu); |
| 899 | } |
| 900 | else |
| 901 | { |
| 902 | std::cerr << kStrVulkanErrorInvalidGpu << config_.target_gpu << std::endl; |
| 903 | } |
| 904 | } |
| 905 | } |
| 906 | |
| 907 | return status; |
| 908 | } |
| 909 | |
| 910 | void RgVulkanBackend::PrintValidationHint() |
| 911 | { |
no test coverage detected