mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
Merge 1e5555374bbe9b5a2c831e649190fc4743c9d339 into c04410ca00f33162d0875bc8500d3f8185bc73df
This commit is contained in:
commit
c3cb154abd
@ -1,5 +1,13 @@
|
|||||||
#include "dxvk_device_filter.h"
|
#include "dxvk_device_filter.h"
|
||||||
|
|
||||||
|
std::string convertUUID(const uint8_t uuid[VK_UUID_SIZE]) {
|
||||||
|
std::ostringstream stream;
|
||||||
|
for (unsigned int i = 0; i < VK_UUID_SIZE; i++) {
|
||||||
|
stream << static_cast<uint32_t>(uuid[i]);
|
||||||
|
}
|
||||||
|
return stream.str();
|
||||||
|
}
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxvkDeviceFilter::DxvkDeviceFilter(
|
DxvkDeviceFilter::DxvkDeviceFilter(
|
||||||
@ -7,12 +15,15 @@ namespace dxvk {
|
|||||||
const DxvkOptions& options)
|
const DxvkOptions& options)
|
||||||
: m_flags(flags) {
|
: m_flags(flags) {
|
||||||
m_matchDeviceName = env::getEnvVar("DXVK_FILTER_DEVICE_NAME");
|
m_matchDeviceName = env::getEnvVar("DXVK_FILTER_DEVICE_NAME");
|
||||||
|
m_matchDeviceUUID = env::getEnvVar("DXVK_FILTER_DEVICE_UUID");
|
||||||
|
|
||||||
if (m_matchDeviceName.empty())
|
if (m_matchDeviceName.empty())
|
||||||
m_matchDeviceName = options.deviceFilter;
|
m_matchDeviceName = options.deviceFilter;
|
||||||
|
|
||||||
if (!m_matchDeviceName.empty())
|
if (!m_matchDeviceName.empty())
|
||||||
m_flags.set(DxvkDeviceFilterFlag::MatchDeviceName);
|
m_flags.set(DxvkDeviceFilterFlag::MatchDeviceName);
|
||||||
|
if (!m_matchDeviceUUID.empty())
|
||||||
|
m_flags.set(DxvkDeviceFilterFlag::MatchDeviceUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,5 +53,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DxvkDeviceFilter::testCreatedAdapter(const DxvkDeviceInfo& deviceInfo) const {
|
||||||
|
if (m_flags.test(DxvkDeviceFilterFlag::MatchDeviceUUID)) {
|
||||||
|
if (convertUUID(deviceInfo.coreDeviceId.deviceUUID).find(m_matchDeviceUUID) == std::string::npos)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
enum class DxvkDeviceFilterFlag {
|
enum class DxvkDeviceFilterFlag {
|
||||||
MatchDeviceName = 0,
|
MatchDeviceName = 0,
|
||||||
SkipCpuDevices = 1,
|
MatchDeviceUUID = 1,
|
||||||
|
SkipCpuDevices = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
using DxvkDeviceFilterFlags = Flags<DxvkDeviceFilterFlag>;
|
using DxvkDeviceFilterFlags = Flags<DxvkDeviceFilterFlag>;
|
||||||
@ -46,13 +47,23 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
bool testAdapter(
|
bool testAdapter(
|
||||||
const VkPhysicalDeviceProperties& properties) const;
|
const VkPhysicalDeviceProperties& properties) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Tests a created adapter
|
||||||
|
*
|
||||||
|
* \param [in] properties Adapter properties
|
||||||
|
* \returns \c true if the test passes
|
||||||
|
*/
|
||||||
|
bool testCreatedAdapter(
|
||||||
|
const DxvkDeviceInfo& deviceInfo) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DxvkDeviceFilterFlags m_flags;
|
DxvkDeviceFilterFlags m_flags;
|
||||||
|
|
||||||
std::string m_matchDeviceName;
|
std::string m_matchDeviceName;
|
||||||
|
std::string m_matchDeviceUUID;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -264,9 +264,11 @@ namespace dxvk {
|
|||||||
uint32_t numIGPU = 0;
|
uint32_t numIGPU = 0;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < numAdapters; i++) {
|
for (uint32_t i = 0; i < numAdapters; i++) {
|
||||||
if (filter.testAdapter(deviceProperties[i])) {
|
if (filter.testAdapter(deviceProperties[i]))
|
||||||
result.push_back(new DxvkAdapter(m_vki, adapters[i]));
|
result.push_back(new DxvkAdapter(m_vki, adapters[i]));
|
||||||
|
if (!filter.testCreatedAdapter(result.back()->devicePropertiesExt())) {
|
||||||
|
result.pop_back();
|
||||||
|
} else {
|
||||||
if (deviceProperties[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
|
if (deviceProperties[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
|
||||||
numDGPU += 1;
|
numDGPU += 1;
|
||||||
else if (deviceProperties[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)
|
else if (deviceProperties[i].deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user