From Stephan Huber, "minor ios-fixes/-enhancements
* force _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC for IOS device + simulator as the test does not pick the right implementation * fixed a small compile-bug for iphone-example * added a check to prevent multiple realization of a GraphicsWindowIOS-object "
This commit is contained in:
parent
d8c1c4bbeb
commit
dbf88cc209
@ -1,4 +1,4 @@
|
|||||||
# Check for availability of atomic operations
|
# Check for availability of atomic operations
|
||||||
# This module defines
|
# This module defines
|
||||||
# OPENTHREADS_HAVE_ATOMIC_OPS
|
# OPENTHREADS_HAVE_ATOMIC_OPS
|
||||||
|
|
||||||
@ -15,123 +15,134 @@ IF (OPENTHREADS_ATOMIC_USE_MUTEX)
|
|||||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
|
# as the test does not work for IOS hardcode the ATOMIC implementation
|
||||||
|
IF(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR OR OSG_BUILD_PLATFORM_IPHONE)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 0)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS 0)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_SUN 0)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 0)
|
||||||
|
|
||||||
INCLUDE(CheckCXXSourceRuns)
|
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC 1)
|
||||||
|
|
||||||
# Do step by step checking,
|
ELSE()
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
INCLUDE(CheckCXXSourceRuns)
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
int main()
|
# Do step by step checking,
|
||||||
{
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
unsigned value = 0;
|
#include <cstdlib>
|
||||||
void* ptr = &value;
|
|
||||||
__sync_add_and_fetch(&value, 1);
|
|
||||||
__sync_synchronize();
|
|
||||||
__sync_sub_and_fetch(&value, 1);
|
|
||||||
if (!__sync_bool_compare_and_swap(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
|
int main()
|
||||||
return EXIT_FAILURE;
|
{
|
||||||
|
unsigned value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
__sync_add_and_fetch(&value, 1);
|
||||||
|
__sync_synchronize();
|
||||||
|
__sync_sub_and_fetch(&value, 1);
|
||||||
|
if (!__sync_bool_compare_and_swap(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <stdlib.h>
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
|
||||||
|
|
||||||
int main(int, const char**)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#include <stdlib.h>
|
||||||
unsigned value = 0;
|
|
||||||
void* ptr = &value;
|
|
||||||
__add_and_fetch(&value, 1);
|
|
||||||
__synchronize(value);
|
|
||||||
__sub_and_fetch(&value, 1);
|
|
||||||
if (!__compare_and_swap(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
int main(int, const char**)
|
||||||
return EXIT_FAILURE;
|
{
|
||||||
|
unsigned value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
__add_and_fetch(&value, 1);
|
||||||
|
__synchronize(value);
|
||||||
|
__sub_and_fetch(&value, 1);
|
||||||
|
if (!__compare_and_swap(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <atomic.h>
|
}
|
||||||
#include <cstdlib>
|
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
|
||||||
|
|
||||||
int main(int, const char**)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#include <atomic.h>
|
||||||
uint_t value = 0;
|
#include <cstdlib>
|
||||||
void* ptr = &value;
|
|
||||||
atomic_inc_uint_nv(&value);
|
|
||||||
membar_consumer();
|
|
||||||
atomic_dec_uint_nv(&value);
|
|
||||||
if (0 != atomic_cas_uint(&value, 0, 1))
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
|
|
||||||
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
|
int main(int, const char**)
|
||||||
return EXIT_FAILURE;
|
{
|
||||||
|
uint_t value = 0;
|
||||||
|
void* ptr = &value;
|
||||||
|
atomic_inc_uint_nv(&value);
|
||||||
|
membar_consumer();
|
||||||
|
atomic_dec_uint_nv(&value);
|
||||||
|
if (0 != atomic_cas_uint(&value, 0, 1))
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_SUN)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <windows.h>
|
}
|
||||||
#include <intrin.h>
|
" _OPENTHREADS_ATOMIC_USE_SUN)
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#pragma intrinsic(_InterlockedAnd)
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
#pragma intrinsic(_InterlockedOr)
|
#include <windows.h>
|
||||||
#pragma intrinsic(_InterlockedXor)
|
#include <intrin.h>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
int main(int, const char**)
|
#pragma intrinsic(_InterlockedAnd)
|
||||||
{
|
#pragma intrinsic(_InterlockedOr)
|
||||||
volatile long value = 0;
|
#pragma intrinsic(_InterlockedXor)
|
||||||
long data = 0;
|
|
||||||
long* volatile ptr = &data;
|
|
||||||
|
|
||||||
InterlockedIncrement(&value);
|
int main(int, const char**)
|
||||||
MemoryBarrier();
|
{
|
||||||
InterlockedDecrement(&value);
|
volatile long value = 0;
|
||||||
|
long data = 0;
|
||||||
|
long* volatile ptr = &data;
|
||||||
|
|
||||||
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
InterlockedIncrement(&value);
|
||||||
return EXIT_FAILURE;
|
MemoryBarrier();
|
||||||
|
InterlockedDecrement(&value);
|
||||||
|
|
||||||
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
if (0 != InterlockedCompareExchange(&value, 1, 0))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
|
||||||
}
|
return EXIT_FAILURE;
|
||||||
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
|
||||||
|
|
||||||
CHECK_CXX_SOURCE_RUNS("
|
return EXIT_SUCCESS;
|
||||||
#include <libkern/OSAtomic.h>
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
|
||||||
|
|
||||||
int main()
|
CHECK_CXX_SOURCE_RUNS("
|
||||||
{
|
#include <libkern/OSAtomic.h>
|
||||||
volatile int32_t value = 0;
|
|
||||||
long data = 0;
|
|
||||||
long * volatile ptr = &data;
|
|
||||||
|
|
||||||
OSAtomicIncrement32(&value);
|
int main()
|
||||||
OSMemoryBarrier();
|
{
|
||||||
OSAtomicDecrement32(&value);
|
volatile int32_t value = 0;
|
||||||
OSAtomicCompareAndSwapInt(value, 1, &value);
|
long data = 0;
|
||||||
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
long * volatile ptr = &data;
|
||||||
}
|
|
||||||
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
|
||||||
|
|
||||||
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
|
OSAtomicIncrement32(&value);
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
|
OSMemoryBarrier();
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
|
OSAtomicDecrement32(&value);
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
|
OSAtomicCompareAndSwapInt(value, 1, &value);
|
||||||
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
|
||||||
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
}
|
||||||
|
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||||
|
|
||||||
|
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
|
||||||
|
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
|
||||||
|
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <osgDB/ReadFile>
|
#include <osgDB/ReadFile>
|
||||||
#include <osg/MatrixTransform>
|
#include <osg/MatrixTransform>
|
||||||
#include <osg/CameraNode>
|
|
||||||
#include <osgText/Text>
|
#include <osgText/Text>
|
||||||
#include <osgViewer/Viewer>
|
#include <osgViewer/Viewer>
|
||||||
|
|
||||||
|
@ -746,6 +746,8 @@ void GraphicsWindowIOS::init()
|
|||||||
|
|
||||||
bool GraphicsWindowIOS::realizeImplementation()
|
bool GraphicsWindowIOS::realizeImplementation()
|
||||||
{
|
{
|
||||||
|
if (_realized) return true;
|
||||||
|
|
||||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
BOOL bar_hidden = (_traits->windowDecoration) ? NO: YES;
|
BOOL bar_hidden = (_traits->windowDecoration) ? NO: YES;
|
||||||
|
Loading…
Reference in New Issue
Block a user