1
0
forked from 0ad/0ad

Adds patch for wxWidgets build on OS X, fixes Atlas crash on VMs with software rendering.

Cleans up wxWidgets config flags

This was SVN commit r15788.
This commit is contained in:
historic_bruno 2014-09-23 00:33:14 +00:00
parent 3b49576fa6
commit 1a2c9835c9
4 changed files with 93 additions and 29 deletions

View File

@ -387,15 +387,14 @@ then
mkdir -p build-release mkdir -p build-release
pushd build-release pushd build-release
# disable XML and richtext support, to avoid dependency on expat CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --with-expat=builtin --with-libjpeg=builtin --with-png=builtin --without-libtiff --without-sdl --without-x"
CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --disable-richtext --with-expat=builtin --without-sdl"
# wxWidgets configure now defaults to targeting 10.5, if not specified, # wxWidgets configure now defaults to targeting 10.5, if not specified,
# but that conflicts with our flags # but that conflicts with our flags
if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION" CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION"
fi fi
# patch to fix Atlas on VMs w/ software rendering (fixed upstream, see http://trac.wxwidgets.org/ticket/16555 )
(../configure CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" $CONF_OPTS && make ${JOBS} && make install) || die "wxWidgets build failed" (patch -p0 -d.. -i../../patches/wxwidgets-glcanvas-fix.diff && ../configure CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" $CONF_OPTS && make ${JOBS} && make install) || die "wxWidgets build failed"
popd popd
popd popd
touch .already-built touch .already-built

View File

@ -1,13 +1,13 @@
Index: atomicrefcount.cpp Index: atomicrefcount.cpp
=================================================================== ===================================================================
--- src/atomicrefcount.cpp (revision 4528) --- src/atomicrefcount.cpp (revision 4528)
+++ src/atomicrefcount.cpp (revision 4529) +++ src/atomicrefcount.cpp (revision 4529)
@@ -76,7 +76,7 @@ @@ -76,7 +76,7 @@
#if defined( _WIN32 ) && !defined( __SYMBIAN32__ ) #if defined( _WIN32 ) && !defined( __SYMBIAN32__ )
::InterlockedExchange( (volatile LONG*)&m_count, (volatile LONG)0 ); ::InterlockedExchange( (volatile LONG*)&m_count, (volatile LONG)0 );
#elif defined( __APPLE__ ) #elif defined( __APPLE__ )
- OSAtomicAnd32Barrier( (int32_t)0, (volatile int32_t*)&m_count ); - OSAtomicAnd32Barrier( (int32_t)0, (volatile int32_t*)&m_count );
+ OSAtomicAnd32Barrier( (uint32_t)0, (volatile uint32_t*)&m_count ); + OSAtomicAnd32Barrier( (uint32_t)0, (volatile uint32_t*)&m_count );
#elif defined( HAVE_GCC_ATOMIC_BUILTINS ) #elif defined( HAVE_GCC_ATOMIC_BUILTINS )
// Use the gcc intrinsic for atomic decrement if supported. // Use the gcc intrinsic for atomic decrement if supported.
__sync_fetch_and_and( &m_count, 0 ); __sync_fetch_and_and( &m_count, 0 );

View File

@ -1,12 +1,12 @@
--- src/video/quartz/SDL_QuartzVideo.h 2012-01-19 01:30:06.000000000 -0500 --- src/video/quartz/SDL_QuartzVideo.h 2012-01-19 01:30:06.000000000 -0500
+++ src/video/quartz/SDL_QuartzVideo.h 2013-11-10 19:51:27.000000000 -0500 +++ src/video/quartz/SDL_QuartzVideo.h 2013-11-10 19:51:27.000000000 -0500
@@ -91,7 +91,9 @@ @@ -91,7 +91,9 @@
CGDirectDisplayID display; /* 0 == main display (only support single display) */ CGDirectDisplayID display; /* 0 == main display (only support single display) */
const void *mode; /* current mode of the display */ const void *mode; /* current mode of the display */
const void *save_mode; /* original mode of the display */ const void *save_mode; /* original mode of the display */
+#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070) +#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1070)
CGDirectPaletteRef palette; /* palette of an 8-bit display */ CGDirectPaletteRef palette; /* palette of an 8-bit display */
+#endif +#endif
NSOpenGLContext *gl_context; /* OpenGL rendering context */ NSOpenGLContext *gl_context; /* OpenGL rendering context */
NSGraphicsContext *nsgfx_context; /* Cocoa graphics context */ NSGraphicsContext *nsgfx_context; /* Cocoa graphics context */
Uint32 width, height, bpp; /* frequently used data about the display */ Uint32 width, height, bpp; /* frequently used data about the display */

View File

@ -0,0 +1,65 @@
--- src/osx/cocoa/glcanvas.mm 2014-06-14 14:48:48.000000000 -0700
+++ src/osx/cocoa/glcanvas.mm 2014-09-22 12:57:10.000000000 -0700
@@ -81,28 +81,47 @@
WXGLPixelFormat WXGLChoosePixelFormat(const int *attribList)
{
NSOpenGLPixelFormatAttribute data[512];
- const NSOpenGLPixelFormatAttribute defaultAttribs[] =
+
+ unsigned p = 0;
+ data[p++] = NSOpenGLPFAMinimumPolicy; // make _SIZE tags behave more like GLX
+
+ // Test if we support hardware acceleration, we always want to use it if it
+ // is available and, apparently, in spite of the Apple docs explicitly
+ // saying the contrary:
+ //
+ // If present, this attribute indicates that only hardware-accelerated
+ // renderers are considered. If not present, accelerated renderers are
+ // still preferred.
+ //
+ // hardware acceleration is not always used without it, so we do need to
+ // specify it. But we shouldn't do it if acceleration is really not
+ // available.
+ const NSOpenGLPixelFormatAttribute
+ attrsAccel[] = { NSOpenGLPFAAccelerated, 0 };
+ if ( WXGLPixelFormat testFormat = [[NSOpenGLPixelFormat alloc]
+ initWithAttributes: attrsAccel] )
{
- NSOpenGLPFADoubleBuffer,
- NSOpenGLPFAMinimumPolicy,
- NSOpenGLPFAColorSize,(NSOpenGLPixelFormatAttribute)8,
- NSOpenGLPFAAlphaSize,(NSOpenGLPixelFormatAttribute)0,
- NSOpenGLPFADepthSize,(NSOpenGLPixelFormatAttribute)8,
- NSOpenGLPFAAccelerated, // use hardware accelerated context
- (NSOpenGLPixelFormatAttribute)nil
- };
-
+ // Hardware acceleration is available, use it.
+ data[p++] = NSOpenGLPFAAccelerated;
+ [testFormat release];
+ }
+
const NSOpenGLPixelFormatAttribute *attribs;
if ( !attribList )
{
- attribs = defaultAttribs;
+ // Default attributes
+ data[p++] = NSOpenGLPFADoubleBuffer;
+ data[p++] = NSOpenGLPFAColorSize;
+ data[p++] = (NSOpenGLPixelFormatAttribute)8;
+ data[p++] = NSOpenGLPFAAlphaSize;
+ data[p++] = (NSOpenGLPixelFormatAttribute)0;
+ data[p++] = NSOpenGLPFADepthSize;
+ data[p++] = (NSOpenGLPixelFormatAttribute)8;
+ data[p] = 0;
+ attribs = data;
}
else
{
- unsigned p = 0;
- data[p++] = NSOpenGLPFAMinimumPolicy; // make _SIZE tags behave more like GLX
- data[p++] = NSOpenGLPFAAccelerated; // use hardware accelerated context
-
for ( unsigned arg = 0; attribList[arg] !=0 && p < WXSIZEOF(data); )
{
switch ( attribList[arg++] )