Query Cachge: Fully rework Vulkan's query cache
This commit is contained in:
parent
bdc01254a9
commit
f1a2e36711
35 changed files with 1573 additions and 355 deletions
|
@ -27,7 +27,7 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) {
|
|||
} // Anonymous namespace
|
||||
|
||||
QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_)
|
||||
: QueryCacheBase(rasterizer_, cpu_memory_), gl_rasterizer{rasterizer_} {}
|
||||
: QueryCacheLegacy(rasterizer_, cpu_memory_), gl_rasterizer{rasterizer_} {}
|
||||
|
||||
QueryCache::~QueryCache() = default;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class RasterizerOpenGL;
|
|||
using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>;
|
||||
|
||||
class QueryCache final
|
||||
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
: public VideoCommon::QueryCacheLegacy<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
public:
|
||||
explicit QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_);
|
||||
~QueryCache();
|
||||
|
|
|
@ -396,13 +396,31 @@ void RasterizerOpenGL::DispatchCompute() {
|
|||
has_written_global_memory |= pipeline->WritesGlobalMemory();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::ResetCounter(VideoCore::QueryType type) {
|
||||
query_cache.ResetCounter(type);
|
||||
void RasterizerOpenGL::ResetCounter(VideoCommon::QueryType type) {
|
||||
if (type == VideoCommon::QueryType::ZPassPixelCount64) {
|
||||
query_cache.ResetCounter(VideoCore::QueryType::SamplesPassed);
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::Query(GPUVAddr gpu_addr, VideoCore::QueryType type,
|
||||
std::optional<u64> timestamp) {
|
||||
query_cache.Query(gpu_addr, type, timestamp);
|
||||
void RasterizerOpenGL::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
|
||||
VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) {
|
||||
if (type == VideoCommon::QueryType::ZPassPixelCount64) {
|
||||
std::optional<u64> timestamp{True(flags & VideoCommon::QueryPropertiesFlags::HasTimeout)
|
||||
? std::make_optional<u64>(gpu.GetTicks()) : std:: nullopt };
|
||||
if (True(flags & VideoCommon::QueryPropertiesFlags::HasTimeout)) {
|
||||
query_cache.Query(gpu_addr, VideoCore::QueryType::SamplesPassed, {gpu.GetTicks()});
|
||||
} else {
|
||||
query_cache.Query(gpu_addr, VideoCore::QueryType::SamplesPassed, std::nullopt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (True(flags & VideoCommon::QueryPropertiesFlags::HasTimeout)) {
|
||||
u64 ticks = gpu.GetTicks();
|
||||
gpu_memory->Write<u64>(gpu_addr + 8, ticks);
|
||||
gpu_memory->Write<u64>(gpu_addr, static_cast<u64>(payload));
|
||||
} else {
|
||||
gpu_memory->Write<u32>(gpu_addr, payload);
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
||||
|
@ -573,8 +591,8 @@ void RasterizerOpenGL::SignalReference() {
|
|||
fence_manager.SignalOrdering();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::ReleaseFences() {
|
||||
fence_manager.WaitPendingFences();
|
||||
void RasterizerOpenGL::ReleaseFences(bool force) {
|
||||
fence_manager.WaitPendingFences(force);
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size,
|
||||
|
|
|
@ -86,8 +86,8 @@ public:
|
|||
void DrawTexture() override;
|
||||
void Clear(u32 layer_count) override;
|
||||
void DispatchCompute() override;
|
||||
void ResetCounter(VideoCore::QueryType type) override;
|
||||
void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) override;
|
||||
void ResetCounter(VideoCommon::QueryType type) override;
|
||||
void Query(GPUVAddr gpu_addr, VideoCommon::QueryType type, VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) override;
|
||||
void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override;
|
||||
void DisableGraphicsUniformBuffer(size_t stage, u32 index) override;
|
||||
void FlushAll() override;
|
||||
|
@ -107,7 +107,7 @@ public:
|
|||
void SyncOperation(std::function<void()>&& func) override;
|
||||
void SignalSyncPoint(u32 value) override;
|
||||
void SignalReference() override;
|
||||
void ReleaseFences() override;
|
||||
void ReleaseFences(bool force = true) override;
|
||||
void FlushAndInvalidateRegion(
|
||||
VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
||||
void WaitForIdle() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue