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:
@@ -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
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user