Add OcclusionQueryPools to Vulkan and move code to cpp file

This commit is contained in:
Wojtek Figat
2025-08-12 10:21:51 +02:00
parent 9cf9fae453
commit b4d501cd6a
3 changed files with 22 additions and 27 deletions

View File

@@ -1349,6 +1349,24 @@ GPUDeviceVulkan::~GPUDeviceVulkan()
GPUDeviceVulkan::Dispose();
}
BufferedQueryPoolVulkan* GPUDeviceVulkan::FindAvailableQueryPool(VkQueryType queryType)
{
auto& pools = queryType == VK_QUERY_TYPE_OCCLUSION ? OcclusionQueryPools : TimestampQueryPools;
// Try to use pool with available space inside
for (int32 i = 0; i < pools.Count(); i++)
{
auto pool = pools.Get()[i];
if (pool->HasRoom())
return pool;
}
// Create new pool
const auto pool = New<BufferedQueryPoolVulkan>(this, queryType == VK_QUERY_TYPE_OCCLUSION ? 4096 : 1024, queryType);
pools.Add(pool);
return pool;
}
RenderPassVulkan* GPUDeviceVulkan::GetOrCreateRenderPass(RenderTargetLayoutVulkan& layout)
{
RenderPassVulkan* renderPass;
@@ -2075,6 +2093,7 @@ void GPUDeviceVulkan::Dispose()
HelperResources.Dispose();
StagingManager.Dispose();
TimestampQueryPools.ClearDelete();
OcclusionQueryPools.ClearDelete();
SAFE_DELETE_GPU_RESOURCE(UniformBufferUploader);
Delete(DescriptorPoolsManager);
SAFE_DELETE(MainContext);