diff options
Diffstat (limited to 'src')
5 files changed, 16 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/gl_fence_manager.cpp b/src/video_core/renderer_opengl/gl_fence_manager.cpp index 91463f854..5326172af 100644 --- a/src/video_core/renderer_opengl/gl_fence_manager.cpp +++ b/src/video_core/renderer_opengl/gl_fence_manager.cpp | |||
| @@ -27,9 +27,7 @@ bool GLInnerFence::IsSignaled() const { | |||
| 27 | return true; | 27 | return true; |
| 28 | } | 28 | } |
| 29 | ASSERT(sync_object.handle != 0); | 29 | ASSERT(sync_object.handle != 0); |
| 30 | GLint sync_status; | 30 | return sync_object.IsSignaled(); |
| 31 | glGetSynciv(sync_object.handle, GL_SYNC_STATUS, 1, nullptr, &sync_status); | ||
| 32 | return sync_status == GL_SIGNALED; | ||
| 33 | } | 31 | } |
| 34 | 32 | ||
| 35 | void GLInnerFence::Wait() { | 33 | void GLInnerFence::Wait() { |
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 29491e762..89000d6e0 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | |||
| @@ -621,10 +621,7 @@ bool GraphicsPipeline::IsBuilt() noexcept { | |||
| 621 | if (built_fence.handle == 0) { | 621 | if (built_fence.handle == 0) { |
| 622 | return false; | 622 | return false; |
| 623 | } | 623 | } |
| 624 | // Timeout of zero means this is non-blocking | 624 | is_built = built_fence.IsSignaled(); |
| 625 | const auto sync_status = glClientWaitSync(built_fence.handle, 0, 0); | ||
| 626 | ASSERT(sync_status != GL_WAIT_FAILED); | ||
| 627 | is_built = sync_status != GL_TIMEOUT_EXPIRED; | ||
| 628 | return is_built; | 625 | return is_built; |
| 629 | } | 626 | } |
| 630 | 627 | ||
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.cpp b/src/video_core/renderer_opengl/gl_resource_manager.cpp index 3a664fdec..eae8fd110 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.cpp +++ b/src/video_core/renderer_opengl/gl_resource_manager.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <string_view> | 4 | #include <string_view> |
| 5 | #include <glad/glad.h> | 5 | #include <glad/glad.h> |
| 6 | #include "common/assert.h" | ||
| 6 | #include "common/microprofile.h" | 7 | #include "common/microprofile.h" |
| 7 | #include "video_core/renderer_opengl/gl_resource_manager.h" | 8 | #include "video_core/renderer_opengl/gl_resource_manager.h" |
| 8 | #include "video_core/renderer_opengl/gl_shader_util.h" | 9 | #include "video_core/renderer_opengl/gl_shader_util.h" |
| @@ -158,6 +159,15 @@ void OGLSync::Release() { | |||
| 158 | handle = 0; | 159 | handle = 0; |
| 159 | } | 160 | } |
| 160 | 161 | ||
| 162 | bool OGLSync::IsSignaled() const noexcept { | ||
| 163 | // At least on Nvidia, glClientWaitSync with a timeout of 0 | ||
| 164 | // is faster than glGetSynciv of GL_SYNC_STATUS. | ||
| 165 | // Timeout of 0 means this check is non-blocking. | ||
| 166 | const auto sync_status = glClientWaitSync(handle, 0, 0); | ||
| 167 | ASSERT(sync_status != GL_WAIT_FAILED); | ||
| 168 | return sync_status != GL_TIMEOUT_EXPIRED; | ||
| 169 | } | ||
| 170 | |||
| 161 | void OGLFramebuffer::Create() { | 171 | void OGLFramebuffer::Create() { |
| 162 | if (handle != 0) | 172 | if (handle != 0) |
| 163 | return; | 173 | return; |
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index bc05ba4bd..77362acd2 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h | |||
| @@ -263,6 +263,9 @@ public: | |||
| 263 | /// Deletes the internal OpenGL resource | 263 | /// Deletes the internal OpenGL resource |
| 264 | void Release(); | 264 | void Release(); |
| 265 | 265 | ||
| 266 | /// Checks if the sync has been signaled | ||
| 267 | bool IsSignaled() const noexcept; | ||
| 268 | |||
| 266 | GLsync handle = 0; | 269 | GLsync handle = 0; |
| 267 | }; | 270 | }; |
| 268 | 271 | ||
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index b047e7b3d..acff3b8ec 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -714,9 +714,7 @@ std::optional<size_t> TextureCacheRuntime::StagingBuffers::FindBuffer(size_t req | |||
| 714 | continue; | 714 | continue; |
| 715 | } | 715 | } |
| 716 | if (syncs[index].handle != 0) { | 716 | if (syncs[index].handle != 0) { |
| 717 | GLint status; | 717 | if (!syncs[index].IsSignaled()) { |
| 718 | glGetSynciv(syncs[index].handle, GL_SYNC_STATUS, 1, nullptr, &status); | ||
| 719 | if (status != GL_SIGNALED) { | ||
| 720 | continue; | 718 | continue; |
| 721 | } | 719 | } |
| 722 | syncs[index].Release(); | 720 | syncs[index].Release(); |