cgD3D10.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. *
  3. * Copyright (c) 2008-2009, NVIDIA Corporation.
  4. *
  5. *
  6. *
  7. * NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
  8. * of your agreement to the following terms, and your use, installation,
  9. * modification or redistribution of this NVIDIA software constitutes
  10. * acceptance of these terms. If you do not agree with these terms, please do
  11. * not use, install, modify or redistribute this NVIDIA software.
  12. *
  13. *
  14. *
  15. * In consideration of your agreement to abide by the following terms, and
  16. * subject to these terms, NVIDIA grants you a personal, non-exclusive license,
  17. * under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
  18. * Software"), to use, reproduce, modify and redistribute the NVIDIA
  19. * Software, with or without modifications, in source and/or binary forms;
  20. * provided that if you redistribute the NVIDIA Software, you must retain the
  21. * copyright notice of NVIDIA, this notice and the following text and
  22. * disclaimers in all such redistributions of the NVIDIA Software. Neither the
  23. * name, trademarks, service marks nor logos of NVIDIA Corporation may be used
  24. * to endorse or promote products derived from the NVIDIA Software without
  25. * specific prior written permission from NVIDIA. Except as expressly stated
  26. * in this notice, no other rights or licenses express or implied, are granted
  27. * by NVIDIA herein, including but not limited to any patent rights that may be
  28. * infringed by your derivative works or by other works in which the NVIDIA
  29. * Software may be incorporated. No hardware is licensed hereunder.
  30. *
  31. *
  32. *
  33. * THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
  34. * WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
  35. * WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  36. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
  37. * EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
  38. *
  39. *
  40. *
  41. * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
  42. * EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
  43. * PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  44. * PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
  45. * REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
  46. * HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
  47. * NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
  48. * OF THE POSSIBILITY OF SUCH DAMAGE.
  49. *
  50. */
  51. #ifndef __CGD3D10_H__
  52. #define __CGD3D10_H__
  53. #ifdef _WIN32
  54. #pragma once
  55. #include <windows.h>
  56. #include <d3d10.h>
  57. #include "Cg/cg.h"
  58. // Set up for either Win32 import/export/lib.
  59. #ifdef CGD3D10DLL_EXPORTS
  60. #define CGD3D10DLL_API __declspec(dllexport)
  61. #elif defined (CG_LIB)
  62. #define CGD3D10DLL_API
  63. #else
  64. #define CGD3D10DLL_API __declspec(dllimport)
  65. #endif
  66. #ifndef CGD3D10ENTRY
  67. # ifdef _WIN32
  68. # define CGD3D10ENTRY __cdecl
  69. # else
  70. # define CGD3D10ENTRY
  71. # endif
  72. #endif
  73. #ifdef __cplusplus
  74. extern "C"
  75. {
  76. #endif
  77. #ifndef CGD3D10_EXPLICIT
  78. /* ----- D3D Device Control ----- */
  79. CGD3D10DLL_API ID3D10Device * CGD3D10ENTRY
  80. cgD3D10GetDevice(
  81. CGcontext Context
  82. );
  83. CGD3D10DLL_API HRESULT CGD3D10ENTRY
  84. cgD3D10SetDevice(
  85. CGcontext Context,
  86. ID3D10Device * pDevice
  87. );
  88. /* ----- Texture Functions ----- */
  89. CGD3D10DLL_API void CGD3D10ENTRY
  90. cgD3D10SetTextureParameter(
  91. CGparameter Parameter,
  92. ID3D10Resource * pTexture
  93. );
  94. CGD3D10DLL_API void CGD3D10ENTRY
  95. cgD3D10SetSamplerStateParameter(
  96. CGparameter Parameter,
  97. ID3D10SamplerState * pSamplerState
  98. );
  99. CGD3D10DLL_API void CGD3D10ENTRY
  100. cgD3D10SetTextureSamplerStateParameter(
  101. CGparameter Parameter,
  102. ID3D10Resource * pTexture,
  103. ID3D10SamplerState * pSamplerState
  104. );
  105. /* ----- Shader Management ----- */
  106. CGD3D10DLL_API HRESULT CGD3D10ENTRY
  107. cgD3D10LoadProgram(
  108. CGprogram Program,
  109. UINT Flags
  110. );
  111. CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY
  112. cgD3D10GetCompiledProgram(
  113. CGprogram Program
  114. );
  115. CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY
  116. cgD3D10GetProgramErrors(
  117. CGprogram Program
  118. );
  119. CGD3D10DLL_API CGbool CGD3D10ENTRY
  120. cgD3D10IsProgramLoaded(
  121. CGprogram Program
  122. );
  123. CGD3D10DLL_API HRESULT CGD3D10ENTRY
  124. cgD3D10BindProgram(
  125. CGprogram Program
  126. );
  127. CGD3D10DLL_API void CGD3D10ENTRY
  128. cgD3D10UnloadProgram(
  129. CGprogram Program
  130. );
  131. /* ----- Buffer Management ----- */
  132. CGD3D10DLL_API ID3D10Buffer * CGD3D10ENTRY
  133. cgD3D10GetBufferByIndex(
  134. CGprogram Program,
  135. UINT Index
  136. );
  137. /* ----- CgFX ----- */
  138. CGD3D10DLL_API void CGD3D10ENTRY
  139. cgD3D10RegisterStates(
  140. CGcontext Context
  141. );
  142. CGD3D10DLL_API void CGD3D10ENTRY
  143. cgD3D10SetManageTextureParameters(
  144. CGcontext Context,
  145. CGbool Flag
  146. );
  147. CGD3D10DLL_API CGbool CGD3D10ENTRY
  148. cgD3D10GetManageTextureParameters(
  149. CGcontext Context
  150. );
  151. CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY
  152. cgD3D10GetIASignatureByPass(
  153. CGpass Pass
  154. );
  155. /* ----- Profile Options ----- */
  156. CGD3D10DLL_API CGprofile CGD3D10ENTRY
  157. cgD3D10GetLatestVertexProfile();
  158. CGD3D10DLL_API CGprofile CGD3D10ENTRY
  159. cgD3D10GetLatestGeometryProfile();
  160. CGD3D10DLL_API CGprofile CGD3D10ENTRY
  161. cgD3D10GetLatestPixelProfile();
  162. CGD3D10DLL_API CGbool CGD3D10ENTRY
  163. cgD3D10IsProfileSupported(
  164. CGprofile Profile
  165. );
  166. /* ----- Utility Functions ----- */
  167. CGD3D10DLL_API DWORD CGD3D10ENTRY
  168. cgD3D10TypeToSize(
  169. CGtype Type
  170. );
  171. CGD3D10DLL_API HRESULT CGD3D10ENTRY
  172. cgD3D10GetLastError();
  173. CGD3D10DLL_API const char ** CGD3D10ENTRY
  174. cgD3D10GetOptimalOptions(
  175. CGprofile Profile
  176. );
  177. CGD3D10DLL_API const char * CGD3D10ENTRY
  178. cgD3D10TranslateCGerror(
  179. CGerror Error
  180. );
  181. CGD3D10DLL_API const char * CGD3D10ENTRY
  182. cgD3D10TranslateHRESULT(
  183. HRESULT hr
  184. );
  185. #endif // #ifndef CGD3D10_EXPLICIT
  186. #ifdef __cplusplus
  187. }; // extern "C"
  188. #endif
  189. #endif // #ifdef _WIN32
  190. #endif // #ifndef __CGD3D10_H__
粤ICP备19079148号