QueryCache: rework async downloads.
This commit is contained in:
parent
7e76c1642c
commit
e29ced29fa
7 changed files with 118 additions and 45 deletions
|
@ -26,8 +26,8 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) {
|
|||
|
||||
} // Anonymous namespace
|
||||
|
||||
QueryCache::QueryCache(RasterizerOpenGL& rasterizer_)
|
||||
: QueryCacheBase(rasterizer_), gl_rasterizer{rasterizer_} {}
|
||||
QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_)
|
||||
: QueryCacheBase(rasterizer_, cpu_memory_), gl_rasterizer{rasterizer_} {}
|
||||
|
||||
QueryCache::~QueryCache() = default;
|
||||
|
||||
|
@ -74,7 +74,7 @@ void HostCounter::EndQuery() {
|
|||
glEndQuery(GetTarget(type));
|
||||
}
|
||||
|
||||
u64 HostCounter::BlockingQuery() const {
|
||||
u64 HostCounter::BlockingQuery([[maybe_unused]] bool async) const {
|
||||
GLint64 value;
|
||||
glGetQueryObjecti64v(query.handle, GL_QUERY_RESULT, &value);
|
||||
return static_cast<u64>(value);
|
||||
|
@ -96,7 +96,7 @@ CachedQuery& CachedQuery::operator=(CachedQuery&& rhs) noexcept {
|
|||
return *this;
|
||||
}
|
||||
|
||||
void CachedQuery::Flush() {
|
||||
u64 CachedQuery::Flush([[maybe_unused]] bool async) {
|
||||
// Waiting for a query while another query of the same target is enabled locks Nvidia's driver.
|
||||
// To avoid this disable and re-enable keeping the dependency stream.
|
||||
// But we only have to do this if we have pending waits to be done.
|
||||
|
@ -106,11 +106,13 @@ void CachedQuery::Flush() {
|
|||
stream.Update(false);
|
||||
}
|
||||
|
||||
VideoCommon::CachedQueryBase<HostCounter>::Flush();
|
||||
auto result = VideoCommon::CachedQueryBase<HostCounter>::Flush();
|
||||
|
||||
if (slice_counter) {
|
||||
stream.Update(true);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace OpenGL
|
||||
|
|
|
@ -28,7 +28,7 @@ using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>;
|
|||
class QueryCache final
|
||||
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
public:
|
||||
explicit QueryCache(RasterizerOpenGL& rasterizer_);
|
||||
explicit QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_);
|
||||
~QueryCache();
|
||||
|
||||
OGLQuery AllocateQuery(VideoCore::QueryType type);
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
void EndQuery();
|
||||
|
||||
private:
|
||||
u64 BlockingQuery() const override;
|
||||
u64 BlockingQuery(bool async = false) const override;
|
||||
|
||||
QueryCache& cache;
|
||||
const VideoCore::QueryType type;
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
CachedQuery(const CachedQuery&) = delete;
|
||||
CachedQuery& operator=(const CachedQuery&) = delete;
|
||||
|
||||
void Flush() override;
|
||||
u64 Flush(bool async = false) override;
|
||||
|
||||
private:
|
||||
QueryCache* cache;
|
||||
|
|
|
@ -63,7 +63,7 @@ RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra
|
|||
buffer_cache(*this, cpu_memory_, buffer_cache_runtime),
|
||||
shader_cache(*this, emu_window_, device, texture_cache, buffer_cache, program_manager,
|
||||
state_tracker, gpu.ShaderNotify()),
|
||||
query_cache(*this), accelerate_dma(buffer_cache, texture_cache),
|
||||
query_cache(*this, cpu_memory_), accelerate_dma(buffer_cache, texture_cache),
|
||||
fence_manager(*this, gpu, texture_cache, buffer_cache, query_cache),
|
||||
blit_image(program_manager_) {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue