15 #include "graphicsStateGuardian.h" 16 #include "displayInformation.h" 25 return (width == other.width && height == other.height &&
26 bits_per_pixel == other.bits_per_pixel &&
27 refresh_rate == other.refresh_rate &&
28 fullscreen_only == other.fullscreen_only);
47 output(ostream &out)
const {
48 out << width <<
'x' << height;
49 if (bits_per_pixel > 0) {
50 out <<
' ' << bits_per_pixel <<
"bpp";
52 if (refresh_rate > 0) {
53 out <<
' ' << refresh_rate <<
"Hz";
55 if (fullscreen_only > 0) {
56 out <<
" (fullscreen only)";
66 ~DisplayInformation() {
67 if (_display_mode_array != NULL) {
68 delete[] _display_mode_array;
70 if (_cpu_id_data != NULL) {
73 if (_cpu_brand_string != NULL) {
74 delete _cpu_brand_string;
84 DisplayInformation() {
85 DisplayInformation::DetectionState state;
86 int get_adapter_display_mode_state;
87 int get_device_caps_state;
90 int window_bits_per_pixel;
91 int total_display_modes;
96 PN_uint64 physical_memory;
97 PN_uint64 available_physical_memory;
99 state = DisplayInformation::DS_unknown;
100 get_adapter_display_mode_state =
false;
101 get_device_caps_state =
false;
104 window_bits_per_pixel = 0;
105 total_display_modes = 0;
106 display_mode_array = NULL;
107 shader_model = GraphicsStateGuardian::SM_00;
111 available_physical_memory = 0;
114 _get_adapter_display_mode_state = get_adapter_display_mode_state;
115 _get_device_caps_state = get_device_caps_state;
116 _maximum_window_width = window_width;
117 _maximum_window_height = window_height;
118 _window_bits_per_pixel = window_bits_per_pixel;
119 _total_display_modes = total_display_modes;
120 _display_mode_array = display_mode_array;
121 _shader_model = shader_model;
122 _video_memory = video_memory;
123 _texture_memory = texture_memory;
125 _physical_memory = physical_memory;
126 _available_physical_memory = available_physical_memory;
128 _available_page_file_size = 0;
129 _process_virtual_memory = 0;
130 _available_process_virtual_memory = 0;
132 _page_fault_count = 0;
134 _peak_process_memory = 0;
135 _page_file_usage = 0;
136 _peak_page_file_usage = 0;
143 _driver_sub_version = 0;
146 _driver_date_month = 0;
147 _driver_date_day = 0;
148 _driver_date_year = 0;
154 _cpu_vendor_string = 0;
155 _cpu_brand_string = 0;
156 _cpu_version_information = 0;
157 _cpu_brand_index = 0;
161 _maximum_cpu_frequency = 0;
162 _current_cpu_frequency = 0;
165 _num_logical_cpus = 0;
167 _get_memory_information_function = 0;
168 _cpu_time_function = 0;
169 _update_cpu_frequency_function = 0;
171 _os_version_major = -1;
172 _os_version_minor = -1;
173 _os_version_build = -1;
174 _os_platform_id = -1;
182 int DisplayInformation::get_display_state() {
191 int DisplayInformation::
192 get_maximum_window_width() {
193 return _maximum_window_width;
201 int DisplayInformation::
202 get_maximum_window_height() {
203 return _maximum_window_height;
211 int DisplayInformation::
212 get_window_bits_per_pixel() {
213 return _window_bits_per_pixel;
221 int DisplayInformation::
222 get_total_display_modes() {
223 return _total_display_modes;
232 get_display_mode(
int display_index) {
235 nassertr(display_index >= 0 && display_index < _total_display_modes, err_mode);
238 return _display_mode_array[display_index];
246 int DisplayInformation::
247 get_display_mode_width (
int display_index) {
251 if (display_index >= 0 && display_index < _total_display_modes) {
252 value = _display_mode_array [display_index].width;
263 int DisplayInformation::
264 get_display_mode_height (
int display_index) {
268 if (display_index >= 0 && display_index < _total_display_modes) {
269 value = _display_mode_array [display_index].height;
280 int DisplayInformation::
281 get_display_mode_bits_per_pixel (
int display_index) {
285 if (display_index >= 0 && display_index < _total_display_modes) {
286 value = _display_mode_array [display_index].bits_per_pixel;
297 int DisplayInformation::
298 get_display_mode_refresh_rate (
int display_index) {
302 if (display_index >= 0 && display_index < _total_display_modes) {
303 value = _display_mode_array [display_index].refresh_rate;
314 int DisplayInformation::
315 get_display_mode_fullscreen_only (
int display_index) {
319 if (display_index >= 0 && display_index < _total_display_modes) {
320 value = _display_mode_array [display_index].fullscreen_only;
331 int DisplayInformation::
332 get_shader_model ( ) {
333 return _shader_model;
341 int DisplayInformation::
342 get_video_memory ( ) {
343 return _video_memory;
351 int DisplayInformation::
352 get_texture_memory() {
353 return _texture_memory;
361 void DisplayInformation::
362 update_memory_information() {
363 if (_get_memory_information_function) {
364 _get_memory_information_function (
this);
373 PN_uint64 DisplayInformation::
374 get_physical_memory() {
375 return _physical_memory;
383 PN_uint64 DisplayInformation::
384 get_available_physical_memory() {
385 return _available_physical_memory;
393 PN_uint64 DisplayInformation::
394 get_page_file_size() {
395 return _page_file_size;
403 PN_uint64 DisplayInformation::
404 get_available_page_file_size() {
405 return _available_page_file_size;
413 PN_uint64 DisplayInformation::
414 get_process_virtual_memory() {
415 return _process_virtual_memory;
423 PN_uint64 DisplayInformation::
424 get_available_process_virtual_memory() {
425 return _available_process_virtual_memory;
433 int DisplayInformation::
443 PN_uint64 DisplayInformation::
444 get_page_fault_count() {
445 return _page_fault_count;
453 PN_uint64 DisplayInformation::
454 get_process_memory() {
455 return _process_memory;
463 PN_uint64 DisplayInformation::
464 get_peak_process_memory() {
465 return _peak_process_memory;
473 PN_uint64 DisplayInformation::
474 get_page_file_usage() {
475 return _page_file_usage;
483 PN_uint64 DisplayInformation::
484 get_peak_page_file_usage() {
485 return _peak_page_file_usage;
493 int DisplayInformation::
503 int DisplayInformation::
513 int DisplayInformation::
514 get_driver_product() {
515 return _driver_product;
523 int DisplayInformation::
524 get_driver_version() {
525 return _driver_version;
533 int DisplayInformation::
534 get_driver_sub_version() {
535 return _driver_sub_version;
543 int DisplayInformation::
545 return _driver_build;
553 int DisplayInformation::
554 get_driver_date_month() {
555 return _driver_date_month;
563 int DisplayInformation::
564 get_driver_date_day() {
565 return _driver_date_day;
573 int DisplayInformation::
574 get_driver_date_year() {
575 return _driver_date_year;
583 int DisplayInformation::
584 get_cpu_id_version() {
585 return _cpu_id_version;
610 if (index >= 0 && index < _cpu_id_size) {
611 data = _cpu_id_data [index];
622 const char *DisplayInformation::
623 get_cpu_vendor_string() {
626 string = _cpu_vendor_string;
639 const char *DisplayInformation::
640 get_cpu_brand_string() {
643 string = _cpu_brand_string;
656 unsigned int DisplayInformation::
657 get_cpu_version_information() {
658 return _cpu_version_information;
666 unsigned int DisplayInformation::
667 get_cpu_brand_index() {
668 return _cpu_brand_index;
676 PN_uint64 DisplayInformation::
677 get_cpu_frequency() {
678 return _cpu_frequency;
686 PN_uint64 DisplayInformation::
691 if (_cpu_time_function) {
692 cpu_time = _cpu_time_function();
703 PN_uint64 DisplayInformation::
704 get_maximum_cpu_frequency() {
705 return _maximum_cpu_frequency;
713 PN_uint64 DisplayInformation::
714 get_current_cpu_frequency() {
715 return _current_cpu_frequency;
723 void DisplayInformation::
724 update_cpu_frequency(
int processor_number) {
725 if (_update_cpu_frequency_function) {
726 _update_cpu_frequency_function (processor_number,
this);
739 return _num_cpu_cores;
751 return _num_logical_cpus;
761 return _os_version_major;
771 return _os_version_minor;
781 return _os_version_build;
791 return _os_platform_id;
bool operator==(const DisplayMode &other) const
Returns true if these two DisplayModes are identical.
bool operator!=(const DisplayMode &other) const
Returns false if these two DisplayModes are identical.