platformVideoInfo.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #ifndef _PLATFORM_VIDEOINFO_H_
  23. #define _PLATFORM_VIDEOINFO_H_
  24. #include "platform/platform.h"
  25. #include "core/util/str.h"
  26. #include "core/util/tVector.h"
  27. // The purpose of this class is to abstract the gathering of video adapter information.
  28. // This information is not specific to the API being used to do the rendering, or
  29. // the capabilities of that renderer. That information is queried in a different
  30. // class.
  31. class PlatformVideoInfo
  32. {
  33. // # of devices
  34. // description
  35. // manufacturer
  36. // chip set
  37. // driver version
  38. // VRAM
  39. public:
  40. enum PVIQueryType
  41. {
  42. PVI_QueryStart = 0, ///< Start of the enum for looping
  43. // The NumAdapters query is the only non-adapter specific query, the following
  44. // queries are all specific to an adapter.
  45. PVI_NumDevices = 0, ///< Number of sub adapters
  46. PVI_Description, ///< String description of the adapter
  47. PVI_Name, ///< Card name string
  48. PVI_ChipSet, ///< Chipset string
  49. PVI_DriverVersion, ///< Driver version string
  50. PVI_VRAM, ///< Dedicated video memory in megabytes
  51. // Please add query types above this value
  52. PVI_QueryCount, ///< Counter so that this enum can be looped over
  53. PVI_NumAdapters, ///< Number of adapters on the system
  54. };
  55. struct PVIAdapter
  56. {
  57. U32 numDevices;
  58. String description;
  59. String name;
  60. String chipSet;
  61. String driverVersion;
  62. U32 vram;
  63. };
  64. private:
  65. Vector<PVIAdapter> mAdapters; ///< Vector of adapters
  66. /// Signal handling method for GFX signals
  67. // bool processGFXSignal( GFXDevice::GFXDeviceEventType gfxEvent );
  68. protected:
  69. /// This method will be called before any queries are made. All initialization,
  70. /// for example Win32 COM startup, should be done in this method. If the return
  71. /// value is false, no querys will be made.
  72. virtual bool _initialize() = 0;
  73. /// This is the query method which subclasses must implement. The querys made
  74. /// are all found in the PVIQueryType enum. If NULL is specified for outValue,
  75. /// the sub class should simply return true if the query type is supported, and
  76. /// false otherwise.
  77. virtual bool _queryProperty( const PVIQueryType queryType, const U32 adapterId, String *outValue ) = 0;
  78. public:
  79. PlatformVideoInfo();
  80. virtual ~PlatformVideoInfo();
  81. bool profileAdapters();
  82. const PVIAdapter &getAdapterInformation( const U32 adapterIndex ) const;
  83. };
  84. #endif