1 /**************************************************************************
3 * Copyright 2010 Luca Barbieri
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 **************************************************************************/
27 #ifndef D3D1XSTUTIL_H_
28 #define D3D1XSTUTIL_H_
31 #include <unordered_map>
32 #include <unordered_set>
34 #include <tr1/unordered_map>
35 #include <tr1/unordered_set>
44 #define WIN32_LEAN_AND_MEAN
47 #include <specstrings.h>
50 #define ATTRIBUTE_UNUSED __attribute__((unused))
52 #define ATTRIBUTE_UNUSED
55 // just replicate GUIDs in every object file to avoid the hassle of having to pull in a library for them
57 #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
58 static const GUID name ATTRIBUTE_UNUSED = \
59 { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
61 #include "galliumdxgi.h"
65 #include <util/u_atomic.h>
66 #include <pipe/p_format.h>
67 #include <os/os_thread.h>
78 /* NOTE: this _depends_ on the vtable layout of the C++ compiler to be
79 * binary compatible with Windows.
80 * Furthermore some absurd vtable layout likely won't work at all, since
81 * we perform some casts which are probably not safe by the C++ standard.
83 * In particular, the GNU/Linux/Itanium/clang ABI and Microsoft ABIs will work,
85 * If in doubt, just switch to the latest version of a widely used C++ compiler.
87 * DESIGN of the Gallium COM implementation
89 * This state tracker uses somewhat unusual C++ coding patterns,
90 * to implement the COM interfaces required by Direct3D.
92 * While it may seem complicated, the effect is that the result
93 * generally behaves as intuitively as possible: in particular pointer
94 * casts very rarely change the pointer value (only for secondary
95 * DXGI/Gallium interfaces)
97 * Implementing COM is on first sight very easy: after all, it just
98 * consists of a reference count, and a dynamic_cast<> equivalent.
100 * However, implementing objects with multiple interfaces is actually
102 * The issue is that the interface pointers can't be equal, since this
103 * would place incompatible constraints on the vtable layout and thus
104 * multiple inheritance (and the subobjects the C++ compiler creates
105 * with it) must be correctly used.
107 * Furthermore, we must have a single reference count, which means
108 * that a naive implementation won't work, and it's necessary to either
109 * use virtual inheritance, or the "mixin inheritance" model we use.
111 * This solution aims to achieve the following object layout:
112 * 0: pointer to vtable for primary interface
115 * ... vtable pointers for secondary interfaces
116 * ... implementation of subclasses assuming secondary interfaces
118 * This allows us to cast pointers by just reinterpreting the value in
121 * To achieve this, *all* non-leaf classes must have their parent
122 * or the base COM interface as a template parameter, since derived
123 * classes may need to change that to support an interface derived
124 * from the one implemented by the superclass.
126 * Note however, that you can cast without regard to the template
127 * parameter, because only the vtable layout depends on it, since
128 * interfaces have no data members.
130 * For this to work, DON'T USE VIRTUAL FUNCTIONS except to implement
131 * interfaces, since the vtable layouts would otherwise be mismatched.
132 * An exception are virtual functions called only from other virtual functions,
133 * which is currently only used for the virtual destructor.
135 * The base class is GalliumComObject<IFoo>, which implements the
136 * IUnknown interface, and inherits IFoo.
138 * To support multiple inheritance, we insert GalliumMultiComObject,
139 * which redirects the secondary interfaces to the GalliumComObject
142 * Gallium(Multi)PrivateDataComObject is like ComObject but also
143 * implements the Get/SetPrivateData functions present on several
144 * D3D/DXGI interfaces.
146 * Example class hierarchy:
160 * GalliumComObject<IDuck>
161 * (non-instantiable, only implements IUnknown)
164 * GalliumAnimal<IDuck>
165 * (non-instantiable, only implements IAnimal)
172 * GalliumMultiComObject<GalliumDuck, IWheeledVehicle> <- IWheeledVehicle <- IVehicle <- IUnknown (second version)
173 * (non-instantiable, only implements IDuck and the IUnknown of IWheeledVehicle)
176 * GalliumDuckOnWheels
179 * This will produce the desired layout.
180 * Note that GalliumAnimal<IFoo>* is safely castable to GalliumAnimal<IBar>*
181 * by reinterpreting, as long as non-interface virtual functions are not used,
182 * and that you only call interface functions for the superinterface of IBar
183 * that the object actually implements.
185 * Instead, if GalliumDuck where to inherit both from GalliumAnimal
186 * and IDuck, then (IDuck*)gallium_duck and (IAnimal*)gallium_duck would
187 * have different pointer values, which the "base class as template parameter"
190 * The price we pay is that you MUST NOT have virtual functions other than those
191 * implementing interfaces (except for leaf classes) since the position of these
192 * would depend on the base interface.
193 * As mentioned above, virtual functions only called from interface functions
194 * are an exception, currently used only for the virtual destructor.
195 * If you want virtual functions anyway , put them in a separate interface class,
196 * multiply inherit from that and cast the pointer to that interface.
198 * You CAN however have virtual functions on any class which does not specify
199 * his base as a template parameter, or where you don't need to change the
200 * template base interface parameter by casting.
202 * --- The magic QueryInterface "delete this" trick ---
204 * When the reference count drops to 0, we must delete the class.
205 * The problem is, that we must call the right virtual destructor (i.e. on the right class).
206 * However, we would like to be able to call release() and nonatomic_release()
207 * non-virtually for performance (also, the latter cannot be called virtually at all, since
208 * IUnknown does not offer it).
210 * The naive solution would be to just add a virtual destructor and rely on it.
211 * However, this doesn't work due to the fact that as described above we perform casets
212 * with are unsafe regarding vtable layout.
213 * In particular, consider the case where we try to delete GalliumComObject<ID3D11Texture2D>
214 * with a pointer to GalliumComObject<ID3D11Resource>.
215 * Since we think that this is a GalliumComObject<ID3D11Resource>, we'll look for the
216 * destructor in the vtable slot immediately after the ID3D11Resource vtable, but this is
217 * actually an ID3D11Texture2D function implemented by the object!
219 * So, we must put the destructor somewhere else.
220 * We could add it as a data member, but it would be awkward and it would bloat the
222 * Thus, we use this trick: we reuse the vtable slot for QueryInterface, which is always at the
224 * To do so, we define a special value for the first pointer argument, that triggers a
226 * In addition to that, we add a virtual destructor to GalliumComObject.
227 * That virtual destructor will be called by QueryInterface, and since that is a virtual
228 * function, it will know the correct place for the virtual destructor.
230 * QueryInterface is already slow due to the need to compare several GUIDs, so the
231 * additional pointer test should not be significant.
233 * Of course the ideal solution would be telling the C++ compiler to put the
234 * destructor it in a negative vtable slot, but unfortunately GCC doesn't support that
235 * yet, and this method is almost as good as that.
241 #define COM_INTERFACE(intf, base) \
243 struct com_traits<intf> \
245 static REFIID iid() {return IID_##intf;} \
246 static inline bool is_self_or_ancestor(REFIID riid) {return riid == iid() || com_traits<base>::is_self_or_ancestor(riid);} \
250 struct com_traits
<IUnknown
>
252 static REFIID
iid() {return IID_IUnknown
;}
253 static inline bool is_self_or_ancestor(REFIID riid
) {return riid
== iid();}
257 #define __uuidof(T) (com_traits<T>::iid())
264 refcnt_t(unsigned v
= 1)
270 p_atomic_inc((int32_t*)&refcnt
);
276 if(p_atomic_dec_zero((int32_t*)&refcnt
))
281 void nonatomic_add_ref()
283 p_atomic_inc((int32_t*)&refcnt
);
286 unsigned nonatomic_release()
288 if(p_atomic_dec_zero((int32_t*)&refcnt
))
295 #if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
296 /* this should be safe because atomic ops are full memory barriers, and thus a sequence that does:
299 * should never be reorderable (as seen from another CPU) to:
303 * since one of the ops is atomic.
304 * If this weren't the case, a CPU could incorrectly destroy an object manipulated in that way by another one.
313 uint32_t atomic_refcnt
;
314 uint32_t nonatomic_refcnt
;
318 dual_refcnt_t(unsigned v
= 1)
321 nonatomic_refcnt
= 0;
326 if(sizeof(void*) == 8)
327 return *(volatile uint64_t*)&refcnt
== 0ULL;
335 while(!__sync_bool_compare_and_swap(&refcnt
, v
, v
));
342 //printf("%p add_ref at %u %u\n", this, atomic_refcnt, nonatomic_refcnt);
343 p_atomic_inc((int32_t*)&atomic_refcnt
);
344 return atomic_refcnt
+ nonatomic_refcnt
;
349 //printf("%p release at %u %u\n", this, atomic_refcnt, nonatomic_refcnt);
350 if(p_atomic_dec_zero((int32_t*)&atomic_refcnt
) && !nonatomic_refcnt
&& is_zero())
352 unsigned v
= atomic_refcnt
+ nonatomic_refcnt
;
356 void nonatomic_add_ref()
358 //printf("%p nonatomic_add_ref at %u %u\n", this, atomic_refcnt, nonatomic_refcnt);
362 unsigned nonatomic_release()
364 //printf("%p nonatomic_release at %u %u\n", this, atomic_refcnt, nonatomic_refcnt);
365 if(!--nonatomic_refcnt
&& !atomic_refcnt
&& is_zero())
371 // this will result in atomic operations being used while they could have been avoided
373 #warning Compile for 586+ using GCC to improve the performance of the Direct3D 10/11 state tracker
375 typedef refcnt_t dual_refcnt_t
;
378 #define IID_MAGIC_DELETE_THIS (*(const IID*)((intptr_t)-(int)(sizeof(IID) - 1)))
380 template<typename Base
= IUnknown
, typename RefCnt
= refcnt_t
>
381 struct GalliumComObject
: public Base
388 /* DO NOT CALL this from externally called non-virtual functions in derived classes, since
389 * the vtable position depends on the COM interface being implemented
391 virtual ~GalliumComObject()
394 inline ULONG
add_ref()
396 return refcnt
.add_ref();
399 inline ULONG
release()
401 ULONG v
= refcnt
.release();
404 /* this will call execute "delete this", using the correct vtable slot for the destructor */
405 /* see the initial comment for an explaination of this magic trick */
406 this->QueryInterface(IID_MAGIC_DELETE_THIS
, 0);
412 inline void nonatomic_add_ref()
414 refcnt
.nonatomic_add_ref();
417 inline void nonatomic_release()
419 if(!refcnt
.nonatomic_release())
421 /* this will execute "delete this", using the correct vtable slot for the destructor */
422 /* see the initial comment for an explaination of this magic trick */
423 this->QueryInterface(IID_MAGIC_DELETE_THIS
, 0);
427 inline HRESULT
query_interface(REFIID riid
, void **ppvObject
)
429 if(com_traits
<Base
>::is_self_or_ancestor(riid
))
431 // must be the virtual AddRef, since it is overridden by some classes
437 return E_NOINTERFACE
;
440 virtual ULONG STDMETHODCALLTYPE
AddRef()
445 virtual ULONG STDMETHODCALLTYPE
Release()
450 virtual HRESULT STDMETHODCALLTYPE
QueryInterface(
454 /* see the initial comment for an explaination of this magic trick */
455 if(&riid
== &IID_MAGIC_DELETE_THIS
)
464 return query_interface(riid
, ppvObject
);
468 template<typename BaseClass
, typename SecondaryInterface
>
469 struct GalliumMultiComObject
: public BaseClass
, SecondaryInterface
471 // we could avoid this duplication, but the increased complexity to do so isn't worth it
472 virtual ULONG STDMETHODCALLTYPE
AddRef()
474 return BaseClass::add_ref();
477 virtual ULONG STDMETHODCALLTYPE
Release()
479 return BaseClass::release();
482 inline HRESULT
query_interface(REFIID riid
, void **ppvObject
)
484 HRESULT hr
= BaseClass::query_interface(riid
, ppvObject
);
487 if(com_traits
<SecondaryInterface
>::is_self_or_ancestor(riid
))
489 // must be the virtual AddRef, since it is overridden by some classes
491 *ppvObject
= (SecondaryInterface
*)this;
495 return E_NOINTERFACE
;
498 virtual HRESULT STDMETHODCALLTYPE
QueryInterface(
502 /* see the initial comment for an explaination of this magic trick */
503 if(&riid
== &IID_MAGIC_DELETE_THIS
)
512 return query_interface(riid
, ppvObject
);
516 template<typename T
, typename Traits
>
525 void add_ref() {Traits::add_ref(p
);}
526 void release() {Traits::release(p
);}
528 template<typename U
, typename UTraits
>
529 refcnt_ptr(const refcnt_ptr
<U
, UTraits
>& c
)
531 *this = static_cast<U
*>(c
.ref());
545 template<typename U
, typename UTraits
>
546 refcnt_ptr
& operator =(const refcnt_ptr
<U
, UTraits
>& q
)
552 refcnt_ptr
& operator =(U
* q
)
555 p
= static_cast<T
*>(q
);
578 const T
* operator ->() const
589 bool operator !() const
594 typedef T
* refcnt_ptr::*unspecified_bool_type
;
596 operator unspecified_bool_type() const
598 return p
? &refcnt_ptr::p
: 0;
602 struct simple_ptr_traits
604 static void add_ref(void* p
) {}
605 static void release(void* p
) {}
608 struct com_ptr_traits
610 static void add_ref(void* p
)
613 ((IUnknown
*)p
)->AddRef();
616 static void release(void* p
)
619 ((IUnknown
*)p
)->Release();
624 struct ComPtr
: public refcnt_ptr
<T
, com_ptr_traits
>
626 template<typename U
, typename UTraits
>
627 ComPtr
& operator =(const refcnt_ptr
<U
, UTraits
>& q
)
633 ComPtr
& operator =(U
* q
)
636 this->p
= static_cast<T
*>(q
);
642 template<typename T
, typename TTraits
, typename U
, typename UTraits
>
643 bool operator ==(const refcnt_ptr
<T
, TTraits
>& a
, const refcnt_ptr
<U
, UTraits
>& b
)
648 template<typename T
, typename TTraits
, typename U
>
649 bool operator ==(const refcnt_ptr
<T
, TTraits
>& a
, U
* b
)
654 template<typename T
, typename TTraits
, typename U
>
655 bool operator ==(U
* b
, const refcnt_ptr
<T
, TTraits
>& a
)
660 template<typename T
, typename TTraits
, typename U
, typename UTraits
>
661 bool operator !=(const refcnt_ptr
<T
, TTraits
>& a
, const refcnt_ptr
<U
, UTraits
>& b
)
666 template<typename T
, typename TTraits
, typename U
>
667 bool operator !=(const refcnt_ptr
<T
, TTraits
>& a
, U
* b
)
672 template<typename T
, typename TTraits
, typename U
>
673 bool operator !=(U
* b
, const refcnt_ptr
<T
, TTraits
>& a
)
678 template<bool threadsafe
>
679 struct maybe_mutex_t
;
682 struct maybe_mutex_t
<true>
688 pipe_mutex_lock(mutex
);
693 pipe_mutex_unlock(mutex
);
698 struct maybe_mutex_t
<false>
709 typedef maybe_mutex_t
<true> mutex_t
;
730 c_string(const char* p
)
734 operator const char*() const
740 static inline bool operator ==(const c_string
& a
, const c_string
& b
)
742 return !strcmp(a
.p
, b
.p
);
745 static inline bool operator !=(const c_string
& a
, const c_string
& b
)
747 return strcmp(a
.p
, b
.p
);
756 inline size_t hash
<GUID
>::operator()(GUID __val
) const
758 return _Fnv_hash::hash(__val
);
762 inline size_t hash
<c_string
>::operator()(c_string __val
) const
764 return _Fnv_hash::hash(__val
.p
, strlen(__val
.p
));
767 template<typename T
, typename U
>
768 struct hash
<std::pair
<T
, U
> > : public std::unary_function
<std::pair
<T
, U
>, size_t>
770 size_t operator()(std::pair
<T
, U
> __val
) const;
773 template<typename T
, typename U
>
774 inline size_t hash
<std::pair
<T
, U
> >::operator()(std::pair
<T
, U
> __val
) const
776 std::pair
<size_t, size_t> p
;
777 p
.first
= hash
<T
>()(__val
.first
);
778 p
.second
= hash
<U
>()(__val
.second
);
779 return _Fnv_hash::hash(p
);
784 #warning "You probably need to add a pair, C string and GUID hash implementation for your C++ library"
787 template<typename Base
, typename RefCnt
= refcnt_t
>
788 struct GalliumPrivateDataComObject
: public GalliumComObject
<Base
, RefCnt
>
790 typedef std::unordered_map
<GUID
, std::pair
<void*, unsigned> > private_data_map_t
;
791 private_data_map_t private_data_map
;
792 mutex_t private_data_mutex
;
794 ~GalliumPrivateDataComObject()
796 for(private_data_map_t::iterator i
= private_data_map
.begin(), e
= private_data_map
.end(); i
!= e
; ++i
)
798 if(i
->second
.second
== ~0u)
799 ((IUnknown
*)i
->second
.first
)->Release();
801 free(i
->second
.first
);
805 HRESULT
get_private_data(
807 __inout UINT
*pDataSize
,
808 __out_bcount_opt(*pDataSize
) void *pData
)
810 lock_t
<mutex_t
> lock(private_data_mutex
);
811 private_data_map_t::iterator i
= private_data_map
.find(guid
);
813 if(i
== private_data_map
.end())
814 return DXGI_ERROR_NOT_FOUND
;
815 if(i
->second
.second
== ~0u)
817 /* TODO: is GetPrivateData on interface data supposed to do this? */
818 if(*pDataSize
< sizeof(void*))
822 memcpy(pData
, &i
->second
.first
, sizeof(void*));
823 ((IUnknown
*)i
->second
.first
)->AddRef();
825 *pDataSize
= sizeof(void*);
829 unsigned size
= std::min(*pDataSize
, i
->second
.second
);
831 memcpy(pData
, i
->second
.first
, size
);
837 HRESULT
set_private_data(
840 __in_bcount_opt( DataSize
) const void *pData
)
844 if(DataSize
&& pData
)
846 p
= malloc(DataSize
);
848 return E_OUTOFMEMORY
;
851 lock_t
<mutex_t
> lock(private_data_mutex
);
852 std::pair
<void*, unsigned>& v
= private_data_map
[guid
];
856 ((IUnknown
*)v
.first
)->Release();
860 if(DataSize
&& pData
)
862 memcpy(p
, pData
, DataSize
);
867 private_data_map
.erase(guid
);
871 HRESULT
set_private_data_interface(
873 __in_opt
const IUnknown
*pData
)
875 lock_t
<mutex_t
> lock(private_data_mutex
);
876 std::pair
<void*, unsigned>& v
= private_data_map
[guid
];
880 ((IUnknown
*)v
.first
)->Release();
886 ((IUnknown
*)pData
)->AddRef();
887 v
.first
= (void*)pData
;
891 private_data_map
.erase(guid
);
895 virtual HRESULT STDMETHODCALLTYPE
GetPrivateData(
897 __inout UINT
*pDataSize
,
898 __out_bcount_opt(*pDataSize
) void *pData
)
900 return get_private_data(guid
, pDataSize
, pData
);
903 virtual HRESULT STDMETHODCALLTYPE
SetPrivateData(
906 __in_bcount_opt( DataSize
) const void *pData
)
908 return set_private_data(guid
, DataSize
, pData
);
911 virtual HRESULT STDMETHODCALLTYPE
SetPrivateDataInterface(
913 __in_opt
const IUnknown
*pData
)
915 return set_private_data_interface(guid
, pData
);
919 template<typename BaseClass
, typename SecondaryInterface
>
920 struct GalliumMultiPrivateDataComObject
: public GalliumMultiComObject
<BaseClass
, SecondaryInterface
>
922 // we could avoid this duplication, but the increased complexity to do so isn't worth it
923 virtual HRESULT STDMETHODCALLTYPE
GetPrivateData(
925 __inout UINT
*pDataSize
,
926 __out_bcount_opt(*pDataSize
) void *pData
)
928 return BaseClass::get_private_data(guid
, pDataSize
, pData
);
931 virtual HRESULT STDMETHODCALLTYPE
SetPrivateData(
934 __in_bcount_opt( DataSize
) const void *pData
)
936 return BaseClass::set_private_data(guid
, DataSize
, pData
);
939 virtual HRESULT STDMETHODCALLTYPE
SetPrivateDataInterface(
941 __in_opt
const IUnknown
*pData
)
943 return BaseClass::set_private_data_interface(guid
, pData
);
947 #define DXGI_FORMAT_COUNT 100
948 extern pipe_format dxgi_to_pipe_format
[DXGI_FORMAT_COUNT
];
949 extern DXGI_FORMAT pipe_to_dxgi_format
[PIPE_FORMAT_COUNT
];
951 void init_pipe_to_dxgi_format();
953 COM_INTERFACE(IGalliumDevice
, IUnknown
);
954 COM_INTERFACE(IGalliumAdapter
, IUnknown
);
955 COM_INTERFACE(IGalliumResource
, IUnknown
);
957 // used to make QueryInterface know the IIDs of the interface and its ancestors
958 COM_INTERFACE(IDXGIObject
, IUnknown
)
959 COM_INTERFACE(IDXGIDeviceSubObject
, IDXGIObject
)
960 COM_INTERFACE(IDXGISurface
, IDXGIDeviceSubObject
)
961 COM_INTERFACE(IDXGIOutput
, IDXGIObject
)
962 COM_INTERFACE(IDXGIAdapter
, IDXGIObject
)
963 COM_INTERFACE(IDXGISwapChain
, IDXGIDeviceSubObject
)
964 COM_INTERFACE(IDXGIFactory
, IDXGIObject
)
965 COM_INTERFACE(IDXGIDevice
, IDXGIObject
)
966 COM_INTERFACE(IDXGIResource
, IDXGIDeviceSubObject
)
967 COM_INTERFACE(IDXGISurface1
, IDXGISurface
)
968 COM_INTERFACE(IDXGIDevice1
, IDXGIDevice
)
969 COM_INTERFACE(IDXGIAdapter1
, IDXGIAdapter
)
970 COM_INTERFACE(IDXGIFactory1
, IDXGIFactory
)
972 template<typename Base
>
973 struct GalliumDXGIDevice
: public GalliumMultiPrivateDataComObject
<Base
, IDXGIDevice
>
975 ComPtr
<IDXGIAdapter
> adapter
;
977 unsigned max_latency
;
979 GalliumDXGIDevice(IDXGIAdapter
* p_adapter
)
984 virtual HRESULT STDMETHODCALLTYPE
GetParent(
986 __out
void **ppParent
)
988 return adapter
.p
->QueryInterface(riid
, ppParent
);
991 virtual HRESULT STDMETHODCALLTYPE
GetAdapter(
992 __out IDXGIAdapter
**pAdapter
)
994 *pAdapter
= adapter
.ref();
998 virtual HRESULT STDMETHODCALLTYPE
QueryResourceResidency(
999 __in_ecount(NumResources
) IUnknown
*const *ppResources
,
1000 __out_ecount(NumResources
) DXGI_RESIDENCY
*pResidencyStatus
,
1003 for(unsigned i
= 0; i
< NumResources
; ++i
)
1004 pResidencyStatus
[i
] = DXGI_RESIDENCY_FULLY_RESIDENT
;
1008 virtual HRESULT STDMETHODCALLTYPE
SetGPUThreadPriority(
1011 priority
= Priority
;
1015 virtual HRESULT STDMETHODCALLTYPE
GetGPUThreadPriority(
1016 __out INT
*pPriority
)
1018 *pPriority
= priority
;
1022 HRESULT STDMETHODCALLTYPE
GetMaximumFrameLatency(
1026 *pMaxLatency
= max_latency
;
1030 virtual HRESULT STDMETHODCALLTYPE
SetMaximumFrameLatency(
1033 max_latency
= MaxLatency
;
1038 #endif /* D3D1XSTUTIL_H_ */