mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: only compile useful VS
logz is a constant wildhack is only compatbile with TME/FST Compilation goes down from 64 to 20 vertex shaders.
This commit is contained in:
parent
16e6d0d305
commit
6124eb844e
|
@ -653,10 +653,10 @@ void GSDeviceOGL::Barrier(GLbitfield b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: must be here because tfx_glsl is static */
|
/* Note: must be here because tfx_glsl is static */
|
||||||
GLuint GSDeviceOGL::CompileVS(VSSelector sel)
|
GLuint GSDeviceOGL::CompileVS(VSSelector sel, int logz)
|
||||||
{
|
{
|
||||||
std::string macro = format("#define VS_BPPZ %d\n", sel.bppz)
|
std::string macro = format("#define VS_BPPZ %d\n", sel.bppz)
|
||||||
+ format("#define VS_LOGZ %d\n", sel.logz)
|
+ format("#define VS_LOGZ %d\n", logz)
|
||||||
+ format("#define VS_TME %d\n", sel.tme)
|
+ format("#define VS_TME %d\n", sel.tme)
|
||||||
+ format("#define VS_FST %d\n", sel.fst)
|
+ format("#define VS_FST %d\n", sel.fst)
|
||||||
+ format("#define VS_WILDHACK %d\n", sel.wildhack)
|
+ format("#define VS_WILDHACK %d\n", sel.wildhack)
|
||||||
|
|
|
@ -275,7 +275,6 @@ class GSDeviceOGL : public GSDevice
|
||||||
{
|
{
|
||||||
uint32 wildhack:1;
|
uint32 wildhack:1;
|
||||||
uint32 bppz:2;
|
uint32 bppz:2;
|
||||||
uint32 logz:1;
|
|
||||||
// Next param will be handle by subroutine
|
// Next param will be handle by subroutine
|
||||||
uint32 tme:1;
|
uint32 tme:1;
|
||||||
uint32 fst:1;
|
uint32 fst:1;
|
||||||
|
@ -284,12 +283,12 @@ class GSDeviceOGL : public GSDevice
|
||||||
uint32 key;
|
uint32 key;
|
||||||
};
|
};
|
||||||
|
|
||||||
operator uint32() {return key & 0x7f;}
|
operator uint32() {return key & 0x3f;}
|
||||||
|
|
||||||
VSSelector() : key(0) {}
|
VSSelector() : key(0) {}
|
||||||
VSSelector(uint32 k) : key(k) {}
|
VSSelector(uint32 k) : key(k) {}
|
||||||
|
|
||||||
static uint32 size() { return 1 << 6; }
|
static uint32 size() { return 1 << 5; }
|
||||||
};
|
};
|
||||||
|
|
||||||
__aligned(struct, 32) PSConstantBuffer
|
__aligned(struct, 32) PSConstantBuffer
|
||||||
|
@ -612,7 +611,7 @@ class GSDeviceOGL : public GSDevice
|
||||||
void OMSetWriteBuffer(GLenum buffer = GL_COLOR_ATTACHMENT0);
|
void OMSetWriteBuffer(GLenum buffer = GL_COLOR_ATTACHMENT0);
|
||||||
|
|
||||||
void CreateTextureFX();
|
void CreateTextureFX();
|
||||||
GLuint CompileVS(VSSelector sel);
|
GLuint CompileVS(VSSelector sel, int logz);
|
||||||
GLuint CompileGS();
|
GLuint CompileGS();
|
||||||
GLuint CompilePS(PSSelector sel);
|
GLuint CompilePS(PSSelector sel);
|
||||||
GLuint CreateSampler(bool bilinear, bool tau, bool tav);
|
GLuint CreateSampler(bool bilinear, bool tau, bool tav);
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
GSRendererOGL::GSRendererOGL()
|
GSRendererOGL::GSRendererOGL()
|
||||||
: GSRendererHW(new GSTextureCacheOGL(this))
|
: GSRendererHW(new GSTextureCacheOGL(this))
|
||||||
{
|
{
|
||||||
m_logz = !!theApp.GetConfig("logz", 1);
|
|
||||||
m_fba = !!theApp.GetConfig("fba", 1);
|
m_fba = !!theApp.GetConfig("fba", 1);
|
||||||
UserHacks_AlphaHack = !!theApp.GetConfig("UserHacks_AlphaHack", 0) && !!theApp.GetConfig("UserHacks", 0);
|
UserHacks_AlphaHack = !!theApp.GetConfig("UserHacks_AlphaHack", 0) && !!theApp.GetConfig("UserHacks", 0);
|
||||||
UserHacks_AlphaStencil = !!theApp.GetConfig("UserHacks_AlphaStencil", 0) && !!theApp.GetConfig("UserHacks", 0);
|
UserHacks_AlphaStencil = !!theApp.GetConfig("UserHacks_AlphaStencil", 0) && !!theApp.GetConfig("UserHacks", 0);
|
||||||
|
@ -262,7 +261,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
|
||||||
|
|
||||||
vs_sel.tme = PRIM->TME;
|
vs_sel.tme = PRIM->TME;
|
||||||
vs_sel.fst = PRIM->FST;
|
vs_sel.fst = PRIM->FST;
|
||||||
vs_sel.logz = m_logz ? 1 : 0;
|
|
||||||
vs_sel.wildhack = (UserHacks_WildHack && !isPackedUV_HackFlag) ? 1 : 0;
|
vs_sel.wildhack = (UserHacks_WildHack && !isPackedUV_HackFlag) ? 1 : 0;
|
||||||
|
|
||||||
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
|
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
|
||||||
|
|
|
@ -35,7 +35,6 @@ class GSRendererOGL : public GSRendererHW
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GSVector2 m_pixelcenter;
|
GSVector2 m_pixelcenter;
|
||||||
bool m_logz;
|
|
||||||
bool m_fba;
|
bool m_fba;
|
||||||
bool UserHacks_AlphaHack;
|
bool UserHacks_AlphaHack;
|
||||||
bool UserHacks_AlphaStencil;
|
bool UserHacks_AlphaStencil;
|
||||||
|
|
|
@ -263,7 +263,7 @@ void GSShaderOGL::UseProgram()
|
||||||
hash_map<uint64, GLuint >::iterator it;
|
hash_map<uint64, GLuint >::iterator it;
|
||||||
// Note: shader are integer lookup pointer. They start from 1 and incr
|
// Note: shader are integer lookup pointer. They start from 1 and incr
|
||||||
// every time you create a new shader OR a new program.
|
// every time you create a new shader OR a new program.
|
||||||
// Note2: vs & gs are precompiled at startup. FGLRX and radeon got value < 128.
|
// Note2: vs & gs are precompiled at startup. FGLRX and radeon got value < 128. GS has only 2 programs
|
||||||
// We migth be able to pack the value in a 32bits int
|
// We migth be able to pack the value in a 32bits int
|
||||||
// I would need to check the behavior on Nvidia (pause/resume).
|
// I would need to check the behavior on Nvidia (pause/resume).
|
||||||
uint64 sel = (uint64)GLState::vs << 40 | (uint64)GLState::gs << 20 | GLState::ps;
|
uint64 sel = (uint64)GLState::vs << 40 | (uint64)GLState::gs << 20 | GLState::ps;
|
||||||
|
|
|
@ -39,8 +39,15 @@ void GSDeviceOGL::CreateTextureFX()
|
||||||
// It might cost a seconds at startup but it would reduce benchmark pollution
|
// It might cost a seconds at startup but it would reduce benchmark pollution
|
||||||
m_gs = CompileGS();
|
m_gs = CompileGS();
|
||||||
|
|
||||||
for (uint32 key = 0; key < VSSelector::size(); key++)
|
int logz = theApp.GetConfig("logz", 1);
|
||||||
m_vs[key] = CompileVS(VSSelector(key));
|
for (uint32 key = 0; key < VSSelector::size(); key++) {
|
||||||
|
// wildhack is only useful if both TME and FST are enabled.
|
||||||
|
VSSelector sel(key);
|
||||||
|
if (sel.wildhack && (!sel.tme || !sel.fst))
|
||||||
|
m_vs[key] = 0;
|
||||||
|
else
|
||||||
|
m_vs[key] = CompileVS(sel, logz);
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++)
|
for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++)
|
||||||
m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));
|
m_om_dss[key] = CreateDepthStencil(OMDepthStencilSelector(key));
|
||||||
|
|
Loading…
Reference in New Issue