Show
Ignore:
Timestamp:
08/28/10 14:26:05 (21 months ago)
Author:
Carsten
Message:

ExtLibs/Cg:
Upgraded the NVidia Cg library from version 1.4 to 3.0, adding the binaries for both 32- and 64-bit Windows.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/ExtLibs/Cg/include/Cg/cgD3D9.h

    r32 r139  
    11/* 
    22 * 
    3  * Copyright (c) 2002, 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  
     3 * Copyright (c) 2002-2010, 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 
    1111 * 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  
     12 * 
     13 * 
     14 * 
     15 * In consideration of your agreement to abide by the following terms, and 
    1616 * 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  
     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 
    3737 * 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  
     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 
    4848 * OF THE POSSIBILITY OF SUCH DAMAGE. 
    49  *  
    50  */  
     49 * 
     50 */ 
     51 
    5152#ifndef CGD3D9_INCLUDED 
    5253#define CGD3D9_INCLUDED 
    5354 
    54 #if WIN32 
     55#ifdef _WIN32 
    5556 
    5657#pragma once 
    5758 
    5859#include "cg.h" 
     60 
    5961#include <d3d9.h> 
    6062#include <d3dx9.h> 
     63#include <windows.h> 
    6164 
    62 // Set up for either Win32 import/export/lib. 
    63 #if WIN32 
    64     # include <windows.h> 
    65     #ifdef CGD3D9DLL_EXPORTS 
    66     #define CGD3D9DLL_API __declspec(dllexport) 
    67     #elif defined (CG_LIB) 
    68     #define CGD3D9DLL_API 
    69     #else 
    70     #define CGD3D9DLL_API __declspec(dllimport) 
    71     #endif 
     65/* Set up for either Win32 import/export/lib. */ 
     66 
     67#ifdef CGD3D9DLL_EXPORTS 
     68# define CGD3D9DLL_API __declspec(dllexport) 
     69#elif defined(CG_LIB) 
     70# define CGD3D9DLL_API 
    7271#else 
    73     #define CGD3D9DLL_API 
     72# define CGD3D9DLL_API __declspec(dllimport) 
    7473#endif 
    7574 
    76 /*--------------------------------------------------------------------------- 
    77 // CGerrors that will be fed to cgSetError 
    78 // Use cgD3D9TranslateCGerror() to translate these errors into strings. 
    79 ---------------------------------------------------------------------------*/ 
     75#ifndef CGD3D9ENTRY 
     76# ifdef _WIN32 
     77#  define CGD3D9ENTRY __cdecl 
     78# else 
     79#  define CGD3D9ENTRY 
     80# endif 
     81#endif 
     82 
    8083enum cgD3D9Errors 
    8184{ 
    82     cgD3D9Failed = 1000, 
    83     cgD3D9DebugTrace = 1001, 
     85  cgD3D9Failed    = 1000, 
     86  cgD3D9DebugTrace = 1001 
    8487}; 
    8588 
     
    8992// Use cgD3D9TranslateHRESULT() to translate these errors into strings. 
    9093---------------------------------------------------------------------------*/ 
     94 
    9195static const HRESULT CGD3D9ERR_NOTLOADED       = MAKE_HRESULT(1, 0x877,  1); 
    9296static const HRESULT CGD3D9ERR_NODEVICE        = MAKE_HRESULT(1, 0x877,  2); 
     
    102106// Other error return values 
    103107---------------------------------------------------------------------------*/ 
     108 
    104109static const DWORD CGD3D9_INVALID_USAGE = 0xFF; 
    105110 
     
    109114#endif 
    110115 
    111 /*--------------------------------------------------------------------------- 
    112 // Minimal Interface 
    113 ---------------------------------------------------------------------------*/ 
     116#ifndef CGD3D9_EXPLICIT 
    114117 
    115 CGD3D9DLL_API  
    116 DWORD cgD3D9TypeToSize( 
    117   CGtype type 
    118 ); 
     118CGD3D9DLL_API DWORD CGD3D9ENTRY cgD3D9TypeToSize(CGtype type); 
     119CGD3D9DLL_API BYTE CGD3D9ENTRY cgD3D9ResourceToDeclUsage(CGresource resource); 
     120CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetVertexDeclaration(CGprogram prog, D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH]); 
     121CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9ValidateVertexDeclaration(CGprogram prog, const D3DVERTEXELEMENT9 *decl); 
     122CGD3D9DLL_API IDirect3DDevice9 * CGD3D9ENTRY cgD3D9GetDevice(void); 
     123CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetDevice(IDirect3DDevice9 *pDevice); 
     124CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9LoadProgram(CGprogram prog, CGbool paramShadowing, DWORD assemFlags); 
     125CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnloadProgram(CGprogram prog); 
     126CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProgramLoaded(CGprogram prog); 
     127CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9BindProgram(CGprogram prog); 
     128CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniform(CGparameter param, const void *floats); 
     129CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformArray(CGparameter param, DWORD offset, DWORD numItems, const void *values); 
     130CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrix(CGparameter param, const D3DMATRIX *matrix); 
     131CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrixArray(CGparameter param, DWORD offset, DWORD numItems, const D3DMATRIX *matrices); 
     132CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTexture(CGparameter param, IDirect3DBaseTexture9 *tex); 
     133CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetSamplerState(CGparameter param, D3DSAMPLERSTATETYPE type, DWORD value); 
     134CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTextureWrapMode(CGparameter param, DWORD value); 
     135CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9EnableParameterShadowing(CGprogram prog, CGbool enable); 
     136CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsParameterShadowingEnabled(CGprogram prog); 
     137CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestVertexProfile(void); 
     138CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestPixelProfile(void); 
     139CGD3D9DLL_API const char ** CGD3D9ENTRY cgD3D9GetOptimalOptions(CGprofile profile); 
     140CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProfileSupported(CGprofile profile); 
     141CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9GetLastError(void); 
     142CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateCGerror(CGerror error); 
     143CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateHRESULT(HRESULT hr); 
     144CGD3D9DLL_API void CGD3D9ENTRY cgD3D9EnableDebugTracing(CGbool enable); 
     145CGD3D9DLL_API void CGD3D9ENTRY cgD3D9RegisterStates(CGcontext ctx); 
     146CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetManageTextureParameters(CGcontext ctx, CGbool flag); 
     147CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetManageTextureParameters(CGcontext ctx); 
     148CGD3D9DLL_API IDirect3DBaseTexture9 * CGD3D9ENTRY cgD3D9GetTextureParameter(CGparameter param); 
     149CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetTextureParameter(CGparameter param, IDirect3DBaseTexture9 *tex); 
     150CGD3D9DLL_API void CGD3D9ENTRY cgD3D9UnloadAllPrograms(void); 
     151CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnbindProgram(CGprogram prog); 
    119152 
    120 CGD3D9DLL_API  
    121 BYTE cgD3D9ResourceToDeclUsage( 
    122   CGresource resource 
    123 ); 
    124  
    125 CGD3D9DLL_API  
    126 CGbool cgD3D9GetVertexDeclaration( 
    127   CGprogram prog, 
    128   D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH] 
    129 ); 
    130  
    131 CGD3D9DLL_API  
    132 CGbool cgD3D9ValidateVertexDeclaration( 
    133   CGprogram    prog, 
    134   const D3DVERTEXELEMENT9* decl 
    135 ); 
    136  
    137 /*--------------------------------------------------------------------------- 
    138 // Expanded Interface 
    139 ---------------------------------------------------------------------------*/ 
    140  
    141 /* ----- D3D Device Control ----------- */ 
    142 CGD3D9DLL_API  
    143 IDirect3DDevice9* cgD3D9GetDevice(); 
    144  
    145 CGD3D9DLL_API  
    146 HRESULT cgD3D9SetDevice( 
    147   IDirect3DDevice9* pDevice 
    148 ); 
    149  
    150 /* ----- Shader Management ----------- */ 
    151  
    152 CGD3D9DLL_API  
    153 HRESULT cgD3D9LoadProgram( 
    154   CGprogram    prog, 
    155   CGbool       paramShadowing, 
    156   DWORD        assemFlags 
    157 ); 
    158  
    159 CGD3D9DLL_API  
    160 HRESULT cgD3D9UnloadProgram( 
    161   CGprogram prog 
    162 ); 
    163  
    164 CGD3D9DLL_API  
    165 CGbool cgD3D9IsProgramLoaded( 
    166   CGprogram prog 
    167 ); 
    168  
    169 CGD3D9DLL_API  
    170 HRESULT cgD3D9BindProgram( 
    171   CGprogram prog 
    172 ); 
    173  
    174 /* ----- Parameter Management ----------- */ 
    175 CGD3D9DLL_API  
    176 HRESULT cgD3D9SetUniform( 
    177   CGparameter param, 
    178   const void* floats 
    179 ); 
    180  
    181 CGD3D9DLL_API  
    182 HRESULT cgD3D9SetUniformArray( 
    183   CGparameter param, 
    184   DWORD       offset, 
    185   DWORD       numItems, 
    186   const void* values 
    187 ); 
    188  
    189 CGD3D9DLL_API  
    190 HRESULT cgD3D9SetUniformMatrix( 
    191   CGparameter      param, 
    192   const D3DMATRIX* matrix 
    193 ); 
    194  
    195 CGD3D9DLL_API  
    196 HRESULT cgD3D9SetUniformMatrixArray( 
    197   CGparameter      param, 
    198   DWORD            offset, 
    199   DWORD            numItems, 
    200   const D3DMATRIX* matrices 
    201 ); 
    202  
    203 CGD3D9DLL_API  
    204 HRESULT cgD3D9SetTexture( 
    205   CGparameter            param, 
    206   IDirect3DBaseTexture9* tex 
    207 ); 
    208  
    209 CGD3D9DLL_API  
    210 HRESULT cgD3D9SetSamplerState( 
    211   CGparameter         param, 
    212   D3DSAMPLERSTATETYPE type, 
    213   DWORD               value  
    214 ); 
    215  
    216 CGD3D9DLL_API  
    217 HRESULT cgD3D9SetTextureWrapMode( 
    218   CGparameter param, 
    219   DWORD       value  
    220 ); 
    221  
    222 /* ----- Parameter Management (Shadowing) ----------- */ 
    223 CGD3D9DLL_API  
    224 HRESULT cgD3D9EnableParameterShadowing( 
    225   CGprogram prog, 
    226   CGbool enable 
    227 ); 
    228  
    229 CGD3D9DLL_API  
    230 CGbool cgD3D9IsParameterShadowingEnabled( 
    231   CGprogram prog 
    232 ); 
    233  
    234 /* --------- Profile Options ----------------- */ 
    235 CGD3D9DLL_API  
    236 CGprofile cgD3D9GetLatestVertexProfile(); 
    237  
    238 CGD3D9DLL_API  
    239 CGprofile cgD3D9GetLatestPixelProfile(); 
    240  
    241 CGD3D9DLL_API  
    242 char const** cgD3D9GetOptimalOptions( 
    243   CGprofile profile 
    244 ); 
    245  
    246 /* --------- Error reporting ----------------- */ 
    247 CGD3D9DLL_API  
    248 HRESULT cgD3D9GetLastError(); 
    249  
    250 CGD3D9DLL_API  
    251 const char* cgD3D9TranslateCGerror( 
    252   CGerror error 
    253 ); 
    254  
    255 CGD3D9DLL_API  
    256 const char* cgD3D9TranslateHRESULT( 
    257   HRESULT hr 
    258 ); 
    259  
    260 CGD3D9DLL_API 
    261 void cgD3D9EnableDebugTracing( 
    262   CGbool enable 
    263 ); 
     153#endif /* CGD3D9_EXPLICIT */ 
    264154 
    265155#ifdef __cplusplus 
    266 }; 
     156} 
    267157#endif 
    268158 
    269 #endif // WIN32 
     159#endif /* _WIN32 */ 
    270160 
    271161#endif