mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Add new methods to find adapters by LUID or device ID
Co-authored-by: Zhiyi Zhang <zzhang@codeweavers.com>
This commit is contained in:
parent
bb1f431e44
commit
f7b3b9ca5c
@ -37,6 +37,31 @@ namespace dxvk {
|
||||
? m_adapters[index]
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkAdapter> DxvkInstance::findAdapterByLuid(const void* luid) const {
|
||||
for (const auto& adapter : m_adapters) {
|
||||
const auto& props = adapter->devicePropertiesExt().coreDeviceId;
|
||||
|
||||
if (props.deviceLUIDValid && !std::memcmp(luid, props.deviceLUID, VK_LUID_SIZE))
|
||||
return adapter;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Rc<DxvkAdapter> DxvkInstance::findAdapterByDeviceId(uint16_t vendorId, uint16_t deviceId) const {
|
||||
for (const auto& adapter : m_adapters) {
|
||||
const auto& props = adapter->deviceProperties();
|
||||
|
||||
if (props.vendorID == vendorId
|
||||
&& props.deviceID == deviceId)
|
||||
return adapter;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
VkInstance DxvkInstance::createInstance() {
|
||||
|
@ -48,6 +48,26 @@ namespace dxvk {
|
||||
Rc<DxvkAdapter> enumAdapters(
|
||||
uint32_t index) const;
|
||||
|
||||
/**
|
||||
* \brief Finds adapter by LUID
|
||||
*
|
||||
* \param [in] luid Pointer to LUID
|
||||
* \returns Matching adapter, if any
|
||||
*/
|
||||
Rc<DxvkAdapter> findAdapterByLuid(
|
||||
const void* luid) const;
|
||||
|
||||
/**
|
||||
* \brief Finds adapter by device IDs
|
||||
*
|
||||
* \param [in] vendorId Vendor ID
|
||||
* \param [in] deviceId Device ID
|
||||
* \returns Matching adapter, if any
|
||||
*/
|
||||
Rc<DxvkAdapter> findAdapterByDeviceId(
|
||||
uint16_t vendorId,
|
||||
uint16_t deviceId) const;
|
||||
|
||||
/**
|
||||
* \brief Retrieves configuration options
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user