Cocoa Port:
- Run the Display Preferences preview inside a single-buffered context. - Do some minor code cleanup.
This commit is contained in:
parent
1674170370
commit
3088fd581e
|
@ -3820,7 +3820,6 @@ OGLInfo::OGLInfo()
|
||||||
_shaderSupport = ShaderSupport_Unsupported;
|
_shaderSupport = ShaderSupport_Unsupported;
|
||||||
_useShader150 = false;
|
_useShader150 = false;
|
||||||
|
|
||||||
_isShaderSupported = false;
|
|
||||||
_isVBOSupported = false;
|
_isVBOSupported = false;
|
||||||
_isPBOSupported = false;
|
_isPBOSupported = false;
|
||||||
_isFBOSupported = false;
|
_isFBOSupported = false;
|
||||||
|
@ -3848,7 +3847,7 @@ bool OGLInfo::IsPBOSupported()
|
||||||
|
|
||||||
bool OGLInfo::IsShaderSupported()
|
bool OGLInfo::IsShaderSupported()
|
||||||
{
|
{
|
||||||
return this->_isShaderSupported;
|
return (this->_shaderSupport != ShaderSupport_Unsupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OGLInfo::IsFBOSupported()
|
bool OGLInfo::IsFBOSupported()
|
||||||
|
@ -3867,19 +3866,11 @@ OGLInfo_Legacy::OGLInfo_Legacy()
|
||||||
|
|
||||||
_isVBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_buffer_object");
|
_isVBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_buffer_object");
|
||||||
|
|
||||||
#if !defined(GL_ARB_shader_objects) || \
|
bool isShaderSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_shader_objects") &&
|
||||||
!defined(GL_ARB_vertex_shader) || \
|
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_shader") &&
|
||||||
!defined(GL_ARB_fragment_shader) || \
|
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_fragment_shader") &&
|
||||||
!defined(GL_ARB_vertex_program)
|
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_program");
|
||||||
|
if (isShaderSupported)
|
||||||
_isShaderSupported = false;
|
|
||||||
#else
|
|
||||||
_isShaderSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_shader_objects") &&
|
|
||||||
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_shader") &&
|
|
||||||
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_fragment_shader") &&
|
|
||||||
this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_program");
|
|
||||||
|
|
||||||
if (_isShaderSupported)
|
|
||||||
{
|
{
|
||||||
if ( _versionMajor < 3 ||
|
if ( _versionMajor < 3 ||
|
||||||
(_versionMajor == 3 && _versionMinor < 2) )
|
(_versionMajor == 3 && _versionMinor < 2) )
|
||||||
|
@ -3947,22 +3938,12 @@ OGLInfo_Legacy::OGLInfo_Legacy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(GL_ARB_pixel_buffer_object) && !defined(GL_EXT_pixel_buffer_object)
|
|
||||||
_isPBOSupported = false;
|
|
||||||
#else
|
|
||||||
_isPBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_buffer_object") &&
|
_isPBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_ARB_vertex_buffer_object") &&
|
||||||
(this->IsExtensionPresent(oglExtensionSet, "GL_ARB_pixel_buffer_object") ||
|
(this->IsExtensionPresent(oglExtensionSet, "GL_ARB_pixel_buffer_object") ||
|
||||||
this->IsExtensionPresent(oglExtensionSet, "GL_EXT_pixel_buffer_object"));
|
this->IsExtensionPresent(oglExtensionSet, "GL_EXT_pixel_buffer_object"));
|
||||||
#endif
|
|
||||||
|
|
||||||
// Don't use ARB versions since we're using the EXT versions for backwards compatibility.
|
|
||||||
#if !defined(GL_EXT_framebuffer_object)
|
|
||||||
_isFBOSupported = false;
|
|
||||||
#else
|
|
||||||
_isFBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_EXT_framebuffer_object");
|
_isFBOSupported = this->IsExtensionPresent(oglExtensionSet, "GL_EXT_framebuffer_object");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OGLInfo_Legacy::GetExtensionSetOGL(std::set<std::string> *oglExtensionSet)
|
void OGLInfo_Legacy::GetExtensionSetOGL(std::set<std::string> *oglExtensionSet)
|
||||||
|
@ -4715,6 +4696,7 @@ OGLImage::OGLImage(OGLInfo *oglInfo, GLsizei imageWidth, GLsizei imageHeight, GL
|
||||||
_pixelScaler = VideoFilterTypeID_None;
|
_pixelScaler = VideoFilterTypeID_None;
|
||||||
_useShader150 = oglInfo->IsUsingShader150();
|
_useShader150 = oglInfo->IsUsingShader150();
|
||||||
_shaderSupport = oglInfo->GetShaderSupport();
|
_shaderSupport = oglInfo->GetShaderSupport();
|
||||||
|
|
||||||
_canUseShaderOutput = oglInfo->IsShaderSupported();
|
_canUseShaderOutput = oglInfo->IsShaderSupported();
|
||||||
if (_canUseShaderOutput)
|
if (_canUseShaderOutput)
|
||||||
{
|
{
|
||||||
|
@ -4734,7 +4716,7 @@ OGLImage::OGLImage(OGLInfo *oglInfo, GLsizei imageWidth, GLsizei imageHeight, GL
|
||||||
_finalOutputProgram = NULL;
|
_finalOutputProgram = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_canUseShaderBasedFilters = (_canUseShaderOutput && oglInfo->IsFBOSupported());
|
_canUseShaderBasedFilters = (oglInfo->IsShaderSupported() && oglInfo->IsFBOSupported());
|
||||||
if (_canUseShaderBasedFilters)
|
if (_canUseShaderBasedFilters)
|
||||||
{
|
{
|
||||||
_filterDeposterize = new OGLFilterDeposterize(_vf->GetSrcWidth(), _vf->GetSrcHeight(), _shaderSupport, _useShader150);
|
_filterDeposterize = new OGLFilterDeposterize(_vf->GetSrcWidth(), _vf->GetSrcHeight(), _shaderSupport, _useShader150);
|
||||||
|
|
|
@ -65,7 +65,6 @@ protected:
|
||||||
|
|
||||||
bool _isVBOSupported;
|
bool _isVBOSupported;
|
||||||
bool _isPBOSupported;
|
bool _isPBOSupported;
|
||||||
bool _isShaderSupported;
|
|
||||||
bool _isFBOSupported;
|
bool _isFBOSupported;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -46,7 +46,6 @@ void glGenVertexArrays_3_2(GLsizei n, GLuint *vaoIDs)
|
||||||
OGLInfo_3_2::OGLInfo_3_2()
|
OGLInfo_3_2::OGLInfo_3_2()
|
||||||
{
|
{
|
||||||
_useShader150 = true;
|
_useShader150 = true;
|
||||||
_isShaderSupported = true;
|
|
||||||
_isVBOSupported = true;
|
_isVBOSupported = true;
|
||||||
_isPBOSupported = true;
|
_isPBOSupported = true;
|
||||||
_isFBOSupported = true;
|
_isFBOSupported = true;
|
||||||
|
|
|
@ -1316,8 +1316,6 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
(NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0,
|
(NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0,
|
||||||
(NSOpenGLPixelFormatAttribute)0 };
|
(NSOpenGLPixelFormatAttribute)0 };
|
||||||
|
|
||||||
NSOpenGLPixelFormat *format = nil;
|
|
||||||
|
|
||||||
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
#ifdef _OGLDISPLAYOUTPUT_3_2_H_
|
||||||
// If we can support a 3.2 Core Profile context, then request that in our
|
// If we can support a 3.2 Core Profile context, then request that in our
|
||||||
// pixel format attributes.
|
// pixel format attributes.
|
||||||
|
@ -1326,20 +1324,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
||||||
attributes[9] = NSOpenGLPFAOpenGLProfile;
|
attributes[9] = NSOpenGLPFAOpenGLProfile;
|
||||||
attributes[10] = NSOpenGLProfileVersion3_2Core;
|
attributes[10] = NSOpenGLProfileVersion3_2Core;
|
||||||
OGLInfoCreate_Func = &OGLInfoCreate_3_2;
|
OGLInfoCreate_Func = &OGLInfoCreate_3_2;
|
||||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
|
||||||
|
|
||||||
if (format == nil)
|
|
||||||
{
|
|
||||||
attributes[9] = NSOpenGLPFAOpenGLProfile;
|
|
||||||
attributes[10] = NSOpenGLProfileVersionLegacy;
|
|
||||||
OGLInfoCreate_Func = &OGLInfoCreate_Legacy;
|
|
||||||
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
if (format == nil)
|
if (format == nil)
|
||||||
{
|
{
|
||||||
|
// If we can't get a 3.2 Core Profile context, then switch to using a
|
||||||
|
// legacy context instead.
|
||||||
attributes[9] = (NSOpenGLPixelFormatAttribute)0;
|
attributes[9] = (NSOpenGLPixelFormatAttribute)0;
|
||||||
attributes[10] = (NSOpenGLPixelFormatAttribute)0;
|
attributes[10] = (NSOpenGLPixelFormatAttribute)0;
|
||||||
OGLInfoCreate_Func = &OGLInfoCreate_Legacy;
|
OGLInfoCreate_Func = &OGLInfoCreate_Legacy;
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8,
|
NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)8,
|
||||||
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)0,
|
NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)0,
|
||||||
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)0,
|
NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)0,
|
||||||
NSOpenGLPFADoubleBuffer,
|
|
||||||
(NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0,
|
(NSOpenGLPixelFormatAttribute)0, (NSOpenGLPixelFormatAttribute)0,
|
||||||
(NSOpenGLPixelFormatAttribute)0 };
|
(NSOpenGLPixelFormatAttribute)0 };
|
||||||
|
|
||||||
|
@ -67,14 +66,23 @@
|
||||||
// pixel format attributes.
|
// pixel format attributes.
|
||||||
if (IsOSXVersionSupported(10, 7, 0))
|
if (IsOSXVersionSupported(10, 7, 0))
|
||||||
{
|
{
|
||||||
attributes[9] = kCGLPFAOpenGLProfile;
|
attributes[8] = NSOpenGLPFAOpenGLProfile;
|
||||||
attributes[10] = (CGLPixelFormatAttribute)kCGLOGLPVersion_3_2_Core;
|
attributes[9] = NSOpenGLProfileVersion3_2Core;
|
||||||
|
|
||||||
OGLInfoCreate_Func = &OGLInfoCreate_3_2;
|
OGLInfoCreate_Func = &OGLInfoCreate_3_2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
NSOpenGLPixelFormat *format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
|
if (format == nil)
|
||||||
|
{
|
||||||
|
// If we can't get a 3.2 Core Profile context, then switch to using a
|
||||||
|
// legacy context instead.
|
||||||
|
attributes[8] = (NSOpenGLPixelFormatAttribute)0;
|
||||||
|
attributes[9] = (NSOpenGLPixelFormatAttribute)0;
|
||||||
|
OGLInfoCreate_Func = &OGLInfoCreate_Legacy;
|
||||||
|
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||||
|
}
|
||||||
|
|
||||||
context = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
|
context = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil];
|
||||||
[format release];
|
[format release];
|
||||||
cglDisplayContext = (CGLContextObj)[context CGLContextObj];
|
cglDisplayContext = (CGLContextObj)[context CGLContextObj];
|
||||||
|
@ -230,7 +238,7 @@
|
||||||
CGLContextObj prevContext = CGLGetCurrentContext();
|
CGLContextObj prevContext = CGLGetCurrentContext();
|
||||||
CGLSetCurrentContext(cglDisplayContext);
|
CGLSetCurrentContext(cglDisplayContext);
|
||||||
oglImage->RenderOGL();
|
oglImage->RenderOGL();
|
||||||
CGLFlushDrawable(cglDisplayContext);
|
glFlush();
|
||||||
CGLSetCurrentContext(prevContext);
|
CGLSetCurrentContext(prevContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue