mirror of https://github.com/snes9xgit/snes9x.git
Drop Cg shaders from GTK+ port.
This commit is contained in:
parent
d39e7af6d0
commit
8200a7bb5f
|
@ -70,7 +70,6 @@ Snes9x 1.56
|
|||
- GTK+: Now disables the compositor in fullscreen mode. (BearOso)
|
||||
- GTK+: Changed icon. (BearOso)
|
||||
- GTK+: Require libepoxy for OpenGL support. (BearOso)
|
||||
- GTK+: Add minimal compatibility with cgp shaders. (BearOso)
|
||||
- GTK+: Add full compatibility with GLSLP shaders, with a (BearOso)
|
||||
parameters dialog to configure them.
|
||||
- Unix: Add xinerama support and window position hints. (Francesco149)
|
||||
|
|
|
@ -235,9 +235,6 @@ if OPENGL
|
|||
snes9x_gtk_SOURCES += \
|
||||
src/gtk_display_driver_opengl.cpp \
|
||||
src/gtk_display_driver_opengl.h \
|
||||
../shaders/CGLCG.cpp \
|
||||
../shaders/cgFunctions.cpp \
|
||||
../shaders/CCGShader.cpp \
|
||||
../shaders/glsl.cpp \
|
||||
../shaders/shader_helpers.cpp \
|
||||
src/gtk_shader_parameters.cpp
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "gtk_shader_parameters.h"
|
||||
|
||||
#include "shaders/shader_helpers.h"
|
||||
#include "shaders/CGLCG.h"
|
||||
|
||||
static void S9xViewportCallback (int src_width, int src_height,
|
||||
int viewport_x, int viewport_y,
|
||||
|
@ -65,7 +64,7 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
|
|||
|
||||
#endif
|
||||
|
||||
if (using_cg_shaders || using_glsl_shaders)
|
||||
if (using_glsl_shaders)
|
||||
{
|
||||
glBindTexture (GL_TEXTURE_2D, texmap);
|
||||
}
|
||||
|
@ -246,19 +245,6 @@ S9xOpenGLDisplayDriver::update (int width, int height, int yoffset)
|
|||
gl_swap ();
|
||||
return;
|
||||
}
|
||||
else if (using_shaders && using_cg_shaders)
|
||||
{
|
||||
xySize texture_size, input_size, viewport_size;
|
||||
texture_size.x = texture_width;
|
||||
texture_size.y = texture_height;
|
||||
input_size.x = width;
|
||||
input_size.y = height;
|
||||
viewport_size.x = w;
|
||||
viewport_size.y = h;
|
||||
|
||||
cg_shader->Render (texmap, texture_size, input_size, viewport_size);
|
||||
glViewport (x, allocation.height - y - h, w, h);
|
||||
}
|
||||
else if (using_shaders)
|
||||
{
|
||||
GLint location;
|
||||
|
@ -462,34 +448,6 @@ S9xOpenGLDisplayDriver::load_shaders (const char *shader_file)
|
|||
}
|
||||
}
|
||||
|
||||
if ((length > 4 && !strcasecmp(shader_file + length - 4, ".cgp")) ||
|
||||
(length > 3 && !strcasecmp(shader_file + length - 3, ".cg")))
|
||||
{
|
||||
if (loadCgFunctions())
|
||||
{
|
||||
cg_context = cgCreateContext ();
|
||||
cg_shader = new CGLCG (cg_context);
|
||||
if (!cg_shader->LoadShader (shader_file))
|
||||
{
|
||||
delete cg_shader;
|
||||
cgDestroyContext (cg_context);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
using_cg_shaders = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("Cannot load CG library.\n"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!shaders_available ())
|
||||
{
|
||||
fprintf (stderr, _("Cannot load GLSL shader functions.\n"));
|
||||
|
@ -582,10 +540,7 @@ S9xOpenGLDisplayDriver::opengl_defaults (void)
|
|||
}
|
||||
|
||||
using_shaders = 0;
|
||||
using_cg_shaders = 0;
|
||||
using_glsl_shaders = 0;
|
||||
cg_context = NULL;
|
||||
cg_shader = NULL;
|
||||
glsl_shader = NULL;
|
||||
|
||||
if (config->use_shaders)
|
||||
|
@ -884,11 +839,6 @@ S9xOpenGLDisplayDriver::deinit (void)
|
|||
glsl_shader->destroy();
|
||||
delete glsl_shader;
|
||||
}
|
||||
else if (using_shaders && using_cg_shaders)
|
||||
{
|
||||
delete cg_shader;
|
||||
cgDestroyContext (cg_context);
|
||||
}
|
||||
else if (using_shaders)
|
||||
{
|
||||
glUseProgram (0);
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <epoxy/gl.h>
|
||||
#include <epoxy/glx.h>
|
||||
|
||||
#include "shaders/CGLCG.h"
|
||||
#include "shaders/glsl.h"
|
||||
|
||||
#define PBO_FMT_16 0
|
||||
|
@ -70,10 +69,6 @@ class S9xOpenGLDisplayDriver : public S9xDisplayDriver
|
|||
int using_shaders;
|
||||
int initialized;
|
||||
|
||||
int using_cg_shaders;
|
||||
CGcontext cg_context;
|
||||
CGLCG *cg_shader;
|
||||
|
||||
int using_glsl_shaders;
|
||||
GLSLShader *glsl_shader;
|
||||
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include "gtk_display.h"
|
||||
#include "gtk_binding.h"
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
#include "gtk_shader_parameters.h"
|
||||
#endif
|
||||
|
||||
#if GTK_MAJOR_VERSION >= 3
|
||||
#include <gdk/gdkkeysyms-compat.h>
|
||||
#endif
|
||||
|
@ -490,42 +486,6 @@ event_auto_input_rate_toggled (GtkToggleButton *togglebutton, gpointer data)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
event_shader_parameters (GtkButton *widget, gpointer data)
|
||||
{
|
||||
S9xDisplayDriver *driver = S9xDisplayGetDriver ();
|
||||
Snes9xPreferences *preferences = (Snes9xPreferences *) data;
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (!driver || !driver->get_parameters () || !gtk_shader_parameters_dialog (top_level->get_window ()))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
dialog = gtk_message_dialog_new (top_level->get_window(),
|
||||
(GtkDialogFlags) 0,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("No Parameters Available"));
|
||||
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG (dialog),
|
||||
_("No shader in use, or the shader in use does not support or has no configurable parameters."));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *config_dir = get_config_dir();
|
||||
char *config_file = new char[strlen (config_dir) + 14];
|
||||
sprintf(config_file, "%s/shader.glslp", config_dir);
|
||||
delete[] config_dir;
|
||||
driver->save (config_file);
|
||||
realpath (config_file, gui_config->fragment_shader);
|
||||
preferences->set_entry_text ("fragment_shader", preferences->config->fragment_shader);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
event_about_clicked (GtkButton *widget, gpointer data)
|
||||
{
|
||||
|
|
|
@ -1,338 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
#include "CCGShader.h"
|
||||
#include "../conffile.h"
|
||||
|
||||
CCGShader::CCGShader(void) {}
|
||||
|
||||
CCGShader::~CCGShader(void) {}
|
||||
|
||||
cgScaleType CCGShader::scaleStringToEnum(const char* scale)
|
||||
{
|
||||
if (!strcasecmp(scale, "source"))
|
||||
{
|
||||
return CG_SCALE_SOURCE;
|
||||
}
|
||||
else if (!strcasecmp(scale, "viewport"))
|
||||
{
|
||||
return CG_SCALE_VIEWPORT;
|
||||
}
|
||||
else if (!strcasecmp(scale, "absolute"))
|
||||
{
|
||||
return CG_SCALE_ABSOLUTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CG_SCALE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
bool CCGShader::LoadShader(const char* path)
|
||||
{
|
||||
ConfigFile conf;
|
||||
int shaderCount;
|
||||
char keyName[100];
|
||||
|
||||
shaderPasses.clear();
|
||||
lookupTextures.clear();
|
||||
|
||||
if (strlen(path) < 4 || strcasecmp(&path[strlen(path) - 4], ".cgp"))
|
||||
{
|
||||
shaderPass pass;
|
||||
pass.scaleParams.scaleTypeX = CG_SCALE_NONE;
|
||||
pass.scaleParams.scaleTypeY = CG_SCALE_NONE;
|
||||
pass.linearFilter = false;
|
||||
pass.filterSet = false;
|
||||
strcpy(pass.cgShaderFile, path);
|
||||
shaderPasses.push_back(pass);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.LoadFile(path);
|
||||
}
|
||||
|
||||
shaderCount = conf.GetInt("::shaders", 0);
|
||||
|
||||
if (shaderCount < 1)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < shaderCount; i++)
|
||||
{
|
||||
shaderPass pass;
|
||||
sprintf(keyName, "::filter_linear%u", i);
|
||||
pass.linearFilter = conf.GetBool(keyName);
|
||||
pass.filterSet = conf.Exists(keyName);
|
||||
|
||||
sprintf(keyName, "::scale_type%u", i);
|
||||
const char* scaleType = conf.GetString(keyName, "");
|
||||
|
||||
if (!strcasecmp(scaleType, ""))
|
||||
{
|
||||
sprintf(keyName, "::scale_type_x%u", i);
|
||||
const char* scaleTypeX = conf.GetString(keyName, "");
|
||||
|
||||
if (*scaleTypeX == '\0' && (i != (shaderCount - 1)))
|
||||
scaleTypeX = "source";
|
||||
|
||||
pass.scaleParams.scaleTypeX = scaleStringToEnum(scaleTypeX);
|
||||
|
||||
sprintf(keyName, "::scale_type_y%u", i);
|
||||
const char* scaleTypeY = conf.GetString(keyName, "");
|
||||
|
||||
if (*scaleTypeY == '\0' && (i != (shaderCount - 1)))
|
||||
scaleTypeY = "source";
|
||||
|
||||
pass.scaleParams.scaleTypeY = scaleStringToEnum(scaleTypeY);
|
||||
}
|
||||
else
|
||||
{
|
||||
cgScaleType sType = scaleStringToEnum(scaleType);
|
||||
pass.scaleParams.scaleTypeX = sType;
|
||||
pass.scaleParams.scaleTypeY = sType;
|
||||
}
|
||||
|
||||
sprintf(keyName, "::scale%u", i);
|
||||
const char* scaleFloat = conf.GetString(keyName, "");
|
||||
int scaleInt = conf.GetInt(keyName, 0);
|
||||
if (!strcasecmp(scaleFloat, ""))
|
||||
{
|
||||
sprintf(keyName, "::scale_x%u", i);
|
||||
const char* scaleFloatX = conf.GetString(keyName, "1.0");
|
||||
pass.scaleParams.scaleX = atof(scaleFloatX);
|
||||
pass.scaleParams.absX = conf.GetInt(keyName, 1);
|
||||
sprintf(keyName, "::scale_y%u", i);
|
||||
const char* scaleFloatY = conf.GetString(keyName, "1.0");
|
||||
pass.scaleParams.scaleY = atof(scaleFloatY);
|
||||
pass.scaleParams.absY = conf.GetInt(keyName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
float floatval = atof(scaleFloat);
|
||||
pass.scaleParams.scaleX = floatval;
|
||||
pass.scaleParams.absX = scaleInt;
|
||||
pass.scaleParams.scaleY = floatval;
|
||||
pass.scaleParams.absY = scaleInt;
|
||||
}
|
||||
|
||||
sprintf(keyName, "::shader%u", i);
|
||||
strcpy(pass.cgShaderFile, conf.GetString(keyName, ""));
|
||||
|
||||
sprintf(keyName, "::frame_count_mod%u", i);
|
||||
pass.frameCounterMod = conf.GetInt(keyName, 0);
|
||||
|
||||
sprintf(keyName, "::float_framebuffer%u", i);
|
||||
pass.floatFbo = conf.GetBool(keyName);
|
||||
|
||||
shaderPasses.push_back(pass);
|
||||
}
|
||||
|
||||
char* shaderIds = conf.GetStringDup("::textures", "");
|
||||
|
||||
char* id = strtok(shaderIds, ";");
|
||||
|
||||
while (id != NULL)
|
||||
{
|
||||
lookupTexture tex;
|
||||
sprintf(keyName, "::%s", id);
|
||||
strcpy(tex.id, id);
|
||||
strcpy(tex.texturePath, conf.GetString(keyName, ""));
|
||||
sprintf(keyName, "::%s_linear", id);
|
||||
tex.linearfilter = conf.GetBool(keyName, true);
|
||||
lookupTextures.push_back(tex);
|
||||
id = strtok(NULL, ";");
|
||||
}
|
||||
|
||||
free(shaderIds);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,250 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
#ifndef CCGSHADER_H
|
||||
#define CCGSHADER_H
|
||||
|
||||
#include "cgFunctions.h"
|
||||
#include "port.h"
|
||||
#include <vector>
|
||||
|
||||
enum cgScaleType
|
||||
{
|
||||
CG_SCALE_NONE,
|
||||
CG_SCALE_SOURCE,
|
||||
CG_SCALE_VIEWPORT,
|
||||
CG_SCALE_ABSOLUTE
|
||||
};
|
||||
|
||||
typedef struct _cgScaleParams
|
||||
{
|
||||
cgScaleType scaleTypeX;
|
||||
cgScaleType scaleTypeY;
|
||||
float scaleX;
|
||||
float scaleY;
|
||||
unsigned absX;
|
||||
unsigned absY;
|
||||
} cgScaleParams;
|
||||
|
||||
class CCGShader
|
||||
{
|
||||
private:
|
||||
cgScaleType scaleStringToEnum(const char* scale);
|
||||
|
||||
public:
|
||||
typedef struct _shaderPass
|
||||
{
|
||||
cgScaleParams scaleParams;
|
||||
bool linearFilter;
|
||||
bool filterSet;
|
||||
bool floatFbo;
|
||||
unsigned frameCounterMod;
|
||||
char cgShaderFile[PATH_MAX];
|
||||
} shaderPass;
|
||||
|
||||
typedef struct _lookupTexture
|
||||
{
|
||||
char id[PATH_MAX];
|
||||
char texturePath[PATH_MAX];
|
||||
bool linearfilter;
|
||||
} lookupTexture;
|
||||
|
||||
CCGShader(void);
|
||||
~CCGShader(void);
|
||||
bool LoadShader(const char* path);
|
||||
|
||||
typedef std::vector<shaderPass> passVector;
|
||||
typedef std::vector<lookupTexture> lutVector;
|
||||
passVector shaderPasses;
|
||||
lutVector lookupTextures;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,915 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
#include "CGLCG.h"
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "snes9x.h"
|
||||
#include "shader_helpers.h"
|
||||
|
||||
static char* ReadShaderFileContents(const char *filename)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
int size;
|
||||
char* contents;
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
contents = new char[size + 1];
|
||||
fread(contents, size, 1, file);
|
||||
contents[size] = '\0';
|
||||
fclose(file);
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
static void ReduceToPath(char* filename)
|
||||
{
|
||||
for (int i = strlen(filename); i >= 0; i--)
|
||||
{
|
||||
if (filename[i] == '\\' || filename[i] == '/')
|
||||
{
|
||||
filename[i] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include <png.h>
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
const GLfloat CGLCG::lut_coords[8] = { 0, 0, 1, 0, 1, 1, 0, 1 };
|
||||
|
||||
CGLCG::CGLCG(CGcontext cgContext)
|
||||
{
|
||||
this->cgContext = cgContext;
|
||||
fboFunctionsLoaded = FALSE;
|
||||
ClearPasses();
|
||||
LoadFBOFunctions();
|
||||
frameCnt = 0;
|
||||
}
|
||||
|
||||
CGLCG::~CGLCG(void)
|
||||
{
|
||||
LoadShader(NULL);
|
||||
}
|
||||
|
||||
void CGLCG::ClearPasses()
|
||||
{
|
||||
/* clean up cg programs, fbos and textures from all regular passes
|
||||
pass 0 is the orignal texture, so ignore that
|
||||
*/
|
||||
if (shaderPasses.size() > 1)
|
||||
{
|
||||
for (glPassVector::iterator it = (shaderPasses.begin() + 1);
|
||||
it != shaderPasses.end();
|
||||
it++)
|
||||
{
|
||||
if (it->cgFragmentProgram)
|
||||
cgDestroyProgram(it->cgFragmentProgram);
|
||||
if (it->cgVertexProgram)
|
||||
cgDestroyProgram(it->cgVertexProgram);
|
||||
if (it->fbo)
|
||||
glDeleteFramebuffers(1, &it->fbo);
|
||||
if (it->tex)
|
||||
glDeleteTextures(1, &it->tex);
|
||||
}
|
||||
}
|
||||
|
||||
for (glLutVector::iterator it = lookupTextures.begin(); it != lookupTextures.end(); it++)
|
||||
{
|
||||
if (it->tex)
|
||||
glDeleteTextures(1, &it->tex);
|
||||
}
|
||||
|
||||
for (glPrevDeque::iterator it = prevPasses.begin(); it != prevPasses.end(); it++)
|
||||
{
|
||||
if (it->tex)
|
||||
glDeleteTextures(1, &it->tex);
|
||||
}
|
||||
shaderPasses.clear();
|
||||
lookupTextures.clear();
|
||||
prevPasses.clear();
|
||||
// prevPasses deque is always filled with PREV + PREV1-6 elements
|
||||
prevPasses.resize(7);
|
||||
|
||||
shaderLoaded = false;
|
||||
}
|
||||
|
||||
bool CGLCG::LoadFBOFunctions()
|
||||
{
|
||||
const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (extensions && strstr(extensions, "framebuffer_object"))
|
||||
{
|
||||
fboFunctionsLoaded = true;
|
||||
}
|
||||
|
||||
return fboFunctionsLoaded;
|
||||
}
|
||||
|
||||
void CGLCG::checkForCgError(const char* situation)
|
||||
{
|
||||
char buffer[4096];
|
||||
CGerror error = cgGetError();
|
||||
const char* string = cgGetErrorString(error);
|
||||
|
||||
if (error != CG_NO_ERROR)
|
||||
{
|
||||
sprintf(buffer,
|
||||
"Situation: %s\n"
|
||||
"Error: %s\n\n"
|
||||
"Cg compiler output...\n",
|
||||
situation,
|
||||
string);
|
||||
printf("Cg error: %s\n", buffer);
|
||||
|
||||
if (error == CG_COMPILER_ERROR)
|
||||
{
|
||||
printf("Cg compilation error: %s\n", cgGetLastListing(cgContext));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CGLCG::LoadShader(const char* shaderFile)
|
||||
{
|
||||
CCGShader cgShader;
|
||||
char shaderPath[PATH_MAX];
|
||||
char tempPath[PATH_MAX];
|
||||
CGprofile vertexProfile, fragmentProfile;
|
||||
|
||||
if (!fboFunctionsLoaded)
|
||||
{
|
||||
printf("CG Error: Your OpenGL graphics driver does not support framebuffer "
|
||||
"objects.\nYou will not be able to use Cg shaders.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
vertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
|
||||
fragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
|
||||
|
||||
cgGLDisableProfile(vertexProfile);
|
||||
cgGLDisableProfile(fragmentProfile);
|
||||
|
||||
ClearPasses();
|
||||
|
||||
if (shaderFile == NULL || *shaderFile == '\0')
|
||||
return true;
|
||||
|
||||
strcpy(shaderPath, shaderFile);
|
||||
ReduceToPath(shaderPath);
|
||||
|
||||
chdir(shaderPath);
|
||||
if (!cgShader.LoadShader(shaderFile))
|
||||
return false;
|
||||
|
||||
cgGLSetOptimalOptions(vertexProfile);
|
||||
cgGLSetOptimalOptions(fragmentProfile);
|
||||
|
||||
/* insert dummy pass that will contain the original texture
|
||||
*/
|
||||
shaderPasses.push_back(shaderPass());
|
||||
|
||||
for (CCGShader::passVector::iterator it = cgShader.shaderPasses.begin();
|
||||
it != cgShader.shaderPasses.end();
|
||||
it++) {
|
||||
shaderPass pass;
|
||||
|
||||
pass.scaleParams = it->scaleParams;
|
||||
/* if this is the last pass (the only one that can have CG_SCALE_NONE)
|
||||
and no filter has been set use the GUI setting
|
||||
*/
|
||||
if (pass.scaleParams.scaleTypeX == CG_SCALE_NONE && !it->filterSet)
|
||||
{
|
||||
pass.linearFilter = Settings.BilinearFilter;
|
||||
}
|
||||
else
|
||||
{
|
||||
pass.linearFilter = it->linearFilter;
|
||||
}
|
||||
|
||||
pass.frameCounterMod = it->frameCounterMod;
|
||||
|
||||
pass.floatFbo = it->floatFbo;
|
||||
|
||||
// paths in the meta file can be relative
|
||||
realpath(it->cgShaderFile, tempPath);
|
||||
char* fileContents = ReadShaderFileContents(tempPath);
|
||||
if (!fileContents)
|
||||
{
|
||||
printf("Couldn't read file %s\n", tempPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// individual shader might include files, these should be relative to shader
|
||||
ReduceToPath(tempPath);
|
||||
chdir(tempPath);
|
||||
|
||||
pass.cgVertexProgram = cgCreateProgram(
|
||||
cgContext, CG_SOURCE, fileContents, vertexProfile, "main_vertex", NULL);
|
||||
|
||||
checkForCgError("Compiling vertex program");
|
||||
|
||||
pass.cgFragmentProgram = cgCreateProgram(cgContext,
|
||||
CG_SOURCE,
|
||||
fileContents,
|
||||
fragmentProfile,
|
||||
"main_fragment",
|
||||
NULL);
|
||||
|
||||
checkForCgError("Compiling fragment program");
|
||||
|
||||
// set path back for next pass
|
||||
chdir(shaderPath);
|
||||
|
||||
delete[] fileContents;
|
||||
if (!pass.cgVertexProgram || !pass.cgFragmentProgram) {
|
||||
return false;
|
||||
}
|
||||
cgGLLoadProgram(pass.cgVertexProgram);
|
||||
cgGLLoadProgram(pass.cgFragmentProgram);
|
||||
|
||||
/* generate framebuffer and texture for this pass and apply
|
||||
default texture settings
|
||||
*/
|
||||
glGenFramebuffers(1, &pass.fbo);
|
||||
glGenTextures(1, &pass.tex);
|
||||
glBindTexture(GL_TEXTURE_2D, pass.tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
shaderPasses.push_back(pass);
|
||||
}
|
||||
|
||||
for (std::vector<CCGShader::lookupTexture>::iterator it = cgShader.lookupTextures.begin();
|
||||
it != cgShader.lookupTextures.end();
|
||||
it++)
|
||||
{
|
||||
lookupTexture tex;
|
||||
strcpy(tex.id, it->id);
|
||||
|
||||
/* generate texture for the lut and apply specified filter setting
|
||||
*/
|
||||
glGenTextures(1, &tex.tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex.tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MAG_FILTER,
|
||||
it->linearfilter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MIN_FILTER,
|
||||
it->linearfilter ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
realpath(it->texturePath, tempPath);
|
||||
|
||||
// simple file extension png/tga decision
|
||||
int strLen = strlen(it->texturePath);
|
||||
if (strLen > 4)
|
||||
{
|
||||
if (!strcasecmp(&it->texturePath[strLen - 4], ".png"))
|
||||
{
|
||||
int width, height;
|
||||
bool hasAlpha;
|
||||
GLubyte* texData;
|
||||
if (loadPngImage(tempPath, width, height, hasAlpha, &texData))
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, width);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
width,
|
||||
height,
|
||||
0,
|
||||
hasAlpha ? GL_RGBA : GL_RGB,
|
||||
GL_UNSIGNED_BYTE,
|
||||
texData);
|
||||
free(texData);
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(&it->texturePath[strLen - 4], ".tga"))
|
||||
{
|
||||
STGA stga;
|
||||
if (loadTGA(tempPath, stga))
|
||||
{
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, stga.width);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGBA,
|
||||
stga.width,
|
||||
stga.height,
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
stga.data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lookupTextures.push_back(tex);
|
||||
}
|
||||
|
||||
/* enable texture unit 1 for the lookup textures
|
||||
*/
|
||||
glClientActiveTexture(GL_TEXTURE1);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, lut_coords);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
|
||||
/* generate textures and set default values for the pref-filled PREV deque.
|
||||
*/
|
||||
for (unsigned int i = 0; i < prevPasses.size(); i++)
|
||||
{
|
||||
glGenTextures(1, &prevPasses[i].tex);
|
||||
glBindTexture(GL_TEXTURE_2D, prevPasses[i].tex);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_RGB,
|
||||
512,
|
||||
512,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
NULL);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
prevPasses[i].textureSize.x = prevPasses[i].textureSize.y = 0;
|
||||
memset(prevPasses[i].texCoords, 0, sizeof(prevPasses[i].texCoords));
|
||||
}
|
||||
|
||||
shaderLoaded = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGLCG::setTexCoords(int pass,
|
||||
xySize inputSize,
|
||||
xySize textureSize,
|
||||
bool topdown)
|
||||
{
|
||||
float tX = inputSize.x / textureSize.x;
|
||||
float tY = inputSize.y / textureSize.y;
|
||||
|
||||
// last pass uses top-down coordinates, all others bottom-up
|
||||
if (topdown)
|
||||
{
|
||||
shaderPasses[pass].texcoords[0] = 0.0f;
|
||||
shaderPasses[pass].texcoords[1] = tY;
|
||||
shaderPasses[pass].texcoords[2] = tX;
|
||||
shaderPasses[pass].texcoords[3] = tY;
|
||||
shaderPasses[pass].texcoords[4] = tX;
|
||||
shaderPasses[pass].texcoords[5] = 0.0f;
|
||||
shaderPasses[pass].texcoords[6] = 0.0f;
|
||||
shaderPasses[pass].texcoords[7] = 0.0f;
|
||||
} else {
|
||||
shaderPasses[pass].texcoords[0] = 0.0f;
|
||||
shaderPasses[pass].texcoords[1] = 0.0f;
|
||||
shaderPasses[pass].texcoords[2] = tX;
|
||||
shaderPasses[pass].texcoords[3] = 0.0f;
|
||||
shaderPasses[pass].texcoords[4] = tX;
|
||||
shaderPasses[pass].texcoords[5] = tY;
|
||||
shaderPasses[pass].texcoords[6] = 0.0f;
|
||||
shaderPasses[pass].texcoords[7] = tY;
|
||||
}
|
||||
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, shaderPasses[pass].texcoords);
|
||||
}
|
||||
|
||||
void CGLCG::Render(GLuint& origTex,
|
||||
xySize textureSize,
|
||||
xySize inputSize,
|
||||
xySize viewportSize)
|
||||
{
|
||||
frameCnt++;
|
||||
CGprofile vertexProfile, fragmentProfile;
|
||||
|
||||
if (!shaderLoaded)
|
||||
return;
|
||||
|
||||
vertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX);
|
||||
fragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT);
|
||||
|
||||
cgGLEnableProfile(vertexProfile);
|
||||
cgGLEnableProfile(fragmentProfile);
|
||||
|
||||
/* set up our dummy pass for easier loop code
|
||||
*/
|
||||
shaderPasses[0].tex = origTex;
|
||||
shaderPasses[0].outputSize = inputSize;
|
||||
shaderPasses[0].textureSize = textureSize;
|
||||
|
||||
/* loop through all real passes
|
||||
*/
|
||||
for (unsigned int i = 1; i < shaderPasses.size(); i++)
|
||||
{
|
||||
switch (shaderPasses[i].scaleParams.scaleTypeX)
|
||||
{
|
||||
case CG_SCALE_ABSOLUTE:
|
||||
shaderPasses[i].outputSize.x = (double)shaderPasses[i].scaleParams.absX;
|
||||
break;
|
||||
case CG_SCALE_SOURCE:
|
||||
shaderPasses[i].outputSize.x = shaderPasses[i - 1].outputSize.x * shaderPasses[i].scaleParams.scaleX;
|
||||
break;
|
||||
case CG_SCALE_VIEWPORT:
|
||||
shaderPasses[i].outputSize.x = viewportSize.x * shaderPasses[i].scaleParams.scaleX;
|
||||
break;
|
||||
default:
|
||||
shaderPasses[i].outputSize.x = viewportSize.x;
|
||||
}
|
||||
|
||||
switch (shaderPasses[i].scaleParams.scaleTypeY)
|
||||
{
|
||||
case CG_SCALE_ABSOLUTE:
|
||||
shaderPasses[i].outputSize.y = (double)shaderPasses[i].scaleParams.absY;
|
||||
break;
|
||||
case CG_SCALE_SOURCE:
|
||||
shaderPasses[i].outputSize.y = shaderPasses[i - 1].outputSize.y * shaderPasses[i].scaleParams.scaleY;
|
||||
break;
|
||||
case CG_SCALE_VIEWPORT:
|
||||
shaderPasses[i].outputSize.y = viewportSize.y * shaderPasses[i].scaleParams.scaleY;
|
||||
break;
|
||||
default:
|
||||
shaderPasses[i].outputSize.y = viewportSize.y;
|
||||
}
|
||||
|
||||
shaderPasses[i].textureSize.x = shaderPasses[i].outputSize.x;
|
||||
shaderPasses[i].textureSize.y = shaderPasses[i].outputSize.y;
|
||||
|
||||
/* set size of output texture
|
||||
*/
|
||||
glBindTexture(GL_TEXTURE_2D, shaderPasses[i].tex);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
(shaderPasses[i].floatFbo ? GL_RGBA32F : GL_RGBA),
|
||||
(unsigned int)shaderPasses[i].textureSize.x,
|
||||
(unsigned int)shaderPasses[i].textureSize.y,
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_INT_8_8_8_8,
|
||||
NULL);
|
||||
|
||||
/* viewport determines the area we render into the output texture
|
||||
*/
|
||||
glViewport(
|
||||
0, 0, shaderPasses[i].outputSize.x, shaderPasses[i].outputSize.y);
|
||||
|
||||
/* set up framebuffer and attach output texture
|
||||
*/
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, shaderPasses[i].fbo);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER,
|
||||
GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D,
|
||||
shaderPasses[i].tex,
|
||||
0);
|
||||
|
||||
/* set up input texture (output of previous pass) and apply filter settings
|
||||
*/
|
||||
glBindTexture(GL_TEXTURE_2D, shaderPasses[i - 1].tex);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH,
|
||||
(GLint)shaderPasses[i - 1].textureSize.x);
|
||||
glTexParameteri(GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MAG_FILTER,
|
||||
shaderPasses[i].linearFilter ? GL_LINEAR : GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D,
|
||||
GL_TEXTURE_MIN_FILTER,
|
||||
shaderPasses[i].linearFilter ? GL_LINEAR : GL_NEAREST);
|
||||
|
||||
/* calculate tex coords first since we pass them to the shader
|
||||
*/
|
||||
setTexCoords(
|
||||
i, shaderPasses[i - 1].outputSize, shaderPasses[i - 1].textureSize);
|
||||
|
||||
setShaderVars(i);
|
||||
|
||||
cgGLBindProgram(shaderPasses[i].cgVertexProgram);
|
||||
cgGLBindProgram(shaderPasses[i].cgFragmentProgram);
|
||||
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDrawArrays(GL_QUADS, 0, 4);
|
||||
|
||||
/* reset client states enabled during setShaderVars
|
||||
*/
|
||||
resetAttribParams();
|
||||
}
|
||||
|
||||
/* disable framebuffer
|
||||
*/
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
|
||||
/* set last PREV texture as original, push current texture and
|
||||
sizes to the front of the PREV deque and make sure the new
|
||||
original texture has the same size as the old one
|
||||
*/
|
||||
|
||||
origTex = prevPasses.back().tex;
|
||||
prevPasses.pop_back();
|
||||
|
||||
prevPass pass;
|
||||
pass.videoSize = inputSize;
|
||||
pass.textureSize = textureSize;
|
||||
pass.tex = shaderPasses[0].tex;
|
||||
memcpy(pass.texCoords, shaderPasses[1].texcoords, sizeof(pass.texCoords));
|
||||
prevPasses.push_front(pass);
|
||||
GLint internal_format;
|
||||
glBindTexture(GL_TEXTURE_2D, pass.tex);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &internal_format);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, origTex);
|
||||
glTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
internal_format,
|
||||
textureSize.x,
|
||||
textureSize.y,
|
||||
0,
|
||||
GL_RGB,
|
||||
GL_UNSIGNED_SHORT_5_6_5,
|
||||
NULL);
|
||||
|
||||
/* bind output of last pass to be rendered on the backbuffer
|
||||
*/
|
||||
glBindTexture(GL_TEXTURE_2D, shaderPasses.back().tex);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)shaderPasses.back().textureSize.x);
|
||||
|
||||
/* calculate and apply viewport and texture coordinates to
|
||||
that will be used in the main ogl code
|
||||
*/
|
||||
|
||||
setTexCoords(shaderPasses.size() - 1,
|
||||
shaderPasses.back().outputSize,
|
||||
shaderPasses.back().textureSize,
|
||||
true);
|
||||
|
||||
/* render to backbuffer without shaders
|
||||
*/
|
||||
cgGLDisableProfile(vertexProfile);
|
||||
cgGLDisableProfile(fragmentProfile);
|
||||
}
|
||||
|
||||
void CGLCG::setShaderVars(int pass)
|
||||
{
|
||||
/* mvp paramater
|
||||
*/
|
||||
CGparameter cgpModelViewProj = cgGetNamedParameter(shaderPasses[pass].cgVertexProgram, "modelViewProj");
|
||||
if (cgpModelViewProj)
|
||||
cgGLSetStateMatrixParameter(cgpModelViewProj,
|
||||
CG_GL_MODELVIEW_PROJECTION_MATRIX,
|
||||
CG_GL_MATRIX_IDENTITY);
|
||||
|
||||
#define setProgram2fv(pass, varname, floats) \
|
||||
{ \
|
||||
CGparameter cgpf = cgGetNamedParameter(shaderPasses[pass].cgFragmentProgram, varname); \
|
||||
CGparameter cgpv = cgGetNamedParameter(shaderPasses[pass].cgVertexProgram, varname); \
|
||||
if (cgpf) \
|
||||
cgGLSetParameter2fv(cgpf, floats); \
|
||||
if (cgpv) \
|
||||
cgGLSetParameter2fv(cgpv, floats); \
|
||||
}
|
||||
|
||||
#define setProgram1f(pass, varname, val) \
|
||||
{ \
|
||||
CGparameter cgpf = cgGetNamedParameter(shaderPasses[pass].cgFragmentProgram, varname); \
|
||||
CGparameter cgpv = cgGetNamedParameter(shaderPasses[pass].cgVertexProgram, varname); \
|
||||
if (cgpf) \
|
||||
cgGLSetParameter1f(cgpf, val); \
|
||||
if (cgpv) \
|
||||
cgGLSetParameter1f(cgpv, val); \
|
||||
}
|
||||
|
||||
#define setTextureParameter(pass, varname, val) \
|
||||
{ \
|
||||
CGparameter cgpf = cgGetNamedParameter(shaderPasses[pass].cgFragmentProgram, varname); \
|
||||
if (cgpf) { \
|
||||
cgGLSetTextureParameter(cgpf, val); \
|
||||
cgGLEnableTextureParameter(cgpf); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define setTexCoordsParameter(pass, varname, val) \
|
||||
{ \
|
||||
CGparameter cgpv = cgGetNamedParameter(shaderPasses[pass].cgVertexProgram, varname); \
|
||||
if (cgpv) { \
|
||||
cgGLSetParameterPointer(cgpv, 2, GL_FLOAT, 0, val); \
|
||||
cgGLEnableClientState(cgpv); \
|
||||
cgAttribParams.push_back(cgpv); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* IN paramater
|
||||
*/
|
||||
float inputSize[2] = { (float) shaderPasses[pass - 1].outputSize.x,
|
||||
(float) shaderPasses[pass - 1].outputSize.y };
|
||||
float textureSize[2] = { (float) shaderPasses[pass - 1].textureSize.x,
|
||||
(float) shaderPasses[pass - 1].textureSize.y };
|
||||
float outputSize[2] = { (float) shaderPasses[pass].outputSize.x,
|
||||
(float) shaderPasses[pass].outputSize.y };
|
||||
|
||||
setProgram2fv(pass, "IN.video_size", inputSize);
|
||||
setProgram2fv(pass, "IN.texture_size", textureSize);
|
||||
setProgram2fv(pass, "IN.output_size", outputSize);
|
||||
unsigned int shaderFrameCnt = frameCnt;
|
||||
if (shaderPasses[pass].frameCounterMod)
|
||||
shaderFrameCnt %= shaderPasses[pass].frameCounterMod;
|
||||
setProgram1f(pass, "IN.frame_count", (float)shaderFrameCnt);
|
||||
setProgram1f(
|
||||
pass, "IN.frame_direction", Settings.Rewinding ? -1.0f : 1.0f);
|
||||
|
||||
/* ORIG parameter
|
||||
*/
|
||||
float orig_videoSize[2] = { (float) shaderPasses[0].outputSize.x,
|
||||
(float) shaderPasses[0].outputSize.y };
|
||||
float orig_textureSize[2] = { (float) shaderPasses[0].textureSize.x,
|
||||
(float) shaderPasses[0].textureSize.y };
|
||||
|
||||
setProgram2fv(pass, "ORIG.video_size", orig_videoSize);
|
||||
setProgram2fv(pass, "ORIG.texture_size", orig_textureSize);
|
||||
setTextureParameter(pass, "ORIG.texture", shaderPasses[0].tex);
|
||||
setTexCoordsParameter(pass, "ORIG.tex_coord", shaderPasses[1].texcoords);
|
||||
|
||||
/* PREV parameter
|
||||
*/
|
||||
if (prevPasses[0].textureSize.x > 0) {
|
||||
float prev_videoSize[2] = { (float) prevPasses[0].videoSize.x,
|
||||
(float) prevPasses[0].videoSize.y };
|
||||
float prev_textureSize[2] = { (float) prevPasses[0].textureSize.x,
|
||||
(float) prevPasses[0].textureSize.y };
|
||||
|
||||
setProgram2fv(pass, "PREV.video_size", prev_videoSize);
|
||||
setProgram2fv(pass, "PREV.texture_size", prev_textureSize);
|
||||
setTextureParameter(pass, "PREV.texture", prevPasses[0].tex);
|
||||
setTexCoordsParameter(pass, "PREV.tex_coord", prevPasses[0].texCoords);
|
||||
}
|
||||
|
||||
/* PREV1-6 parameters
|
||||
*/
|
||||
for (unsigned int i = 1; i < prevPasses.size(); i++)
|
||||
{
|
||||
if (prevPasses[i].textureSize.x == 0)
|
||||
break;
|
||||
char varname[100];
|
||||
float prev_videoSize[2] = { (float) prevPasses[i].videoSize.x,
|
||||
(float) prevPasses[i].videoSize.y };
|
||||
float prev_textureSize[2] = { (float) prevPasses[i].textureSize.x,
|
||||
(float) prevPasses[i].textureSize.y };
|
||||
sprintf(varname, "PREV%d.video_size", i);
|
||||
setProgram2fv(pass, varname, prev_videoSize);
|
||||
sprintf(varname, "PREV%d.texture_size", i);
|
||||
setProgram2fv(pass, varname, prev_textureSize);
|
||||
sprintf(varname, "PREV%d.texture", i);
|
||||
setTextureParameter(pass, varname, prevPasses[i].tex);
|
||||
sprintf(varname, "PREV%d.tex_coord", i);
|
||||
setTexCoordsParameter(pass, varname, prevPasses[i].texCoords);
|
||||
}
|
||||
|
||||
/* LUT parameters
|
||||
*/
|
||||
for (unsigned int i = 0; i < lookupTextures.size(); i++) {
|
||||
setTextureParameter(pass, lookupTextures[i].id, lookupTextures[i].tex);
|
||||
}
|
||||
|
||||
/* PASSX parameters, only for third pass and up
|
||||
*/
|
||||
if (pass > 2) {
|
||||
for (int i = 1; i < pass - 1; i++) {
|
||||
char varname[100];
|
||||
float pass_videoSize[2] = { (float) shaderPasses[i].outputSize.x,
|
||||
(float) shaderPasses[i].outputSize.y };
|
||||
float pass_textureSize[2] = { (float) shaderPasses[i].textureSize.x,
|
||||
(float) shaderPasses[i].textureSize.y };
|
||||
sprintf(varname, "PASS%d.video_size", i);
|
||||
setProgram2fv(pass, varname, pass_videoSize);
|
||||
sprintf(varname, "PASS%d.texture_size", i);
|
||||
setProgram2fv(pass, varname, pass_textureSize);
|
||||
sprintf(varname, "PASS%d.texture", i);
|
||||
setTextureParameter(pass, varname, shaderPasses[i].tex);
|
||||
sprintf(varname, "PASS%d.tex_coord", i);
|
||||
setTexCoordsParameter(pass, varname, shaderPasses[i + 1].texcoords);
|
||||
}
|
||||
}
|
||||
|
||||
/* PASSPREV parameter */
|
||||
for (int i = 0; i < pass; i++)
|
||||
{
|
||||
char varname[100];
|
||||
float pass_videoSize[2] = { (float) shaderPasses[i].outputSize.x,
|
||||
(float) shaderPasses[i].outputSize.y };
|
||||
float pass_textureSize[2] = { (float) shaderPasses[i].textureSize.x,
|
||||
(float) shaderPasses[i].textureSize.y };
|
||||
sprintf(varname, "PASSPREV%d.video_size", pass - i);
|
||||
setProgram2fv(pass, varname, pass_videoSize);
|
||||
sprintf(varname, "PASSPREV%d.texture_size", pass - i);
|
||||
setProgram2fv(pass, varname, pass_textureSize);
|
||||
sprintf(varname, "PASSPREV%d.texture", pass - i);
|
||||
setTextureParameter(pass, varname, shaderPasses[i].tex);
|
||||
sprintf(varname, "PASSPREV%d.tex_coord", pass - i);
|
||||
setTexCoordsParameter(pass, varname, shaderPasses[i + 1].texcoords);
|
||||
}
|
||||
}
|
||||
|
||||
void CGLCG::resetAttribParams()
|
||||
{
|
||||
for (unsigned int i = 0; i < cgAttribParams.size(); i++)
|
||||
cgGLDisableClientState(cgAttribParams[i]);
|
||||
cgAttribParams.clear();
|
||||
}
|
||||
|
285
shaders/CGLCG.h
285
shaders/CGLCG.h
|
@ -1,285 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
#ifndef CGGLCG_H
|
||||
#define CGGLCG_H
|
||||
|
||||
#include "shader_platform.h"
|
||||
|
||||
#include "CCGShader.h"
|
||||
#include "cgFunctions.h"
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
|
||||
typedef struct _xySize
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
operator const float*() const;
|
||||
} xySize;
|
||||
|
||||
class CGLCG
|
||||
{
|
||||
private:
|
||||
typedef struct _shaderPass
|
||||
{
|
||||
cgScaleParams scaleParams;
|
||||
bool linearFilter;
|
||||
unsigned frameCounterMod;
|
||||
bool floatFbo;
|
||||
CGprogram cgVertexProgram, cgFragmentProgram;
|
||||
GLuint tex;
|
||||
GLuint fbo;
|
||||
xySize outputSize;
|
||||
xySize textureSize;
|
||||
GLfloat texcoords[8];
|
||||
_shaderPass()
|
||||
{
|
||||
cgVertexProgram = NULL;
|
||||
cgFragmentProgram = NULL;
|
||||
fbo = 0;
|
||||
tex = 0;
|
||||
}
|
||||
} shaderPass;
|
||||
|
||||
typedef struct _prevPass
|
||||
{
|
||||
GLuint tex;
|
||||
xySize videoSize;
|
||||
xySize textureSize;
|
||||
GLfloat texCoords[8];
|
||||
_prevPass() { tex = 0; }
|
||||
} prevPass;
|
||||
|
||||
typedef struct _lookupTexture
|
||||
{
|
||||
char id[PATH_MAX];
|
||||
GLuint tex;
|
||||
_lookupTexture() { tex = 0; }
|
||||
} lookupTexture;
|
||||
|
||||
typedef std::vector<shaderPass> glPassVector;
|
||||
typedef std::vector<lookupTexture> glLutVector;
|
||||
typedef std::deque<prevPass> glPrevDeque;
|
||||
typedef std::vector<CGparameter> glAttribParams;
|
||||
glPassVector shaderPasses;
|
||||
glLutVector lookupTextures;
|
||||
glPrevDeque prevPasses;
|
||||
glAttribParams cgAttribParams;
|
||||
|
||||
bool fboFunctionsLoaded;
|
||||
bool shaderLoaded;
|
||||
bool LoadFBOFunctions();
|
||||
void checkForCgError(const char* situation);
|
||||
void setTexCoords(int pass,
|
||||
xySize inputSize,
|
||||
xySize textureSize,
|
||||
bool topdown = false);
|
||||
void setShaderVars(int pass);
|
||||
void resetAttribParams();
|
||||
|
||||
CGcontext cgContext;
|
||||
unsigned int frameCnt;
|
||||
static const GLfloat lut_coords[8];
|
||||
|
||||
public:
|
||||
CGLCG(CGcontext cgContext);
|
||||
~CGLCG(void);
|
||||
|
||||
bool LoadShader(const char* shaderFile);
|
||||
void Render(GLuint& origTex,
|
||||
xySize textureSize,
|
||||
xySize inputSize,
|
||||
xySize viewportSize);
|
||||
void ClearPasses();
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,339 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
|
||||
#include "cgFunctions.h"
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include "shader_platform.h"
|
||||
|
||||
void* hCgDll = NULL;
|
||||
void* hCgGLDll = NULL;
|
||||
|
||||
// cg.dll
|
||||
CGCC cgCreateContext = NULL;
|
||||
CGDC cgDestroyContext = NULL;
|
||||
CGGNP cgGetNamedParameter = NULL;
|
||||
CGGE cgGetError = NULL;
|
||||
CGGES cgGetErrorString = NULL;
|
||||
CGGLL cgGetLastListing = NULL;
|
||||
CGCP cgCreateProgram = NULL;
|
||||
CGDP cgDestroyProgram = NULL;
|
||||
CGGPRI cgGetParameterResourceIndex = NULL;
|
||||
CGGFP cgGetFirstParameter = NULL;
|
||||
CGGNEP cgGetNextParameter = NULL;
|
||||
CGGPD cgGetParameterDirection = NULL;
|
||||
CGGPS cgGetParameterSemantic = NULL;
|
||||
CGGRS cgGetResourceString = NULL;
|
||||
CGGPV cgGetParameterVariability = NULL;
|
||||
CGGPT cgGetParameterType = NULL;
|
||||
CGGFSP cgGetFirstStructParameter = NULL;
|
||||
CGGPN cgGetParameterName = NULL;
|
||||
// cggl.dll
|
||||
CGGLSSMP cgGLSetStateMatrixParameter = NULL;
|
||||
CGGLSP2FV cgGLSetParameter2fv = NULL;
|
||||
CGGLSP1F cgGLSetParameter1f = NULL;
|
||||
CGGLGLP cgGLGetLatestProfile = NULL;
|
||||
CGGLEP cgGLEnableProfile = NULL;
|
||||
CGGLDP cgGLDisableProfile = NULL;
|
||||
CGGLSOO cgGLSetOptimalOptions = NULL;
|
||||
CGGLLP cgGLLoadProgram = NULL;
|
||||
CGGLBP cgGLBindProgram = NULL;
|
||||
CGGLSTP cgGLSetTextureParameter = NULL;
|
||||
CGGLETP cgGLEnableTextureParameter = NULL;
|
||||
CGGLSPP cgGLSetParameterPointer = NULL;
|
||||
CGGLECS cgGLEnableClientState = NULL;
|
||||
CGGLDCS cgGLDisableClientState = NULL;
|
||||
|
||||
bool loadCgFunctions()
|
||||
{
|
||||
if (hCgDll && hCgGLDll)
|
||||
return true;
|
||||
|
||||
hCgDll = dlopen("libCg.so", RTLD_LAZY);
|
||||
if (hCgDll)
|
||||
{
|
||||
hCgGLDll = dlopen("libCgGL.so", RTLD_LAZY);
|
||||
}
|
||||
|
||||
if (!hCgDll || !hCgGLDll)
|
||||
{
|
||||
unloadCgLibrary();
|
||||
return false;
|
||||
}
|
||||
// cg.dll
|
||||
cgCreateContext = (CGCC)dlsym(hCgDll, "cgCreateContext");
|
||||
cgDestroyContext = (CGDC)dlsym(hCgDll, "cgDestroyContext");
|
||||
cgGetNamedParameter = (CGGNP)dlsym(hCgDll, "cgGetNamedParameter");
|
||||
cgGetError = (CGGE)dlsym(hCgDll, "cgGetError");
|
||||
cgGetErrorString = (CGGES)dlsym(hCgDll, "cgGetErrorString");
|
||||
cgGetLastListing = (CGGLL)dlsym(hCgDll, "cgGetLastListing");
|
||||
cgCreateProgram = (CGCP)dlsym(hCgDll, "cgCreateProgram");
|
||||
cgDestroyProgram = (CGDP)dlsym(hCgDll, "cgDestroyProgram");
|
||||
cgGetParameterResourceIndex = (CGGPRI)dlsym(hCgDll, "cgGetParameterResourceIndex");
|
||||
cgGetFirstParameter = (CGGFP)dlsym(hCgDll, "cgGetFirstParameter");
|
||||
cgGetNextParameter = (CGGNEP)dlsym(hCgDll, "cgGetNextParameter");
|
||||
cgGetParameterDirection = (CGGPD)dlsym(hCgDll, "cgGetParameterDirection");
|
||||
cgGetParameterSemantic = (CGGPS)dlsym(hCgDll, "cgGetParameterSemantic");
|
||||
cgGetResourceString = (CGGRS)dlsym(hCgDll, "cgGetResourceString");
|
||||
cgGetParameterVariability = (CGGPV)dlsym(hCgDll, "cgGetParameterVariability");
|
||||
cgGetParameterType = (CGGPT)dlsym(hCgDll, "cgGetParameterType");
|
||||
cgGetFirstStructParameter = (CGGFSP)dlsym(hCgDll, "cgGetFirstStructParameter");
|
||||
cgGetParameterName = (CGGPN)dlsym(hCgDll, "cgGetParameterName");
|
||||
// cggl.dll
|
||||
cgGLSetStateMatrixParameter = (CGGLSSMP)dlsym(hCgGLDll, "cgGLSetStateMatrixParameter");
|
||||
cgGLSetParameter2fv = (CGGLSP2FV)dlsym(hCgGLDll, "cgGLSetParameter2fv");
|
||||
cgGLSetParameter1f = (CGGLSP1F)dlsym(hCgGLDll, "cgGLSetParameter1f");
|
||||
cgGLGetLatestProfile = (CGGLGLP)dlsym(hCgGLDll, "cgGLGetLatestProfile");
|
||||
cgGLEnableProfile = (CGGLEP)dlsym(hCgGLDll, "cgGLEnableProfile");
|
||||
cgGLDisableProfile = (CGGLDP)dlsym(hCgGLDll, "cgGLDisableProfile");
|
||||
cgGLSetOptimalOptions = (CGGLSOO)dlsym(hCgGLDll, "cgGLSetOptimalOptions");
|
||||
cgGLLoadProgram = (CGGLLP)dlsym(hCgGLDll, "cgGLLoadProgram");
|
||||
cgGLBindProgram = (CGGLBP)dlsym(hCgGLDll, "cgGLBindProgram");
|
||||
cgGLSetTextureParameter = (CGGLSTP)dlsym(hCgGLDll, "cgGLSetTextureParameter");
|
||||
cgGLEnableTextureParameter = (CGGLETP)dlsym(hCgGLDll, "cgGLEnableTextureParameter");
|
||||
cgGLSetParameterPointer = (CGGLSPP)dlsym(hCgGLDll, "cgGLSetParameterPointer");
|
||||
cgGLEnableClientState = (CGGLECS)dlsym(hCgGLDll, "cgGLEnableClientState");
|
||||
cgGLDisableClientState = (CGGLDCS)dlsym(hCgGLDll, "cgGLDisableClientState");
|
||||
|
||||
if (
|
||||
// cg.dll
|
||||
!cgCreateContext || !cgDestroyContext || !cgGetNamedParameter || !cgGetError || !cgGetErrorString || !cgGetLastListing || !cgCreateProgram || !cgDestroyProgram || !cgGetParameterResourceIndex || !cgGetFirstParameter || !cgGetNextParameter || !cgGetParameterDirection || !cgGetParameterSemantic || !cgGetResourceString || !cgGetParameterVariability || !cgGetParameterType || !cgGetFirstStructParameter || !cgGetParameterName ||
|
||||
// cggl.dll
|
||||
!cgGLSetStateMatrixParameter || !cgGLSetParameter2fv || !cgGLSetParameter1f || !cgGLGetLatestProfile || !cgGLEnableProfile || !cgGLDisableProfile || !cgGLSetOptimalOptions || !cgGLLoadProgram || !cgGLBindProgram || !cgGLSetTextureParameter || !cgGLEnableTextureParameter || !cgGLSetParameterPointer || !cgGLEnableClientState || !cgGLDisableClientState)
|
||||
{
|
||||
unloadCgLibrary();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void unloadCgLibrary()
|
||||
{
|
||||
if (hCgDll)
|
||||
dlclose(hCgDll);
|
||||
if (hCgGLDll)
|
||||
dlclose(hCgGLDll);
|
||||
|
||||
hCgDll = hCgGLDll = NULL;
|
||||
|
||||
// cg.dll
|
||||
cgCreateContext = NULL;
|
||||
cgDestroyContext = NULL;
|
||||
cgGetNamedParameter = NULL;
|
||||
cgGetError = NULL;
|
||||
cgGetErrorString = NULL;
|
||||
cgGetLastListing = NULL;
|
||||
cgCreateProgram = NULL;
|
||||
cgDestroyProgram = NULL;
|
||||
cgGetParameterResourceIndex = NULL;
|
||||
cgGetFirstParameter = NULL;
|
||||
cgGetNextParameter = NULL;
|
||||
cgGetParameterDirection = NULL;
|
||||
cgGetParameterSemantic = NULL;
|
||||
cgGetResourceString = NULL;
|
||||
cgGetParameterVariability = NULL;
|
||||
cgGetParameterType = NULL;
|
||||
cgGetFirstStructParameter = NULL;
|
||||
cgGetParameterName = NULL;
|
||||
// cggl.dll
|
||||
cgGLSetStateMatrixParameter = NULL;
|
||||
cgGLSetParameter2fv = NULL;
|
||||
cgGLGetLatestProfile = NULL;
|
||||
cgGLEnableProfile = NULL;
|
||||
cgGLDisableProfile = NULL;
|
||||
cgGLSetOptimalOptions = NULL;
|
||||
cgGLLoadProgram = NULL;
|
||||
cgGLBindProgram = NULL;
|
||||
cgGLEnableClientState = NULL;
|
||||
cgGLDisableClientState = NULL;
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef CGFUNCTIONS_H
|
||||
#define CGFUNCTIONS_H
|
||||
|
||||
#include "cgMini.h"
|
||||
|
||||
// cg.dll
|
||||
typedef CG_API
|
||||
CGcontext(CGENTRY* CGCC)(void);
|
||||
extern CGCC cgCreateContext;
|
||||
typedef CG_API void(CGENTRY* CGDC)(CGcontext context);
|
||||
extern CGDC cgDestroyContext;
|
||||
typedef CG_API
|
||||
CGparameter(CGENTRY* CGGNP)(CGprogram program, const char* name);
|
||||
extern CGGNP cgGetNamedParameter;
|
||||
typedef CG_API
|
||||
CGerror(CGENTRY* CGGE)(void);
|
||||
extern CGGE cgGetError;
|
||||
typedef CG_API const char*(CGENTRY* CGGES)(CGerror error);
|
||||
extern CGGES cgGetErrorString;
|
||||
typedef CG_API const char*(CGENTRY* CGGLL)(CGcontext context);
|
||||
extern CGGLL cgGetLastListing;
|
||||
typedef CG_API
|
||||
CGprogram(CGENTRY* CGCP)(CGcontext context,
|
||||
CGenum program_type,
|
||||
const char* program,
|
||||
CGprofile profile,
|
||||
const char* entry,
|
||||
const char** args);
|
||||
extern CGCP cgCreateProgram;
|
||||
typedef CG_API void(CGENTRY* CGDP)(CGprogram program);
|
||||
extern CGDP cgDestroyProgram;
|
||||
typedef CG_API unsigned long(CGENTRY* CGGPRI)(CGparameter param);
|
||||
extern CGGPRI cgGetParameterResourceIndex;
|
||||
typedef CG_API
|
||||
CGparameter(CGENTRY* CGGFP)(CGprogram program, CGenum name_space);
|
||||
extern CGGFP cgGetFirstParameter;
|
||||
typedef CG_API
|
||||
CGparameter(CGENTRY* CGGNEP)(CGparameter current);
|
||||
extern CGGNEP cgGetNextParameter;
|
||||
typedef CG_API
|
||||
CGenum(CGENTRY* CGGPD)(CGparameter param);
|
||||
extern CGGPD cgGetParameterDirection;
|
||||
typedef CG_API const char*(CGENTRY* CGGPS)(CGparameter param);
|
||||
extern CGGPS cgGetParameterSemantic;
|
||||
typedef CG_API const char*(CGENTRY* CGGRS)(CGresource resource);
|
||||
extern CGGRS cgGetResourceString;
|
||||
typedef CG_API
|
||||
CGenum(CGENTRY* CGGPV)(CGparameter param);
|
||||
extern CGGPV cgGetParameterVariability;
|
||||
typedef CG_API
|
||||
CGtype(CGENTRY* CGGPT)(CGparameter param);
|
||||
extern CGGPT cgGetParameterType;
|
||||
typedef CG_API
|
||||
CGparameter(CGENTRY* CGGFSP)(CGparameter param);
|
||||
extern CGGFSP cgGetFirstStructParameter;
|
||||
typedef CG_API const char*(CGENTRY* CGGPN)(CGparameter param);
|
||||
extern CGGPN cgGetParameterName;
|
||||
|
||||
// cggl.dll
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSSMP)(CGparameter param,
|
||||
CGGLenum matrix,
|
||||
CGGLenum transform);
|
||||
extern CGGLSSMP cgGLSetStateMatrixParameter;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSP1F)(CGparameter param, float x);
|
||||
extern CGGLSP1F cgGLSetParameter1f;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSP2FV)(CGparameter param, const float* v);
|
||||
extern CGGLSP2FV cgGLSetParameter2fv;
|
||||
typedef CGGL_API
|
||||
CGprofile(CGGLENTRY* CGGLGLP)(CGGLenum profile_type);
|
||||
extern CGGLGLP cgGLGetLatestProfile;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLEP)(CGprofile profile);
|
||||
extern CGGLEP cgGLEnableProfile;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLDP)(CGprofile profile);
|
||||
extern CGGLDP cgGLDisableProfile;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSOO)(CGprofile profile);
|
||||
extern CGGLSOO cgGLSetOptimalOptions;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLLP)(CGprogram program);
|
||||
extern CGGLLP cgGLLoadProgram;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLBP)(CGprogram program);
|
||||
extern CGGLBP cgGLBindProgram;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSTP)(CGparameter param, GLuint texobj);
|
||||
extern CGGLSTP cgGLSetTextureParameter;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLETP)(CGparameter param);
|
||||
extern CGGLETP cgGLEnableTextureParameter;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLSPP)(CGparameter param,
|
||||
GLint fsize,
|
||||
GLenum type,
|
||||
GLsizei stride,
|
||||
const GLvoid* pointer);
|
||||
extern CGGLSPP cgGLSetParameterPointer;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLECS)(CGparameter param);
|
||||
extern CGGLECS cgGLEnableClientState;
|
||||
typedef CGGL_API void(CGGLENTRY* CGGLDCS)(CGparameter param);
|
||||
extern CGGLDCS cgGLDisableClientState;
|
||||
|
||||
// cgfunctions.cpp
|
||||
bool loadCgFunctions();
|
||||
void unloadCgLibrary();
|
||||
|
||||
#endif // CGFUNCTIONS_H
|
661
shaders/cgMini.h
661
shaders/cgMini.h
|
@ -1,661 +0,0 @@
|
|||
/***********************************************************************************
|
||||
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
||||
|
||||
(c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com),
|
||||
Jerremy Koot (jkoot@snes9x.com)
|
||||
|
||||
(c) Copyright 2002 - 2004 Matthew Kendora
|
||||
|
||||
(c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org)
|
||||
|
||||
(c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/)
|
||||
|
||||
(c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net)
|
||||
|
||||
(c) Copyright 2002 - 2006 funkyass (funkyass@spam.shaw.ca),
|
||||
Kris Bleakley (codeviolation@hotmail.com)
|
||||
|
||||
(c) Copyright 2002 - 2010 Brad Jorsch (anomie@users.sourceforge.net),
|
||||
Nach (n-a-c-h@users.sourceforge.net),
|
||||
|
||||
(c) Copyright 2002 - 2011 zones (kasumitokoduck@yahoo.com)
|
||||
|
||||
(c) Copyright 2006 - 2007 nitsuja
|
||||
|
||||
(c) Copyright 2009 - 2017 BearOso,
|
||||
OV2
|
||||
|
||||
(c) Copyright 2017 qwertymodo
|
||||
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
BS-X C emulator code
|
||||
(c) Copyright 2005 - 2006 Dreamer Nom,
|
||||
zones
|
||||
|
||||
C4 x86 assembler and some C emulation code
|
||||
(c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com),
|
||||
Nach,
|
||||
zsKnight (zsknight@zsnes.com)
|
||||
|
||||
C4 C++ code
|
||||
(c) Copyright 2003 - 2006 Brad Jorsch,
|
||||
Nach
|
||||
|
||||
DSP-1 emulator code
|
||||
(c) Copyright 1998 - 2006 _Demo_,
|
||||
Andreas Naive (andreasnaive@gmail.com),
|
||||
Gary Henderson,
|
||||
Ivar (ivar@snes9x.com),
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
neviksti (neviksti@hotmail.com)
|
||||
|
||||
DSP-2 emulator code
|
||||
(c) Copyright 2003 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lord Nightmare
|
||||
(lord_nightmare@users.sourceforge.net), Matthew Kendora, neviksti
|
||||
|
||||
DSP-3 emulator code
|
||||
(c) Copyright 2003 - 2006 John Weidman,
|
||||
Kris Bleakley,
|
||||
Lancer,
|
||||
z80 gaiden
|
||||
|
||||
DSP-4 emulator code
|
||||
(c) Copyright 2004 - 2006 Dreamer Nom,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Nach,
|
||||
z80 gaiden
|
||||
|
||||
OBC1 emulator code
|
||||
(c) Copyright 2001 - 2004 zsKnight,
|
||||
pagefault (pagefault@zsnes.com),
|
||||
Kris Bleakley
|
||||
Ported from x86 assembler to C by sanmaiwashi
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.39-1.51
|
||||
(c) Copyright 2002 Matthew Kendora with research by
|
||||
zsKnight,
|
||||
John Weidman,
|
||||
Dark Force
|
||||
|
||||
SPC7110 and RTC C++ emulator code used in 1.52+
|
||||
(c) Copyright 2009 byuu,
|
||||
neviksti
|
||||
|
||||
S-DD1 C emulator code
|
||||
(c) Copyright 2003 Brad Jorsch with research by
|
||||
Andreas Naive,
|
||||
John Weidman
|
||||
|
||||
S-RTC C emulator code
|
||||
(c) Copyright 2001 - 2006 byuu,
|
||||
John Weidman
|
||||
|
||||
ST010 C++ emulator code
|
||||
(c) Copyright 2003 Feather,
|
||||
John Weidman,
|
||||
Kris Bleakley,
|
||||
Matthew Kendora
|
||||
|
||||
Super FX x86 assembler emulator code
|
||||
(c) Copyright 1998 - 2003 _Demo_,
|
||||
pagefault,
|
||||
zsKnight
|
||||
|
||||
Super FX C emulator code
|
||||
(c) Copyright 1997 - 1999 Ivar,
|
||||
Gary Henderson,
|
||||
John Weidman
|
||||
|
||||
Sound emulator code used in 1.5-1.51
|
||||
(c) Copyright 1998 - 2003 Brad Martin
|
||||
(c) Copyright 1998 - 2006 Charles Bilyue'
|
||||
|
||||
Sound emulator code used in 1.52+
|
||||
(c) Copyright 2004 - 2007 Shay Green (gblargg@gmail.com)
|
||||
|
||||
S-SMP emulator code used in 1.54+
|
||||
(c) Copyright 2016 byuu
|
||||
|
||||
SH assembler code partly based on x86 assembler code
|
||||
(c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se)
|
||||
|
||||
2xSaI filter
|
||||
(c) Copyright 1999 - 2001 Derek Liauw Kie Fa
|
||||
|
||||
HQ2x, HQ3x, HQ4x filters
|
||||
(c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com)
|
||||
|
||||
NTSC filter
|
||||
(c) Copyright 2006 - 2007 Shay Green
|
||||
|
||||
GTK+ GUI code
|
||||
(c) Copyright 2004 - 2017 BearOso
|
||||
|
||||
Win32 GUI code
|
||||
(c) Copyright 2003 - 2006 blip,
|
||||
funkyass,
|
||||
Matthew Kendora,
|
||||
Nach,
|
||||
nitsuja
|
||||
(c) Copyright 2009 - 2017 OV2
|
||||
|
||||
Mac OS GUI code
|
||||
(c) Copyright 1998 - 2001 John Stiles
|
||||
(c) Copyright 2001 - 2011 zones
|
||||
|
||||
Libretro port
|
||||
(c) Copyright 2011 - 2017 Hans-Kristian Arntzen,
|
||||
Daniel De Matteis
|
||||
(Under no circumstances will commercial rights be
|
||||
given)
|
||||
|
||||
|
||||
Specific ports contains the works of other authors. See headers in
|
||||
individual files.
|
||||
|
||||
|
||||
Snes9x homepage: http://www.snes9x.com/
|
||||
|
||||
Permission to use, copy, modify and/or distribute Snes9x in both binary
|
||||
and source form, for non-commercial purposes, is hereby granted without
|
||||
fee, providing that this license information and copyright notice appear
|
||||
with all copies and any derived work.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event shall the authors be held liable for any damages
|
||||
arising from the use of this software or it's derivatives.
|
||||
|
||||
Snes9x is freeware for PERSONAL USE only. Commercial users should
|
||||
seek permission of the copyright holders first. Commercial use includes,
|
||||
but is not limited to, charging money for Snes9x or software derived from
|
||||
Snes9x, including Snes9x or derivatives in commercial game bundles, and/or
|
||||
using Snes9x as a promotion for your commercial product.
|
||||
|
||||
The copyright holders request that bug fixes and improvements to the code
|
||||
should be forwarded to them so everyone can benefit from the modifications
|
||||
in future versions.
|
||||
|
||||
Super NES and Super Nintendo Entertainment System are trademarks of
|
||||
Nintendo Co., Limited and its subsidiary companies.
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef CGMINI_H
|
||||
#define CGMINI_H
|
||||
|
||||
#define CGENTRY
|
||||
#define CGD3D9ENTRY
|
||||
#define CGGLENTRY
|
||||
#define CGD3D9DLL_API
|
||||
#define CGGL_API
|
||||
|
||||
#include "shader_platform.h"
|
||||
|
||||
#define CG_API
|
||||
typedef struct _CGprogram* CGprogram;
|
||||
typedef struct _CGcontext* CGcontext;
|
||||
typedef struct _CGparameter* CGparameter;
|
||||
typedef enum {
|
||||
CG_NO_ERROR = 0,
|
||||
CG_COMPILER_ERROR = 1,
|
||||
CG_INVALID_PARAMETER_ERROR = 2,
|
||||
CG_INVALID_PROFILE_ERROR = 3,
|
||||
CG_PROGRAM_LOAD_ERROR = 4,
|
||||
CG_PROGRAM_BIND_ERROR = 5,
|
||||
CG_PROGRAM_NOT_LOADED_ERROR = 6,
|
||||
CG_UNSUPPORTED_GL_EXTENSION_ERROR = 7,
|
||||
CG_INVALID_VALUE_TYPE_ERROR = 8,
|
||||
CG_NOT_MATRIX_PARAM_ERROR = 9,
|
||||
CG_INVALID_ENUMERANT_ERROR = 10,
|
||||
CG_NOT_4x4_MATRIX_ERROR = 11,
|
||||
CG_FILE_READ_ERROR = 12,
|
||||
CG_FILE_WRITE_ERROR = 13,
|
||||
CG_NVPARSE_ERROR = 14,
|
||||
CG_MEMORY_ALLOC_ERROR = 15,
|
||||
CG_INVALID_CONTEXT_HANDLE_ERROR = 16,
|
||||
CG_INVALID_PROGRAM_HANDLE_ERROR = 17,
|
||||
CG_INVALID_PARAM_HANDLE_ERROR = 18,
|
||||
CG_UNKNOWN_PROFILE_ERROR = 19,
|
||||
CG_VAR_ARG_ERROR = 20,
|
||||
CG_INVALID_DIMENSION_ERROR = 21,
|
||||
CG_ARRAY_PARAM_ERROR = 22,
|
||||
CG_OUT_OF_ARRAY_BOUNDS_ERROR = 23,
|
||||
CG_CONFLICTING_TYPES_ERROR = 24,
|
||||
CG_CONFLICTING_PARAMETER_TYPES_ERROR = 25,
|
||||
CG_PARAMETER_IS_NOT_SHARED_ERROR = 26,
|
||||
CG_INVALID_PARAMETER_VARIABILITY_ERROR = 27,
|
||||
CG_CANNOT_DESTROY_PARAMETER_ERROR = 28,
|
||||
CG_NOT_ROOT_PARAMETER_ERROR = 29,
|
||||
CG_PARAMETERS_DO_NOT_MATCH_ERROR = 30,
|
||||
CG_IS_NOT_PROGRAM_PARAMETER_ERROR = 31,
|
||||
CG_INVALID_PARAMETER_TYPE_ERROR = 32,
|
||||
CG_PARAMETER_IS_NOT_RESIZABLE_ARRAY_ERROR = 33,
|
||||
CG_INVALID_SIZE_ERROR = 34,
|
||||
CG_BIND_CREATES_CYCLE_ERROR = 35,
|
||||
CG_ARRAY_TYPES_DO_NOT_MATCH_ERROR = 36,
|
||||
CG_ARRAY_DIMENSIONS_DO_NOT_MATCH_ERROR = 37,
|
||||
CG_ARRAY_HAS_WRONG_DIMENSION_ERROR = 38,
|
||||
CG_TYPE_IS_NOT_DEFINED_IN_PROGRAM_ERROR = 39,
|
||||
CG_INVALID_EFFECT_HANDLE_ERROR = 40,
|
||||
CG_INVALID_STATE_HANDLE_ERROR = 41,
|
||||
CG_INVALID_STATE_ASSIGNMENT_HANDLE_ERROR = 42,
|
||||
CG_INVALID_PASS_HANDLE_ERROR = 43,
|
||||
CG_INVALID_ANNOTATION_HANDLE_ERROR = 44,
|
||||
CG_INVALID_TECHNIQUE_HANDLE_ERROR = 45,
|
||||
CG_INVALID_PARAMETER_HANDLE_ERROR = 46,
|
||||
CG_STATE_ASSIGNMENT_TYPE_MISMATCH_ERROR = 47,
|
||||
CG_INVALID_FUNCTION_HANDLE_ERROR = 48,
|
||||
CG_INVALID_TECHNIQUE_ERROR = 49,
|
||||
CG_INVALID_POINTER_ERROR = 50,
|
||||
CG_NOT_ENOUGH_DATA_ERROR = 51,
|
||||
CG_NON_NUMERIC_PARAMETER_ERROR = 52,
|
||||
CG_ARRAY_SIZE_MISMATCH_ERROR = 53,
|
||||
CG_CANNOT_SET_NON_UNIFORM_PARAMETER_ERROR = 54,
|
||||
CG_DUPLICATE_NAME_ERROR = 55,
|
||||
CG_INVALID_OBJ_HANDLE_ERROR = 56,
|
||||
CG_INVALID_BUFFER_HANDLE_ERROR = 57,
|
||||
CG_BUFFER_INDEX_OUT_OF_RANGE_ERROR = 58,
|
||||
CG_BUFFER_ALREADY_MAPPED_ERROR = 59,
|
||||
CG_BUFFER_UPDATE_NOT_ALLOWED_ERROR = 60,
|
||||
CG_GLSLG_UNCOMBINED_LOAD_ERROR = 61
|
||||
} CGerror;
|
||||
typedef enum {
|
||||
CG_UNKNOWN = 4096,
|
||||
CG_IN = 4097,
|
||||
CG_OUT = 4098,
|
||||
CG_INOUT = 4099,
|
||||
CG_MIXED = 4100,
|
||||
CG_VARYING = 4101,
|
||||
CG_UNIFORM = 4102,
|
||||
CG_CONSTANT = 4103,
|
||||
CG_PROGRAM_SOURCE = 4104, /* cgGetProgramString */
|
||||
CG_PROGRAM_ENTRY = 4105, /* cgGetProgramString */
|
||||
CG_COMPILED_PROGRAM = 4106, /* cgGetProgramString */
|
||||
CG_PROGRAM_PROFILE = 4107, /* cgGetProgramString */
|
||||
CG_GLOBAL = 4108,
|
||||
CG_PROGRAM = 4109,
|
||||
CG_DEFAULT = 4110,
|
||||
CG_ERROR = 4111,
|
||||
CG_SOURCE = 4112,
|
||||
CG_OBJECT = 4113,
|
||||
CG_COMPILE_MANUAL = 4114,
|
||||
CG_COMPILE_IMMEDIATE = 4115,
|
||||
CG_COMPILE_LAZY = 4116,
|
||||
CG_CURRENT = 4117,
|
||||
CG_LITERAL = 4118,
|
||||
CG_VERSION = 4119, /* cgGetString */
|
||||
CG_ROW_MAJOR = 4120,
|
||||
CG_COLUMN_MAJOR = 4121,
|
||||
CG_FRAGMENT = 4122, /* cgGetProgramInput and cgGetProgramOutput */
|
||||
CG_VERTEX = 4123, /* cgGetProgramInput and cgGetProgramOutput */
|
||||
CG_POINT = 4124, /* Geometry program cgGetProgramInput */
|
||||
CG_LINE = 4125, /* Geometry program cgGetProgramInput */
|
||||
CG_LINE_ADJ = 4126, /* Geometry program cgGetProgramInput */
|
||||
CG_TRIANGLE = 4127, /* Geometry program cgGetProgramInput */
|
||||
CG_TRIANGLE_ADJ = 4128, /* Geometry program cgGetProgramInput */
|
||||
CG_POINT_OUT = 4129, /* Geometry program cgGetProgramOutput */
|
||||
CG_LINE_OUT = 4130, /* Geometry program cgGetProgramOutput */
|
||||
CG_TRIANGLE_OUT = 4131, /* Geometry program cgGetProgramOutput */
|
||||
CG_IMMEDIATE_PARAMETER_SETTING = 4132,
|
||||
CG_DEFERRED_PARAMETER_SETTING = 4133,
|
||||
CG_NO_LOCKS_POLICY = 4134,
|
||||
CG_THREAD_SAFE_POLICY = 4135,
|
||||
CG_FORCE_UPPER_CASE_POLICY = 4136,
|
||||
CG_UNCHANGED_CASE_POLICY = 4137,
|
||||
CG_IS_OPENGL_PROFILE = 4138,
|
||||
CG_IS_DIRECT3D_PROFILE = 4139,
|
||||
CG_IS_DIRECT3D_8_PROFILE = 4140,
|
||||
CG_IS_DIRECT3D_9_PROFILE = 4141,
|
||||
CG_IS_DIRECT3D_10_PROFILE = 4142,
|
||||
CG_IS_VERTEX_PROFILE = 4143,
|
||||
CG_IS_FRAGMENT_PROFILE = 4144,
|
||||
CG_IS_GEOMETRY_PROFILE = 4145,
|
||||
CG_IS_TRANSLATION_PROFILE = 4146,
|
||||
CG_IS_HLSL_PROFILE = 4147,
|
||||
CG_IS_GLSL_PROFILE = 4148,
|
||||
CG_IS_TESSELLATION_CONTROL_PROFILE = 4149,
|
||||
CG_IS_TESSELLATION_EVALUATION_PROFILE = 4150,
|
||||
CG_PATCH = 4152, /* cgGetProgramInput and cgGetProgramOutput */
|
||||
CG_IS_DIRECT3D_11_PROFILE = 4153
|
||||
} CGenum;
|
||||
|
||||
typedef enum {
|
||||
CG_PROFILE_INVALID
|
||||
} CGprofile;
|
||||
|
||||
typedef enum {
|
||||
CG_RESOURCE_INVALID
|
||||
} CGresource;
|
||||
|
||||
typedef enum {
|
||||
CG_UNKNOWN_TYPE = 0,
|
||||
CG_ARRAY = 2,
|
||||
CG_STRING = 1135,
|
||||
CG_STRUCT = 1,
|
||||
CG_TYPELESS_STRUCT = 3,
|
||||
CG_TEXTURE = 1137,
|
||||
CG_BUFFER = 1319,
|
||||
CG_UNIFORMBUFFER = 1320,
|
||||
CG_ADDRESS = 1321,
|
||||
CG_PIXELSHADER_TYPE = 1142,
|
||||
CG_PROGRAM_TYPE = 1136,
|
||||
CG_VERTEXSHADER_TYPE = 1141,
|
||||
CG_SAMPLER = 1143,
|
||||
CG_SAMPLER1D = 1065,
|
||||
CG_SAMPLER1DARRAY = 1138,
|
||||
CG_SAMPLER1DSHADOW = 1313,
|
||||
CG_SAMPLER2D = 1066,
|
||||
CG_SAMPLER2DARRAY = 1139,
|
||||
CG_SAMPLER2DMS = 1317, /* ARB_texture_multisample */
|
||||
CG_SAMPLER2DMSARRAY = 1318, /* ARB_texture_multisample */
|
||||
CG_SAMPLER2DSHADOW = 1314,
|
||||
CG_SAMPLER3D = 1067,
|
||||
CG_SAMPLERBUF = 1144,
|
||||
CG_SAMPLERCUBE = 1069,
|
||||
CG_SAMPLERCUBEARRAY = 1140,
|
||||
CG_SAMPLERRBUF = 1316, /* NV_explicit_multisample */
|
||||
CG_SAMPLERRECT = 1068,
|
||||
CG_SAMPLERRECTSHADOW = 1315,
|
||||
CG_TYPE_START_ENUM = 1024,
|
||||
CG_BOOL = 1114,
|
||||
CG_BOOL1 = 1115,
|
||||
CG_BOOL2 = 1116,
|
||||
CG_BOOL3 = 1117,
|
||||
CG_BOOL4 = 1118,
|
||||
CG_BOOL1x1 = 1119,
|
||||
CG_BOOL1x2 = 1120,
|
||||
CG_BOOL1x3 = 1121,
|
||||
CG_BOOL1x4 = 1122,
|
||||
CG_BOOL2x1 = 1123,
|
||||
CG_BOOL2x2 = 1124,
|
||||
CG_BOOL2x3 = 1125,
|
||||
CG_BOOL2x4 = 1126,
|
||||
CG_BOOL3x1 = 1127,
|
||||
CG_BOOL3x2 = 1128,
|
||||
CG_BOOL3x3 = 1129,
|
||||
CG_BOOL3x4 = 1130,
|
||||
CG_BOOL4x1 = 1131,
|
||||
CG_BOOL4x2 = 1132,
|
||||
CG_BOOL4x3 = 1133,
|
||||
CG_BOOL4x4 = 1134,
|
||||
CG_CHAR = 1166,
|
||||
CG_CHAR1 = 1167,
|
||||
CG_CHAR2 = 1168,
|
||||
CG_CHAR3 = 1169,
|
||||
CG_CHAR4 = 1170,
|
||||
CG_CHAR1x1 = 1171,
|
||||
CG_CHAR1x2 = 1172,
|
||||
CG_CHAR1x3 = 1173,
|
||||
CG_CHAR1x4 = 1174,
|
||||
CG_CHAR2x1 = 1175,
|
||||
CG_CHAR2x2 = 1176,
|
||||
CG_CHAR2x3 = 1177,
|
||||
CG_CHAR2x4 = 1178,
|
||||
CG_CHAR3x1 = 1179,
|
||||
CG_CHAR3x2 = 1180,
|
||||
CG_CHAR3x3 = 1181,
|
||||
CG_CHAR3x4 = 1182,
|
||||
CG_CHAR4x1 = 1183,
|
||||
CG_CHAR4x2 = 1184,
|
||||
CG_CHAR4x3 = 1185,
|
||||
CG_CHAR4x4 = 1186,
|
||||
CG_DOUBLE = 1145,
|
||||
CG_DOUBLE1 = 1146,
|
||||
CG_DOUBLE2 = 1147,
|
||||
CG_DOUBLE3 = 1148,
|
||||
CG_DOUBLE4 = 1149,
|
||||
CG_DOUBLE1x1 = 1150,
|
||||
CG_DOUBLE1x2 = 1151,
|
||||
CG_DOUBLE1x3 = 1152,
|
||||
CG_DOUBLE1x4 = 1153,
|
||||
CG_DOUBLE2x1 = 1154,
|
||||
CG_DOUBLE2x2 = 1155,
|
||||
CG_DOUBLE2x3 = 1156,
|
||||
CG_DOUBLE2x4 = 1157,
|
||||
CG_DOUBLE3x1 = 1158,
|
||||
CG_DOUBLE3x2 = 1159,
|
||||
CG_DOUBLE3x3 = 1160,
|
||||
CG_DOUBLE3x4 = 1161,
|
||||
CG_DOUBLE4x1 = 1162,
|
||||
CG_DOUBLE4x2 = 1163,
|
||||
CG_DOUBLE4x3 = 1164,
|
||||
CG_DOUBLE4x4 = 1165,
|
||||
CG_FIXED = 1070,
|
||||
CG_FIXED1 = 1092,
|
||||
CG_FIXED2 = 1071,
|
||||
CG_FIXED3 = 1072,
|
||||
CG_FIXED4 = 1073,
|
||||
CG_FIXED1x1 = 1074,
|
||||
CG_FIXED1x2 = 1075,
|
||||
CG_FIXED1x3 = 1076,
|
||||
CG_FIXED1x4 = 1077,
|
||||
CG_FIXED2x1 = 1078,
|
||||
CG_FIXED2x2 = 1079,
|
||||
CG_FIXED2x3 = 1080,
|
||||
CG_FIXED2x4 = 1081,
|
||||
CG_FIXED3x1 = 1082,
|
||||
CG_FIXED3x2 = 1083,
|
||||
CG_FIXED3x3 = 1084,
|
||||
CG_FIXED3x4 = 1085,
|
||||
CG_FIXED4x1 = 1086,
|
||||
CG_FIXED4x2 = 1087,
|
||||
CG_FIXED4x3 = 1088,
|
||||
CG_FIXED4x4 = 1089,
|
||||
CG_FLOAT = 1045,
|
||||
CG_FLOAT1 = 1091,
|
||||
CG_FLOAT2 = 1046,
|
||||
CG_FLOAT3 = 1047,
|
||||
CG_FLOAT4 = 1048,
|
||||
CG_FLOAT1x1 = 1049,
|
||||
CG_FLOAT1x2 = 1050,
|
||||
CG_FLOAT1x3 = 1051,
|
||||
CG_FLOAT1x4 = 1052,
|
||||
CG_FLOAT2x1 = 1053,
|
||||
CG_FLOAT2x2 = 1054,
|
||||
CG_FLOAT2x3 = 1055,
|
||||
CG_FLOAT2x4 = 1056,
|
||||
CG_FLOAT3x1 = 1057,
|
||||
CG_FLOAT3x2 = 1058,
|
||||
CG_FLOAT3x3 = 1059,
|
||||
CG_FLOAT3x4 = 1060,
|
||||
CG_FLOAT4x1 = 1061,
|
||||
CG_FLOAT4x2 = 1062,
|
||||
CG_FLOAT4x3 = 1063,
|
||||
CG_FLOAT4x4 = 1064,
|
||||
CG_HALF = 1025,
|
||||
CG_HALF1 = 1090,
|
||||
CG_HALF2 = 1026,
|
||||
CG_HALF3 = 1027,
|
||||
CG_HALF4 = 1028,
|
||||
CG_HALF1x1 = 1029,
|
||||
CG_HALF1x2 = 1030,
|
||||
CG_HALF1x3 = 1031,
|
||||
CG_HALF1x4 = 1032,
|
||||
CG_HALF2x1 = 1033,
|
||||
CG_HALF2x2 = 1034,
|
||||
CG_HALF2x3 = 1035,
|
||||
CG_HALF2x4 = 1036,
|
||||
CG_HALF3x1 = 1037,
|
||||
CG_HALF3x2 = 1038,
|
||||
CG_HALF3x3 = 1039,
|
||||
CG_HALF3x4 = 1040,
|
||||
CG_HALF4x1 = 1041,
|
||||
CG_HALF4x2 = 1042,
|
||||
CG_HALF4x3 = 1043,
|
||||
CG_HALF4x4 = 1044,
|
||||
CG_INT = 1093,
|
||||
CG_INT1 = 1094,
|
||||
CG_INT2 = 1095,
|
||||
CG_INT3 = 1096,
|
||||
CG_INT4 = 1097,
|
||||
CG_INT1x1 = 1098,
|
||||
CG_INT1x2 = 1099,
|
||||
CG_INT1x3 = 1100,
|
||||
CG_INT1x4 = 1101,
|
||||
CG_INT2x1 = 1102,
|
||||
CG_INT2x2 = 1103,
|
||||
CG_INT2x3 = 1104,
|
||||
CG_INT2x4 = 1105,
|
||||
CG_INT3x1 = 1106,
|
||||
CG_INT3x2 = 1107,
|
||||
CG_INT3x3 = 1108,
|
||||
CG_INT3x4 = 1109,
|
||||
CG_INT4x1 = 1110,
|
||||
CG_INT4x2 = 1111,
|
||||
CG_INT4x3 = 1112,
|
||||
CG_INT4x4 = 1113,
|
||||
CG_LONG = 1271,
|
||||
CG_LONG1 = 1272,
|
||||
CG_LONG2 = 1273,
|
||||
CG_LONG3 = 1274,
|
||||
CG_LONG4 = 1275,
|
||||
CG_LONG1x1 = 1276,
|
||||
CG_LONG1x2 = 1277,
|
||||
CG_LONG1x3 = 1278,
|
||||
CG_LONG1x4 = 1279,
|
||||
CG_LONG2x1 = 1280,
|
||||
CG_LONG2x2 = 1281,
|
||||
CG_LONG2x3 = 1282,
|
||||
CG_LONG2x4 = 1283,
|
||||
CG_LONG3x1 = 1284,
|
||||
CG_LONG3x2 = 1285,
|
||||
CG_LONG3x3 = 1286,
|
||||
CG_LONG3x4 = 1287,
|
||||
CG_LONG4x1 = 1288,
|
||||
CG_LONG4x2 = 1289,
|
||||
CG_LONG4x3 = 1290,
|
||||
CG_LONG4x4 = 1291,
|
||||
CG_SHORT = 1208,
|
||||
CG_SHORT1 = 1209,
|
||||
CG_SHORT2 = 1210,
|
||||
CG_SHORT3 = 1211,
|
||||
CG_SHORT4 = 1212,
|
||||
CG_SHORT1x1 = 1213,
|
||||
CG_SHORT1x2 = 1214,
|
||||
CG_SHORT1x3 = 1215,
|
||||
CG_SHORT1x4 = 1216,
|
||||
CG_SHORT2x1 = 1217,
|
||||
CG_SHORT2x2 = 1218,
|
||||
CG_SHORT2x3 = 1219,
|
||||
CG_SHORT2x4 = 1220,
|
||||
CG_SHORT3x1 = 1221,
|
||||
CG_SHORT3x2 = 1222,
|
||||
CG_SHORT3x3 = 1223,
|
||||
CG_SHORT3x4 = 1224,
|
||||
CG_SHORT4x1 = 1225,
|
||||
CG_SHORT4x2 = 1226,
|
||||
CG_SHORT4x3 = 1227,
|
||||
CG_SHORT4x4 = 1228,
|
||||
CG_UCHAR = 1187,
|
||||
CG_UCHAR1 = 1188,
|
||||
CG_UCHAR2 = 1189,
|
||||
CG_UCHAR3 = 1190,
|
||||
CG_UCHAR4 = 1191,
|
||||
CG_UCHAR1x1 = 1192,
|
||||
CG_UCHAR1x2 = 1193,
|
||||
CG_UCHAR1x3 = 1194,
|
||||
CG_UCHAR1x4 = 1195,
|
||||
CG_UCHAR2x1 = 1196,
|
||||
CG_UCHAR2x2 = 1197,
|
||||
CG_UCHAR2x3 = 1198,
|
||||
CG_UCHAR2x4 = 1199,
|
||||
CG_UCHAR3x1 = 1200,
|
||||
CG_UCHAR3x2 = 1201,
|
||||
CG_UCHAR3x3 = 1202,
|
||||
CG_UCHAR3x4 = 1203,
|
||||
CG_UCHAR4x1 = 1204,
|
||||
CG_UCHAR4x2 = 1205,
|
||||
CG_UCHAR4x3 = 1206,
|
||||
CG_UCHAR4x4 = 1207,
|
||||
CG_UINT = 1250,
|
||||
CG_UINT1 = 1251,
|
||||
CG_UINT2 = 1252,
|
||||
CG_UINT3 = 1253,
|
||||
CG_UINT4 = 1254,
|
||||
CG_UINT1x1 = 1255,
|
||||
CG_UINT1x2 = 1256,
|
||||
CG_UINT1x3 = 1257,
|
||||
CG_UINT1x4 = 1258,
|
||||
CG_UINT2x1 = 1259,
|
||||
CG_UINT2x2 = 1260,
|
||||
CG_UINT2x3 = 1261,
|
||||
CG_UINT2x4 = 1262,
|
||||
CG_UINT3x1 = 1263,
|
||||
CG_UINT3x2 = 1264,
|
||||
CG_UINT3x3 = 1265,
|
||||
CG_UINT3x4 = 1266,
|
||||
CG_UINT4x1 = 1267,
|
||||
CG_UINT4x2 = 1268,
|
||||
CG_UINT4x3 = 1269,
|
||||
CG_UINT4x4 = 1270,
|
||||
CG_ULONG = 1292,
|
||||
CG_ULONG1 = 1293,
|
||||
CG_ULONG2 = 1294,
|
||||
CG_ULONG3 = 1295,
|
||||
CG_ULONG4 = 1296,
|
||||
CG_ULONG1x1 = 1297,
|
||||
CG_ULONG1x2 = 1298,
|
||||
CG_ULONG1x3 = 1299,
|
||||
CG_ULONG1x4 = 1300,
|
||||
CG_ULONG2x1 = 1301,
|
||||
CG_ULONG2x2 = 1302,
|
||||
CG_ULONG2x3 = 1303,
|
||||
CG_ULONG2x4 = 1304,
|
||||
CG_ULONG3x1 = 1305,
|
||||
CG_ULONG3x2 = 1306,
|
||||
CG_ULONG3x3 = 1307,
|
||||
CG_ULONG3x4 = 1308,
|
||||
CG_ULONG4x1 = 1309,
|
||||
CG_ULONG4x2 = 1310,
|
||||
CG_ULONG4x3 = 1311,
|
||||
CG_ULONG4x4 = 1312,
|
||||
CG_USHORT = 1229,
|
||||
CG_USHORT1 = 1230,
|
||||
CG_USHORT2 = 1231,
|
||||
CG_USHORT3 = 1232,
|
||||
CG_USHORT4 = 1233,
|
||||
CG_USHORT1x1 = 1234,
|
||||
CG_USHORT1x2 = 1235,
|
||||
CG_USHORT1x3 = 1236,
|
||||
CG_USHORT1x4 = 1237,
|
||||
CG_USHORT2x1 = 1238,
|
||||
CG_USHORT2x2 = 1239,
|
||||
CG_USHORT2x3 = 1240,
|
||||
CG_USHORT2x4 = 1241,
|
||||
CG_USHORT3x1 = 1242,
|
||||
CG_USHORT3x2 = 1243,
|
||||
CG_USHORT3x3 = 1244,
|
||||
CG_USHORT3x4 = 1245,
|
||||
CG_USHORT4x1 = 1246,
|
||||
CG_USHORT4x2 = 1247,
|
||||
CG_USHORT4x3 = 1248,
|
||||
CG_USHORT4x4 = 1249
|
||||
} CGtype;
|
||||
typedef int CGbool;
|
||||
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;
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue