mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] GPU query reset path
Require VK_EXT_host_query_reset instead. This fallback path is untested nowadays and too slow to be useful.
This commit is contained in:
parent
6a80b51dc3
commit
e7e7fa231c
@ -1954,7 +1954,7 @@ namespace dxvk {
|
||||
enabled.core.features.shaderCullDistance = VK_TRUE;
|
||||
enabled.core.features.textureCompressionBC = VK_TRUE;
|
||||
enabled.extDepthClipEnable.depthClipEnable = supported.extDepthClipEnable.depthClipEnable;
|
||||
enabled.extHostQueryReset.hostQueryReset = supported.extHostQueryReset.hostQueryReset;
|
||||
enabled.extHostQueryReset.hostQueryReset = VK_TRUE;
|
||||
}
|
||||
|
||||
if (featureLevel >= D3D_FEATURE_LEVEL_9_2) {
|
||||
|
@ -3911,7 +3911,7 @@ namespace dxvk {
|
||||
enabled.core.features.textureCompressionBC = VK_TRUE;
|
||||
|
||||
enabled.extDepthClipEnable.depthClipEnable = supported.extDepthClipEnable.depthClipEnable;
|
||||
enabled.extHostQueryReset.hostQueryReset = supported.extHostQueryReset.hostQueryReset;
|
||||
enabled.extHostQueryReset.hostQueryReset = VK_TRUE;
|
||||
|
||||
// SM2 level hardware
|
||||
enabled.core.features.occlusionQueryPrecise = VK_TRUE;
|
||||
|
@ -643,39 +643,6 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void cmdResetQuery(
|
||||
VkQueryPool queryPool,
|
||||
uint32_t queryId,
|
||||
VkEvent event) {
|
||||
if (event == VK_NULL_HANDLE) {
|
||||
m_vkd->vkResetQueryPoolEXT(
|
||||
m_vkd->device(), queryPool, queryId, 1);
|
||||
} else {
|
||||
m_cmdBuffersUsed.set(DxvkCmdBuffer::InitBuffer);
|
||||
|
||||
m_vkd->vkResetEvent(
|
||||
m_vkd->device(), event);
|
||||
|
||||
m_vkd->vkCmdResetQueryPool(
|
||||
m_initBuffer, queryPool, queryId, 1);
|
||||
|
||||
m_vkd->vkCmdSetEvent(m_initBuffer,
|
||||
event, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cmdResetQueryPool(
|
||||
VkQueryPool queryPool,
|
||||
uint32_t firstQuery,
|
||||
uint32_t queryCount) {
|
||||
m_cmdBuffersUsed.set(DxvkCmdBuffer::InitBuffer);
|
||||
|
||||
m_vkd->vkCmdResetQueryPool(m_initBuffer,
|
||||
queryPool, firstQuery, queryCount);
|
||||
}
|
||||
|
||||
|
||||
void cmdResolveImage(
|
||||
VkImage srcImage,
|
||||
VkImageLayout srcImageLayout,
|
||||
@ -775,6 +742,13 @@ namespace dxvk {
|
||||
|
||||
void cmdInsertDebugUtilsLabel(VkDebugUtilsLabelEXT *pLabelInfo);
|
||||
|
||||
void resetQuery(
|
||||
VkQueryPool queryPool,
|
||||
uint32_t queryId) {
|
||||
m_vkd->vkResetQueryPoolEXT(
|
||||
m_vkd->device(), queryPool, queryId, 1);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
DxvkDevice* m_device;
|
||||
|
@ -90,21 +90,8 @@ namespace dxvk {
|
||||
const DxvkGpuQueryHandle& handle) const {
|
||||
DxvkQueryData tmpData;
|
||||
|
||||
// Wait for the query to be reset first
|
||||
VkResult result;
|
||||
|
||||
if (handle.resetEvent) {
|
||||
result = m_vkd->vkGetEventStatus(
|
||||
m_vkd->device(), handle.resetEvent);
|
||||
|
||||
if (result == VK_EVENT_RESET)
|
||||
return DxvkGpuQueryStatus::Pending;
|
||||
else if (result != VK_EVENT_SET)
|
||||
return DxvkGpuQueryStatus::Failed;
|
||||
}
|
||||
|
||||
// Try to copy query data to temporary structure
|
||||
result = m_vkd->vkGetQueryPoolResults(m_vkd->device(),
|
||||
VkResult result = m_vkd->vkGetQueryPoolResults(m_vkd->device(),
|
||||
handle.queryPool, handle.queryId, 1,
|
||||
sizeof(DxvkQueryData), &tmpData,
|
||||
sizeof(DxvkQueryData), VK_QUERY_RESULT_64_BIT);
|
||||
@ -167,11 +154,6 @@ namespace dxvk {
|
||||
|
||||
|
||||
DxvkGpuQueryAllocator::~DxvkGpuQueryAllocator() {
|
||||
for (DxvkGpuQueryHandle handle : m_handles) {
|
||||
m_vkd->vkDestroyEvent(m_vkd->device(),
|
||||
handle.resetEvent, nullptr);
|
||||
}
|
||||
|
||||
for (VkQueryPool pool : m_pools) {
|
||||
m_vkd->vkDestroyQueryPool(
|
||||
m_vkd->device(), pool, nullptr);
|
||||
@ -233,22 +215,8 @@ namespace dxvk {
|
||||
|
||||
m_pools.push_back(queryPool);
|
||||
|
||||
VkEventCreateInfo eventInfo;
|
||||
eventInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
||||
eventInfo.pNext = nullptr;
|
||||
eventInfo.flags = 0;
|
||||
|
||||
for (uint32_t i = 0; i < m_queryPoolSize; i++) {
|
||||
VkEvent event = VK_NULL_HANDLE;
|
||||
|
||||
if (!m_device->features().extHostQueryReset.hostQueryReset
|
||||
&& m_vkd->vkCreateEvent(m_vkd->device(), &eventInfo, nullptr, &event) != VK_SUCCESS) {
|
||||
Logger::err("DXVK: Failed to create query reset event");
|
||||
return;
|
||||
}
|
||||
|
||||
m_handles.push_back({ this, event, queryPool, i });
|
||||
}
|
||||
for (uint32_t i = 0; i < m_queryPoolSize; i++)
|
||||
m_handles.push_back({ this, queryPool, i });
|
||||
}
|
||||
|
||||
|
||||
@ -337,10 +305,9 @@ namespace dxvk {
|
||||
query->addQueryHandle(handle);
|
||||
query->end();
|
||||
|
||||
cmd->cmdResetQuery(
|
||||
cmd->resetQuery(
|
||||
handle.queryPool,
|
||||
handle.queryId,
|
||||
handle.resetEvent);
|
||||
handle.queryId);
|
||||
|
||||
cmd->cmdWriteTimestamp(
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||
@ -380,10 +347,9 @@ namespace dxvk {
|
||||
const Rc<DxvkGpuQuery>& query) {
|
||||
DxvkGpuQueryHandle handle = m_pool->allocQuery(query->type());
|
||||
|
||||
cmd->cmdResetQuery(
|
||||
cmd->resetQuery(
|
||||
handle.queryPool,
|
||||
handle.queryId,
|
||||
handle.resetEvent);
|
||||
handle.queryId);
|
||||
|
||||
if (query->isIndexed()) {
|
||||
cmd->cmdBeginQueryIndexed(
|
||||
|
@ -102,7 +102,6 @@ namespace dxvk {
|
||||
*/
|
||||
struct DxvkGpuQueryHandle {
|
||||
DxvkGpuQueryAllocator* allocator = nullptr;
|
||||
VkEvent resetEvent = VK_NULL_HANDLE;
|
||||
VkQueryPool queryPool = VK_NULL_HANDLE;
|
||||
uint32_t queryId = 0;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user