4848class SyphonServerImpl
4949{
5050public:
51- SyphonServerImpl () : _server(nil ), _serverCtx(NULL ) {}
51+ SyphonServerImpl ()
52+ : _server(nil ), _serverCtx(NULL ), _failed(false ), _logged(false ) {}
5253
5354 ~SyphonServerImpl () { teardown (); }
5455
@@ -61,6 +62,8 @@ void teardown()
6162 _server = nil ;
6263 }
6364 _serverCtx = NULL ;
65+ _failed = false ;
66+ _logged = false ;
6467 }
6568
6669 void setName (const QString& name)
@@ -87,14 +90,25 @@ void publish(GLuint sourceFbo, int w, int h, const QString& name)
8790
8891 if (_server == nil )
8992 {
93+ if (_failed)
94+ return ; // Already failed on this context; don't retry every frame.
95+
9096 _server = [[SyphonOpenGLServer alloc ] initWithName: qStringToNS (name)
9197 context: cgl
9298 options: nil ];
9399 if (_server == nil )
100+ {
101+ _failed = true ;
102+ NSLog (@" [SyphonOutput] SyphonOpenGLServer init FAILED for context %p "
103+ @" (legacy OpenGL output may be unsupported on this GPU)." , cgl);
94104 return ;
105+ }
95106 _serverCtx = cgl;
107+ NSLog (@" [SyphonOutput] server started: %@ context %p " , qStringToNS(name), cgl);
96108 }
97109
110+ glGetError (); // clear any pre-existing error
111+
98112 // Bind the server's FBO and blit our composition into it. A same-size
99113 // blit from the (multisampled) widget FBO resolves MSAA in one step.
100114 if ([_server bindToDrawFrameOfSize: NSMakeSize (w, h)])
@@ -108,13 +122,27 @@ void publish(GLuint sourceFbo, int w, int h, const QString& name)
108122 glBindFramebufferEXT (GL_READ_FRAMEBUFFER_EXT , (GLuint) prevRead);
109123
110124 [_server unbindAndPublish ]; // restores the previously-bound FBO + flushes
125+
126+ if (!_logged)
127+ {
128+ _logged = true ;
129+ NSLog (@" [SyphonOutput] first publish %d x%d hasClients=%d glError=0x%x " ,
130+ w, h, (int ) [_server hasClients], (unsigned ) glGetError());
131+ }
132+ }
133+ else if (!_logged)
134+ {
135+ _logged = true ;
136+ NSLog (@" [SyphonOutput] bindToDrawFrameOfSize FAILED at %d x%d " , w, h);
111137 }
112138 }
113139 }
114140
115141private:
116142 SyphonOpenGLServer* _server;
117143 CGLContextObj _serverCtx; // context the server was created with
144+ bool _failed; // init failed on _serverCtx; stop retrying
145+ bool _logged; // one-shot diagnostics
118146};
119147
120148// ---------------------------------------------------------------------------
0 commit comments