gfxAdapter.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 _GFXADAPTER_H_
  23. #define _GFXADAPTER_H_
  24. #ifndef _GFXSTRUCTS_H_
  25. #include "gfx/gfxStructs.h"
  26. #endif
  27. #ifndef _TVECTOR_H_
  28. #include "core/util/tVector.h"
  29. #endif
  30. #ifndef _UTIL_DELEGATE_H_
  31. #include "core/util/delegate.h"
  32. #endif
  33. struct GFXAdapterLUID
  34. {
  35. unsigned long LowPart;
  36. long HighPart;
  37. };
  38. struct GFXAdapter
  39. {
  40. public:
  41. typedef Delegate<GFXDevice* (U32 adapterIndex)> CreateDeviceInstanceDelegate;
  42. enum
  43. {
  44. MaxAdapterNameLen = 512,
  45. };
  46. char mName[MaxAdapterNameLen];
  47. /// The name of the display output device for the adapter, if any.
  48. /// For example under Windows, this could be: \\.\DISPLAY1
  49. char mOutputName[MaxAdapterNameLen];
  50. /// List of available full-screen modes. Windows can be any size,
  51. /// so we do not enumerate them here.
  52. Vector<GFXVideoMode> mAvailableModes;
  53. /// Supported shader model. 0.f means none supported.
  54. F32 mShaderModel;
  55. /// LUID for windows oculus support
  56. GFXAdapterLUID mLUID;
  57. const char * getName() const { return mName; }
  58. const char * getOutputName() const { return mOutputName; }
  59. GFXAdapterType mType;
  60. U32 mIndex;
  61. CreateDeviceInstanceDelegate mCreateDeviceInstanceDelegate;
  62. GFXAdapter()
  63. {
  64. VECTOR_SET_ASSOCIATION( mAvailableModes );
  65. mName[0] = 0;
  66. mOutputName[0] = 0;
  67. mShaderModel = 0.f;
  68. mIndex = 0;
  69. dMemset(&mLUID, '\0', sizeof(mLUID));
  70. mType = GFXAdapterType::NullDevice;
  71. }
  72. ~GFXAdapter()
  73. {
  74. mAvailableModes.clear();
  75. }
  76. private:
  77. // Disallow copying to prevent mucking with our data above.
  78. GFXAdapter(const GFXAdapter&);
  79. };
  80. #endif // _GFXADAPTER_H_