Add in GLSL setting again.

PS and VS making. Untested and won't work for now.

Add in program shader cache files.

Readd NativeVertexFormat stuffs.

Add in PS and VS cache things.

SetShaders in places.

Fixed EFB cache index computations in OpenGL renderer.

The previous computation was very likely to go out of array bounds,
which could result in crashes on EFB access.

Also, the cache size was rounded down instead of up. This is a problem
since EFB_HEIGHT (528) is not a multiple of EFB_CACHE_RECT_SIZE (64).
This commit is contained in:
Ryan Houdek
2011-11-30 21:00:21 -06:00
committed by Sonicadvance1
parent 3990002250
commit a357c77257
20 changed files with 1168 additions and 505 deletions

View File

@ -33,6 +33,7 @@
#include "PixelShaderManager.h"
#include "VertexShaderCache.h"
#include "VertexShaderManager.h"
#include "ProgramShaderCache.h"
#include "VertexShaderGen.h"
#include "VertexLoader.h"
#include "VertexManager.h"
@ -168,10 +169,6 @@ void VertexManager::vFlush()
}
}
// set global constants
VertexShaderManager::SetConstants();
PixelShaderManager::SetConstants();
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
&& bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
@ -204,8 +201,18 @@ void VertexManager::vFlush()
FRAGMENTSHADER* ps = PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components);
#endif
VERTEXSHADER* vs = VertexShaderCache::SetShader(g_nativeVertexFmt->m_components);
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here.
if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);
if(g_ActiveConfig.bUseGLSL)
ProgramShaderCache::SetBothShaders(ps->glprogid, vs->glprogid);
else
{
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid); // Lego Star Wars crashes here.
if (vs) VertexShaderCache::SetCurrentShader(vs->glprogid);
}
// set global constants
VertexShaderManager::SetConstants();
PixelShaderManager::SetConstants();
Draw();
@ -213,7 +220,13 @@ void VertexManager::vFlush()
if (useDstAlpha && !dualSourcePossible)
{
ps = PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS,g_nativeVertexFmt->m_components);
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
if(g_ActiveConfig.bUseGLSL)
{
ProgramShaderCache::SetBothShaders(ps->glprogid, 0);
PixelShaderManager::SetConstants(); // Need to set these again
}
else
if (ps) PixelShaderCache::SetCurrentShader(ps->glprogid);
// only update alpha
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);