[dxvk] Add function to check for a specific driver / driver version

This commit is contained in:
Philip Rebohle 2018-12-12 15:43:39 +01:00
parent 6c992c7b02
commit 598280dc3f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 38 additions and 0 deletions

View File

@ -327,6 +327,22 @@ namespace dxvk {
VkDeviceSize bytes) {
m_heapAlloc[heap] -= bytes;
}
bool DxvkAdapter::matchesDriver(
DxvkGpuVendor vendor,
VkDriverIdKHR driver,
uint32_t minVer,
uint32_t maxVer) const {
bool driverMatches = m_deviceInfo.khrDeviceDriverProperties.driverID
? driver == m_deviceInfo.khrDeviceDriverProperties.driverID
: vendor == DxvkGpuVendor(m_deviceInfo.core.properties.vendorID);
if (minVer) driverMatches &= m_deviceInfo.core.properties.driverVersion >= minVer;
if (maxVer) driverMatches &= m_deviceInfo.core.properties.driverVersion < maxVer;
return driverMatches;
}
void DxvkAdapter::logAdapterInfo() const {
@ -398,6 +414,11 @@ namespace dxvk {
m_deviceInfo.extVertexAttributeDivisor.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.extVertexAttributeDivisor);
}
if (m_deviceExtensions.supports(VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME)) {
m_deviceInfo.khrDeviceDriverProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR;
m_deviceInfo.khrDeviceDriverProperties.pNext = std::exchange(m_deviceInfo.core.pNext, &m_deviceInfo.khrDeviceDriverProperties);
}
// Query full device properties for all enabled extensions
m_vki->vkGetPhysicalDeviceProperties2KHR(m_handle, &m_deviceInfo.core);

View File

@ -214,6 +214,22 @@ namespace dxvk {
uint32_t heap,
VkDeviceSize bytes);
/**
* \brief Tests if the driver matches certain criteria
*
* \param [in] vendor GPU vendor
* \param [in] driver Driver. Ignored when the
* driver properties extension is not supported.
* \param [in] minVer Match versions starting with this one
* \param [in] maxVer Match versions lower than this one
* \returns \c True if the driver matches these criteria
*/
bool matchesDriver(
DxvkGpuVendor vendor,
VkDriverIdKHR driver,
uint32_t minVer,
uint32_t maxVer) const;
/**
* \brief Logs DXVK adapter info
*

View File

@ -18,6 +18,7 @@ namespace dxvk {
VkPhysicalDeviceSubgroupProperties coreSubgroup;
VkPhysicalDeviceTransformFeedbackPropertiesEXT extTransformFeedback;
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT extVertexAttributeDivisor;
VkPhysicalDeviceDriverPropertiesKHR khrDeviceDriverProperties;
};