gl_graphics_pipeline: Replace GetSync calls with non-blocking waits

The spec states that a ClientWait on a Fence object ensures the changes propagate to the calling context
This commit is contained in:
ameerj
2022-02-27 20:28:05 -05:00
parent b72ca10c94
commit 8413f80efb
2 changed files with 7 additions and 5 deletions

View File

@@ -587,16 +587,18 @@ void GraphicsPipeline::WaitForBuild() {
is_built = true; is_built = true;
} }
bool GraphicsPipeline::IsBuilt() const noexcept { bool GraphicsPipeline::IsBuilt() noexcept {
if (is_built) { if (is_built) {
return true; return true;
} }
if (built_fence.handle == 0) { if (built_fence.handle == 0) {
return false; return false;
} }
GLint sync_status{}; // Timeout of zero means this is non-blocking
glGetSynciv(built_fence.handle, GL_SYNC_STATUS, 1, nullptr, &sync_status); const auto sync_status = glClientWaitSync(built_fence.handle, 0, 0);
return sync_status == GL_SIGNALED; ASSERT(sync_status != GL_WAIT_FAILED);
is_built = sync_status != GL_TIMEOUT_EXPIRED;
return is_built;
} }
} // namespace OpenGL } // namespace OpenGL

View File

@@ -100,7 +100,7 @@ public:
return writes_global_memory; return writes_global_memory;
} }
[[nodiscard]] bool IsBuilt() const noexcept; [[nodiscard]] bool IsBuilt() noexcept;
template <typename Spec> template <typename Spec>
static auto MakeConfigureSpecFunc() { static auto MakeConfigureSpecFunc() {