Skip to content

Commit

Permalink
Improve renderer change tracking
Browse files Browse the repository at this point in the history
Fix so we check context changes in the correct context
Don't needlessly track context changes for Core Profile with a stencil buffer
  • Loading branch information
bangnoise committed Oct 23, 2017
1 parent f3b04cb commit 676effa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions SyphonServer.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,10 @@ - (id)initWithName:(NSString*)serverName context:(CGLContextObj)context options:
GLuint depthBufferResolution = [[self class] integerValueForKey:SyphonServerOptionDepthBufferResolution fromOptions:options];
GLuint stencilBufferResolution = [[self class] integerValueForKey:SyphonServerOptionStencilBufferResolution fromOptions:options];

if (MSAASampleCount > 0 || stencilBufferResolution > 0)
if (MSAASampleCount > 0 || (stencilBufferResolution > 0 && SyphonOpenGLContextIsLegacy(context)))
{
// TODO: update comment if these remain for both core and legacy GL
// If we have a stencil buffer we will try to use the GL_EXT_packed_depth_stencil extension
// so we need to know about changes to the context's abilities
// For MSAA we need to check we don't exceed GL_MAX_SAMPLES when the context changes
// If we have a stencil buffer in a Legacy context, we rely on the GL_EXT_packed_depth_stencil extension
_wantsContextChanges = YES;
}

Expand All @@ -164,7 +163,7 @@ - (id)initWithName:(NSString*)serverName context:(CGLContextObj)context options:
if (SyphonOpenGLContextIsLegacy(context))
{
_renderer = [[SyphonServerRendererLegacy alloc] initWithContext:context
MSAASampleCount:MSAASampleCount // TODO: type for this argument?
MSAASampleCount:MSAASampleCount
depthBufferResolution:depthBufferResolution
stencilBufferResolution:stencilBufferResolution];
}
Expand Down Expand Up @@ -406,7 +405,9 @@ - (BOOL)capabilitiesDidChange
if (screen != _virtualScreen)
{
_virtualScreen = screen;
[_renderer beginInContext];
BOOL changed = [_renderer capabilitiesDidChange];
[_renderer endInContext];
SYPHONLOG(@"SyphonServer: renderer change, required capabilities %@", changed ? @"changed" : @"did not change");
return changed;
}
Expand Down

0 comments on commit 676effa

Please sign in to comment.