2018-11-16 00:31:39 +01: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 15:21:37 +01:00
|
|
|
|
2011-07-02 04:25:13 +02:00
|
|
|
#ifndef CGGLCG_H
|
|
|
|
#define CGGLCG_H
|
|
|
|
|
|
|
|
#include <windows.h>
|
2018-05-20 17:25:39 +02:00
|
|
|
#include "gl_core_3_1.h"
|
2011-07-02 04:25:13 +02:00
|
|
|
#include "cgFunctions.h"
|
|
|
|
#include "CCGShader.h"
|
|
|
|
#include <vector>
|
2011-12-10 15:21:37 +01:00
|
|
|
#include <deque>
|
2018-08-07 01:16:41 +02:00
|
|
|
#include "image_functions.h"
|
2011-07-02 04:25:13 +02:00
|
|
|
|
|
|
|
typedef struct _xySize {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
} xySize;
|
|
|
|
|
|
|
|
class CGLCG
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef struct _shaderPass {
|
|
|
|
cgScaleParams scaleParams;
|
|
|
|
bool linearFilter;
|
2013-03-26 15:39:17 +01:00
|
|
|
unsigned frameCounterMod;
|
2013-03-26 16:09:01 +01:00
|
|
|
bool floatFbo;
|
2011-07-02 04:25:13 +02: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 15:21:37 +01:00
|
|
|
typedef struct _prevPass {
|
|
|
|
GLuint tex;
|
|
|
|
xySize videoSize;
|
|
|
|
xySize textureSize;
|
|
|
|
GLfloat texCoords[8];
|
|
|
|
_prevPass() {tex=0;}
|
|
|
|
} prevPass;
|
2011-07-02 04:25:13 +02:00
|
|
|
typedef struct _lookupTexture {
|
|
|
|
char id[PATH_MAX];
|
|
|
|
GLuint tex;
|
|
|
|
_lookupTexture() {tex=NULL;}
|
|
|
|
} lookupTexture;
|
|
|
|
|
2011-07-03 23:12:41 +02:00
|
|
|
typedef std::vector<shaderPass> glPassVector;
|
|
|
|
typedef std::vector<lookupTexture> glLutVector;
|
2011-12-10 15:21:37 +01:00
|
|
|
typedef std::deque<prevPass> glPrevDeque;
|
|
|
|
typedef std::vector<CGparameter> glAttribParams;
|
2011-07-03 23:12:41 +02:00
|
|
|
glPassVector shaderPasses;
|
|
|
|
glLutVector lookupTextures;
|
2011-12-10 15:21:37 +01:00
|
|
|
glPrevDeque prevPasses;
|
|
|
|
glAttribParams cgAttribParams;
|
2011-07-02 04:25:13 +02: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 15:21:37 +01:00
|
|
|
void resetAttribParams();
|
2011-07-02 04:25:13 +02:00
|
|
|
|
|
|
|
CGcontext cgContext;
|
2013-03-26 15:39:17 +01:00
|
|
|
unsigned int frameCnt;
|
2011-07-02 04:25:13 +02:00
|
|
|
static const GLfloat lut_coords[8];
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
CGLCG(CGcontext cgContext);
|
|
|
|
~CGLCG(void);
|
|
|
|
|
|
|
|
bool LoadShader(const TCHAR *shaderFile);
|
2011-07-03 23:12:41 +02:00
|
|
|
void Render(GLuint &origTex, xySize textureSize, xySize inputSize, xySize viewportSize, xySize windowSize);
|
2011-07-02 04:25:13 +02:00
|
|
|
void ClearPasses();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|