Panda3D
displayInformation.h
1 // Filename: displayInformation.h
2 // Created by: aignacio (17Jan07)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef DISPLAYINFORMATION_H
16 #define DISPLAYINFORMATION_H
17 
18 #include "typedef.h"
19 
20 struct EXPCL_PANDA_DISPLAY DisplayMode {
21 PUBLISHED:
22  int width;
23  int height;
24  int bits_per_pixel;
25  int refresh_rate;
26  int fullscreen_only;
27 
28  bool operator == (const DisplayMode &other) const;
29  bool operator != (const DisplayMode &other) const;
30  void output(ostream &out) const;
31 };
32 
33 ////////////////////////////////////////////////////////////////////
34 // Class : DisplayInformation
35 // Description : This class contains various display information.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDA_DISPLAY DisplayInformation {
38 PUBLISHED:
39  enum DetectionState {
40  DS_unknown,
41  DS_success,
42 
43  DS_direct_3d_create_error,
44  DS_create_window_error,
45  DS_create_device_error,
46  };
47 
50 
51  int get_display_state();
52 
53  int get_maximum_window_width();
54  int get_maximum_window_height();
55  int get_window_bits_per_pixel();
56 
57  int get_total_display_modes();
58  const DisplayMode &get_display_mode(int display_index);
59  MAKE_SEQ(get_display_modes, get_total_display_modes, get_display_mode);
60 
61  // Older interface for display modes.
62  int get_display_mode_width(int display_index);
63  int get_display_mode_height(int display_index);
64  int get_display_mode_bits_per_pixel(int display_index);
65  int get_display_mode_refresh_rate(int display_index);
66  int get_display_mode_fullscreen_only(int display_index);
67 
68  int get_shader_model();
69  int get_video_memory();
70  int get_texture_memory();
71 
72  void update_memory_information();
73  PN_uint64 get_physical_memory();
74  PN_uint64 get_available_physical_memory();
75  PN_uint64 get_page_file_size();
76  PN_uint64 get_available_page_file_size();
77  PN_uint64 get_process_virtual_memory();
78  PN_uint64 get_available_process_virtual_memory();
79  int get_memory_load();
80  PN_uint64 get_page_fault_count();
81  PN_uint64 get_process_memory();
82  PN_uint64 get_peak_process_memory();
83  PN_uint64 get_page_file_usage();
84  PN_uint64 get_peak_page_file_usage();
85 
86  int get_vendor_id();
87  int get_device_id();
88 
89  int get_driver_product();
90  int get_driver_version();
91  int get_driver_sub_version();
92  int get_driver_build();
93 
94  int get_driver_date_month();
95  int get_driver_date_day();
96  int get_driver_date_year();
97 
98  int get_cpu_id_version();
99  int get_cpu_id_size();
100  unsigned int get_cpu_id_data(int index);
101 
102  const char *get_cpu_vendor_string();
103  const char *get_cpu_brand_string();
104  unsigned int get_cpu_version_information();
105  unsigned int get_cpu_brand_index();
106 
107  PN_uint64 get_cpu_frequency();
108  PN_uint64 get_cpu_time();
109 
110  PN_uint64 get_maximum_cpu_frequency();
111  PN_uint64 get_current_cpu_frequency();
112  void update_cpu_frequency(int processor_number);
113 
114  int get_num_cpu_cores();
115  int get_num_logical_cpus();
116 
117  int get_os_version_major();
118  int get_os_version_minor();
119  int get_os_version_build();
120  int get_os_platform_id();
121 
122 public:
123  DetectionState _state;
124  int _get_adapter_display_mode_state;
125  int _get_device_caps_state;
126  int _maximum_window_width;
127  int _maximum_window_height;
128  int _window_bits_per_pixel;
129  int _total_display_modes;
130  DisplayMode *_display_mode_array;
131  int _shader_model;
132  int _video_memory;
133  int _texture_memory;
134 
135  PN_uint64 _physical_memory;
136  PN_uint64 _available_physical_memory;
137  PN_uint64 _page_file_size;
138  PN_uint64 _available_page_file_size;
139  PN_uint64 _process_virtual_memory;
140  PN_uint64 _available_process_virtual_memory;
141 
142  PN_uint64 _page_fault_count;
143  PN_uint64 _process_memory;
144  PN_uint64 _peak_process_memory;
145  PN_uint64 _page_file_usage;
146  PN_uint64 _peak_page_file_usage;
147 
148  int _memory_load;
149 
150  int _vendor_id;
151  int _device_id;
152 
153  int _driver_product;
154  int _driver_version;
155  int _driver_sub_version;
156  int _driver_build;
157 
158  int _driver_date_month;
159  int _driver_date_day;
160  int _driver_date_year;
161 
162  int _cpu_id_version;
163  int _cpu_id_size;
164  unsigned int *_cpu_id_data;
165 
166  char *_cpu_vendor_string;
167  char *_cpu_brand_string;
168  unsigned int _cpu_version_information;
169  unsigned int _cpu_brand_index;
170 
171  PN_uint64 _cpu_frequency;
172 
173  PN_uint64 _maximum_cpu_frequency;
174  PN_uint64 _current_cpu_frequency;
175 
176  int _num_cpu_cores;
177  int _num_logical_cpus;
178 
179  void (*_get_memory_information_function) (DisplayInformation *display_information);
180  PN_uint64 (*_cpu_time_function) (void);
181  int (*_update_cpu_frequency_function) (int processor_number, DisplayInformation *display_information);
182 
183  int _os_version_major;
184  int _os_version_minor;
185  int _os_version_build;
186  int _os_platform_id;
187 };
188 
189 #endif
This class contains various display information.