mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxvk] Remove DxvkFence
This commit is contained in:
parent
0bdae4f930
commit
2566909917
@ -16,7 +16,7 @@ namespace dxvk {
|
|||||||
fenceInfo.flags = 0;
|
fenceInfo.flags = 0;
|
||||||
|
|
||||||
if (m_vkd->vkCreateFence(m_vkd->device(), &fenceInfo, nullptr, &m_fence) != VK_SUCCESS)
|
if (m_vkd->vkCreateFence(m_vkd->device(), &fenceInfo, nullptr, &m_fence) != VK_SUCCESS)
|
||||||
throw DxvkError("DxvkFence::DxvkFence: Failed to create fence");
|
throw DxvkError("DxvkCommandList: Failed to create fence");
|
||||||
|
|
||||||
VkCommandPoolCreateInfo poolInfo;
|
VkCommandPoolCreateInfo poolInfo;
|
||||||
poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||||
@ -25,7 +25,7 @@ namespace dxvk {
|
|||||||
poolInfo.queueFamilyIndex = queueFamily;
|
poolInfo.queueFamilyIndex = queueFamily;
|
||||||
|
|
||||||
if (m_vkd->vkCreateCommandPool(m_vkd->device(), &poolInfo, nullptr, &m_pool) != VK_SUCCESS)
|
if (m_vkd->vkCreateCommandPool(m_vkd->device(), &poolInfo, nullptr, &m_pool) != VK_SUCCESS)
|
||||||
throw DxvkError("DxvkCommandList::DxvkCommandList: Failed to create command pool");
|
throw DxvkError("DxvkCommandList: Failed to create command pool");
|
||||||
|
|
||||||
VkCommandBufferAllocateInfo cmdInfo;
|
VkCommandBufferAllocateInfo cmdInfo;
|
||||||
cmdInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
cmdInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||||
@ -35,7 +35,7 @@ namespace dxvk {
|
|||||||
cmdInfo.commandBufferCount = 1;
|
cmdInfo.commandBufferCount = 1;
|
||||||
|
|
||||||
if (m_vkd->vkAllocateCommandBuffers(m_vkd->device(), &cmdInfo, &m_buffer) != VK_SUCCESS)
|
if (m_vkd->vkAllocateCommandBuffers(m_vkd->device(), &cmdInfo, &m_buffer) != VK_SUCCESS)
|
||||||
throw DxvkError("DxvkCommandList::DxvkCommandList: Failed to allocate command buffer");
|
throw DxvkError("DxvkCommandList: Failed to allocate command buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,38 +20,4 @@ namespace dxvk {
|
|||||||
m_vkd->device(), m_semaphore, nullptr);
|
m_vkd->device(), m_semaphore, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkFence::DxvkFence(const Rc<vk::DeviceFn>& vkd)
|
|
||||||
: m_vkd(vkd) {
|
|
||||||
VkFenceCreateInfo info;
|
|
||||||
info.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
|
||||||
info.pNext = nullptr;
|
|
||||||
info.flags = 0;
|
|
||||||
|
|
||||||
if (m_vkd->vkCreateFence(m_vkd->device(), &info, nullptr, &m_fence) != VK_SUCCESS)
|
|
||||||
throw DxvkError("DxvkFence::DxvkFence: Failed to create fence");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkFence::~DxvkFence() {
|
|
||||||
m_vkd->vkDestroyFence(
|
|
||||||
m_vkd->device(), m_fence, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool DxvkFence::wait(uint64_t timeout) const {
|
|
||||||
VkResult status = m_vkd->vkWaitForFences(
|
|
||||||
m_vkd->device(), 1, &m_fence, VK_FALSE, timeout);
|
|
||||||
|
|
||||||
if (status == VK_SUCCESS) return true;
|
|
||||||
if (status == VK_TIMEOUT) return false;
|
|
||||||
throw DxvkError("DxvkFence::wait: Failed to wait for fence");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkFence::reset() {
|
|
||||||
if (m_vkd->vkResetFences(m_vkd->device(), 1, &m_fence) != VK_SUCCESS)
|
|
||||||
throw DxvkError("DxvkFence::reset: Failed to reset fence");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -36,54 +36,4 @@ namespace dxvk {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Fence object
|
|
||||||
*
|
|
||||||
* This is merely an abstraction of Vulkan's fences. Client
|
|
||||||
* APIs that support fence operations may use them directly.
|
|
||||||
* Other than that, they are used internally to keep track
|
|
||||||
* of GPU resource usage.
|
|
||||||
*/
|
|
||||||
class DxvkFence : public RcObject {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkFence(const Rc<vk::DeviceFn>& vkd);
|
|
||||||
~DxvkFence();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Fence handle
|
|
||||||
*
|
|
||||||
* Internal use only.
|
|
||||||
* \returns Fence handle
|
|
||||||
*/
|
|
||||||
VkFence handle() const {
|
|
||||||
return m_fence;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Waits for fence to be signaled
|
|
||||||
*
|
|
||||||
* \param [in] timeout Amount of time to wait
|
|
||||||
* \returns \c true if the fence has been signaled,
|
|
||||||
* \c false if a timeout occured.
|
|
||||||
*/
|
|
||||||
bool wait(uint64_t timeout) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Resets the fence
|
|
||||||
*
|
|
||||||
* Transitions the fence into the unsignaled state,
|
|
||||||
* which means that the fence may be submitted again.
|
|
||||||
*/
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Rc<vk::DeviceFn> m_vkd;
|
|
||||||
VkFence m_fence;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user