source: OGRE/trunk/ogrenew/Dependencies/include/Cg/cgD3D8.h @ 657

Revision 657, 8.0 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/*
2 *
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
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 CGD3D8_INCLUDED
52#define CGD3D8_INCLUDED
53
54#if WIN32
55
56#pragma once
57
58#include "cg.h"
59#include <d3d8.h>
60#include <d3dx8.h>
61
62// Set up for either Win32 import/export/lib.
63#if WIN32
64    # include <windows.h>
65    #ifdef CGD3D8DLL_EXPORTS
66    #define CGD3D8DLL_API __declspec(dllexport)
67    #elif defined (CG_LIB)
68    #define CGD3D8DLL_API
69    #else
70    #define CGD3D8DLL_API __declspec(dllimport)
71    #endif
72#else
73    #define CGD3D8DLL_API
74#endif
75
76/*---------------------------------------------------------------------------
77// CGerrors that will be fed to cgSetError
78// Use cgD3D8TranslateCGerror() to translate these errors into strings.
79---------------------------------------------------------------------------*/
80enum cgD3D8Errors
81{
82    cgD3D8Failed = 1000,
83    cgD3D8DebugTrace = 1001,
84};
85
86/*---------------------------------------------------------------------------
87// HRESULTs specific to cgD3D8. When the CGerror is set to cgD3D8Failed
88// cgD3D8GetLastError will return an HRESULT that could be one these.
89// Use cgD3D8TranslateHRESULT() to translate these errors into strings.
90---------------------------------------------------------------------------*/
91static const HRESULT CGD3D8ERR_NOTLOADED       = MAKE_HRESULT(1, 0x877,  1);
92static const HRESULT CGD3D8ERR_NODEVICE        = MAKE_HRESULT(1, 0x877,  2);
93static const HRESULT CGD3D8ERR_NOTSAMPLER      = MAKE_HRESULT(1, 0x877,  3);
94static const HRESULT CGD3D8ERR_INVALIDPROFILE  = MAKE_HRESULT(1, 0x877,  4);
95static const HRESULT CGD3D8ERR_NULLVALUE       = MAKE_HRESULT(1, 0x877,  5);
96static const HRESULT CGD3D8ERR_OUTOFRANGE      = MAKE_HRESULT(1, 0x877,  6);
97static const HRESULT CGD3D8ERR_NOTUNIFORM      = MAKE_HRESULT(1, 0x877,  7);
98static const HRESULT CGD3D8ERR_NOTMATRIX       = MAKE_HRESULT(1, 0x877,  8);
99static const HRESULT CGD3D8ERR_INVALIDPARAM    = MAKE_HRESULT(1, 0x877,  9);
100
101static const HRESULT CGD3D8ERR_INVALIDSAMPLERSTATE       = MAKE_HRESULT(1, 0x877, 100);
102static const HRESULT CGD3D8ERR_INVALIDVEREXDECL          = MAKE_HRESULT(1, 0x877, 101);
103
104/*---------------------------------------------------------------------------
105// Other error return values
106---------------------------------------------------------------------------*/
107static const DWORD CGD3D8_INVALID_REG = 0xFFFFFFFF;
108
109#ifdef __cplusplus
110extern "C"
111{
112#endif
113
114/*---------------------------------------------------------------------------
115// Minimal Interface
116---------------------------------------------------------------------------*/
117
118CGD3D8DLL_API
119DWORD cgD3D8TypeToSize(
120  CGtype type
121);
122
123CGD3D8DLL_API
124DWORD cgD3D8ResourceToInputRegister(
125  CGresource resource
126);
127
128CGD3D8DLL_API
129CGbool cgD3D8GetVertexDeclaration(
130  CGprogram prog,
131  DWORD     decl[MAX_FVF_DECL_SIZE]
132);
133
134CGD3D8DLL_API
135CGbool cgD3D8ValidateVertexDeclaration(
136  CGprogram    prog,
137  const DWORD* decl
138);
139
140/*---------------------------------------------------------------------------
141// Expanded Interface
142---------------------------------------------------------------------------*/
143
144/* ----- D3D Device Control ----------- */
145CGD3D8DLL_API
146IDirect3DDevice8* cgD3D8GetDevice();
147
148CGD3D8DLL_API
149HRESULT cgD3D8SetDevice(
150  IDirect3DDevice8* pDevice
151);
152
153/* ----- Shader Management ----------- */
154CGD3D8DLL_API
155HRESULT cgD3D8LoadProgram(
156  CGprogram    prog,
157  CGbool       paramShadowing,
158  DWORD        assemFlags,
159  DWORD        vshaderUsage,
160  const DWORD* vertexDecl
161);
162
163CGD3D8DLL_API
164HRESULT cgD3D8UnloadProgram(
165  CGprogram prog
166);
167
168CGD3D8DLL_API
169CGbool cgD3D8IsProgramLoaded(
170  CGprogram prog
171);
172
173CGD3D8DLL_API
174HRESULT cgD3D8BindProgram(
175  CGprogram prog
176);
177
178/* ----- Parameter Management ----------- */
179CGD3D8DLL_API
180HRESULT cgD3D8SetUniform(
181  CGparameter param,
182  const void* floats
183);
184
185CGD3D8DLL_API
186HRESULT cgD3D8SetUniformArray(
187  CGparameter param,
188  DWORD       offset,
189  DWORD       numItems,
190  const void* values
191);
192
193CGD3D8DLL_API
194HRESULT cgD3D8SetUniformMatrix(
195  CGparameter      param,
196  const D3DMATRIX* matrix
197);
198
199CGD3D8DLL_API
200HRESULT cgD3D8SetUniformMatrixArray(
201  CGparameter      param,
202  DWORD            offset,
203  DWORD            numItems,
204  const D3DMATRIX* matrices
205);
206
207CGD3D8DLL_API
208HRESULT cgD3D8SetTexture(
209  CGparameter            param,
210  IDirect3DBaseTexture8* tex
211);
212
213CGD3D8DLL_API
214HRESULT cgD3D8SetTextureStageState(
215  CGparameter              param,
216  D3DTEXTURESTAGESTATETYPE type,
217  DWORD                    value
218);
219
220CGD3D8DLL_API
221HRESULT cgD3D8SetTextureWrapMode(
222  CGparameter param,
223  DWORD       value
224);
225
226/* ----- Parameter Management (Shadowing) ----------- */
227CGD3D8DLL_API
228HRESULT cgD3D8EnableParameterShadowing(
229  CGprogram prog,
230  CGbool enable
231);
232
233CGD3D8DLL_API
234CGbool cgD3D8IsParameterShadowingEnabled(
235  CGprogram prog
236);
237
238/* --------- Profile Options ----------------- */
239CGD3D8DLL_API
240CGprofile cgD3D8GetLatestVertexProfile();
241
242CGD3D8DLL_API
243CGprofile cgD3D8GetLatestPixelProfile();
244
245CGD3D8DLL_API
246char const* cgD3D8GetOptimalOptions(
247  CGprofile profile
248);
249
250/* --------- Error reporting ----------------- */
251CGD3D8DLL_API
252HRESULT cgD3D8GetLastError();
253
254CGD3D8DLL_API
255const char* cgD3D8TranslateCGerror(
256  CGerror error
257);
258
259CGD3D8DLL_API
260const char* cgD3D8TranslateHRESULT(
261  HRESULT hr
262);
263
264CGD3D8DLL_API
265void cgD3D8EnableDebugTracing(
266  CGbool enable
267);
268
269#ifdef __cplusplus
270};
271#endif
272
273#endif // WIN32
274
275#endif
Note: See TracBrowser for help on using the repository browser.