2018-11-15 23:31:39 +00:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
2011-12-10 14:21:37 +00:00
|
|
|
|
2011-07-02 02:25:13 +00:00
|
|
|
#ifndef CGGLCG_H
|
|
|
|
#define CGGLCG_H
|
|
|
|
|
|
|
|
#include <windows.h>
|
2018-05-20 15:25:39 +00:00
|
|
|
#include "gl_core_3_1.h"
|
2011-07-02 02:25:13 +00:00
|
|
|
#include "cgFunctions.h"
|
|
|
|
#include "CCGShader.h"
|
|
|
|
#include <vector>
|
2011-12-10 14:21:37 +00:00
|
|
|
#include <deque>
|
2018-08-06 23:16:41 +00:00
|
|
|
#include "image_functions.h"
|
2011-07-02 02:25:13 +00:00
|
|
|
|
|
|
|
typedef struct _xySize {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
} xySize;
|
|
|
|
|
|
|
|
class CGLCG
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef struct _shaderPass {
|
|
|
|
cgScaleParams scaleParams;
|
|
|
|
bool linearFilter;
|
2013-03-26 14:39:17 +00:00
|
|
|
unsigned frameCounterMod;
|
2013-03-26 15:09:01 +00:00
|
|
|
bool floatFbo;
|
2011-07-02 02:25:13 +00:00
|
|
|
CGprogram cgVertexProgram, cgFragmentProgram;
|
|
|
|
GLuint tex;
|
|
|
|
GLuint fbo;
|
|
|
|
xySize outputSize;
|
|
|
|
xySize textureSize;
|
|
|
|
GLfloat texcoords[8];
|
|
|
|
_shaderPass() {cgVertexProgram=NULL;
|
|
|
|
cgFragmentProgram=NULL;
|
|
|
|
fbo=NULL;
|
|
|
|
tex=NULL;}
|
|
|
|
} shaderPass;
|
2011-12-10 14:21:37 +00:00
|
|
|
typedef struct _prevPass {
|
|
|
|
GLuint tex;
|
|
|
|
xySize videoSize;
|
|
|
|
xySize textureSize;
|
|
|
|
GLfloat texCoords[8];
|
|
|
|
_prevPass() {tex=0;}
|
|
|
|
} prevPass;
|
2011-07-02 02:25:13 +00:00
|
|
|
typedef struct _lookupTexture {
|
|
|
|
char id[PATH_MAX];
|
|
|
|
GLuint tex;
|
|
|
|
_lookupTexture() {tex=NULL;}
|
|
|
|
} lookupTexture;
|
|
|
|
|
2011-07-03 21:12:41 +00:00
|
|
|
typedef std::vector<shaderPass> glPassVector;
|
|
|
|
typedef std::vector<lookupTexture> glLutVector;
|
2011-12-10 14:21:37 +00:00
|
|
|
typedef std::deque<prevPass> glPrevDeque;
|
|
|
|
typedef std::vector<CGparameter> glAttribParams;
|
2011-07-03 21:12:41 +00:00
|
|
|
glPassVector shaderPasses;
|
|
|
|
glLutVector lookupTextures;
|
2011-12-10 14:21:37 +00:00
|
|
|
glPrevDeque prevPasses;
|
|
|
|
glAttribParams cgAttribParams;
|
2011-07-02 02:25:13 +00:00
|
|
|
|
|
|
|
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);
|
2011-12-10 14:21:37 +00:00
|
|
|
void resetAttribParams();
|
2011-07-02 02:25:13 +00:00
|
|
|
|
|
|
|
CGcontext cgContext;
|
2013-03-26 14:39:17 +00:00
|
|
|
unsigned int frameCnt;
|
2011-07-02 02:25:13 +00:00
|
|
|
static const GLfloat lut_coords[8];
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
CGLCG(CGcontext cgContext);
|
|
|
|
~CGLCG(void);
|
|
|
|
|
|
|
|
bool LoadShader(const TCHAR *shaderFile);
|
2011-07-03 21:12:41 +00:00
|
|
|
void Render(GLuint &origTex, xySize textureSize, xySize inputSize, xySize viewportSize, xySize windowSize);
|
2011-07-02 02:25:13 +00:00
|
|
|
void ClearPasses();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|