Skip to content

Commit cad62dc

Browse files
committed
Disable experimental Syphon output behind a build flag
1 parent 9f1d385 commit cad62dc

4 files changed

Lines changed: 43 additions & 4 deletions

File tree

src/core/SyphonServerImpl.mm

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
class SyphonServerImpl
4949
{
5050
public:
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 %dx%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 %dx%d", w, h);
111137
}
112138
}
113139
}
114140

115141
private:
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
// ---------------------------------------------------------------------------

src/gui/MainWindow.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,8 +2248,9 @@ void MainWindow::createActions()
22482248
connect(displayTestSignalAction, SIGNAL(toggled(bool)), outputWindow, SLOT(setDisplayTestSignal(bool)));
22492249
// connect(displayTestSignalAction, SIGNAL(toggled(bool)), this, SLOT(update()));
22502250

2251-
#ifdef HAVE_SYPHON
2251+
#if defined(HAVE_SYPHON) && defined(SYPHON_OUTPUT_EXPERIMENTAL)
22522252
// Publish the output as a Syphon server (opt-in, macOS only).
2253+
// EXPERIMENTAL / DISABLED — see the SYPHON_OUTPUT_EXPERIMENTAL note in src/src.pri.
22532254
publishSyphonOutputAction = new QAction(tr("&Publish Syphon Output"), this);
22542255
publishSyphonOutputAction->setToolTip(tr("Publish the output composition as a Syphon server other apps can receive"));
22552256
publishSyphonOutputAction->setIconVisibleInMenu(false);
@@ -2484,7 +2485,7 @@ void MainWindow::createMenus()
24842485
viewMenu->addSeparator();
24852486
viewMenu->addAction(outputFullScreenAction);
24862487
viewMenu->addAction(displayTestSignalAction);
2487-
#ifdef HAVE_SYPHON
2488+
#if defined(HAVE_SYPHON) && defined(SYPHON_OUTPUT_EXPERIMENTAL)
24882489
viewMenu->addAction(publishSyphonOutputAction);
24892490
#endif
24902491
viewMenu->addAction(displayControlsAction);

src/gui/OutputGLCanvas.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ void OutputGLCanvas::setSyphonServerName(const QString& name)
7878

7979
void OutputGLCanvas::drawForeground(QPainter *painter , const QRectF &rect)
8080
{
81-
#ifdef HAVE_SYPHON
81+
#if defined(HAVE_SYPHON) && defined(SYPHON_OUTPUT_EXPERIMENTAL)
8282
// Publish the clean composition (background + mappings, no editing overlays or
8383
// test signal) to Syphon before the foreground is drawn. drawForeground runs
8484
// after the background and all items, so the framebuffer holds the full frame.
85+
// DISABLED — see the SYPHON_OUTPUT_EXPERIMENTAL note in src/src.pri.
8586
if (_syphonOutput.isEnabled())
8687
{
8788
painter->beginNativePainting();

src/src.pri

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ macx {
5555
syphon_framework.path = Contents/Frameworks
5656
QMAKE_BUNDLE_DATA += syphon_framework
5757

58+
# Syphon OUTPUT (publishing MapMap's output as a Syphon server) is EXPERIMENTAL
59+
# and DISABLED by default: SyphonOpenGLServer cannot create its IOSurface
60+
# texture in MapMap's legacy-OpenGL-over-Metal context on Apple Silicon (it
61+
# floods "cannot create texture, Metal texture cache was released" and never
62+
# publishes). The implementation is kept (SyphonOutput / SyphonServerImpl.mm +
63+
# the OutputGLCanvas hook + the "Publish Syphon Output" menu item) but compiled
64+
# out. Uncomment to build it back in for development. Tracked on the roadmap.
65+
# DEFINES += SYPHON_OUTPUT_EXPERIMENTAL
66+
5867
# With Xcode Tools > 1.5, to reduce the size of your binary even more:
5968
# LIBS += -dead_strip
6069
# This tells qmake not to put the executable inside a bundle.

0 commit comments

Comments
 (0)