diff options
Diffstat (limited to 'src/native/ogl/MasterControl.c')
-rw-r--r-- | src/native/ogl/MasterControl.c | 163 |
1 files changed, 2 insertions, 161 deletions
diff --git a/src/native/ogl/MasterControl.c b/src/native/ogl/MasterControl.c index 2ca2b08..027b640 100644 --- a/src/native/ogl/MasterControl.c +++ b/src/native/ogl/MasterControl.c @@ -72,7 +72,7 @@ extern int isExtensionSupported(const char *allExtensions, const char *extension); JNIEXPORT jboolean JNICALL -Java_javax_media_j3d_MasterControl_initializeJ3D( +Java_javax_media_j3d_NativePipeline_initializeJ3D( JNIEnv *env, jobject obj, jboolean disableXinerama) { jboolean glIsMTSafe = JNI_TRUE; @@ -164,84 +164,8 @@ DWORD countBits(DWORD mask) #endif /* WIN32 */ -/* - * Class: javax_media_j3d_MasterControl - * Method: getNumberOfProcessor - * Signature: ()I - * - * This function get the number of active processor in the system - */ -JNIEXPORT jint JNICALL Java_javax_media_j3d_MasterControl_getNumberOfProcessor - (JNIEnv *env, jobject obj) -{ -#if defined(UNIX) - return sysconf(_SC_NPROCESSORS_ONLN); -#endif /* UNIX_ */ - -#ifdef WIN32 - SYSTEM_INFO sysInfo; - - GetSystemInfo(&sysInfo); - return countBits(sysInfo.dwActiveProcessorMask); -#endif /* WIN32 */ -} - - -/* - * Class: javax_media_j3d_MasterControl - * Method: getThreadConcurrency - * Signature: ()I - */ -JNIEXPORT jint JNICALL -Java_javax_media_j3d_MasterControl_getThreadConcurrency(JNIEnv *env, - jobject obj) -{ - /* - * Return the number of concurrent threads that can be run, - * -1 if unknown. - */ - -#ifdef SOLARIS - return (jint) thr_getconcurrency(); -#endif /* SOLARIS */ - -#ifdef LINUX - return -1; -#endif /* LINUX */ - -#ifdef WIN32 - return -1; -#endif /* WIN32 */ -} - - -/* - * Class: javax_media_j3d_MasterControl - * Method: setThreadConcurrency - * Signature: (I)V - */ -JNIEXPORT void JNICALL -Java_javax_media_j3d_MasterControl_setThreadConcurrency(JNIEnv *env, - jobject obj, - jint newLevel) -{ -#ifdef SOLARIS - thr_setconcurrency((int)newLevel); -#endif /* SOLARIS */ - -#ifdef WIN32 - /* No-op on windows */ -#endif /* WIN32 */ - -#ifdef LINUX - /* No-op on linux */ -#endif /* LINUX */ -} - - - JNIEXPORT -jint JNICALL Java_javax_media_j3d_MasterControl_getMaximumLights( +jint JNICALL Java_javax_media_j3d_NativePipeline_getMaximumLights( JNIEnv *env, jobject obj ) { @@ -258,86 +182,3 @@ jint JNICALL Java_javax_media_j3d_MasterControl_getMaximumLights( return 8; #endif /* LINUX */ } - - -/* ======================================================================= */ - -/* - * The following method implements a high-resolution timer (based on the - * native code in the J3DTimer class). It will no longer be needed once - * we drop support for JDK 1.4.2, at which time it will be replaced by - * a call to System.nanoTime(). - */ - -#define NSEC_PER_SEC ((jlong)1000000000) - -#ifdef __linux__ -#include <sys/time.h> -#include <time.h> -#include <unistd.h> -#endif - -#ifdef SOLARIS -#include <time.h> -#include <sys/systeminfo.h> -#include <string.h> -#ifndef CLOCK_HIGHRES -#define CLOCK_HIGHRES 4 /* Solaris 7 does not define this */ -#endif /* constant. When run on Solaris 7 */ -#endif /* CLOCK_HIGHRES is not used. */ - -#ifdef WIN32 -#include <Windows.h> -#include <math.h> -static double timerScale = -1.0; -#endif - -/* - * Class: javax_media_j3d_MasterControl - * Method: getNativeTimerValue - * Signature: ()J - */ -JNIEXPORT jlong JNICALL -Java_javax_media_j3d_MasterControl_getNativeTimerValue(JNIEnv *env, jclass clazz) -{ - jlong timerNsec; - -#ifdef SOLARIS - /* - struct timespec tp; - clock_gettime( CLOCK_HIGHRES, &tp ); - - return (jlong)tp.tv_nsec + (jlong)tp.tv_sec * NSEC_PER_SEC; - */ - - timerNsec = (jlong)gethrtime(); -#endif /* SOLARIS */ - -#ifdef WIN32 - LARGE_INTEGER time; - LARGE_INTEGER freq; - - if (timerScale < 0.0) { - QueryPerformanceFrequency( &freq ); - if (freq.QuadPart <= 0) { - timerScale = 0.0; - } - else { - timerScale = (double) NSEC_PER_SEC / (double)freq.QuadPart; - } - } - - QueryPerformanceCounter(&time); - timerNsec = (jlong)((double)time.QuadPart * timerScale); - -#endif /* WIN32 */ - -#ifdef __linux__ - struct timeval t; - - gettimeofday(&t, 0); - timerNsec = ((jlong)t.tv_sec) * NSEC_PER_SEC + ((jlong)t.tv_usec) * ((jlong)1000); -#endif /* __linux__ */ - - return timerNsec; -} |