mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Initial removal of Nvidia CG. Still some more cleanup to go
This commit is contained in:
@@ -466,23 +466,6 @@ else()
|
||||
add_subdirectory(Externals/GLew)
|
||||
include_directories(Externals/GLew/include)
|
||||
endif(NOT GLEW_FOUND)
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
check_lib(CG Cg Cg/cg.h)
|
||||
endif()
|
||||
if(NOT CG_FOUND)
|
||||
message("Using static Cg from Externals")
|
||||
include_directories(Externals)
|
||||
endif(NOT CG_FOUND)
|
||||
check_lib(CGGL CgGL Cg/cgGL.h)
|
||||
if(NOT CG_FOUND)
|
||||
message("CG not found, Building without")
|
||||
add_definitions(-DHAVE_CG=0)
|
||||
set(HAVE_CG 0)
|
||||
else()
|
||||
add_definitions(-DHAVE_CG=1)
|
||||
set(HAVE_CG 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
Vendored
BIN
Binary file not shown.
-42
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="2.1">
|
||||
<dict>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>NVIDIA Cg version 3.0.0007</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.nvidia.cg</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>NVIDIA Cg</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.0007</string>
|
||||
<key>IFMajorVersion</key>
|
||||
<integer>3</integer>
|
||||
<key>IFMinorVersion</key>
|
||||
<integer>0</integer>
|
||||
<key>IFPkgFlagAllowBackRev</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagAuthorizationAction</key>
|
||||
<string>RootAuthorization</string>
|
||||
<key>IFPkgFlagDefaultLocation</key>
|
||||
<string>/</string>
|
||||
<key>IFPkgFlagInstallFat</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagIsRequired</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagOverwritePermissions</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagRelocatable</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagRestartAction</key>
|
||||
<string>NoRestart</string>
|
||||
<key>IFPkgFlagRootVolumeOnly</key>
|
||||
<true/>
|
||||
<key>IFPkgFlagUpdateInstalledLanguages</key>
|
||||
<false/>
|
||||
<key>IFPkgFlagUseUserMask</key>
|
||||
<false/>
|
||||
<key>IFPkgFormatVersion</key>
|
||||
<real>0.10000000149011612</real>
|
||||
</dict>
|
||||
</plist>
|
||||
Vendored
BIN
Binary file not shown.
Vendored
-1354
File diff suppressed because it is too large
Load Diff
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
-243
@@ -1,243 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2002-2010, 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
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#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;
|
||||
|
||||
#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);
|
||||
|
||||
#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
|
||||
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -85,7 +85,7 @@ void PixelShaderManager::Shutdown()
|
||||
|
||||
void PixelShaderManager::SetConstants()
|
||||
{
|
||||
if (g_ActiveConfig.bUseGLSL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (!g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
Dirty();
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ void VertexShaderManager::Dirty()
|
||||
// TODO: A cleaner way to control the matricies without making a mess in the parameters field
|
||||
void VertexShaderManager::SetConstants()
|
||||
{
|
||||
if (g_ActiveConfig.bUseGLSL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
if (!g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
Dirty();
|
||||
if (nTransformMatricesChanged[0] >= 0)
|
||||
{
|
||||
|
||||
@@ -87,7 +87,6 @@ void VideoConfig::Load(const char *ini_file)
|
||||
iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
|
||||
iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
|
||||
iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);
|
||||
iniFile.Get("Settings", "UseGLSL", &bUseGLSL, true);
|
||||
|
||||
iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false);
|
||||
iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false);
|
||||
@@ -143,7 +142,6 @@ void VideoConfig::GameIniLoad(const char *ini_file)
|
||||
iniFile.GetIfExists("Video_Settings", "DisableFog", &bDisableFog);
|
||||
iniFile.GetIfExists("Video_Settings", "EnableOpenCL", &bEnableOpenCL);
|
||||
iniFile.GetIfExists("Video_Settings", "OMPDecoder", &bOMPDecoder);
|
||||
iniFile.GetIfExists("Video_Settings", "UseGLSL", &bUseGLSL);
|
||||
|
||||
iniFile.GetIfExists("Video_Enhancements", "ForceFiltering", &bForceFiltering);
|
||||
iniFile.GetIfExists("Video_Enhancements", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
|
||||
@@ -176,7 +174,6 @@ void VideoConfig::VerifyValidity()
|
||||
if (!backend_info.bSupports3DVision) b3DVision = false;
|
||||
if (!backend_info.bSupportsFormatReinterpretation) bEFBEmulateFormatChanges = false;
|
||||
if (!backend_info.bSupportsPixelLighting) bEnablePixelLighting = false;
|
||||
if (!backend_info.bSupportsGLSL) bUseGLSL = false;
|
||||
}
|
||||
|
||||
void VideoConfig::Save(const char *ini_file)
|
||||
@@ -218,7 +215,6 @@ void VideoConfig::Save(const char *ini_file)
|
||||
iniFile.Set("Settings", "Wireframe", bWireFrame);
|
||||
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
|
||||
iniFile.Set("Settings", "DisableFog", bDisableFog);
|
||||
iniFile.Set("Settings", "UseGLSL", bUseGLSL);
|
||||
|
||||
iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL);
|
||||
iniFile.Set("Settings", "OMPDecoder", bOMPDecoder);
|
||||
@@ -281,7 +277,6 @@ void VideoConfig::GameIniSave(const char* default_ini, const char* game_ini)
|
||||
SET_IF_DIFFERS("Video_Settings", "DisableFog", bDisableFog);
|
||||
SET_IF_DIFFERS("Video_Settings", "EnableOpenCL", bEnableOpenCL);
|
||||
SET_IF_DIFFERS("Video_Settings", "OMPDecoder", bOMPDecoder);
|
||||
SET_IF_DIFFERS("Video_Settings", "UseGLSL", bUseGLSL);
|
||||
|
||||
SET_IF_DIFFERS("Video_Enhancements", "ForceFiltering", bForceFiltering);
|
||||
SET_IF_DIFFERS("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy); // NOTE - this is x in (1 << x)
|
||||
|
||||
@@ -103,7 +103,6 @@ struct VideoConfig
|
||||
bool bWireFrame;
|
||||
bool bDstAlphaPass;
|
||||
bool bDisableFog;
|
||||
bool bUseGLSL;
|
||||
|
||||
// Utility
|
||||
bool bDumpTextures;
|
||||
|
||||
@@ -23,12 +23,6 @@ if(wxWidgets_FOUND)
|
||||
set(LIBS ${LIBS} ${wxWidgets_LIBRARIES})
|
||||
endif(wxWidgets_FOUND)
|
||||
|
||||
if(HAVE_CG AND (APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux"))
|
||||
set(LIBS ${LIBS} Cg CgGL)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
list(APPEND LIBS "${CMAKE_SOURCE_DIR}/Externals/Cg/Cg.framework")
|
||||
endif()
|
||||
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(LIBS ${LIBS} clrun)
|
||||
endif()
|
||||
|
||||
@@ -113,13 +113,6 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
||||
#define GL_REPORT_PROGRAM_ERROR() (void)0
|
||||
#endif
|
||||
|
||||
#if HAVE_CG && (defined __APPLE__ || defined __linux__ || defined _WIN32)
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
extern CGcontext g_cgcontext;
|
||||
extern CGprofile g_cgvProf, g_cgfProf;
|
||||
#endif
|
||||
|
||||
// Isn't defined if we aren't using GLEW 1.6
|
||||
#ifndef GL_ONE_MINUS_SRC1_ALPHA
|
||||
#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
|
||||
|
||||
@@ -50,11 +50,6 @@ bool PixelShaderCache::ShaderEnabled;
|
||||
PixelShaderCache::PSCacheEntry* PixelShaderCache::last_entry = NULL;
|
||||
PIXELSHADERUID PixelShaderCache::last_uid;
|
||||
|
||||
void (*pSetPSConstant4f)(unsigned int, float, float, float, float);
|
||||
void (*pSetPSConstant4fv)(unsigned int, const float*);
|
||||
void (*pSetMultiPSConstant4fv)(unsigned int, unsigned int, const float*);
|
||||
bool (*pCompilePixelShader)(FRAGMENTSHADER&, const char*);
|
||||
|
||||
GLuint PixelShaderCache::GetDepthMatrixProgram()
|
||||
{
|
||||
return s_DepthMatrixProgram.glprogid;
|
||||
@@ -73,207 +68,88 @@ void PixelShaderCache::Init()
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
s_displayCompileAlert = true;
|
||||
|
||||
char pmatrixprog[2048];
|
||||
sprintf(pmatrixprog, "#version %s\n"
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"%s\n"
|
||||
"%suniform sampler2DRect samp0;\n"
|
||||
"%s\n"
|
||||
"%svec4 " I_COLORS"[7];\n"
|
||||
"%s\n"
|
||||
"void main(){\n"
|
||||
"vec4 Temp0, Temp1;\n"
|
||||
"vec4 K0 = vec4(0.5, 0.5, 0.5, 0.5);\n"
|
||||
"Temp0 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||
"Temp0 = Temp0 * " I_COLORS"[%d];\n"
|
||||
"Temp0 = Temp0 + K0;\n"
|
||||
"Temp0 = floor(Temp0);\n"
|
||||
"Temp0 = Temp0 * " I_COLORS"[%d];\n"
|
||||
"Temp1.x = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.y = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.z = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.w = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"gl_FragData[0] = Temp1 + " I_COLORS"[%d];\n"
|
||||
"}\n",
|
||||
(g_ActiveConfig.backend_info.bSupportsGLSLUBO || g_ActiveConfig.backend_info.bSupportsGLSLBinding) ? "330 compatibility" : "120",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "#extension GL_ARB_shading_language_420pack : enable" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "layout(binding = 0) " : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "layout(std140) uniform PSBlock {" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "uniform ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "};" : "",
|
||||
C_COLORS+5, C_COLORS+6, C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
|
||||
if (g_ActiveConfig.bUseGLSL)
|
||||
|
||||
if (!PixelShaderCache::CompilePixelShader(s_ColorMatrixProgram, pmatrixprog))
|
||||
{
|
||||
pSetPSConstant4f = SetGLSLPSConstant4f;
|
||||
pSetPSConstant4fv = SetGLSLPSConstant4fv;
|
||||
pSetMultiPSConstant4fv = SetMultiGLSLPSConstant4fv;
|
||||
pCompilePixelShader = CompileGLSLPixelShader;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSetPSConstant4f = SetCGPSConstant4f;
|
||||
pSetPSConstant4fv = SetCGPSConstant4fv;
|
||||
pSetMultiPSConstant4fv = SetMultiCGPSConstant4fv;
|
||||
pCompilePixelShader = CompileCGPixelShader;
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
||||
s_ColorMatrixProgram.Destroy();
|
||||
}
|
||||
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, (GLint *)&s_nMaxPixelInstructions);
|
||||
sprintf(pmatrixprog, "#version %s\n"
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"%s\n"
|
||||
"%suniform sampler2DRect samp0;\n"
|
||||
"%s\n"
|
||||
"%svec4 " I_COLORS"[5];\n"
|
||||
"%s\n"
|
||||
"void main(){\n"
|
||||
"vec4 R0, R1, R2;\n"
|
||||
"vec4 K0 = vec4(255.99998474121, 0.003921568627451, 256.0, 0.0);\n"
|
||||
"vec4 K1 = vec4(15.0, 0.066666666666, 0.0, 0.0);\n"
|
||||
"R2 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||
"R0.x = R2.x * K0.x;\n"
|
||||
"R0.x = floor(R0).x;\n"
|
||||
"R0.yzw = (R0 - R0.x).yzw;\n"
|
||||
"R0.yzw = (R0 * K0.z).yzw;\n"
|
||||
"R0.y = floor(R0).y;\n"
|
||||
"R0.zw = (R0 - R0.y).zw;\n"
|
||||
"R0.zw = (R0 * K0.z).zw;\n"
|
||||
"R0.z = floor(R0).z;\n"
|
||||
"R0.w = R0.x;\n"
|
||||
"R0 = R0 * K0.y;\n"
|
||||
"R0.w = (R0 * K1.x).w;\n"
|
||||
"R0.w = floor(R0).w;\n"
|
||||
"R0.w = (R0 * K1.y).w;\n"
|
||||
"R1.x = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.y = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.z = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.w = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"gl_FragData[0] = R1 * " I_COLORS"[%d];\n"
|
||||
"}\n",
|
||||
(g_ActiveConfig.backend_info.bSupportsGLSLUBO || g_ActiveConfig.backend_info.bSupportsGLSLBinding) ? "330 compatibility" : "120",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "#extension GL_ARB_shading_language_420pack : enable" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "layout(binding = 0) " : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "layout(std140) uniform PSBlock {" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "uniform ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "};" : "",
|
||||
C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
|
||||
if (s_nMaxPixelInstructions == 0) // Some combination of drivers and hardware returns zero for some reason.
|
||||
s_nMaxPixelInstructions = 4096;
|
||||
if (strstr((const char*)glGetString(GL_VENDOR), "Humper") != NULL) s_nMaxPixelInstructions = 4096;
|
||||
#if CG_VERSION_NUM == 2100
|
||||
if (strstr((const char*)glGetString(GL_VENDOR), "ATI") != NULL)
|
||||
if (!PixelShaderCache::CompilePixelShader(s_DepthMatrixProgram, pmatrixprog))
|
||||
{
|
||||
s_nMaxPixelInstructions = 4096;
|
||||
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
||||
s_DepthMatrixProgram.Destroy();
|
||||
}
|
||||
#endif
|
||||
|
||||
int maxinst, maxattribs;
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, (GLint *)&maxinst);
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB, (GLint *)&maxattribs);
|
||||
INFO_LOG(VIDEO, "pixel max_alu=%d, max_inst=%d, max_attrib=%d", s_nMaxPixelInstructions, maxinst, maxattribs);
|
||||
if (g_ActiveConfig.bUseGLSL)
|
||||
{
|
||||
char pmatrixprog[2048];
|
||||
sprintf(pmatrixprog, "#version %s\n"
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"%s\n"
|
||||
"%suniform sampler2DRect samp0;\n"
|
||||
"%s\n"
|
||||
"%svec4 " I_COLORS"[7];\n"
|
||||
"%s\n"
|
||||
"void main(){\n"
|
||||
"vec4 Temp0, Temp1;\n"
|
||||
"vec4 K0 = vec4(0.5, 0.5, 0.5, 0.5);\n"
|
||||
"Temp0 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||
"Temp0 = Temp0 * " I_COLORS"[%d];\n"
|
||||
"Temp0 = Temp0 + K0;\n"
|
||||
"Temp0 = floor(Temp0);\n"
|
||||
"Temp0 = Temp0 * " I_COLORS"[%d];\n"
|
||||
"Temp1.x = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.y = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.z = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"Temp1.w = dot(Temp0, " I_COLORS"[%d]);\n"
|
||||
"gl_FragData[0] = Temp1 + " I_COLORS"[%d];\n"
|
||||
"}\n",
|
||||
(g_ActiveConfig.backend_info.bSupportsGLSLUBO || g_ActiveConfig.backend_info.bSupportsGLSLBinding) ? "330 compatibility" : "120",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "#extension GL_ARB_shading_language_420pack : enable" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "layout(binding = 0) " : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "layout(std140) uniform PSBlock {" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "uniform ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "};" : "",
|
||||
C_COLORS+5, C_COLORS+6, C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
|
||||
|
||||
if (!PixelShaderCache::CompilePixelShader(s_ColorMatrixProgram, pmatrixprog))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
||||
s_ColorMatrixProgram.Destroy();
|
||||
}
|
||||
|
||||
sprintf(pmatrixprog, "#version %s\n"
|
||||
"#extension GL_ARB_texture_rectangle : enable\n"
|
||||
"%s\n"
|
||||
"%suniform sampler2DRect samp0;\n"
|
||||
"%s\n"
|
||||
"%svec4 " I_COLORS"[5];\n"
|
||||
"%s\n"
|
||||
"void main(){\n"
|
||||
"vec4 R0, R1, R2;\n"
|
||||
"vec4 K0 = vec4(255.99998474121, 0.003921568627451, 256.0, 0.0);\n"
|
||||
"vec4 K1 = vec4(15.0, 0.066666666666, 0.0, 0.0);\n"
|
||||
"R2 = texture2DRect(samp0, gl_TexCoord[0].xy);\n"
|
||||
"R0.x = R2.x * K0.x;\n"
|
||||
"R0.x = floor(R0).x;\n"
|
||||
"R0.yzw = (R0 - R0.x).yzw;\n"
|
||||
"R0.yzw = (R0 * K0.z).yzw;\n"
|
||||
"R0.y = floor(R0).y;\n"
|
||||
"R0.zw = (R0 - R0.y).zw;\n"
|
||||
"R0.zw = (R0 * K0.z).zw;\n"
|
||||
"R0.z = floor(R0).z;\n"
|
||||
"R0.w = R0.x;\n"
|
||||
"R0 = R0 * K0.y;\n"
|
||||
"R0.w = (R0 * K1.x).w;\n"
|
||||
"R0.w = floor(R0).w;\n"
|
||||
"R0.w = (R0 * K1.y).w;\n"
|
||||
"R1.x = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.y = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.z = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"R1.w = dot(R0, " I_COLORS"[%d]);\n"
|
||||
"gl_FragData[0] = R1 * " I_COLORS"[%d];\n"
|
||||
"}\n",
|
||||
(g_ActiveConfig.backend_info.bSupportsGLSLUBO || g_ActiveConfig.backend_info.bSupportsGLSLBinding) ? "330 compatibility" : "120",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "#extension GL_ARB_shading_language_420pack : enable" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLBinding ? "layout(binding = 0) " : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "layout(std140) uniform PSBlock {" : "",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "uniform ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "};" : "",
|
||||
C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
|
||||
if (!PixelShaderCache::CompilePixelShader(s_DepthMatrixProgram, pmatrixprog))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
||||
s_DepthMatrixProgram.Destroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char pmatrixprog[2048];
|
||||
sprintf(pmatrixprog, "!!ARBfp1.0"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
"PARAM K0 = { 0.5, 0.5, 0.5, 0.5};\n"
|
||||
"TEX R0, fragment.texcoord[0], texture[0], RECT;\n"
|
||||
"MUL R0, R0, program.env[%d];\n"
|
||||
"ADD R0, R0, K0;\n"
|
||||
"FLR R0, R0;\n"
|
||||
"MUL R0, R0, program.env[%d];\n"
|
||||
"DP4 R1.x, R0, program.env[%d];\n"
|
||||
"DP4 R1.y, R0, program.env[%d];\n"
|
||||
"DP4 R1.z, R0, program.env[%d];\n"
|
||||
"DP4 R1.w, R0, program.env[%d];\n"
|
||||
"ADD result.color, R1, program.env[%d];\n"
|
||||
"END\n",C_COLORS+5,C_COLORS+6, C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
glGenProgramsARB(1, &s_ColorMatrixProgram.glprogid);
|
||||
SetCurrentShader(s_ColorMatrixProgram.glprogid);
|
||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
||||
|
||||
GLenum err = GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR) {
|
||||
ERROR_LOG(VIDEO, "Failed to create color matrix fragment program");
|
||||
s_ColorMatrixProgram.Destroy();
|
||||
}
|
||||
|
||||
sprintf(pmatrixprog, "!!ARBfp1.0\n"
|
||||
"TEMP R0;\n"
|
||||
"TEMP R1;\n"
|
||||
"TEMP R2;\n"
|
||||
//16777215/16777216*256, 1/255, 256, 0
|
||||
"PARAM K0 = { 255.99998474121, 0.003921568627451, 256.0, 0.0};\n"
|
||||
"PARAM K1 = { 15.0, 0.066666666666, 0.0, 0.0};\n"
|
||||
//sample the depth value
|
||||
"TEX R2, fragment.texcoord[0], texture[0], RECT;\n"
|
||||
|
||||
//scale from [0*16777216..1*16777216] to
|
||||
//[0*16777215..1*16777215], multiply by 256
|
||||
"MUL R0, R2.x, K0.x;\n" // *16777215/16777216*256
|
||||
|
||||
//It is easy to get bad results due to low precision
|
||||
//here, for example converting like this:
|
||||
//MUL R0,R0,{ 65536, 256, 1, 16777216 }
|
||||
//FRC R0,R0
|
||||
//gives {?, 128/255, 254/255, ?} for depth value 254/255
|
||||
//on some gpus
|
||||
|
||||
"FLR R0.x,R0;\n" //bits 31..24
|
||||
|
||||
"SUB R0.yzw,R0,R0.x;\n" //subtract bits 31..24 from rest
|
||||
"MUL R0.yzw,R0,K0.z;\n" // *256
|
||||
"FLR R0.y,R0;\n" //bits 23..16
|
||||
|
||||
"SUB R0.zw,R0,R0.y;\n" //subtract bits 23..16 from rest
|
||||
"MUL R0.zw,R0,K0.z;\n" // *256
|
||||
"FLR R0.z,R0;\n" //bits 15..8
|
||||
|
||||
"MOV R0.w,R0.x;\n" //duplicate bit 31..24
|
||||
|
||||
"MUL R0,R0,K0.y;\n" // /255
|
||||
|
||||
"MUL R0.w,R0,K1.x;\n" // *15
|
||||
"FLR R0.w,R0;\n" //bits 31..28
|
||||
"MUL R0.w,R0,K1.y;\n" // /15
|
||||
|
||||
"DP4 R1.x, R0, program.env[%d];\n"
|
||||
"DP4 R1.y, R0, program.env[%d];\n"
|
||||
"DP4 R1.z, R0, program.env[%d];\n"
|
||||
"DP4 R1.w, R0, program.env[%d];\n"
|
||||
"ADD result.color, R1, program.env[%d];\n"
|
||||
"END\n", C_COLORS, C_COLORS+1, C_COLORS+2, C_COLORS+3, C_COLORS+4);
|
||||
glGenProgramsARB(1, &s_DepthMatrixProgram.glprogid);
|
||||
SetCurrentShader(s_DepthMatrixProgram.glprogid);
|
||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pmatrixprog), pmatrixprog);
|
||||
|
||||
err = GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR) {
|
||||
ERROR_LOG(VIDEO, "Failed to create depth matrix fragment program");
|
||||
s_DepthMatrixProgram.Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PixelShaderCache::Shutdown()
|
||||
@@ -318,7 +194,7 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
|
||||
// Make an entry in the table
|
||||
PSCacheEntry& newentry = PixelShaders[uid];
|
||||
last_entry = &newentry;
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, g_ActiveConfig.bUseGLSL ? API_GLSL : API_OPENGL, components);
|
||||
const char *code = GeneratePixelShaderCode(dstAlphaMode, API_GLSL, components);
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging && code)
|
||||
{
|
||||
@@ -348,38 +224,6 @@ FRAGMENTSHADER* PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 comp
|
||||
}
|
||||
|
||||
bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||
{
|
||||
return pCompilePixelShader(ps, pstrprogram);
|
||||
}
|
||||
|
||||
// Disable Fragment programs and reset the selected Program
|
||||
void PixelShaderCache::DisableShader()
|
||||
{
|
||||
if (ShaderEnabled)
|
||||
{
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
ShaderEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// bind a program if is different from the binded oone
|
||||
void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
if (!ShaderEnabled)
|
||||
{
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
ShaderEnabled = true;
|
||||
}
|
||||
if (CurrentShader != Shader)
|
||||
{
|
||||
if (Shader != 0)
|
||||
CurrentShader = Shader;
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, CurrentShader);
|
||||
}
|
||||
}
|
||||
|
||||
// GLSL Specific
|
||||
bool CompileGLSLPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||
{
|
||||
GLuint result = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
|
||||
@@ -415,7 +259,6 @@ bool CompileGLSLPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||
|
||||
(void)GL_REPORT_ERROR();
|
||||
ps.glprogid = result;
|
||||
ps.bGLSL = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -437,7 +280,8 @@ void SetPSConstant4fvByName(const char * name, unsigned int offset, const float
|
||||
}
|
||||
}
|
||||
|
||||
void SetGLSLPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
// Renderer functions
|
||||
void Renderer::SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
float const f[4] = {f1, f2, f3, f4};
|
||||
|
||||
@@ -457,7 +301,7 @@ void SetGLSLPSConstant4f(unsigned int const_number, float f1, float f2, float f3
|
||||
}
|
||||
}
|
||||
|
||||
void SetGLSLPSConstant4fv(unsigned int const_number, const float *f)
|
||||
void Renderer::SetPSConstant4fv(unsigned int const_number, const float *f)
|
||||
{
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
{
|
||||
@@ -475,7 +319,7 @@ void SetGLSLPSConstant4fv(unsigned int const_number, const float *f)
|
||||
}
|
||||
}
|
||||
|
||||
void SetMultiGLSLPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
void Renderer::SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||
{
|
||||
@@ -492,120 +336,4 @@ void SetMultiGLSLPSConstant4fv(unsigned int const_number, unsigned int count, co
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CG Specific
|
||||
bool CompileCGPixelShader(FRAGMENTSHADER& ps, const char* pstrprogram)
|
||||
{
|
||||
GLenum err = GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "glError %08x before PS!", err);
|
||||
}
|
||||
|
||||
#if defined HAVE_CG && HAVE_CG
|
||||
CGprogram tempprog = cgCreateProgram(g_cgcontext, CG_SOURCE, pstrprogram, g_cgfProf, "main", NULL);
|
||||
|
||||
// handle errors
|
||||
if (!cgIsProgram(tempprog))
|
||||
{
|
||||
cgDestroyProgram(tempprog);
|
||||
|
||||
static int num_failures = 0;
|
||||
char szTemp[MAX_PATH];
|
||||
sprintf(szTemp, "bad_ps_%04i.txt", num_failures++);
|
||||
std::ofstream file(szTemp);
|
||||
file << pstrprogram;
|
||||
file.close();
|
||||
|
||||
PanicAlert("Failed to compile pixel shader %d!\nThis usually happens when trying to use Dolphin with an outdated GPU or integrated GPU like the Intel GMA series.\n\nIf you're sure this is Dolphin's error anyway, post the contents of %s along with this error message at the forums.\n\nDebug info (%d):\n%s",
|
||||
num_failures - 1, szTemp,
|
||||
g_cgfProf,
|
||||
cgGetLastListing(g_cgcontext));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// handle warnings
|
||||
if (cgGetError() != CG_NO_ERROR)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Warnings on compile ps %s:", cgGetLastListing(g_cgcontext));
|
||||
WARN_LOG(VIDEO, "%s", pstrprogram);
|
||||
}
|
||||
|
||||
// This looks evil - we modify the program through the const char * we got from cgGetProgramString!
|
||||
// It SHOULD not have any nasty side effects though - but you never know...
|
||||
char *pcompiledprog = (char*)cgGetProgramString(tempprog, CG_COMPILED_PROGRAM);
|
||||
char *plocal = strstr(pcompiledprog, "program.local");
|
||||
while (plocal != NULL)
|
||||
{
|
||||
const char *penv = " program.env";
|
||||
memcpy(plocal, penv, 13);
|
||||
plocal = strstr(plocal+13, "program.local");
|
||||
}
|
||||
|
||||
glGenProgramsARB(1, &ps.glprogid);
|
||||
ps.bGLSL = false;
|
||||
PixelShaderCache::SetCurrentShader(ps.glprogid);
|
||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);
|
||||
|
||||
err = GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR)
|
||||
{
|
||||
GLint error_pos, native_limit;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &error_pos);
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB, &native_limit);
|
||||
// Error occur
|
||||
if (error_pos != -1) {
|
||||
const char *program_error = (const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB);
|
||||
char line[256];
|
||||
strncpy(line, (const char *)pcompiledprog + error_pos, 255);
|
||||
line[255] = 0;
|
||||
ERROR_LOG(VIDEO, "Error at %i: %s", error_pos, program_error);
|
||||
ERROR_LOG(VIDEO, "Line dump: \n%s", line);
|
||||
} else if (native_limit != -1) {
|
||||
ERROR_LOG(VIDEO, "Hit limit? %i", native_limit);
|
||||
// TODO
|
||||
}
|
||||
ERROR_LOG(VIDEO, "%s", pstrprogram);
|
||||
ERROR_LOG(VIDEO, "%s", pcompiledprog);
|
||||
}
|
||||
|
||||
cgDestroyProgram(tempprog);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetCGPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
float f[4] = { f1, f2, f3, f4 };
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
|
||||
}
|
||||
|
||||
void SetCGPSConstant4fv(unsigned int const_number, const float *f)
|
||||
{
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number, f);
|
||||
}
|
||||
|
||||
void SetMultiCGPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
for (unsigned int i = 0; i < count; i++,f+=4)
|
||||
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, const_number + i, f);
|
||||
}
|
||||
|
||||
// Renderer functions
|
||||
void Renderer::SetPSConstant4f(unsigned int const_number, float f1, float f2, float f3, float f4)
|
||||
{
|
||||
pSetPSConstant4f(const_number, f1, f2, f3, f4);
|
||||
}
|
||||
|
||||
void Renderer::SetPSConstant4fv(unsigned int const_number, const float *f)
|
||||
{
|
||||
pSetPSConstant4fv(const_number, f);
|
||||
}
|
||||
|
||||
void Renderer::SetMultiPSConstant4fv(unsigned int const_number, unsigned int count, const float *f)
|
||||
{
|
||||
pSetMultiPSConstant4fv(const_number, count, f);
|
||||
}
|
||||
} // namespace OGL
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user