FIXED: Wrong detection of CPU cores crashes emu.

ADDED: D3D will not use more than 16 cores.

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@471 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2008-03-30 13:26:17 +00:00
parent f060ef5ac6
commit 8682f2f989
2 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,7 @@
#ifndef NO_D3D #ifndef NO_D3D
// The number of pixel-filter threads to be created // The number of pixel-filter threads to be created
#define NTHREADS ( theApp.maxCpuCores ) #define NTHREADS ( nThreads )
#pragma comment( lib, "d3d9" ) #pragma comment( lib, "d3d9" )
#pragma comment( lib, "d3dx9" ) #pragma comment( lib, "d3dx9" )
@ -114,6 +114,7 @@ private:
bool rectangleFillsScreen; bool rectangleFillsScreen;
PFTHREAD_DATA *pfthread_data; PFTHREAD_DATA *pfthread_data;
HANDLE *hThreads; HANDLE *hThreads;
int nThreads;
struct VERTEX { struct VERTEX {
FLOAT x, y, z, rhw; // screen coordinates FLOAT x, y, z, rhw; // screen coordinates
@ -174,6 +175,8 @@ Direct3DDisplay::Direct3DDisplay()
rectangleFillsScreen = false; rectangleFillsScreen = false;
pfthread_data = NULL; pfthread_data = NULL;
hThreads = NULL; hThreads = NULL;
nThreads = theApp.maxCpuCores;
if( nThreads > 16 ) nThreads = 16;
} }

View File

@ -2597,6 +2597,9 @@ int VBA::detectCpuCores()
int processor_count = ( CPUInfo[1] & 0x00FF0000 ) >> 16; int processor_count = ( CPUInfo[1] & 0x00FF0000 ) >> 16;
// some CPUs probably do not support this instruction properly
if( processor_count < 1 ) processor_count = 1;
return processor_count; return processor_count;
} }