summaryrefslogtreecommitdiff
path: root/indra/llrender/llimagegl.cpp
diff options
context:
space:
mode:
authorMike <contact@mikelittman.me>2026-10-05 01:47:40 -0500
committerGitHub <noreply@github.com>2026-10-05 14:47:40 +0800
commitdcaa2903c3bb96e97bf679d0a721536aaa019a29 (patch)
treed41feecf98a8d4b6aa812e47b5304209aa183703 /indra/llrender/llimagegl.cpp
parent62e2d529558ba086708025b394aa790e49076c77 (diff)
Avoid the Apple OpenGL null-fence crash during precache (#30)
glDeleteBuffers and glWaitSync on a failed fence both fault in GLDFenceRec::getStatus on Apple's GL/Metal translator. Finish and unbind before deleting buffers, skip a null upload fence, and resize depth targets with the unsized format Apple accepts.
Diffstat (limited to 'indra/llrender/llimagegl.cpp')
-rw-r--r--indra/llrender/llimagegl.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 1d51c6741c..82bc00fe7a 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1839,9 +1839,16 @@ void LLImageGL::syncToMainThread(LLGLuint new_tex_name)
// wait for texture upload to finish before notifying main thread
// upload is complete
auto sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
- glFlush();
- glClientWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
- glDeleteSync(sync);
+ if (sync)
+ {
+ glFlush();
+ glClientWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
+ glDeleteSync(sync);
+ }
+ else
+ {
+ glFinish();
+ }
}
else
{
@@ -1851,20 +1858,29 @@ void LLImageGL::syncToMainThread(LLGLuint new_tex_name)
glFlush();
auto sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
glFlush();
- LL::WorkQueue::postMaybe(
- mMainQueue,
- [=]()
- {
- LL_PROFILE_ZONE_NAMED("cglt - wait sync");
- {
- LL_PROFILE_ZONE_NAMED("glWaitSync");
- glWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
- }
+ if (sync)
+ {
+ LL::WorkQueue::postMaybe(
+ mMainQueue,
+ [=]()
{
- LL_PROFILE_ZONE_NAMED("glDeleteSync");
- glDeleteSync(sync);
- }
- });
+ LL_PROFILE_ZONE_NAMED("cglt - wait sync");
+ {
+ LL_PROFILE_ZONE_NAMED("glWaitSync");
+ glWaitSync(sync, 0, GL_TIMEOUT_IGNORED);
+ }
+ {
+ LL_PROFILE_ZONE_NAMED("glDeleteSync");
+ glDeleteSync(sync);
+ }
+ });
+ }
+ else
+ {
+ // glFenceSync failed. glWaitSync(0) is dispatched to Apple's
+ // OpenGL thread, which faults in GLDFenceRec::getStatus.
+ glFinish();
+ }
}
}