RetroArch
cgD3D9.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (c) 2002-2012, 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 
52 #ifndef CGD3D9_INCLUDED
53 #define CGD3D9_INCLUDED
54 
55 #ifdef _WIN32
56 
57 #pragma once
58 
59 #include "cg.h"
60 
61 #include <d3d9.h>
62 #if 0
63 #ifdef HAVE_D3DX
64 #include "../d3d9/d3dx9.h"
65 #endif
66 #endif
67 #include <windows.h>
68 
69 /* Set up for either Win32 import/export/lib. */
70 
71 #ifdef CGD3D9DLL_EXPORTS
72 # define CGD3D9DLL_API __declspec(dllexport)
73 #elif defined(CG_LIB)
74 # define CGD3D9DLL_API
75 #else
76 # define CGD3D9DLL_API __declspec(dllimport)
77 #endif
78 
79 #ifndef CGD3D9ENTRY
80 # ifdef _WIN32
81 # define CGD3D9ENTRY __cdecl
82 # else
83 # define CGD3D9ENTRY
84 # endif
85 #endif
86 
87 enum cgD3D9Errors
88 {
89  cgD3D9Failed = 1000,
90  cgD3D9DebugTrace = 1001
91 };
92 
93 /*
94  * HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed
95  * cgD3D9GetLastError will return an HRESULT that could be one these.
96  * Use cgD3D9TranslateHRESULT() to translate these errors into strings.
97 */
98 
99 static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1);
100 static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2);
101 static const HRESULT CGD3D9ERR_NOTSAMPLER = MAKE_HRESULT(1, 0x877, 3);
102 static const HRESULT CGD3D9ERR_INVALIDPROFILE = MAKE_HRESULT(1, 0x877, 4);
103 static const HRESULT CGD3D9ERR_NULLVALUE = MAKE_HRESULT(1, 0x877, 5);
104 static const HRESULT CGD3D9ERR_OUTOFRANGE = MAKE_HRESULT(1, 0x877, 6);
105 static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7);
106 static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8);
107 static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9);
108 
109 /*
110  * Other error return values
111 */
112 
113 static const DWORD CGD3D9_INVALID_USAGE = 0xFF;
114 
115 #ifdef __cplusplus
116 extern "C"
117 {
118 #endif
119 
120 #ifndef CGD3D9_EXPLICIT
121 
122 CGD3D9DLL_API DWORD CGD3D9ENTRY cgD3D9TypeToSize(CGtype type);
123 CGD3D9DLL_API BYTE CGD3D9ENTRY cgD3D9ResourceToDeclUsage(CGresource resource);
124 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetVertexDeclaration(CGprogram prog, D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH]);
125 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9ValidateVertexDeclaration(CGprogram prog, const D3DVERTEXELEMENT9 *decl);
126 CGD3D9DLL_API IDirect3DDevice9 * CGD3D9ENTRY cgD3D9GetDevice(void);
127 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetDevice(IDirect3DDevice9 *pDevice);
128 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9LoadProgram(CGprogram prog, CGbool paramShadowing, DWORD assemFlags);
129 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnloadProgram(CGprogram prog);
130 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProgramLoaded(CGprogram prog);
131 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9BindProgram(CGprogram prog);
132 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniform(CGparameter param, const void *floats);
133 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformArray(CGparameter param, DWORD offset, DWORD numItems, const void *values);
134 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrix(CGparameter param, const D3DMATRIX *matrix);
135 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrixArray(CGparameter param, DWORD offset, DWORD numItems, const D3DMATRIX *matrices);
136 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTexture(CGparameter param, IDirect3DBaseTexture9 *tex);
137 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetSamplerState(CGparameter param, D3DSAMPLERSTATETYPE type, DWORD value);
138 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTextureWrapMode(CGparameter param, DWORD value);
139 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9EnableParameterShadowing(CGprogram prog, CGbool enable);
140 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsParameterShadowingEnabled(CGprogram prog);
141 CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestVertexProfile(void);
142 CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestPixelProfile(void);
143 CGD3D9DLL_API const char ** CGD3D9ENTRY cgD3D9GetOptimalOptions(CGprofile profile);
144 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProfileSupported(CGprofile profile);
145 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9GetLastError(void);
146 CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateCGerror(CGerror error);
147 CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateHRESULT(HRESULT hr);
148 CGD3D9DLL_API void CGD3D9ENTRY cgD3D9EnableDebugTracing(CGbool enable);
149 CGD3D9DLL_API void CGD3D9ENTRY cgD3D9RegisterStates(CGcontext ctx);
150 CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetManageTextureParameters(CGcontext ctx, CGbool flag);
151 CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetManageTextureParameters(CGcontext ctx);
152 CGD3D9DLL_API IDirect3DBaseTexture9 * CGD3D9ENTRY cgD3D9GetTextureParameter(CGparameter param);
153 CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetTextureParameter(CGparameter param, IDirect3DBaseTexture9 *tex);
154 CGD3D9DLL_API void CGD3D9ENTRY cgD3D9UnloadAllPrograms(void);
155 CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnbindProgram(CGprogram prog);
156 
157 #endif /* CGD3D9_EXPLICIT */
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif /* _WIN32 */
164 
165 #endif
Definition: d3d8types.h:77
CGresource
Definition: cg.h:439
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:6318
CGtype
Definition: cg.h:133
GLboolean enable
Definition: glext.h:12027
GLuint GLenum matrix
Definition: glext.h:10314
typedef HRESULT(WINAPI *PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)(_In_ const D3D12_ROOT_SIGNATURE_DESC *pRootSignature
struct _CGprogram * CGprogram
Definition: cg.h:108
GLfloat param
Definition: glext.h:6480
GLenum type
Definition: glext.h:6233
AVFormatContext * ctx
Definition: record_ffmpeg.c:247
CGprofile
Definition: cg.h:758
static l_noret error(LoadState *S, const char *why)
Definition: lundump.c:39
int CGbool
Definition: cg.h:106
struct _CGcontext * CGcontext
Definition: cg.h:107
interface IDirect3DDevice9 IDirect3DDevice9
Definition: d3d9.h:181
Definition: d3d9types.h:761
CGerror
Definition: cg.h:809
GLsizei const GLfloat * value
Definition: glext.h:6709
#define MAXD3DDECLLENGTH
Definition: d3d9types.h:717
interface IDirect3DBaseTexture9 IDirect3DBaseTexture9
Definition: d3d9.h:187
GLintptr offset
Definition: glext.h:6560
struct _CGparameter * CGparameter
Definition: cg.h:109
enum _D3DSAMPLERSTATETYPE D3DSAMPLERSTATETYPE