mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
Merge branch 'release/1.9.x'
This commit is contained in:
commit
194a43fa2a
@ -15,6 +15,48 @@
|
|||||||
#include "graphicsStateGuardian.h"
|
#include "graphicsStateGuardian.h"
|
||||||
#include "displayInformation.h"
|
#include "displayInformation.h"
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DisplayMode::Comparison Operator
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns true if these two DisplayModes are identical.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DisplayMode::
|
||||||
|
operator == (const DisplayMode &other) const {
|
||||||
|
return (width == other.width && height == other.height &&
|
||||||
|
bits_per_pixel == other.bits_per_pixel &&
|
||||||
|
refresh_rate == other.refresh_rate &&
|
||||||
|
fullscreen_only == other.fullscreen_only);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DisplayMode::Comparison Operator
|
||||||
|
// Access: Published
|
||||||
|
// Description: Returns false if these two DisplayModes are identical.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool DisplayMode::
|
||||||
|
operator != (const DisplayMode &other) const {
|
||||||
|
return !operator == (other);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DisplayMode::output
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void DisplayMode::
|
||||||
|
output(ostream &out) const {
|
||||||
|
out << width << 'x' << height;
|
||||||
|
if (bits_per_pixel > 0) {
|
||||||
|
out << ' ' << bits_per_pixel << "bpp";
|
||||||
|
}
|
||||||
|
if (refresh_rate > 0) {
|
||||||
|
out << ' ' << refresh_rate << "Hz";
|
||||||
|
}
|
||||||
|
if (fullscreen_only > 0) {
|
||||||
|
out << " (fullscreen only)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DisplayInformation::Destructor
|
// Function: DisplayInformation::Destructor
|
||||||
// Access: Published
|
// Access: Published
|
||||||
@ -181,6 +223,21 @@ get_total_display_modes() {
|
|||||||
return _total_display_modes;
|
return _total_display_modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: DisplayInformation::get_display_mode
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
const DisplayMode &DisplayInformation::
|
||||||
|
get_display_mode(int display_index) {
|
||||||
|
#ifndef NDEBUG
|
||||||
|
static DisplayMode err_mode = {0};
|
||||||
|
nassertr(display_index >= 0 && display_index < _total_display_modes, err_mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return _display_mode_array[display_index];
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: DisplayInformation::get_display_mode_width
|
// Function: DisplayInformation::get_display_mode_width
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -17,24 +17,25 @@
|
|||||||
|
|
||||||
#include "typedef.h"
|
#include "typedef.h"
|
||||||
|
|
||||||
typedef struct {
|
struct EXPCL_PANDA_DISPLAY DisplayMode {
|
||||||
|
PUBLISHED:
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int bits_per_pixel;
|
int bits_per_pixel;
|
||||||
int refresh_rate;
|
int refresh_rate;
|
||||||
int fullscreen_only;
|
int fullscreen_only;
|
||||||
}
|
|
||||||
DisplayMode;
|
bool operator == (const DisplayMode &other) const;
|
||||||
|
bool operator != (const DisplayMode &other) const;
|
||||||
|
void output(ostream &out) const;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : DisplayInformation
|
// Class : DisplayInformation
|
||||||
// Description : This class contains various display information.
|
// Description : This class contains various display information.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class EXPCL_PANDA_DISPLAY DisplayInformation {
|
class EXPCL_PANDA_DISPLAY DisplayInformation {
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
|
|
||||||
enum DetectionState {
|
enum DetectionState {
|
||||||
DS_unknown,
|
DS_unknown,
|
||||||
DS_success,
|
DS_success,
|
||||||
@ -54,6 +55,10 @@ PUBLISHED:
|
|||||||
int get_window_bits_per_pixel();
|
int get_window_bits_per_pixel();
|
||||||
|
|
||||||
int get_total_display_modes();
|
int get_total_display_modes();
|
||||||
|
const DisplayMode &get_display_mode(int display_index);
|
||||||
|
MAKE_SEQ(get_display_modes, get_total_display_modes, get_display_mode);
|
||||||
|
|
||||||
|
// Older interface for display modes.
|
||||||
int get_display_mode_width(int display_index);
|
int get_display_mode_width(int display_index);
|
||||||
int get_display_mode_height(int display_index);
|
int get_display_mode_height(int display_index);
|
||||||
int get_display_mode_bits_per_pixel(int display_index);
|
int get_display_mode_bits_per_pixel(int display_index);
|
||||||
|
@ -4759,8 +4759,8 @@ prepare_shader(Shader *se) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_CG) && !defined(OPENGLES)
|
|
||||||
case Shader::SL_Cg:
|
case Shader::SL_Cg:
|
||||||
|
#if defined(HAVE_CG) && !defined(OPENGLES)
|
||||||
if (_supports_basic_shaders) {
|
if (_supports_basic_shaders) {
|
||||||
result = new CLP(CgShaderContext)(this, se);
|
result = new CLP(CgShaderContext)(this, se);
|
||||||
break;
|
break;
|
||||||
@ -4769,6 +4769,10 @@ prepare_shader(Shader *se) {
|
|||||||
<< "Tried to load Cg shader, but basic shaders not supported.\n";
|
<< "Tried to load Cg shader, but basic shaders not supported.\n";
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#elif defined(OPENGLES)
|
||||||
|
GLCAT.error()
|
||||||
|
<< "Tried to load Cg shader, but Cg support is not available for OpenGL ES.\n";
|
||||||
|
return NULL;
|
||||||
#else
|
#else
|
||||||
GLCAT.error()
|
GLCAT.error()
|
||||||
<< "Tried to load Cg shader, but Cg support not compiled in.\n";
|
<< "Tried to load Cg shader, but Cg support not compiled in.\n";
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "winGraphicsPipe.h"
|
#include "winGraphicsPipe.h"
|
||||||
#include "config_windisplay.h"
|
#include "config_windisplay.h"
|
||||||
#include "displaySearchParameters.h"
|
#include "displaySearchParameters.h"
|
||||||
|
#include "displayInformation.h"
|
||||||
#include "dtool_config.h"
|
#include "dtool_config.h"
|
||||||
#include "pbitops.h"
|
#include "pbitops.h"
|
||||||
|
|
||||||
@ -52,8 +53,7 @@ static GetProcessMemoryInfoType GetProcessMemoryInfoFunction = 0;
|
|||||||
static GlobalMemoryStatusExType GlobalMemoryStatusExFunction = 0;
|
static GlobalMemoryStatusExType GlobalMemoryStatusExFunction = 0;
|
||||||
static CallNtPowerInformationType CallNtPowerInformationFunction = 0;
|
static CallNtPowerInformationType CallNtPowerInformationFunction = 0;
|
||||||
|
|
||||||
void get_memory_information (DisplayInformation *display_information)
|
void get_memory_information (DisplayInformation *display_information) {
|
||||||
{
|
|
||||||
if (initialize == false) {
|
if (initialize == false) {
|
||||||
psapi_dll = LoadLibrary("psapi.dll");
|
psapi_dll = LoadLibrary("psapi.dll");
|
||||||
if (psapi_dll) {
|
if (psapi_dll) {
|
||||||
@ -81,8 +81,7 @@ void get_memory_information (DisplayInformation *display_information)
|
|||||||
display_information->_available_process_virtual_memory = memory_status.ullAvailVirtual;
|
display_information->_available_process_virtual_memory = memory_status.ullAvailVirtual;
|
||||||
display_information->_memory_load = memory_status.dwMemoryLoad;
|
display_information->_memory_load = memory_status.dwMemoryLoad;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
MEMORYSTATUS memory_status;
|
MEMORYSTATUS memory_status;
|
||||||
|
|
||||||
memory_status.dwLength = sizeof(MEMORYSTATUS);
|
memory_status.dwLength = sizeof(MEMORYSTATUS);
|
||||||
@ -118,8 +117,7 @@ void get_memory_information (DisplayInformation *display_information)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union
|
typedef union {
|
||||||
{
|
|
||||||
PN_uint64 long_integer;
|
PN_uint64 long_integer;
|
||||||
}
|
}
|
||||||
LONG_INTEGER;
|
LONG_INTEGER;
|
||||||
@ -133,8 +131,7 @@ PN_uint64 cpu_time_function (void) {
|
|||||||
|
|
||||||
long_integer_pointer = &long_integer;
|
long_integer_pointer = &long_integer;
|
||||||
|
|
||||||
__asm
|
__asm {
|
||||||
{
|
|
||||||
mov ebx,[long_integer_pointer]
|
mov ebx,[long_integer_pointer]
|
||||||
rdtsc
|
rdtsc
|
||||||
mov [ebx + 0], eax
|
mov [ebx + 0], eax
|
||||||
@ -145,14 +142,10 @@ PN_uint64 cpu_time_function (void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef union
|
typedef union {
|
||||||
{
|
struct {
|
||||||
struct
|
union {
|
||||||
{
|
struct {
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
unsigned char al;
|
unsigned char al;
|
||||||
unsigned char ah;
|
unsigned char ah;
|
||||||
};
|
};
|
||||||
@ -162,15 +155,11 @@ typedef union
|
|||||||
unsigned int ecx;
|
unsigned int ecx;
|
||||||
unsigned int edx;
|
unsigned int edx;
|
||||||
};
|
};
|
||||||
}
|
} CPU_ID_REGISTERS;
|
||||||
CPU_ID_REGISTERS;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
union {
|
||||||
union
|
struct {
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
int maximum_cpu_id_input;
|
int maximum_cpu_id_input;
|
||||||
char cpu_vendor [16];
|
char cpu_vendor [16];
|
||||||
};
|
};
|
||||||
@ -178,19 +167,15 @@ typedef struct
|
|||||||
CPU_ID_REGISTERS cpu_id_registers_0;
|
CPU_ID_REGISTERS cpu_id_registers_0;
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_1;
|
CPU_ID_REGISTERS cpu_id_registers_1;
|
||||||
|
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
// eax
|
// eax
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
unsigned int eax;
|
unsigned int eax;
|
||||||
unsigned int version_information;
|
unsigned int version_information;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int stepping_id : 4;
|
unsigned int stepping_id : 4;
|
||||||
unsigned int model : 4;
|
unsigned int model : 4;
|
||||||
unsigned int family : 4;
|
unsigned int family : 4;
|
||||||
@ -203,11 +188,9 @@ typedef struct
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ebx
|
// ebx
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
unsigned int ebx;
|
unsigned int ebx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int brand_index : 8;
|
unsigned int brand_index : 8;
|
||||||
unsigned int clflush : 8;
|
unsigned int clflush : 8;
|
||||||
unsigned int maximum_logical_processors : 8;
|
unsigned int maximum_logical_processors : 8;
|
||||||
@ -216,11 +199,9 @@ typedef struct
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ecx
|
// ecx
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
unsigned int ecx;
|
unsigned int ecx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int sse3 : 1;
|
unsigned int sse3 : 1;
|
||||||
unsigned int reserved_1_to_2 : 2;
|
unsigned int reserved_1_to_2 : 2;
|
||||||
unsigned int monitor : 1;
|
unsigned int monitor : 1;
|
||||||
@ -239,11 +220,9 @@ typedef struct
|
|||||||
};
|
};
|
||||||
|
|
||||||
// edx
|
// edx
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
unsigned int edx;
|
unsigned int edx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int fpu : 1;
|
unsigned int fpu : 1;
|
||||||
unsigned int vme : 1;
|
unsigned int vme : 1;
|
||||||
unsigned int de : 1;
|
unsigned int de : 1;
|
||||||
@ -284,69 +263,45 @@ typedef struct
|
|||||||
#define MAXIMUM_2 8
|
#define MAXIMUM_2 8
|
||||||
#define MAXIMUM_CHARACTERS (MAXIMUM_2 * sizeof(CPU_ID_REGISTERS))
|
#define MAXIMUM_CHARACTERS (MAXIMUM_2 * sizeof(CPU_ID_REGISTERS))
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_2;
|
CPU_ID_REGISTERS cpu_id_registers_2;
|
||||||
unsigned char character_array_2 [MAXIMUM_CHARACTERS];
|
unsigned char character_array_2 [MAXIMUM_CHARACTERS];
|
||||||
CPU_ID_REGISTERS cpu_id_registers_2_array [MAXIMUM_2];
|
CPU_ID_REGISTERS cpu_id_registers_2_array [MAXIMUM_2];
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000000;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000000;
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000001;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000001;
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
|
||||||
char cpu_brand_string [sizeof(CPU_ID_REGISTERS) * 3];
|
char cpu_brand_string [sizeof(CPU_ID_REGISTERS) * 3];
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000002;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000002;
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000003;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000003;
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000004;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000004;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
struct {
|
||||||
struct
|
|
||||||
{
|
|
||||||
// eax
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int eax;
|
unsigned int eax;
|
||||||
};
|
|
||||||
|
|
||||||
// ebx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ebx;
|
unsigned int ebx;
|
||||||
};
|
union {
|
||||||
|
|
||||||
// ecx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ecx;
|
unsigned int ecx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int l1_data_cache_line_size : 8;
|
unsigned int l1_data_cache_line_size : 8;
|
||||||
unsigned int l1_data_reserved_8_to_15 : 8;
|
unsigned int l1_data_reserved_8_to_15 : 8;
|
||||||
unsigned int l1_data_associativity : 8;
|
unsigned int l1_data_associativity : 8;
|
||||||
unsigned int l1_data_cache_size : 8;
|
unsigned int l1_data_cache_size : 8;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
union {
|
||||||
// edx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int edx;
|
unsigned int edx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int l1_code_cache_line_size : 8;
|
unsigned int l1_code_cache_line_size : 8;
|
||||||
unsigned int l1_code_reserved_8_to_15 : 8;
|
unsigned int l1_code_reserved_8_to_15 : 8;
|
||||||
unsigned int l1_code_associativity : 8;
|
unsigned int l1_code_associativity : 8;
|
||||||
@ -357,82 +312,31 @@ typedef struct
|
|||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000005;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000005;
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
union {
|
||||||
{
|
struct {
|
||||||
struct
|
|
||||||
{
|
|
||||||
// eax
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int eax;
|
unsigned int eax;
|
||||||
};
|
|
||||||
|
|
||||||
// ebx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ebx;
|
unsigned int ebx;
|
||||||
};
|
union {
|
||||||
|
|
||||||
// ecx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ecx;
|
unsigned int ecx;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
unsigned int l2_cache_line_size : 8;
|
unsigned int l2_cache_line_size : 8;
|
||||||
unsigned int l2_reserved_8_to_11 : 4;
|
unsigned int l2_reserved_8_to_11 : 4;
|
||||||
unsigned int l2_associativity : 4;
|
unsigned int l2_associativity : 4;
|
||||||
unsigned int l2_cache_size : 16;
|
unsigned int l2_cache_size : 16;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// edx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int edx;
|
unsigned int edx;
|
||||||
};
|
};
|
||||||
};
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000006;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000006;
|
||||||
};
|
};
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
// eax
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int eax;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ebx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ebx;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ecx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int ecx;
|
|
||||||
};
|
|
||||||
|
|
||||||
// edx
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned int edx;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000008;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000008;
|
||||||
};
|
|
||||||
|
|
||||||
unsigned int cache_line_size;
|
unsigned int cache_line_size;
|
||||||
unsigned int log_base_2_cache_line_size;
|
unsigned int log_base_2_cache_line_size;
|
||||||
}
|
} CPU_ID;
|
||||||
CPU_ID;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0;
|
CPU_ID_REGISTERS cpu_id_registers_0;
|
||||||
CPU_ID_REGISTERS cpu_id_registers_1;
|
CPU_ID_REGISTERS cpu_id_registers_1;
|
||||||
|
|
||||||
@ -445,21 +349,9 @@ typedef struct
|
|||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000006;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000006;
|
||||||
|
|
||||||
CPU_ID_REGISTERS cpu_id_registers_0x80000008;
|
CPU_ID_REGISTERS cpu_id_registers_0x80000008;
|
||||||
}
|
} CPU_ID_BINARY_DATA;
|
||||||
CPU_ID_BINARY_DATA;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
union
|
|
||||||
{
|
|
||||||
CPU_ID_BINARY_DATA cpu_binary_data;
|
|
||||||
unsigned int data_array [sizeof (CPU_ID_BINARY_DATA) / 4];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
CPU_ID_BINARY_DATA_ARRAY;
|
|
||||||
|
|
||||||
void cpu_id_to_cpu_id_binary_data (CPU_ID *cpu_id, CPU_ID_BINARY_DATA *cpu_id_binary_data) {
|
void cpu_id_to_cpu_id_binary_data (CPU_ID *cpu_id, CPU_ID_BINARY_DATA *cpu_id_binary_data) {
|
||||||
|
|
||||||
cpu_id_binary_data->cpu_id_registers_0 = cpu_id->cpu_id_registers_0;
|
cpu_id_binary_data->cpu_id_registers_0 = cpu_id->cpu_id_registers_0;
|
||||||
cpu_id_binary_data->cpu_id_registers_1 = cpu_id->cpu_id_registers_1;
|
cpu_id_binary_data->cpu_id_registers_1 = cpu_id->cpu_id_registers_1;
|
||||||
cpu_id_binary_data->cpu_id_registers_0x80000000 = cpu_id->cpu_id_registers_0x80000000;
|
cpu_id_binary_data->cpu_id_registers_0x80000000 = cpu_id->cpu_id_registers_0x80000000;
|
||||||
@ -472,7 +364,6 @@ void cpu_id_to_cpu_id_binary_data (CPU_ID *cpu_id, CPU_ID_BINARY_DATA *cpu_id_bi
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cpu_id_binary_data_to_cpu_id (CPU_ID_BINARY_DATA *cpu_id_binary_data, CPU_ID *cpu_id) {
|
void cpu_id_binary_data_to_cpu_id (CPU_ID_BINARY_DATA *cpu_id_binary_data, CPU_ID *cpu_id) {
|
||||||
|
|
||||||
memset (cpu_id, 0, sizeof(CPU_ID));
|
memset (cpu_id, 0, sizeof(CPU_ID));
|
||||||
|
|
||||||
cpu_id->cpu_id_registers_0 = cpu_id_binary_data->cpu_id_registers_0;
|
cpu_id->cpu_id_registers_0 = cpu_id_binary_data->cpu_id_registers_0;
|
||||||
@ -490,8 +381,7 @@ int cpuid (int input_eax, CPU_ID_REGISTERS *cpu_id_registers) {
|
|||||||
int state;
|
int state;
|
||||||
|
|
||||||
state = false;
|
state = false;
|
||||||
__try
|
__try {
|
||||||
{
|
|
||||||
if (input_eax == 0) {
|
if (input_eax == 0) {
|
||||||
// the order of ecx and edx is swapped when saved to make a proper vendor string
|
// the order of ecx and edx is swapped when saved to make a proper vendor string
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
@ -500,8 +390,7 @@ int cpuid (int input_eax, CPU_ID_REGISTERS *cpu_id_registers) {
|
|||||||
cpu_id_registers->edx = cpu_id_registers->ecx;
|
cpu_id_registers->edx = cpu_id_registers->ecx;
|
||||||
cpu_id_registers->ecx = tmp;
|
cpu_id_registers->ecx = tmp;
|
||||||
#else
|
#else
|
||||||
__asm
|
__asm {
|
||||||
{
|
|
||||||
mov eax, [input_eax]
|
mov eax, [input_eax]
|
||||||
mov edi, [cpu_id_registers]
|
mov edi, [cpu_id_registers]
|
||||||
|
|
||||||
@ -513,13 +402,11 @@ int cpuid (int input_eax, CPU_ID_REGISTERS *cpu_id_registers) {
|
|||||||
mov [edi + 12], ecx
|
mov [edi + 12], ecx
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
__cpuid((int*)cpu_id_registers, input_eax);
|
__cpuid((int*)cpu_id_registers, input_eax);
|
||||||
#else
|
#else
|
||||||
__asm
|
__asm {
|
||||||
{
|
|
||||||
mov eax, [input_eax]
|
mov eax, [input_eax]
|
||||||
mov edi, [cpu_id_registers]
|
mov edi, [cpu_id_registers]
|
||||||
|
|
||||||
@ -535,8 +422,7 @@ int cpuid (int input_eax, CPU_ID_REGISTERS *cpu_id_registers) {
|
|||||||
|
|
||||||
state = true;
|
state = true;
|
||||||
}
|
}
|
||||||
__except (1)
|
__except (1) {
|
||||||
{
|
|
||||||
state = false;
|
state = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +430,6 @@ int cpuid (int input_eax, CPU_ID_REGISTERS *cpu_id_registers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void parse_cpu_id(CPU_ID *cpu_id) {
|
void parse_cpu_id(CPU_ID *cpu_id) {
|
||||||
|
|
||||||
printf("CPUID\n");
|
printf("CPUID\n");
|
||||||
printf(" vendor = %s\n", cpu_id->cpu_vendor);
|
printf(" vendor = %s\n", cpu_id->cpu_vendor);
|
||||||
printf(" brand string %s\n", cpu_id->cpu_brand_string);
|
printf(" brand string %s\n", cpu_id->cpu_brand_string);
|
||||||
@ -594,12 +479,7 @@ void parse_cpu_id (CPU_ID *cpu_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int initialize_cpu_id(CPU_ID *cpu_id) {
|
int initialize_cpu_id(CPU_ID *cpu_id) {
|
||||||
|
int debug = false;
|
||||||
int state;
|
|
||||||
int debug;
|
|
||||||
|
|
||||||
state = false;
|
|
||||||
debug = false;
|
|
||||||
memset(cpu_id, 0, sizeof(CPU_ID));
|
memset(cpu_id, 0, sizeof(CPU_ID));
|
||||||
|
|
||||||
if (cpuid(0, &cpu_id->cpu_id_registers_0)) {
|
if (cpuid(0, &cpu_id->cpu_id_registers_0)) {
|
||||||
@ -623,8 +503,7 @@ int initialize_cpu_id (CPU_ID *cpu_id) {
|
|||||||
if (debug) {
|
if (debug) {
|
||||||
printf(" cache/TLB byte = %X\n", cpu_id->character_array_2 [index]);
|
printf(" cache/TLB byte = %X\n", cpu_id->character_array_2 [index]);
|
||||||
}
|
}
|
||||||
switch (cpu_id -> character_array_2 [index])
|
switch (cpu_id->character_array_2 [index]) {
|
||||||
{
|
|
||||||
case 0x0A:
|
case 0x0A:
|
||||||
case 0x0C:
|
case 0x0C:
|
||||||
cpu_id->cache_line_size = 32;
|
cpu_id->cache_line_size = 32;
|
||||||
@ -668,14 +547,13 @@ int initialize_cpu_id (CPU_ID *cpu_id) {
|
|||||||
cpuid(0x80000008, &cpu_id->cpu_id_registers_0x80000008);
|
cpuid(0x80000008, &cpu_id->cpu_id_registers_0x80000008);
|
||||||
}
|
}
|
||||||
|
|
||||||
state = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int update_cpu_frequency_function (int processor_number, DisplayInformation *display_information)
|
int update_cpu_frequency_function(int processor_number, DisplayInformation *display_information) {
|
||||||
{
|
|
||||||
int update;
|
int update;
|
||||||
|
|
||||||
update = false;
|
update = false;
|
||||||
@ -801,11 +679,8 @@ count_number_of_cpus(DisplayInformation *display_information) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
WinGraphicsPipe::
|
WinGraphicsPipe::
|
||||||
WinGraphicsPipe() {
|
WinGraphicsPipe() {
|
||||||
|
|
||||||
bool state;
|
|
||||||
char string [512];
|
char string [512];
|
||||||
|
|
||||||
state = false;
|
|
||||||
_supported_types = OT_window | OT_fullscreen_window;
|
_supported_types = OT_window | OT_fullscreen_window;
|
||||||
|
|
||||||
// these fns arent defined on win95, so get dynamic ptrs to them
|
// these fns arent defined on win95, so get dynamic ptrs to them
|
||||||
@ -819,15 +694,38 @@ WinGraphicsPipe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_DX9
|
#ifdef HAVE_DX9
|
||||||
|
// Use D3D to get display info. This is disabled by default as it is slow.
|
||||||
if (request_dxdisplay_information) {
|
if (request_dxdisplay_information) {
|
||||||
DisplaySearchParameters display_search_parameters_dx9;
|
DisplaySearchParameters display_search_parameters_dx9;
|
||||||
int dx9_display_information (DisplaySearchParameters &display_search_parameters_dx9, DisplayInformation *display_information);
|
int dx9_display_information (DisplaySearchParameters &display_search_parameters_dx9, DisplayInformation *display_information);
|
||||||
|
dx9_display_information(display_search_parameters_dx9, _display_information);
|
||||||
if (state == false && dx9_display_information (display_search_parameters_dx9, _display_information)) {
|
} else
|
||||||
state = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
// Use the Win32 API to query the available display modes.
|
||||||
|
pvector<DisplayMode> display_modes;
|
||||||
|
DEVMODE dm = {0};
|
||||||
|
dm.dmSize = sizeof(dm);
|
||||||
|
for (int i = 0; EnumDisplaySettings(NULL, i, &dm) != 0; ++i) {
|
||||||
|
DisplayMode mode;
|
||||||
|
mode.width = dm.dmPelsWidth;
|
||||||
|
mode.height = dm.dmPelsHeight;
|
||||||
|
mode.bits_per_pixel = dm.dmBitsPerPel;
|
||||||
|
mode.refresh_rate = dm.dmDisplayFrequency;
|
||||||
|
mode.fullscreen_only = 0;
|
||||||
|
if (i == 0 || mode != display_modes.back()) {
|
||||||
|
display_modes.push_back(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy this information to the DisplayInformation object.
|
||||||
|
_display_information->_total_display_modes = display_modes.size();
|
||||||
|
if (!display_modes.empty()) {
|
||||||
|
_display_information->_display_mode_array = new DisplayMode[display_modes.size()];
|
||||||
|
std::copy(display_modes.begin(), display_modes.end(),
|
||||||
|
_display_information->_display_mode_array);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (auto_cpu_data) {
|
if (auto_cpu_data) {
|
||||||
lookup_cpu_data();
|
lookup_cpu_data();
|
||||||
@ -837,9 +735,11 @@ WinGraphicsPipe() {
|
|||||||
|
|
||||||
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||||
if (GetVersionEx(&version_info)) {
|
if (GetVersionEx(&version_info)) {
|
||||||
|
if (windisplay_cat.is_info()) {
|
||||||
sprintf(string, "OS version: %d.%d.%d.%d\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber);
|
sprintf(string, "OS version: %d.%d.%d.%d\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber);
|
||||||
windisplay_cat.info() << string;
|
windisplay_cat.info() << string;
|
||||||
windisplay_cat.info() << " " << version_info.szCSDVersion << "\n";
|
windisplay_cat.info() << " " << version_info.szCSDVersion << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
_display_information->_os_version_major = version_info.dwMajorVersion;
|
_display_information->_os_version_major = version_info.dwMajorVersion;
|
||||||
_display_information->_os_version_minor = version_info.dwMinorVersion;
|
_display_information->_os_version_minor = version_info.dwMinorVersion;
|
||||||
@ -865,10 +765,6 @@ WinGraphicsPipe() {
|
|||||||
windisplay_cat.info() << string;
|
windisplay_cat.info() << string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -955,14 +851,13 @@ lookup_cpu_data() {
|
|||||||
<< hex << _display_information->_cpu_id_version << dec << "|";
|
<< hex << _display_information->_cpu_id_version << dec << "|";
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
for (index = 0; index < _display_information -> _cpu_id_size; index++) {
|
for (index = 0; index < _display_information->_cpu_id_size; ++index) {
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
|
|
||||||
data = _display_information->_cpu_id_data[index];
|
data = _display_information->_cpu_id_data[index];
|
||||||
|
|
||||||
windisplay_cat.debug(false)
|
windisplay_cat.debug(false)
|
||||||
<< hex << data << dec;
|
<< hex << data << dec;
|
||||||
if (index < (_display_information -> _cpu_id_size - 1)) {
|
if (index < _display_information->_cpu_id_size - 1) {
|
||||||
windisplay_cat.debug(false)
|
windisplay_cat.debug(false)
|
||||||
<< "|";
|
<< "|";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user