Win32: add frame counter to cg shader vars (Themaister)
This commit is contained in:
parent
54d8e77a96
commit
acfe6a53cc
@ -221,6 +221,7 @@ CDirect3D::CDirect3D()
|
||||
shaderTimer = 1.0f;
|
||||
shaderTimeStart = 0;
|
||||
shaderTimeElapsed = 0;
|
||||
frameCount = 0;
|
||||
cgContext = NULL;
|
||||
cgVertexProgram = cgFragmentProgram = NULL;
|
||||
cgAvailable = false;
|
||||
@ -649,11 +650,13 @@ void CDirect3D::SetShaderVars()
|
||||
D3DXVECTOR2 videoSize;
|
||||
D3DXVECTOR2 textureSize;
|
||||
D3DXVECTOR2 outputSize;
|
||||
float frameCnt;
|
||||
videoSize.x = (float)afterRenderWidth;
|
||||
videoSize.y = (float)afterRenderHeight;
|
||||
textureSize.x = textureSize.y = (float)quadTextureSize;
|
||||
outputSize.x = GUI.Stretch?(float)dPresentParams.BackBufferWidth:(float)afterRenderWidth;
|
||||
outputSize.y = GUI.Stretch?(float)dPresentParams.BackBufferHeight:(float)afterRenderHeight;
|
||||
frameCnt = (float)++frameCount;
|
||||
|
||||
#define setProgramUniform(program,varname,floats)\
|
||||
{\
|
||||
@ -665,10 +668,13 @@ void CDirect3D::SetShaderVars()
|
||||
setProgramUniform(cgFragmentProgram,"IN.video_size",&videoSize);
|
||||
setProgramUniform(cgFragmentProgram,"IN.texture_size",&textureSize);
|
||||
setProgramUniform(cgFragmentProgram,"IN.output_size",&outputSize);
|
||||
setProgramUniform(cgFragmentProgram,"IN.frame_count",&frameCnt);
|
||||
|
||||
setProgramUniform(cgVertexProgram,"IN.video_size",&videoSize);
|
||||
setProgramUniform(cgVertexProgram,"IN.texture_size",&textureSize);
|
||||
setProgramUniform(cgVertexProgram,"IN.output_size",&outputSize);
|
||||
setProgramUniform(cgVertexProgram,"IN.frame_count",&frameCnt);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,6 +230,7 @@ private:
|
||||
float shaderTimer;
|
||||
int shaderTimeStart;
|
||||
int shaderTimeElapsed;
|
||||
int frameCount;
|
||||
|
||||
bool BlankTexture(LPDIRECT3DTEXTURE9 texture);
|
||||
void CreateDrawSurface();
|
||||
|
@ -210,6 +210,7 @@ COpenGL::COpenGL(void)
|
||||
cgContext = NULL;
|
||||
cgVertexProgram = cgFragmentProgram = NULL;
|
||||
cgAvailable = false;
|
||||
frameCount = 0;
|
||||
}
|
||||
|
||||
COpenGL::~COpenGL(void)
|
||||
@ -452,6 +453,7 @@ void COpenGL::Render(SSurface Src)
|
||||
float outputSize[2] = {(float)(GUI.Stretch?windowSize.right:afterRenderWidth),
|
||||
(float)(GUI.Stretch?windowSize.bottom:afterRenderHeight) };
|
||||
float textureSize[2] = { (float)quadTextureSize, (float)quadTextureSize };
|
||||
float frameCnt = (float)++frameCount;
|
||||
|
||||
if(shader_type == OGL_SHADER_GLSL) {
|
||||
location = glGetUniformLocation (shaderProgram, "rubyInputSize");
|
||||
@ -474,12 +476,21 @@ void COpenGL::Render(SSurface Src)
|
||||
cgGLSetParameter2fv(cgp,floats);\
|
||||
}\
|
||||
|
||||
#define setProgram1f(program,varname,val)\
|
||||
{\
|
||||
CGparameter cgp = cgGetNamedParameter(program, varname);\
|
||||
if(cgp)\
|
||||
cgGLSetParameter1f(cgp,val);\
|
||||
}\
|
||||
|
||||
setProgram2fv(cgFragmentProgram,"IN.video_size",inputSize);
|
||||
setProgram2fv(cgFragmentProgram,"IN.texture_size",textureSize);
|
||||
setProgram2fv(cgFragmentProgram,"IN.output_size",outputSize);
|
||||
setProgram1f(cgFragmentProgram,"IN.frame_count",frameCnt);
|
||||
setProgram2fv(cgVertexProgram,"IN.video_size",inputSize);
|
||||
setProgram2fv(cgVertexProgram,"IN.texture_size",textureSize);
|
||||
setProgram2fv(cgVertexProgram,"IN.output_size",outputSize);
|
||||
setProgram1f(cgVertexProgram,"IN.frame_count",frameCnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +202,8 @@ private:
|
||||
GLfloat texcoords[8];
|
||||
unsigned char * noPboBuffer;
|
||||
|
||||
int frameCount;
|
||||
|
||||
bool initDone;
|
||||
bool fullscreen;
|
||||
unsigned int quadTextureSize;
|
||||
|
@ -204,6 +204,7 @@ CGD3DSU cgD3D9SetUniform = NULL;
|
||||
//cggl.dll
|
||||
CGGLSSMP cgGLSetStateMatrixParameter = NULL;
|
||||
CGGLSP2FV cgGLSetParameter2fv = NULL;
|
||||
CGGLSP1F cgGLSetParameter1f = NULL;
|
||||
CGGLGLP cgGLGetLatestProfile = NULL;
|
||||
CGGLEP cgGLEnableProfile = NULL;
|
||||
CGGLDP cgGLDisableProfile = NULL;
|
||||
@ -248,6 +249,7 @@ bool loadCgFunctions()
|
||||
//cggl.dll
|
||||
cgGLSetStateMatrixParameter = (CGGLSSMP)GetProcAddress(hCgGLDll,"cgGLSetStateMatrixParameter");
|
||||
cgGLSetParameter2fv = (CGGLSP2FV)GetProcAddress(hCgGLDll,"cgGLSetParameter2fv");
|
||||
cgGLSetParameter1f = (CGGLSP1F)GetProcAddress(hCgGLDll,"cgGLSetParameter1f");
|
||||
cgGLGetLatestProfile = (CGGLGLP)GetProcAddress(hCgGLDll,"cgGLGetLatestProfile");
|
||||
cgGLEnableProfile = (CGGLEP)GetProcAddress(hCgGLDll,"cgGLEnableProfile");
|
||||
cgGLDisableProfile = (CGGLDP)GetProcAddress(hCgGLDll,"cgGLDisableProfile");
|
||||
@ -277,6 +279,7 @@ bool loadCgFunctions()
|
||||
//cggl.dll
|
||||
!cgGLSetStateMatrixParameter ||
|
||||
!cgGLSetParameter2fv ||
|
||||
!cgGLSetParameter1f ||
|
||||
!cgGLGetLatestProfile ||
|
||||
!cgGLEnableProfile ||
|
||||
!cgGLDisableProfile ||
|
||||
|
@ -227,6 +227,8 @@ extern CGD3DSU cgD3D9SetUniform;
|
||||
//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);
|
||||
|
Loading…
Reference in New Issue
Block a user