I observed intermittent fence_wait failures on macOS due to
GL_TIMEOUT_EXPIRED while running Path of Exile 3.0.0c. My hypothesis is
that the previous value, ~(GLuint64)0xffff, overflowed internally after
being adjusted by the driver; after overflow, the timeout would be very
small and thus expire instantly.
To avoid that from happening, this patch uses a new, smaller timeout
value which should not be capable of overflow. The "- 0xffff" is
preserved to keep the low bits the same in case some driver needs them.
dlls/wined3d/query.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
- /* Apple seems to be into arbitrary limits, and timeouts larger than
- * 0xfffffffffffffbff immediately return GL_TIMEOUT_EXPIRED. We don't
- * really care and can live with waiting a few μs less. (OS X 10.7.4). */
+ /* Timeouts near 0xffffffffffffffff may immediately return GL_TIMEOUT_EXPIRED,
+ * possibly because macOS internally adds some slop to the timer. To avoid this,
+ * we use a large number that isn't near the point of overflow (macOS 10.12.5).
GLenum gl_ret = GL_EXTCALL(glClientWaitSync(fence->object.sync,
- GL_SYNC_FLUSH_COMMANDS_BIT, ~(GLuint64)0xffff));
+ GL_SYNC_FLUSH_COMMANDS_BIT, (GLuint64)((1ULL << 62ULL) - 0xffff)));
- /* We don't expect a timeout for a ~584 year wait */
+ /* We don't expect a timeout for a ~146 year wait */
ERR("glClientWaitSync returned %#x.\n", gl_ret);
ret = WINED3D_FENCE_ERROR;
2.10.1 (Apple Git-78)