|
|
@ -65,7 +65,7 @@ void QueryPool::Reserve(std::pair<VkQueryPool, u32> query) {
|
|
|
|
usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false;
|
|
|
|
usage[pool_index * GROW_STEP + static_cast<std::ptrdiff_t>(query.second)] = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_,
|
|
|
|
QueryCache::QueryCache(VideoCore::RasterizerInterface& rasterizer_,
|
|
|
|
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_,
|
|
|
|
Tegra::Engines::Maxwell3D& maxwell3d_, Tegra::MemoryManager& gpu_memory_,
|
|
|
|
const Device& device_, Scheduler& scheduler_)
|
|
|
|
const Device& device_, Scheduler& scheduler_)
|
|
|
|
: QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_},
|
|
|
|
: QueryCacheBase{rasterizer_, maxwell3d_, gpu_memory_}, device{device_}, scheduler{scheduler_},
|
|
|
@ -73,7 +73,7 @@ VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer_,
|
|
|
|
QueryPool{device_, scheduler_, QueryType::SamplesPassed},
|
|
|
|
QueryPool{device_, scheduler_, QueryType::SamplesPassed},
|
|
|
|
} {}
|
|
|
|
} {}
|
|
|
|
|
|
|
|
|
|
|
|
VKQueryCache::~VKQueryCache() {
|
|
|
|
QueryCache::~QueryCache() {
|
|
|
|
// TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class
|
|
|
|
// TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class
|
|
|
|
// destructor is called. The query cache should be redesigned to have a proper ownership model
|
|
|
|
// destructor is called. The query cache should be redesigned to have a proper ownership model
|
|
|
|
// instead of using shared pointers.
|
|
|
|
// instead of using shared pointers.
|
|
|
@ -84,15 +84,15 @@ VKQueryCache::~VKQueryCache() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::pair<VkQueryPool, u32> VKQueryCache::AllocateQuery(QueryType type) {
|
|
|
|
std::pair<VkQueryPool, u32> QueryCache::AllocateQuery(QueryType type) {
|
|
|
|
return query_pools[static_cast<std::size_t>(type)].Commit();
|
|
|
|
return query_pools[static_cast<std::size_t>(type)].Commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void VKQueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
|
|
|
|
void QueryCache::Reserve(QueryType type, std::pair<VkQueryPool, u32> query) {
|
|
|
|
query_pools[static_cast<std::size_t>(type)].Reserve(query);
|
|
|
|
query_pools[static_cast<std::size_t>(type)].Reserve(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HostCounter::HostCounter(VKQueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
|
|
|
HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependency_,
|
|
|
|
QueryType type_)
|
|
|
|
QueryType type_)
|
|
|
|
: HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
|
|
|
|
: HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
|
|
|
|
query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
|
|
|
|
query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
|
|
|
|