gfxAdapter.h

Engine/source/gfx/gfxAdapter.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2012 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GFXADAPTER_H_
25#define _GFXADAPTER_H_
26
27#ifndef _GFXSTRUCTS_H_
28#include "gfx/gfxStructs.h"
29#endif
30
31#ifndef _TVECTOR_H_
32#include "core/util/tVector.h"
33#endif
34
35#ifndef _UTIL_DELEGATE_H_
36#include "core/util/delegate.h"
37#endif
38
39struct GFXAdapterLUID
40{
41   unsigned long LowPart;
42   long HighPart;
43};
44
45struct GFXAdapter 
46{
47public:
48   typedef Delegate<GFXDevice* (U32 adapterIndex)> CreateDeviceInstanceDelegate;     
49
50   enum
51   {
52      MaxAdapterNameLen = 512,
53   };
54
55   char mName[MaxAdapterNameLen];
56
57   /// The name of the display output device for the adapter, if any.
58   /// For example under Windows, this could be: \\.\DISPLAY1
59   char mOutputName[MaxAdapterNameLen];
60
61   /// List of available full-screen modes. Windows can be any size,
62   /// so we do not enumerate them here.
63   Vector<GFXVideoMode> mAvailableModes;
64
65   /// Supported shader model. 0.f means none supported.
66   F32 mShaderModel;
67
68   /// LUID for windows oculus support
69   GFXAdapterLUID mLUID;
70
71   const char * getName() const { return mName; }
72   const char * getOutputName() const { return mOutputName; }
73   GFXAdapterType mType;
74   U32            mIndex;
75   CreateDeviceInstanceDelegate mCreateDeviceInstanceDelegate;
76
77   GFXAdapter()
78   {
79      VECTOR_SET_ASSOCIATION( mAvailableModes );
80
81      mName[0] = 0;
82      mOutputName[0] = 0;
83      mShaderModel = 0.f;
84      mIndex = 0;
85      dMemset(&mLUID, '\0', sizeof(mLUID));
86      mType = GFXAdapterType::NullDevice;
87   }
88
89   ~GFXAdapter()
90   {
91      mAvailableModes.clear();
92   }
93private:
94   // Disallow copying to prevent mucking with our data above.
95   GFXAdapter(const GFXAdapter&);
96};
97
98#endif // _GFXADAPTER_H_
99