🎉 Added cg-toolkit

This commit is contained in:
2021-08-03 14:14:42 +00:00
committed by GitHub
parent 26bc7561bf
commit be965ce6c5
45 changed files with 2230 additions and 0 deletions

1375
cg/all/include/Cg/cg.h Normal file

File diff suppressed because it is too large Load Diff

127
cg/all/include/Cg/cgD3D10.h Normal file
View File

@ -0,0 +1,127 @@
/*
*
* Copyright (c) 2002-2012, NVIDIA Corporation.
*
*
*
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
* of your agreement to the following terms, and your use, installation,
* modification or redistribution of this NVIDIA software constitutes
* acceptance of these terms. If you do not agree with these terms, please do
* not use, install, modify or redistribute this NVIDIA software.
*
*
*
* In consideration of your agreement to abide by the following terms, and
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
* Software"), to use, reproduce, modify and redistribute the NVIDIA
* Software, with or without modifications, in source and/or binary forms;
* provided that if you redistribute the NVIDIA Software, you must retain the
* copyright notice of NVIDIA, this notice and the following text and
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
* to endorse or promote products derived from the NVIDIA Software without
* specific prior written permission from NVIDIA. Except as expressly stated
* in this notice, no other rights or licenses express or implied, are granted
* by NVIDIA herein, including but not limited to any patent rights that may be
* infringed by your derivative works or by other works in which the NVIDIA
* Software may be incorporated. No hardware is licensed hereunder.
*
*
*
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
*
*
*
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __CGD3D10_H__
#define __CGD3D10_H__
#ifdef _WIN32
#pragma once
#include <windows.h>
#include <d3d10_1.h>
#include "Cg/cg.h"
/* Set up for either Win32 import/export/lib. */
#ifdef CGD3D10DLL_EXPORTS
# define CGD3D10DLL_API __declspec(dllexport)
#elif defined(CG_LIB)
# define CGD3D10DLL_API
#else
# define CGD3D10DLL_API __declspec(dllimport)
#endif
#ifndef CGD3D10ENTRY
# ifdef _WIN32
# define CGD3D10ENTRY __cdecl
# else
# define CGD3D10ENTRY
# endif
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef CGD3D10_EXPLICIT
CGD3D10DLL_API ID3D10Device * CGD3D10ENTRY cgD3D10GetDevice(CGcontext Context);
CGD3D10DLL_API HRESULT CGD3D10ENTRY cgD3D10SetDevice(CGcontext Context, ID3D10Device *pDevice);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10SetTextureParameter(CGparameter Parameter, ID3D10Resource *pTexture);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10SetSamplerStateParameter(CGparameter Parameter, ID3D10SamplerState *pSamplerState);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10SetTextureSamplerStateParameter(CGparameter Parameter, ID3D10Resource *pTexture, ID3D10SamplerState *pSamplerState);
CGD3D10DLL_API HRESULT CGD3D10ENTRY cgD3D10LoadProgram(CGprogram Program, UINT Flags);
CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY cgD3D10GetCompiledProgram(CGprogram Program);
CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY cgD3D10GetProgramErrors(CGprogram Program);
CGD3D10DLL_API CGbool CGD3D10ENTRY cgD3D10IsProgramLoaded(CGprogram Program);
CGD3D10DLL_API HRESULT CGD3D10ENTRY cgD3D10BindProgram(CGprogram Program);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10UnloadProgram(CGprogram Program);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10UnbindProgram(CGprogram Program);
CGD3D10DLL_API ID3D10Buffer * CGD3D10ENTRY cgD3D10GetBufferByIndex(CGprogram Program, UINT Index);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10RegisterStates(CGcontext Context);
CGD3D10DLL_API void CGD3D10ENTRY cgD3D10SetManageTextureParameters(CGcontext Context, CGbool Flag);
CGD3D10DLL_API CGbool CGD3D10ENTRY cgD3D10GetManageTextureParameters(CGcontext Context);
CGD3D10DLL_API ID3D10Blob * CGD3D10ENTRY cgD3D10GetIASignatureByPass(CGpass Pass);
CGD3D10DLL_API CGprofile CGD3D10ENTRY cgD3D10GetLatestVertexProfile(void);
CGD3D10DLL_API CGprofile CGD3D10ENTRY cgD3D10GetLatestGeometryProfile(void);
CGD3D10DLL_API CGprofile CGD3D10ENTRY cgD3D10GetLatestPixelProfile(void);
CGD3D10DLL_API CGbool CGD3D10ENTRY cgD3D10IsProfileSupported(CGprofile Profile);
CGD3D10DLL_API DWORD CGD3D10ENTRY cgD3D10TypeToSize(CGtype Type);
CGD3D10DLL_API HRESULT CGD3D10ENTRY cgD3D10GetLastError(void);
CGD3D10DLL_API const char ** CGD3D10ENTRY cgD3D10GetOptimalOptions(CGprofile Profile);
CGD3D10DLL_API const char * CGD3D10ENTRY cgD3D10TranslateCGerror(CGerror Error);
CGD3D10DLL_API const char * CGD3D10ENTRY cgD3D10TranslateHRESULT(HRESULT hr);
CGD3D10DLL_API CGbuffer CGD3D10ENTRY cgD3D10CreateBuffer(CGcontext Context, int size, const void *data, D3D10_USAGE bufferUsage);
CGD3D10DLL_API CGbuffer CGD3D10ENTRY cgD3D10CreateBufferFromObject(CGcontext Context, ID3D10Buffer *obj, CGbool manageObject);
CGD3D10DLL_API ID3D10Buffer * CGD3D10ENTRY cgD3D10GetBufferObject(CGbuffer buffer);
#endif /* CGD3D10_EXPLICIT */
#ifdef __cplusplus
}
#endif
#endif /* _WIN32 */
#endif

129
cg/all/include/Cg/cgD3D11.h Normal file
View File

@ -0,0 +1,129 @@
/*
*
* Copyright (c) 2002-2012, NVIDIA Corporation.
*
*
*
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
* of your agreement to the following terms, and your use, installation,
* modification or redistribution of this NVIDIA software constitutes
* acceptance of these terms. If you do not agree with these terms, please do
* not use, install, modify or redistribute this NVIDIA software.
*
*
*
* In consideration of your agreement to abide by the following terms, and
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
* Software"), to use, reproduce, modify and redistribute the NVIDIA
* Software, with or without modifications, in source and/or binary forms;
* provided that if you redistribute the NVIDIA Software, you must retain the
* copyright notice of NVIDIA, this notice and the following text and
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
* to endorse or promote products derived from the NVIDIA Software without
* specific prior written permission from NVIDIA. Except as expressly stated
* in this notice, no other rights or licenses express or implied, are granted
* by NVIDIA herein, including but not limited to any patent rights that may be
* infringed by your derivative works or by other works in which the NVIDIA
* Software may be incorporated. No hardware is licensed hereunder.
*
*
*
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
*
*
*
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __CGD3D11_H__
#define __CGD3D11_H__
#ifdef _WIN32
#pragma once
#include <windows.h>
#include <d3d11.h>
#include "Cg/cg.h"
/* Set up for either Win32 import/export/lib. */
#ifdef CGD3D11DLL_EXPORTS
# define CGD3D11DLL_API __declspec(dllexport)
#elif defined(CG_LIB)
# define CGD3D11DLL_API
#else
# define CGD3D11DLL_API __declspec(dllimport)
#endif
#ifndef CGD3D11ENTRY
# ifdef _WIN32
# define CGD3D11ENTRY __cdecl
# else
# define CGD3D11ENTRY
# endif
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef CGD3D11_EXPLICIT
CGD3D11DLL_API ID3D11Device * CGD3D11ENTRY cgD3D11GetDevice(CGcontext Context);
CGD3D11DLL_API HRESULT CGD3D11ENTRY cgD3D11SetDevice(CGcontext Context, ID3D11Device *pDevice);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11SetTextureParameter(CGparameter Parameter, ID3D11Resource *pTexture);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11SetSamplerStateParameter(CGparameter Parameter, ID3D11SamplerState *pSamplerState);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11SetTextureSamplerStateParameter(CGparameter Parameter, ID3D11Resource *pTexture, ID3D11SamplerState *pSamplerState);
CGD3D11DLL_API HRESULT CGD3D11ENTRY cgD3D11LoadProgram(CGprogram Program, UINT Flags);
CGD3D11DLL_API ID3D10Blob * CGD3D11ENTRY cgD3D11GetCompiledProgram(CGprogram Program);
CGD3D11DLL_API ID3D10Blob * CGD3D11ENTRY cgD3D11GetProgramErrors(CGprogram Program);
CGD3D11DLL_API CGbool CGD3D11ENTRY cgD3D11IsProgramLoaded(CGprogram Program);
CGD3D11DLL_API HRESULT CGD3D11ENTRY cgD3D11BindProgram(CGprogram Program);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11UnloadProgram(CGprogram Program);
CGD3D11DLL_API ID3D11Buffer * CGD3D11ENTRY cgD3D11GetBufferByIndex(CGprogram Program, UINT Index);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11RegisterStates(CGcontext Context);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11SetManageTextureParameters(CGcontext Context, CGbool Flag);
CGD3D11DLL_API CGbool CGD3D11ENTRY cgD3D11GetManageTextureParameters(CGcontext Context);
CGD3D11DLL_API ID3D10Blob * CGD3D11ENTRY cgD3D11GetIASignatureByPass(CGpass Pass);
CGD3D11DLL_API CGprofile CGD3D11ENTRY cgD3D11GetLatestVertexProfile(void);
CGD3D11DLL_API CGprofile CGD3D11ENTRY cgD3D11GetLatestGeometryProfile(void);
CGD3D11DLL_API CGprofile CGD3D11ENTRY cgD3D11GetLatestPixelProfile(void);
CGD3D11DLL_API CGprofile CGD3D11ENTRY cgD3D11GetLatestHullProfile(void);
CGD3D11DLL_API CGprofile CGD3D11ENTRY cgD3D11GetLatestDomainProfile(void);
CGD3D11DLL_API CGbool CGD3D11ENTRY cgD3D11IsProfileSupported(CGprofile Profile);
CGD3D11DLL_API DWORD CGD3D11ENTRY cgD3D11TypeToSize(CGtype Type);
CGD3D11DLL_API HRESULT CGD3D11ENTRY cgD3D11GetLastError(void);
CGD3D11DLL_API const char ** CGD3D11ENTRY cgD3D11GetOptimalOptions(CGprofile Profile);
CGD3D11DLL_API const char * CGD3D11ENTRY cgD3D11TranslateCGerror(CGerror Error);
CGD3D11DLL_API const char * CGD3D11ENTRY cgD3D11TranslateHRESULT(HRESULT hr);
CGD3D11DLL_API void CGD3D11ENTRY cgD3D11UnbindProgram(CGprogram Program);
CGD3D11DLL_API CGbuffer CGD3D11ENTRY cgD3D11CreateBuffer(CGcontext Context, int size, const void *data, D3D11_USAGE bufferUsage);
CGD3D11DLL_API CGbuffer CGD3D11ENTRY cgD3D11CreateBufferFromObject(CGcontext Context, ID3D11Buffer *obj, CGbool manageObject);
CGD3D11DLL_API ID3D11Buffer * CGD3D11ENTRY cgD3D11GetBufferObject(CGbuffer buffer);
#endif /* CGD3D11_EXPLICIT */
#ifdef __cplusplus
}
#endif
#endif /* _WIN32 */
#endif

161
cg/all/include/Cg/cgD3D9.h Normal file
View File

@ -0,0 +1,161 @@
/*
*
* Copyright (c) 2002-2012, NVIDIA Corporation.
*
*
*
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
* of your agreement to the following terms, and your use, installation,
* modification or redistribution of this NVIDIA software constitutes
* acceptance of these terms. If you do not agree with these terms, please do
* not use, install, modify or redistribute this NVIDIA software.
*
*
*
* In consideration of your agreement to abide by the following terms, and
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
* Software"), to use, reproduce, modify and redistribute the NVIDIA
* Software, with or without modifications, in source and/or binary forms;
* provided that if you redistribute the NVIDIA Software, you must retain the
* copyright notice of NVIDIA, this notice and the following text and
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
* to endorse or promote products derived from the NVIDIA Software without
* specific prior written permission from NVIDIA. Except as expressly stated
* in this notice, no other rights or licenses express or implied, are granted
* by NVIDIA herein, including but not limited to any patent rights that may be
* infringed by your derivative works or by other works in which the NVIDIA
* Software may be incorporated. No hardware is licensed hereunder.
*
*
*
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
*
*
*
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef CGD3D9_INCLUDED
#define CGD3D9_INCLUDED
#ifdef _WIN32
#pragma once
#include "cg.h"
#include <d3d9.h>
#include <d3dx9.h>
#include <windows.h>
/* Set up for either Win32 import/export/lib. */
#ifdef CGD3D9DLL_EXPORTS
# define CGD3D9DLL_API __declspec(dllexport)
#elif defined(CG_LIB)
# define CGD3D9DLL_API
#else
# define CGD3D9DLL_API __declspec(dllimport)
#endif
#ifndef CGD3D9ENTRY
# ifdef _WIN32
# define CGD3D9ENTRY __cdecl
# else
# define CGD3D9ENTRY
# endif
#endif
enum cgD3D9Errors
{
cgD3D9Failed = 1000,
cgD3D9DebugTrace = 1001
};
/*---------------------------------------------------------------------------
// HRESULTs specific to cgD3D9. When the CGerror is set to cgD3D9Failed
// cgD3D9GetLastError will return an HRESULT that could be one these.
// Use cgD3D9TranslateHRESULT() to translate these errors into strings.
---------------------------------------------------------------------------*/
static const HRESULT CGD3D9ERR_NOTLOADED = MAKE_HRESULT(1, 0x877, 1);
static const HRESULT CGD3D9ERR_NODEVICE = MAKE_HRESULT(1, 0x877, 2);
static const HRESULT CGD3D9ERR_NOTSAMPLER = MAKE_HRESULT(1, 0x877, 3);
static const HRESULT CGD3D9ERR_INVALIDPROFILE = MAKE_HRESULT(1, 0x877, 4);
static const HRESULT CGD3D9ERR_NULLVALUE = MAKE_HRESULT(1, 0x877, 5);
static const HRESULT CGD3D9ERR_OUTOFRANGE = MAKE_HRESULT(1, 0x877, 6);
static const HRESULT CGD3D9ERR_NOTUNIFORM = MAKE_HRESULT(1, 0x877, 7);
static const HRESULT CGD3D9ERR_NOTMATRIX = MAKE_HRESULT(1, 0x877, 8);
static const HRESULT CGD3D9ERR_INVALIDPARAM = MAKE_HRESULT(1, 0x877, 9);
/*---------------------------------------------------------------------------
// Other error return values
---------------------------------------------------------------------------*/
static const DWORD CGD3D9_INVALID_USAGE = 0xFF;
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef CGD3D9_EXPLICIT
CGD3D9DLL_API DWORD CGD3D9ENTRY cgD3D9TypeToSize(CGtype type);
CGD3D9DLL_API BYTE CGD3D9ENTRY cgD3D9ResourceToDeclUsage(CGresource resource);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetVertexDeclaration(CGprogram prog, D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH]);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9ValidateVertexDeclaration(CGprogram prog, const D3DVERTEXELEMENT9 *decl);
CGD3D9DLL_API IDirect3DDevice9 * CGD3D9ENTRY cgD3D9GetDevice(void);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetDevice(IDirect3DDevice9 *pDevice);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9LoadProgram(CGprogram prog, CGbool paramShadowing, DWORD assemFlags);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnloadProgram(CGprogram prog);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProgramLoaded(CGprogram prog);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9BindProgram(CGprogram prog);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniform(CGparameter param, const void *floats);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformArray(CGparameter param, DWORD offset, DWORD numItems, const void *values);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrix(CGparameter param, const D3DMATRIX *matrix);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetUniformMatrixArray(CGparameter param, DWORD offset, DWORD numItems, const D3DMATRIX *matrices);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTexture(CGparameter param, IDirect3DBaseTexture9 *tex);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetSamplerState(CGparameter param, D3DSAMPLERSTATETYPE type, DWORD value);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9SetTextureWrapMode(CGparameter param, DWORD value);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9EnableParameterShadowing(CGprogram prog, CGbool enable);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsParameterShadowingEnabled(CGprogram prog);
CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestVertexProfile(void);
CGD3D9DLL_API CGprofile CGD3D9ENTRY cgD3D9GetLatestPixelProfile(void);
CGD3D9DLL_API const char ** CGD3D9ENTRY cgD3D9GetOptimalOptions(CGprofile profile);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9IsProfileSupported(CGprofile profile);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9GetLastError(void);
CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateCGerror(CGerror error);
CGD3D9DLL_API const char * CGD3D9ENTRY cgD3D9TranslateHRESULT(HRESULT hr);
CGD3D9DLL_API void CGD3D9ENTRY cgD3D9EnableDebugTracing(CGbool enable);
CGD3D9DLL_API void CGD3D9ENTRY cgD3D9RegisterStates(CGcontext ctx);
CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetManageTextureParameters(CGcontext ctx, CGbool flag);
CGD3D9DLL_API CGbool CGD3D9ENTRY cgD3D9GetManageTextureParameters(CGcontext ctx);
CGD3D9DLL_API IDirect3DBaseTexture9 * CGD3D9ENTRY cgD3D9GetTextureParameter(CGparameter param);
CGD3D9DLL_API void CGD3D9ENTRY cgD3D9SetTextureParameter(CGparameter param, IDirect3DBaseTexture9 *tex);
CGD3D9DLL_API void CGD3D9ENTRY cgD3D9UnloadAllPrograms(void);
CGD3D9DLL_API HRESULT CGD3D9ENTRY cgD3D9UnbindProgram(CGprogram prog);
#endif /* CGD3D9_EXPLICIT */
#ifdef __cplusplus
}
#endif
#endif /* _WIN32 */
#endif

263
cg/all/include/Cg/cgGL.h Normal file
View File

@ -0,0 +1,263 @@
/*
*
* Copyright (c) 2002-2012, NVIDIA Corporation.
*
*
*
* NVIDIA Corporation("NVIDIA") supplies this software to you in consideration
* of your agreement to the following terms, and your use, installation,
* modification or redistribution of this NVIDIA software constitutes
* acceptance of these terms. If you do not agree with these terms, please do
* not use, install, modify or redistribute this NVIDIA software.
*
*
*
* In consideration of your agreement to abide by the following terms, and
* subject to these terms, NVIDIA grants you a personal, non-exclusive license,
* under NVIDIA's copyrights in this original NVIDIA software (the "NVIDIA
* Software"), to use, reproduce, modify and redistribute the NVIDIA
* Software, with or without modifications, in source and/or binary forms;
* provided that if you redistribute the NVIDIA Software, you must retain the
* copyright notice of NVIDIA, this notice and the following text and
* disclaimers in all such redistributions of the NVIDIA Software. Neither the
* name, trademarks, service marks nor logos of NVIDIA Corporation may be used
* to endorse or promote products derived from the NVIDIA Software without
* specific prior written permission from NVIDIA. Except as expressly stated
* in this notice, no other rights or licenses express or implied, are granted
* by NVIDIA herein, including but not limited to any patent rights that may be
* infringed by your derivative works or by other works in which the NVIDIA
* Software may be incorporated. No hardware is licensed hereunder.
*
*
*
* THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR ITS USE AND OPERATION
* EITHER ALONE OR IN COMBINATION WITH OTHER PRODUCTS.
*
*
*
* IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
* EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOST
* PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY OUT OF THE USE,
* REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE NVIDIA SOFTWARE,
* HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING
* NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF NVIDIA HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _cggl_h
#define _cggl_h
/*************************************************************************/
/*** CGGL Run-Time Library API ***/
/*************************************************************************/
#include <Cg/cg.h>
#ifdef _WIN32
# ifndef APIENTRY /* From Win32's <windef.h> */
# define CGGL_APIENTRY_DEFINED
# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
# define APIENTRY __stdcall
# else
# define APIENTRY
# endif
# endif
# ifndef WINGDIAPI /* From Win32's <wingdi.h> and <winnt.h> */
# define CGGL_WINGDIAPI_DEFINED
# define WINGDIAPI __declspec(dllimport)
# endif
#endif /* _WIN32 */
/* Set up CGGL_API for Win32 dllexport or gcc visibility. */
#ifndef CGGL_API
# ifdef CGGL_EXPORTS
# ifdef _WIN32
# define CGGL_API __declspec(dllexport)
# elif defined(__GNUC__) && __GNUC__>=4
# define CGGL_API __attribute__ ((visibility("default")))
# elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
# define CGGL_API __global
# else
# define CGGL_API
# endif
# else
# define CGGL_API
# endif
#endif
#ifndef CGGLENTRY
# ifdef _WIN32
# define CGGLENTRY __cdecl
# else
# define CGGLENTRY
# endif
#endif
/* Use CGGL_NO_OPENGL to avoid including OpenGL headers. */
#ifndef CGGL_NO_OPENGL
# ifdef __APPLE__
# include <OpenGL/gl.h>
# else
# include <GL/gl.h>
# endif
#endif
/*************************************************************************/
/*** Data types and enumerants ***/
/*************************************************************************/
typedef enum
{
CG_GL_MATRIX_IDENTITY = 0,
CG_GL_MATRIX_TRANSPOSE = 1,
CG_GL_MATRIX_INVERSE = 2,
CG_GL_MATRIX_INVERSE_TRANSPOSE = 3,
CG_GL_MODELVIEW_MATRIX = 4,
CG_GL_PROJECTION_MATRIX = 5,
CG_GL_TEXTURE_MATRIX = 6,
CG_GL_MODELVIEW_PROJECTION_MATRIX = 7,
CG_GL_VERTEX = 8,
CG_GL_FRAGMENT = 9,
CG_GL_GEOMETRY = 10,
CG_GL_TESSELLATION_CONTROL = 11,
CG_GL_TESSELLATION_EVALUATION = 12
} CGGLenum;
typedef enum
{
CG_GL_GLSL_DEFAULT = 0,
CG_GL_GLSL_100 = 1,
CG_GL_GLSL_110 = 2,
CG_GL_GLSL_120 = 3
} CGGLglslversion;
#ifdef __cplusplus
extern "C"
{
#endif
/*************************************************************************/
/*** Functions ***/
/*************************************************************************/
#ifndef CGGL_EXPLICIT
CGGL_API CGbool CGGLENTRY cgGLIsProfileSupported(CGprofile profile);
CGGL_API void CGGLENTRY cgGLEnableProfile(CGprofile profile);
CGGL_API void CGGLENTRY cgGLDisableProfile(CGprofile profile);
CGGL_API CGprofile CGGLENTRY cgGLGetLatestProfile(CGGLenum profile_type);
CGGL_API void CGGLENTRY cgGLSetOptimalOptions(CGprofile profile);
CGGL_API char const ** CGGLENTRY cgGLGetOptimalOptions(CGprofile profile);
CGGL_API void CGGLENTRY cgGLLoadProgram(CGprogram program);
CGGL_API void CGGLENTRY cgGLUnloadProgram(CGprogram program);
CGGL_API CGbool CGGLENTRY cgGLIsProgramLoaded(CGprogram program);
CGGL_API void CGGLENTRY cgGLBindProgram(CGprogram program);
CGGL_API void CGGLENTRY cgGLUnbindProgram(CGprofile profile);
CGGL_API GLuint CGGLENTRY cgGLGetProgramID(CGprogram program);
CGGL_API void CGGLENTRY cgGLSetParameter1f(CGparameter param, float x);
CGGL_API void CGGLENTRY cgGLSetParameter2f(CGparameter param, float x, float y);
CGGL_API void CGGLENTRY cgGLSetParameter3f(CGparameter param, float x, float y, float z);
CGGL_API void CGGLENTRY cgGLSetParameter4f(CGparameter param, float x, float y, float z, float w);
CGGL_API void CGGLENTRY cgGLSetParameter1fv(CGparameter param, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameter2fv(CGparameter param, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameter3fv(CGparameter param, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameter4fv(CGparameter param, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameter1d(CGparameter param, double x);
CGGL_API void CGGLENTRY cgGLSetParameter2d(CGparameter param, double x, double y);
CGGL_API void CGGLENTRY cgGLSetParameter3d(CGparameter param, double x, double y, double z);
CGGL_API void CGGLENTRY cgGLSetParameter4d(CGparameter param, double x, double y, double z, double w);
CGGL_API void CGGLENTRY cgGLSetParameter1dv(CGparameter param, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameter2dv(CGparameter param, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameter3dv(CGparameter param, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameter4dv(CGparameter param, const double *v);
CGGL_API void CGGLENTRY cgGLGetParameter1f(CGparameter param, float *v);
CGGL_API void CGGLENTRY cgGLGetParameter2f(CGparameter param, float *v);
CGGL_API void CGGLENTRY cgGLGetParameter3f(CGparameter param, float *v);
CGGL_API void CGGLENTRY cgGLGetParameter4f(CGparameter param, float *v);
CGGL_API void CGGLENTRY cgGLGetParameter1d(CGparameter param, double *v);
CGGL_API void CGGLENTRY cgGLGetParameter2d(CGparameter param, double *v);
CGGL_API void CGGLENTRY cgGLGetParameter3d(CGparameter param, double *v);
CGGL_API void CGGLENTRY cgGLGetParameter4d(CGparameter param, double *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray1f(CGparameter param, long offset, long nelements, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray2f(CGparameter param, long offset, long nelements, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray3f(CGparameter param, long offset, long nelements, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray4f(CGparameter param, long offset, long nelements, const float *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray1d(CGparameter param, long offset, long nelements, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray2d(CGparameter param, long offset, long nelements, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray3d(CGparameter param, long offset, long nelements, const double *v);
CGGL_API void CGGLENTRY cgGLSetParameterArray4d(CGparameter param, long offset, long nelements, const double *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray1f(CGparameter param, long offset, long nelements, float *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray2f(CGparameter param, long offset, long nelements, float *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray3f(CGparameter param, long offset, long nelements, float *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray4f(CGparameter param, long offset, long nelements, float *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray1d(CGparameter param, long offset, long nelements, double *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray2d(CGparameter param, long offset, long nelements, double *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray3d(CGparameter param, long offset, long nelements, double *v);
CGGL_API void CGGLENTRY cgGLGetParameterArray4d(CGparameter param, long offset, long nelements, double *v);
CGGL_API void CGGLENTRY cgGLSetParameterPointer(CGparameter param, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
CGGL_API void CGGLENTRY cgGLEnableClientState(CGparameter param);
CGGL_API void CGGLENTRY cgGLDisableClientState(CGparameter param);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterdr(CGparameter param, const double *matrix);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterfr(CGparameter param, const float *matrix);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterdc(CGparameter param, const double *matrix);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterfc(CGparameter param, const float *matrix);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterdr(CGparameter param, double *matrix);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterfr(CGparameter param, float *matrix);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterdc(CGparameter param, double *matrix);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterfc(CGparameter param, float *matrix);
CGGL_API void CGGLENTRY cgGLSetStateMatrixParameter(CGparameter param, CGGLenum matrix, CGGLenum transform);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfc(CGparameter param, long offset, long nelements, const float *matrices);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterArrayfr(CGparameter param, long offset, long nelements, const float *matrices);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydc(CGparameter param, long offset, long nelements, const double *matrices);
CGGL_API void CGGLENTRY cgGLSetMatrixParameterArraydr(CGparameter param, long offset, long nelements, const double *matrices);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfc(CGparameter param, long offset, long nelements, float *matrices);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterArrayfr(CGparameter param, long offset, long nelements, float *matrices);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydc(CGparameter param, long offset, long nelements, double *matrices);
CGGL_API void CGGLENTRY cgGLGetMatrixParameterArraydr(CGparameter param, long offset, long nelements, double *matrices);
CGGL_API void CGGLENTRY cgGLSetTextureParameter(CGparameter param, GLuint texobj);
CGGL_API GLuint CGGLENTRY cgGLGetTextureParameter(CGparameter param);
CGGL_API void CGGLENTRY cgGLEnableTextureParameter(CGparameter param);
CGGL_API void CGGLENTRY cgGLDisableTextureParameter(CGparameter param);
CGGL_API GLenum CGGLENTRY cgGLGetTextureEnum(CGparameter param);
CGGL_API void CGGLENTRY cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag);
CGGL_API CGbool CGGLENTRY cgGLGetManageTextureParameters(CGcontext ctx);
CGGL_API void CGGLENTRY cgGLSetupSampler(CGparameter param, GLuint texobj);
CGGL_API void CGGLENTRY cgGLRegisterStates(CGcontext ctx);
CGGL_API void CGGLENTRY cgGLEnableProgramProfiles(CGprogram program);
CGGL_API void CGGLENTRY cgGLDisableProgramProfiles(CGprogram program);
CGGL_API void CGGLENTRY cgGLSetDebugMode(CGbool debug);
CGGL_API CGbuffer CGGLENTRY cgGLCreateBuffer(CGcontext context, int size, const void *data, GLenum bufferUsage);
CGGL_API GLuint CGGLENTRY cgGLGetBufferObject(CGbuffer buffer);
CGGL_API CGbuffer CGGLENTRY cgGLCreateBufferFromObject(CGcontext context, GLuint obj, CGbool manageObject);
CGGL_API void CGGLENTRY cgGLSetContextOptimalOptions(CGcontext context, CGprofile profile);
CGGL_API char const ** CGGLENTRY cgGLGetContextOptimalOptions(CGcontext context, CGprofile profile);
CGGL_API void CGGLENTRY cgGLSetContextGLSLVersion(CGcontext context, CGGLglslversion version);
CGGL_API CGGLglslversion CGGLENTRY cgGLGetContextGLSLVersion(CGcontext context);
CGGL_API const char * CGGLENTRY cgGLGetGLSLVersionString(CGGLglslversion version);
CGGL_API CGGLglslversion CGGLENTRY cgGLGetGLSLVersion(const char *version_string);
CGGL_API CGGLglslversion CGGLENTRY cgGLDetectGLSLVersion(void);
#endif
#ifdef __cplusplus
}
#endif
#ifdef CGGL_APIENTRY_DEFINED
# undef CGGL_APIENTRY_DEFINED
# undef APIENTRY
#endif
#ifdef CGGL_WINGDIAPI_DEFINED
# undef CGGL_WINGDIAPI_DEFINED
# undef WINGDIAPI
#endif
#endif