Split a couple of huge files up, to make them easier to handle.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@24 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-17 21:09:18 +00:00
parent af0e52554e
commit 91ccda69ef
18 changed files with 1696 additions and 1574 deletions

View File

@ -18,7 +18,6 @@
#ifndef GCOGL_VERTEXSHADER_H
#define GCOGL_VERTEXSHADER_H
#include <map>
/////////////
// Lighting
@ -226,99 +225,7 @@ struct VERTEXSHADER
#endif
};
class VertexShaderMngr
{
struct VSCacheEntry
{
VERTEXSHADER shader;
int frameCount;
VSCacheEntry() : frameCount(0) {}
void Destroy() {
SAFE_RELEASE_PROG(shader.glprogid);
}
};
class VERTEXSHADERUID
{
public:
VERTEXSHADERUID() {}
VERTEXSHADERUID(const VERTEXSHADERUID& r) {
for(size_t i = 0; i < sizeof(values) / sizeof(u32); ++i)
values[i] = r.values[i];
}
bool operator<(const VERTEXSHADERUID& _Right) const
{
if( values[0] < _Right.values[0] )
return true;
else if( values[0] > _Right.values[0] )
return false;
int N = (((values[0]>>23)&0xf)*3+3)/4 + 3; // numTexGens*3/4+1
for(int i = 1; i < N; ++i) {
if( values[i] < _Right.values[i] )
return true;
else if( values[i] > _Right.values[i] )
return false;
}
return false;
}
bool operator==(const VERTEXSHADERUID& _Right) const
{
if( values[0] != _Right.values[0] )
return false;
int N = (((values[0]>>23)&0xf)*3+3)/4 + 3; // numTexGens*3/4+1
for(int i = 1; i < N; ++i) {
if( values[i] != _Right.values[i] )
return false;
}
return true;
}
u32 values[9];
};
typedef std::map<VERTEXSHADERUID,VSCacheEntry> VSCache;
static VSCache vshaders;
static VERTEXSHADER* pShaderLast;
static TMatrixIndexA MatrixIndexA;
static TMatrixIndexB MatrixIndexB;
static void GetVertexShaderId(VERTEXSHADERUID& uid, u32 components);
static bool GenerateVertexShader(VERTEXSHADER& vs, u32 components);
static char* GenerateLightShader(char* p, int index, const LitChannel& chan, const char* dest, int coloralpha);
public:
static void Init();
static void Cleanup();
static void Shutdown();
static VERTEXSHADER* GetShader(u32 components);
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
// constant management
static void SetConstants(VERTEXSHADER& vs);
static void SetViewport(float* _Viewport);
static void SetViewportChanged();
static void SetProjection(float* _pProjection, int constantIndex = -1);
static void InvalidateXFRange(int start, int end);
static void SetTexMatrixChangedA(u32 Value);
static void SetTexMatrixChangedB(u32 Value);
static size_t SaveLoadState(char *ptr, BOOL save);
static void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
static void LoadIndexedXF(u32 val, int array);
static float* GetPosNormalMat();
static float rawViewport[6];
static float rawProjection[7];
};
bool GenerateVertexShader(VERTEXSHADER& vs, u32 components);
extern XFRegisters xfregs;