mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[dxvk] Rework device queue initialization
This commit is contained in:
parent
ef9d5048f3
commit
d8f3a1c83d
@ -6,7 +6,19 @@
|
||||
#include "dxvk_instance.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
|
||||
DxvkDeviceQueue getDeviceQueue(const Rc<vk::DeviceFn>& vkd, uint32_t family, uint32_t index) {
|
||||
DxvkDeviceQueue result = { };
|
||||
result.queueFamily = family;
|
||||
result.queueIndex = index;
|
||||
|
||||
if (family != VK_QUEUE_FAMILY_IGNORED)
|
||||
vkd->vkGetDeviceQueue(vkd->device(), family, index, &result.queueHandle);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DxvkAdapter::DxvkAdapter(
|
||||
const Rc<vk::InstanceFn>& vki,
|
||||
VkPhysicalDevice handle)
|
||||
@ -655,9 +667,14 @@ namespace dxvk {
|
||||
if (vr != VK_SUCCESS)
|
||||
throw DxvkError("DxvkAdapter: Failed to create device");
|
||||
|
||||
return new DxvkDevice(instance, this,
|
||||
new vk::DeviceFn(m_vki, true, device),
|
||||
enabledFeatures);
|
||||
Rc<vk::DeviceFn> vkd = new vk::DeviceFn(m_vki, true, device);
|
||||
|
||||
DxvkDeviceQueueSet queues = { };
|
||||
queues.graphics = getDeviceQueue(vkd, queueFamilies.graphics, 0);
|
||||
queues.transfer = getDeviceQueue(vkd, queueFamilies.transfer, 0);
|
||||
queues.sparse = getDeviceQueue(vkd, queueFamilies.sparse, 0);
|
||||
|
||||
return new DxvkDevice(instance, this, vkd, enabledFeatures, queues);
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,8 @@ namespace dxvk {
|
||||
const Rc<DxvkInstance>& instance,
|
||||
const Rc<DxvkAdapter>& adapter,
|
||||
const Rc<vk::DeviceFn>& vkd,
|
||||
const DxvkDeviceFeatures& features)
|
||||
const DxvkDeviceFeatures& features,
|
||||
const DxvkDeviceQueueSet& queues)
|
||||
: m_options (instance->options()),
|
||||
m_instance (instance),
|
||||
m_adapter (adapter),
|
||||
@ -16,11 +17,9 @@ namespace dxvk {
|
||||
m_properties (adapter->devicePropertiesExt()),
|
||||
m_perfHints (getPerfHints()),
|
||||
m_objects (this),
|
||||
m_queues (queues),
|
||||
m_submissionQueue (this) {
|
||||
auto queueFamilies = m_adapter->findQueueFamilies();
|
||||
m_queues.graphics = getQueue(queueFamilies.graphics, 0);
|
||||
m_queues.transfer = getQueue(queueFamilies.transfer, 0);
|
||||
m_queues.sparse = getQueue(queueFamilies.sparse, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -321,16 +320,4 @@ namespace dxvk {
|
||||
m_recycledCommandLists.returnObject(cmdList);
|
||||
}
|
||||
|
||||
|
||||
DxvkDeviceQueue DxvkDevice::getQueue(
|
||||
uint32_t family,
|
||||
uint32_t index) const {
|
||||
VkQueue queue = VK_NULL_HANDLE;
|
||||
|
||||
if (family != VK_QUEUE_FAMILY_IGNORED)
|
||||
m_vkd->vkGetDeviceQueue(m_vkd->device(), family, index, &queue);
|
||||
|
||||
return DxvkDeviceQueue { queue, family, index };
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,8 @@ namespace dxvk {
|
||||
const Rc<DxvkInstance>& instance,
|
||||
const Rc<DxvkAdapter>& adapter,
|
||||
const Rc<vk::DeviceFn>& vkd,
|
||||
const DxvkDeviceFeatures& features);
|
||||
const DxvkDeviceFeatures& features,
|
||||
const DxvkDeviceQueueSet& queues);
|
||||
|
||||
~DxvkDevice();
|
||||
|
||||
@ -551,11 +552,7 @@ namespace dxvk {
|
||||
|
||||
void recycleCommandList(
|
||||
const Rc<DxvkCommandList>& cmdList);
|
||||
|
||||
DxvkDeviceQueue getQueue(
|
||||
uint32_t family,
|
||||
uint32_t index) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user