mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
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:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user