You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

524 lines
25 KiB

  1. unit uutlSystemInfo;
  2. { Package: Utils
  3. Prefix: utl - UTiLs
  4. Beschreibung: diese Unit enthält Klassen zum Auslesen von System Informationen (CPU, Grafikkarte, OpenGL) }
  5. {$mode objfpc}{$H+}
  6. interface
  7. uses
  8. Classes, SysUtils, uutlGenerics
  9. {$IFDEF WINDOWS}, ActiveX, ComObj, variants {$ENDIF};
  10. type
  11. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  12. TutlSystemInfo = class;
  13. TutlSystemInfoList = specialize TutlList<TutlSystemInfo>;
  14. TutlSystemInfo = class(TObject)
  15. private
  16. fName: String;
  17. fValue: String;
  18. fItems: TutlSystemInfoList;
  19. function GetCount: Integer;
  20. function GetItems(const aIndex: Integer): TutlSystemInfo;
  21. public
  22. property Name: String read fName;
  23. property Value: String read fValue;
  24. property Count: Integer read GetCount;
  25. property Items[const aIndex: Integer]: TutlSystemInfo read GetItems; default;
  26. procedure Update; virtual;
  27. function ToString: String; override;
  28. constructor Create; virtual;
  29. destructor Destroy; override;
  30. end;
  31. TutlSystemInfoClass = class of TutlSystemInfo;
  32. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. TutlOpenGLInfo = class(TutlSystemInfo)
  34. public
  35. procedure Update; override;
  36. end;
  37. {$IFDEF WINDOWS}
  38. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  39. TutlWmiSystemInfo = class(TutlSystemInfo)
  40. protected type
  41. TStringArr = array of String;
  42. protected
  43. function GetComputer: String; virtual;
  44. function GetNamespace: String; virtual;
  45. function GetUsername: String; virtual;
  46. function GetPassword: String; virtual;
  47. function GetQuery: String; virtual;
  48. function GetProperties: TStringArr; virtual;
  49. function GetSubItemName(const aIndex: Integer): String; virtual;
  50. public
  51. procedure Update; override;
  52. end;
  53. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  54. TutlProcessorInfo = class(TutlWmiSystemInfo)
  55. private const
  56. PROCESSOR_PROPERTIES: array[0..11] of String = ('AddressWidth', 'Caption',
  57. 'CurrentClockSpeed', 'Description', 'ExtClock', 'Family', 'Manufacturer',
  58. 'MaxClockSpeed', 'Name', 'NumberOfCores', 'NumberOfLogicalProcessors',
  59. 'Version');
  60. protected
  61. function GetQuery: String; override;
  62. function GetProperties: TStringArr; override;
  63. function GetSubItemName(const aIndex: Integer): String; override;
  64. public
  65. procedure Update; override;
  66. end;
  67. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  68. TutlVideoControllerInfo = class(TutlWmiSystemInfo)
  69. private const
  70. VIDEO_CONTROLLER_PROPERTIES: array[0..11] of String = ('AdapterRAM', 'Caption',
  71. 'CurrentBitsPerPixel', 'CurrentHorizontalResolution', 'CurrentRefreshRate',
  72. 'CurrentScanMode', 'CurrentVerticalResolution', 'Description', 'DriverDate',
  73. 'DriverVersion', 'Name', 'VideoProcessor');
  74. protected
  75. function GetQuery: String; override;
  76. function GetProperties: TStringArr; override;
  77. function GetSubItemName(const aIndex: Integer): String; override;
  78. public
  79. procedure Update; override;
  80. end;
  81. {$ENDIF}
  82. procedure LogSystemInfo(const aClass: TutlSystemInfoClass);
  83. const
  84. SYTEM_INFO_CLASSES_COUNT = {$IFDEF WINDOWS}2+{$ENDIF}1;
  85. SYTEM_INFO_CLASSES: array[0..SYTEM_INFO_CLASSES_COUNT-1] of TutlSystemInfoClass = (
  86. {$IFDEF WINDOWS}TutlProcessorInfo,
  87. TutlVideoControllerInfo,{$ENDIF}
  88. TutlOpenGLInfo);
  89. implementation
  90. uses
  91. uutlExceptions, math, dglOpenGL, uutlLogger;
  92. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  93. function CreateItem(const aName, aValue: String): TutlSystemInfo;
  94. begin
  95. result := TutlSystemInfo.Create;
  96. result.fName := aName;
  97. result.fValue := aValue;
  98. end;
  99. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  100. function VariantToStr(const aVariant: Variant): String;
  101. begin
  102. result := '';
  103. if (TVarData(aVariant).vtype <> varempty) and
  104. (TVarData(aVariant).vtype <> varnull) and
  105. (TVarData(aVariant).vtype <> varerror) then begin
  106. result := aVariant;
  107. end;
  108. end;
  109. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  110. procedure LogSystemInfo(const aClass: TutlSystemInfoClass);
  111. var
  112. info: TutlSystemInfo;
  113. sList: TStringList;
  114. i: Integer;
  115. begin
  116. info := aClass.Create;
  117. sList := TStringList.Create;
  118. try try
  119. info.Update;
  120. sList.Text := info.ToString;
  121. for i := 0 to sList.Count-1 do
  122. utlLogger.Log('SystemInfo', sList[i], []);
  123. except on e: Exception do
  124. utlLogger.Error('SystemInfo', 'Error while logging system info: %s', [e.Message]);
  125. end;
  126. finally
  127. FreeAndNil(info);
  128. FreeAndNil(sList);
  129. end;
  130. end;
  131. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  132. //TutlSystemInfo////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  133. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  134. function TutlSystemInfo.GetCount: Integer;
  135. begin
  136. result := fItems.Count;
  137. end;
  138. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  139. function TutlSystemInfo.GetItems(const aIndex: Integer): TutlSystemInfo;
  140. begin
  141. if (aIndex >= 0) and (aIndex < fItems.Count) then
  142. result := fItems[aIndex]
  143. else
  144. raise EOutOfRange.Create(aIndex, 0, fItems.Count-1);
  145. end;
  146. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  147. procedure TutlSystemInfo.Update;
  148. begin
  149. //DUMMY
  150. end;
  151. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  152. function TutlSystemInfo.ToString: String;
  153. var
  154. str: String;
  155. procedure FillStr(var aStr: String; const aLen: Integer; const aChar: Char = ' ');
  156. begin
  157. while (Length(aStr) < aLen) do
  158. aStr := aStr + aChar;
  159. end;
  160. procedure WriteItem(const aPrefix: String; const aItem: TutlSystemInfo; const aItemLen: Integer);
  161. var
  162. len, i: Integer;
  163. line: String;
  164. begin
  165. line := aItem.Name + ':';
  166. if (aItem.Count = 0) then begin
  167. line := line;
  168. FillStr(line, aItemLen + 2);
  169. line := line + aItem.Value;
  170. end;
  171. str := str + aPrefix + line + sLineBreak;
  172. if (aItem.Count > 0) then begin
  173. len := 0;
  174. for i := 0 to aItem.Count-1 do
  175. len := max(len, Length(aItem[i].Name));
  176. for i := 0 to aItem.Count-1 do
  177. WriteItem(aPrefix+' ', aItem[i], len);
  178. end;
  179. end;
  180. begin
  181. str := '';
  182. WriteItem('', self, 0);
  183. result := str;
  184. end;
  185. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  186. constructor TutlSystemInfo.Create;
  187. begin
  188. inherited Create;
  189. fName := '';
  190. fValue := '';
  191. fItems := TutlSystemInfoList.Create(true);
  192. end;
  193. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  194. destructor TutlSystemInfo.Destroy;
  195. begin
  196. FreeAndNil(fItems);
  197. inherited Destroy;
  198. end;
  199. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  200. //TutlOpenGLInfo////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  201. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  202. procedure TutlOpenGLInfo.Update;
  203. function AddItem(const aParent: TutlSystemInfo; const aName, aValue: String): TutlSystemInfo;
  204. begin
  205. result := CreateItem(aName, aValue);
  206. aParent.fItems.Add(result);
  207. end;
  208. function GetInteger(const aName: GLenum): String;
  209. var
  210. i: GLint;
  211. begin
  212. i := 0;
  213. glGetIntegerv(aName, @i);
  214. result := IntToStr(i);
  215. end;
  216. var
  217. item: TutlSystemInfo;
  218. begin
  219. inherited Update;
  220. fName := 'OpenGL Information';
  221. fValue := '';
  222. item := AddItem(self, 'ImplementationBasics', '');
  223. AddItem(item, 'GL_VENDOR', glGetString(GL_VENDOR));
  224. AddItem(item, 'GL_RENDER', glGetString(GL_RENDER));
  225. AddItem(item, 'GL_VERSION', glGetString(GL_VERSION));
  226. AddItem(item, 'GL_SHADING_LANGUAGE_VERSION', glGetString(GL_SHADING_LANGUAGE_VERSION));
  227. item := AddItem(self, 'Basics', '');
  228. AddItem(item, 'GL_MAX_VIEWPORT_DIMS', GetInteger(GL_MAX_VIEWPORT_DIMS));
  229. AddItem(item, 'GL_MAX_LIGHTS', GetInteger(GL_MAX_LIGHTS));
  230. AddItem(item, 'GL_MAX_CLIP_PLANES', GetInteger(GL_MAX_CLIP_PLANES));
  231. AddItem(item, 'GL_MAX_MODELVIEW_STACK_DEPTH', GetInteger(GL_MAX_MODELVIEW_STACK_DEPTH));
  232. AddItem(item, 'GL_MAX_PROJECTION_STACK_DEPTH', GetInteger(GL_MAX_PROJECTION_STACK_DEPTH));
  233. AddItem(item, 'GL_MAX_TEXTURE_STACK_DEPTH', GetInteger(GL_MAX_TEXTURE_STACK_DEPTH));
  234. AddItem(item, 'GL_MAX_ATTRIB_STACK_DEPTH', GetInteger(GL_MAX_ATTRIB_STACK_DEPTH));
  235. AddItem(item, 'GL_MAX_COLOR_MATRIX_STACK_DEPTH', GetInteger(GL_MAX_COLOR_MATRIX_STACK_DEPTH));
  236. AddItem(item, 'GL_MAX_LIST_NESTING', GetInteger(GL_MAX_LIST_NESTING));
  237. AddItem(item, 'GL_SUBPIXEL_BITS', GetInteger(GL_SUBPIXEL_BITS));
  238. AddItem(item, 'GL_MAX_ELEMENTS_INDICES', GetInteger(GL_MAX_ELEMENTS_INDICES));
  239. AddItem(item, 'GL_MAX_ELEMENTS_VERTICES', GetInteger(GL_MAX_ELEMENTS_VERTICES));
  240. AddItem(item, 'GL_MAX_TEXTURE_UNITS', GetInteger(GL_MAX_TEXTURE_UNITS));
  241. AddItem(item, 'GL_MAX_TEXTURE_COORDS', GetInteger(GL_MAX_TEXTURE_COORDS));
  242. AddItem(item, 'GL_MAX_SAMPLE_MASK_WORDS', GetInteger(GL_MAX_SAMPLE_MASK_WORDS));
  243. AddItem(item, 'GL_MAX_COLOR_TEXTURE_SAMPLES', GetInteger(GL_MAX_COLOR_TEXTURE_SAMPLES));
  244. AddItem(item, 'GL_MAX_DEPTH_TEXTURE_SAMPLES', GetInteger(GL_MAX_DEPTH_TEXTURE_SAMPLES));
  245. AddItem(item, 'GL_MAX_INTEGER_SAMPLES', GetInteger(GL_MAX_INTEGER_SAMPLES));
  246. item := AddItem(self, 'Textures', '');
  247. AddItem(item, 'GL_MAX_TEXTURE_SIZE', GetInteger(GL_MAX_TEXTURE_SIZE));
  248. AddItem(item, 'GL_MAX_3D_TEXTURE_SIZE', GetInteger(GL_MAX_3D_TEXTURE_SIZE));
  249. AddItem(item, 'GL_MAX_CUBE_MAP_TEXTURE_SIZE', GetInteger(GL_MAX_CUBE_MAP_TEXTURE_SIZE));
  250. AddItem(item, 'GL_MAX_TEXTURE_LOD_BIAS', GetInteger(GL_MAX_TEXTURE_LOD_BIAS));
  251. AddItem(item, 'GL_MAX_ARRAY_TEXTURE_LAYERS', GetInteger(GL_MAX_ARRAY_TEXTURE_LAYERS));
  252. AddItem(item, 'GL_MAX_TEXTURE_BUFFER_SIZE', GetInteger(GL_MAX_TEXTURE_BUFFER_SIZE));
  253. AddItem(item, 'GL_MAX_RECTANGLE_TEXTURE_SIZE', GetInteger(GL_MAX_RECTANGLE_TEXTURE_SIZE));
  254. AddItem(item, 'GL_MAX_RENDERBUFFER_SIZE', GetInteger(GL_MAX_RENDERBUFFER_SIZE));
  255. item := AddItem(self, 'FrameBuffers', '');
  256. AddItem(item, 'GL_MAX_DRAW_BUFFERS', GetInteger(GL_MAX_DRAW_BUFFERS));
  257. AddItem(item, 'GL_MAX_COLOR_ATTACHMENTS', GetInteger(GL_MAX_COLOR_ATTACHMENTS));
  258. AddItem(item, 'GL_MAX_SAMPLES', GetInteger(GL_MAX_SAMPLES));
  259. item := AddItem(self, 'VertexShaderLimits', '');
  260. AddItem(item, 'GL_MAX_VERTEX_ATTRIBS', GetInteger(GL_MAX_VERTEX_ATTRIBS));
  261. AddItem(item, 'GL_MAX_VERTEX_UNIFORM_COMPONENTS', GetInteger(GL_MAX_VERTEX_UNIFORM_COMPONENTS));
  262. AddItem(item, 'GL_MAX_VERTEX_UNIFORM_VECTORS', GetInteger(GL_MAX_VERTEX_UNIFORM_VECTORS));
  263. AddItem(item, 'GL_MAX_VERTEX_UNIFORM_BLOCKS', GetInteger(GL_MAX_VERTEX_UNIFORM_BLOCKS));
  264. AddItem(item, 'GL_MAX_VERTEX_OUTPUT_COMPONENTS', GetInteger(GL_MAX_VERTEX_OUTPUT_COMPONENTS));
  265. AddItem(item, 'GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS', GetInteger(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS));
  266. item := AddItem(self, 'FragmentShaderLimits', '');
  267. AddItem(item, 'GL_MAX_FRAGMENT_UNIFORM_COMPONENTS', GetInteger(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS));
  268. AddItem(item, 'GL_MAX_FRAGMENT_UNIFORM_VECTORS', GetInteger(GL_MAX_FRAGMENT_UNIFORM_VECTORS));
  269. AddItem(item, 'GL_MAX_FRAGMENT_UNIFORM_BLOCKS', GetInteger(GL_MAX_FRAGMENT_UNIFORM_BLOCKS));
  270. AddItem(item, 'GL_MAX_FRAGMENT_INPUT_COMPONENTS', GetInteger(GL_MAX_FRAGMENT_INPUT_COMPONENTS));
  271. AddItem(item, 'GL_MAX_IMAGE_UNITS', GetInteger(GL_MAX_IMAGE_UNITS));
  272. AddItem(item, 'GL_MAX_FRAGMENT_IMAGE_UNIFORMS', GetInteger(GL_MAX_FRAGMENT_IMAGE_UNIFORMS));
  273. AddItem(item, 'GL_MIN_PROGRAM_TEXEL_OFFSET', GetInteger(GL_MIN_PROGRAM_TEXEL_OFFSET));
  274. AddItem(item, 'GL_MAX_PROGRAM_TEXEL_OFFSET', GetInteger(GL_MAX_PROGRAM_TEXEL_OFFSET));
  275. AddItem(item, 'GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET', GetInteger(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET));
  276. AddItem(item, 'GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET', GetInteger(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET));
  277. item := AddItem(self, 'CombinedFragmentAndVertexShaderLimits', '');
  278. AddItem(item, 'GL_MAX_UNIFORM_BUFFER_BINDINGS', GetInteger(GL_MAX_UNIFORM_BUFFER_BINDINGS));
  279. AddItem(item, 'GL_MAX_UNIFORM_BLOCK_SIZE', GetInteger(GL_MAX_UNIFORM_BLOCK_SIZE));
  280. AddItem(item, 'GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT', GetInteger(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT));
  281. AddItem(item, 'GL_MAX_COMBINED_UNIFORM_BLOCKS', GetInteger(GL_MAX_COMBINED_UNIFORM_BLOCKS));
  282. AddItem(item, 'GL_MAX_VARYING_FLOATS', GetInteger(GL_MAX_VARYING_FLOATS));
  283. AddItem(item, 'GL_MAX_VARYING_COMPONENTS', GetInteger(GL_MAX_VARYING_COMPONENTS));
  284. AddItem(item, 'GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS', GetInteger(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS));
  285. AddItem(item, 'GL_MAX_SUBROUTINES', GetInteger(GL_MAX_SUBROUTINES));
  286. AddItem(item, 'GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS', GetInteger(GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS));
  287. AddItem(item, 'GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS', GetInteger(GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS));
  288. AddItem(item, 'GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS', GetInteger(GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS));
  289. AddItem(item, 'GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS', GetInteger(GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS));
  290. AddItem(item, 'GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS', GetInteger(GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS));
  291. AddItem(item, 'GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS', GetInteger(GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS));
  292. item := AddItem(self, 'GeometryShaderLimits', '');
  293. AddItem(item, 'GL_MAX_GEOMETRY_UNIFORM_BLOCKS', GetInteger(GL_MAX_GEOMETRY_UNIFORM_BLOCKS));
  294. AddItem(item, 'GL_MAX_GEOMETRY_INPUT_COMPONENTS', GetInteger(GL_MAX_GEOMETRY_INPUT_COMPONENTS));
  295. AddItem(item, 'GL_MAX_GEOMETRY_OUTPUT_COMPONENTS', GetInteger(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS));
  296. AddItem(item, 'GL_MAX_GEOMETRY_OUTPUT_VERTICES', GetInteger(GL_MAX_GEOMETRY_OUTPUT_VERTICES));
  297. AddItem(item, 'GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS', GetInteger(GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS));
  298. AddItem(item, 'GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS', GetInteger(GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS));
  299. AddItem(item, 'GL_MAX_GEOMETRY_SHADER_INVOCATIONS', GetInteger(GL_MAX_GEOMETRY_SHADER_INVOCATIONS));
  300. item := AddItem(self, 'TesselationShaderLimits', '');
  301. AddItem(item, 'GL_MAX_TESS_GEN_LEVEL', GetInteger(GL_MAX_TESS_GEN_LEVEL));
  302. AddItem(item, 'GL_MAX_PATCH_VERTICES', GetInteger(GL_MAX_PATCH_VERTICES));
  303. AddItem(item, 'GL_MAX_TESS_PATCH_COMPONENTS', GetInteger(GL_MAX_TESS_PATCH_COMPONENTS));
  304. AddItem(item, 'GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS', GetInteger(GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS));
  305. AddItem(item, 'GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS', GetInteger(GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS));
  306. AddItem(item, 'GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS', GetInteger(GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS));
  307. AddItem(item, 'GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS', GetInteger(GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS));
  308. AddItem(item, 'GL_MAX_TESS_CONTROL_INPUT_COMPONENTS', GetInteger(GL_MAX_TESS_CONTROL_INPUT_COMPONENTS));
  309. AddItem(item, 'GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS', GetInteger(GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS));
  310. AddItem(item, 'GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS', GetInteger(GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS));
  311. AddItem(item, 'GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS', GetInteger(GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS));
  312. AddItem(item, 'GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS', GetInteger(GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS));
  313. AddItem(item, 'GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS', GetInteger(GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS));
  314. AddItem(item, 'GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS', GetInteger(GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS));
  315. item := AddItem(self, 'TransformFeedbackShaderLimits', '');
  316. AddItem(item, 'GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS', GetInteger(GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS));
  317. AddItem(item, 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS', GetInteger(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS));
  318. AddItem(item, 'GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS', GetInteger(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS));
  319. AddItem(item, 'GL_MAX_TRANSFORM_FEEDBACK_BUFFERS', GetInteger(GL_MAX_TRANSFORM_FEEDBACK_BUFFERS));
  320. end;
  321. {$IFDEF WINDOWS}
  322. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  323. //TutlWmiSystemInfo/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  324. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  325. function TutlWmiSystemInfo.GetComputer: String;
  326. begin
  327. result := 'localhost'#0;
  328. end;
  329. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  330. function TutlWmiSystemInfo.GetNamespace: String;
  331. begin
  332. result := 'root\CIMV2'#0;
  333. end;
  334. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  335. function TutlWmiSystemInfo.GetUsername: String;
  336. begin
  337. result := #0;
  338. end;
  339. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  340. function TutlWmiSystemInfo.GetPassword: String;
  341. begin
  342. result := #0;
  343. end;
  344. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  345. function TutlWmiSystemInfo.GetQuery: String;
  346. begin
  347. result := #0;
  348. end;
  349. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  350. function TutlWmiSystemInfo.GetProperties: TStringArr;
  351. begin
  352. SetLength(result, 0);
  353. end;
  354. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  355. function TutlWmiSystemInfo.GetSubItemName(const aIndex: Integer): String;
  356. begin
  357. result := IntToStr(aIndex);
  358. end;
  359. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  360. procedure TutlWmiSystemInfo.Update;
  361. var
  362. SWbemLocator: OLEVariant;
  363. WMIService: OLEVariant;
  364. WbemObjectSet, WbemObject: OLEVariant;
  365. s: Variant;
  366. pCeltFetched: LongWord;
  367. oEnum: IEnumvariant;
  368. i, j: Integer;
  369. properties: TStringArr;
  370. item: TutlSystemInfo;
  371. computer: Variant;
  372. namespace: Variant;
  373. username: Variant;
  374. password: Variant;
  375. query: Variant;
  376. const
  377. WBEM_FLAGFORWARDONLY = $00000020;
  378. begin
  379. inherited Update;
  380. fItems.Clear;
  381. CoInitialize(nil);
  382. SWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  383. //WMIService := SWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
  384. computer := GetComputer;
  385. namespace := GetNamespace;
  386. username := GetUsername;
  387. password := GetPassword;
  388. query := GetQuery;
  389. WMIService := SWbemLocator.ConnectServer(computer, namespace, username, password);
  390. WbemObjectSet := WMIService.ExecQuery(query, 'WQL', WBEM_FLAGFORWARDONLY);
  391. oEnum := IUnknown(WbemObjectSet._NewEnum) as IEnumVariant;
  392. i := 0;
  393. properties := GetProperties;
  394. while oEnum.Next(1, WbemObject, pCeltFetched) = 0 do begin
  395. inc(i);
  396. item := TutlSystemInfo.Create;
  397. item.fName := GetSubItemName(i);
  398. fItems.Add(item);
  399. for j := low(properties) to high(properties) do begin
  400. s := properties[j];
  401. item.fItems.Add(CreateItem(
  402. properties[j],
  403. VariantToStr(WbemObject.Properties_.Item(s).Value)));
  404. end;
  405. end;
  406. end;
  407. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  408. //TutlProcessorInfo/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  409. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  410. function TutlProcessorInfo.GetQuery: String;
  411. begin
  412. result := 'SELECT * FROM Win32_Processor'#0;
  413. end;
  414. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  415. function TutlProcessorInfo.GetProperties: TStringArr;
  416. var
  417. i: Integer;
  418. begin
  419. SetLength(result, Length(PROCESSOR_PROPERTIES));
  420. for i := low(result) to high(result) do
  421. result[i] := PROCESSOR_PROPERTIES[i];
  422. end;
  423. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  424. function TutlProcessorInfo.GetSubItemName(const aIndex: Integer): String;
  425. begin
  426. result := format('Processor %d', [aIndex]);
  427. end;
  428. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  429. procedure TutlProcessorInfo.Update;
  430. begin
  431. fName := 'Processor Information';
  432. fValue := '';
  433. inherited Update;
  434. end;
  435. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  436. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  437. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  438. function TutlVideoControllerInfo.GetQuery: String;
  439. begin
  440. Result := 'SELECT * FROM Win32_VideoController';
  441. end;
  442. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  443. function TutlVideoControllerInfo.GetProperties: TStringArr;
  444. var
  445. i: Integer;
  446. begin
  447. SetLength(result, Length(VIDEO_CONTROLLER_PROPERTIES));
  448. for i := low(result) to high(result) do
  449. result[i] := VIDEO_CONTROLLER_PROPERTIES[i];
  450. end;
  451. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  452. function TutlVideoControllerInfo.GetSubItemName(const aIndex: Integer): String;
  453. begin
  454. Result := format('Video Controller %d', [aIndex]);
  455. end;
  456. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  457. procedure TutlVideoControllerInfo.Update;
  458. begin
  459. fName := 'Video Controller Information';
  460. fValue := '';
  461. inherited Update;
  462. end;
  463. {$ENDIF}
  464. end.