Counter Strike : Global Offensive Source Code
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.

225 lines
14 KiB

  1. /************************************************************************************************************************************\
  2. |* *|
  3. |* Copyright 2012 NVIDIA Corporation. All rights reserved. *|
  4. |* *|
  5. |* NOTICE TO USER: *|
  6. |* *|
  7. |* This software is subject to NVIDIA ownership rights under U.S. and international Copyright laws. *|
  8. |* *|
  9. |* This software and the information contained herein are PROPRIETARY and CONFIDENTIAL to NVIDIA *|
  10. |* and are being provided solely under the terms and conditions of an NVIDIA software license agreement. *|
  11. |* Otherwise, you have no rights to use or access this software in any manner. *|
  12. |* *|
  13. |* If not covered by the applicable NVIDIA software license agreement: *|
  14. |* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. *|
  15. |* IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. *|
  16. |* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, *|
  17. |* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. *|
  18. |* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, *|
  19. |* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, *|
  20. |* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. *|
  21. |* *|
  22. |* U.S. Government End Users. *|
  23. |* This software is a "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 1995), *|
  24. |* consisting of "commercial computer software" and "commercial computer software documentation" *|
  25. |* as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government only as a commercial end item. *|
  26. |* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), *|
  27. |* all U.S. Government End Users acquire the software with only those rights set forth herein. *|
  28. |* *|
  29. |* Any use of this software in individual and commercial software must include, *|
  30. |* in the user documentation and internal comments to the code, *|
  31. |* the above Disclaimer (as applicable) and U.S. Government End Users Notice. *|
  32. |* *|
  33. \************************************************************************************************************************************/
  34. #pragma once
  35. #include"nvapi_lite_salstart.h"
  36. #include"nvapi_lite_common.h"
  37. #pragma pack(push,8)
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41. //-----------------------------------------------------------------------------
  42. // DirectX APIs
  43. //-----------------------------------------------------------------------------
  44. //! \ingroup dx
  45. //! Used in NvAPI_D3D10_GetCurrentSLIState(), and NvAPI_D3D_GetCurrentSLIState().
  46. typedef struct
  47. {
  48. NvU32 version; //!< Structure version
  49. NvU32 maxNumAFRGroups; //!< [OUT] The maximum possible value of numAFRGroups
  50. NvU32 numAFRGroups; //!< [OUT] The number of AFR groups enabled in the system
  51. NvU32 currentAFRIndex; //!< [OUT] The AFR group index for the frame currently being rendered
  52. NvU32 nextFrameAFRIndex; //!< [OUT] What the AFR group index will be for the next frame (i.e. after calling Present)
  53. NvU32 previousFrameAFRIndex; //!< [OUT] The AFR group index that was used for the previous frame (~0 if more than one frame has not been rendered yet)
  54. NvU32 bIsCurAFRGroupNew; //!< [OUT] Boolean: Is this frame the first time running on the current AFR group
  55. } NV_GET_CURRENT_SLI_STATE;
  56. //! \ingroup dx
  57. #define NV_GET_CURRENT_SLI_STATE_VER MAKE_NVAPI_VERSION(NV_GET_CURRENT_SLI_STATE,1)
  58. #if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  59. ///////////////////////////////////////////////////////////////////////////////
  60. //
  61. // FUNCTION NAME: NvAPI_D3D_GetCurrentSLIState
  62. //
  63. //! DESCRIPTION: This function returns the current SLI state for the specified device. The structure
  64. //! contains the number of AFR groups, the current AFR group index,
  65. //! and what the AFR group index will be for the next frame. \p
  66. //! pDevice can be either a IDirect3DDevice9 or ID3D10Device pointer.
  67. //!
  68. //! SUPPORTED OS: Windows XP and higher
  69. //!
  70. //!
  71. //! \since Release: 173
  72. //!
  73. //! \retval NVAPI_OK Completed request
  74. //! \retval NVAPI_ERROR Error occurred
  75. //!
  76. //! \ingroup dx
  77. ///////////////////////////////////////////////////////////////////////////////
  78. NVAPI_INTERFACE NvAPI_D3D_GetCurrentSLIState(IUnknown *pDevice, NV_GET_CURRENT_SLI_STATE *pSliState);
  79. #endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  80. #if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  81. ///////////////////////////////////////////////////////////////////////////////
  82. //
  83. // FUNCTION NAME: NvAPI_D3D_SetResourceHint
  84. //
  85. //! \fn NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj,
  86. //! NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory,
  87. //! NvU32 dwHintName,
  88. //! NvU32 *pdwHintValue)
  89. //!
  90. //! DESCRIPTION: This is a general purpose function for passing down various resource
  91. //! related hints to the driver. Hints are divided into categories
  92. //! and types within each category.
  93. //!
  94. //! SUPPORTED OS: Windows XP and higher
  95. //!
  96. //!
  97. //! \since Release: 185
  98. //!
  99. //! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource
  100. //! \param [in] obj Previously obtained HV resource handle
  101. //! \param [in] dwHintCategory Category of the hints
  102. //! \param [in] dwHintName A hint within this category
  103. //! \param [in] *pdwHintValue Pointer to location containing hint value
  104. //!
  105. //! \return an int which could be an NvAPI status or DX HRESULT code
  106. //!
  107. //! \retval ::NVAPI_OK
  108. //! \retval ::NVAPI_INVALID_ARGUMENT
  109. //! \retval ::NVAPI_INVALID_CALL It is illegal to change a hint dynamically when the resource is already bound.
  110. //
  111. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  112. //! \ingroup dx
  113. //! Valid categories for NvAPI_D3D_SetResourceHint()
  114. typedef enum _NVAPI_D3D_SETRESOURCEHINT_CATEGORY
  115. {
  116. NVAPI_D3D_SRH_CATEGORY_SLI = 1
  117. } NVAPI_D3D_SETRESOURCEHINT_CATEGORY;
  118. //
  119. // NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC:
  120. // NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USING:
  121. //! \ingroup dx
  122. //! Types of SLI hints; \n
  123. //! NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC: Valid values : 0 or 1 \n
  124. //! Default value: 0 \n
  125. //! Explanation: If the value is 1, the driver will not track any rendering operations that would mark this resource as dirty,
  126. //! avoiding any form of synchronization across frames rendered in parallel in multiple GPUs in AFR mode.
  127. //!
  128. //! NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE: Valid values : 0 or 1 \n
  129. //! Default value: 0 \n
  130. //! Explanation: If the value is 1, the driver will try to perform operations which involved target resource in broadcast,
  131. //! where its possible. Hint is static and must be set before resource starts using.
  132. typedef enum _NVAPI_D3D_SETRESOURCEHINT_SLI
  133. {
  134. NVAPI_D3D_SRH_SLI_APP_CONTROLLED_INTERFRAME_CONTENT_SYNC = 1,
  135. NVAPI_D3D_SRH_SLI_ASK_FOR_BROADCAST_USAGE = 2
  136. } NVAPI_D3D_SETRESOURCEHINT_SLI;
  137. //! \ingroup dx
  138. NVAPI_INTERFACE NvAPI_D3D_SetResourceHint(IUnknown *pDev, NVDX_ObjectHandle obj,
  139. NVAPI_D3D_SETRESOURCEHINT_CATEGORY dwHintCategory,
  140. NvU32 dwHintName,
  141. NvU32 *pdwHintValue);
  142. #endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  143. #if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  144. ///////////////////////////////////////////////////////////////////////////////
  145. //
  146. // FUNCTION NAME: NvAPI_D3D_BeginResourceRendering
  147. //
  148. //! \fn NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags)
  149. //! DESCRIPTION: This function tells the driver that the resource will begin to receive updates. It must be used in combination with NvAPI_D3D_EndResourceRendering().
  150. //! The primary use of this function is allow the driver to initiate early inter-frame synchronization of resources while running in AFR SLI mode.
  151. //!
  152. //! SUPPORTED OS: Windows XP and higher
  153. //!
  154. //!
  155. //! \since Release: 185
  156. //!
  157. //! \param [in] pDev The ID3D10Device or IDirect3DDevice9 that is a using the resource
  158. //! \param [in] obj Previously obtained HV resource handle
  159. //! \param [in] Flags The flags for functionality applied to resource while being used.
  160. //!
  161. //! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources.
  162. //! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values
  163. //! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls
  164. //
  165. ///////////////////////////////////////////////////////////////////////////////
  166. //! \ingroup dx
  167. //! Used in NvAPI_D3D_BeginResourceRendering().
  168. typedef enum _NVAPI_D3D_RESOURCERENDERING_FLAG
  169. {
  170. NVAPI_D3D_RR_FLAG_DEFAULTS = 0x00000000, //!< All bits set to 0 are defaults.
  171. NVAPI_D3D_RR_FLAG_FORCE_DISCARD_CONTENT = 0x00000001, //!< (bit 0) The flag forces to discard previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint
  172. NVAPI_D3D_RR_FLAG_FORCE_KEEP_CONTENT = 0x00000002, //!< (bit 1) The flag forces to respect previous content of the resource regardless of the NvApiHints_Sli_Disable_InterframeSync hint
  173. NVAPI_D3D_RR_FLAG_MULTI_FRAME = 0x00000004 //!< (bit 2) The flag hints the driver that content will be used for many frames. If not specified then the driver assumes that content is used only on the next frame
  174. } NVAPI_D3D_RESOURCERENDERING_FLAG;
  175. //! \ingroup dx
  176. NVAPI_INTERFACE NvAPI_D3D_BeginResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags);
  177. #endif //defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  178. #if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  179. ///////////////////////////////////////////////////////////////////////////////
  180. //
  181. // FUNCTION NAME: NvAPI_D3D_EndResourceRendering
  182. //
  183. //! DESCRIPTION: This function tells the driver that the resource is done receiving updates. It must be used in combination with
  184. //! NvAPI_D3D_BeginResourceRendering().
  185. //! The primary use of this function is allow the driver to initiate early inter-frame syncs of resources while running in AFR SLI mode.
  186. //!
  187. //! SUPPORTED OS: Windows XP and higher
  188. //!
  189. //!
  190. //! \since Release: 185
  191. //!
  192. //! \param [in] pDev The ID3D10Device or IDirect3DDevice9 thatis a using the resource
  193. //! \param [in] obj Previously obtained HV resource handle
  194. //! \param [in] Flags Reserved, must be zero
  195. //
  196. //! \retval ::NVAPI_OK Function succeeded, if used properly and driver can initiate proper sync'ing of the resources.
  197. //! \retval ::NVAPI_INVALID_ARGUMENT Bad argument(s) or invalid flag values
  198. //! \retval ::NVAPI_INVALID_CALL Mismatched begin/end calls
  199. //!
  200. //! \ingroup dx
  201. ///////////////////////////////////////////////////////////////////////////////
  202. NVAPI_INTERFACE NvAPI_D3D_EndResourceRendering(IUnknown *pDev, NVDX_ObjectHandle obj, NvU32 Flags);
  203. #endif //if defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d11_h__)
  204. #include"nvapi_lite_salend.h"
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208. #pragma pack(pop)