Big Commit this will break a lot, fix a lot, but i thing is a good step:

Implemented all the correct format conversions in efb to texture copy.
replaced all the stretcrect calls with quad draws this must improve speed a bit.
A BIGGGGGGGGGG cleanup in the code and reorganization.
reimplemented zpeek using a secondary render target ( this still is buggy so many issues left)
please a lot off feedback.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4520 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2009-11-08 20:35:11 +00:00
parent 84c6135bfd
commit 0ac07e8aa8
13 changed files with 609 additions and 197 deletions

View File

@ -34,6 +34,19 @@ PixelShaderCache::PSCache PixelShaderCache::PixelShaders;
const PixelShaderCache::PSCacheEntry *PixelShaderCache::last_entry;
static float lastPSconstants[C_COLORMATRIX+16][4];
static LPDIRECT3DPIXELSHADER9 s_ColorMatrixProgram = 0;
static LPDIRECT3DPIXELSHADER9 s_ColorCopyProgram = 0;
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorMatrixProgram()
{
return s_ColorMatrixProgram;
}
LPDIRECT3DPIXELSHADER9 PixelShaderCache::GetColorCopyProgram()
{
return s_ColorCopyProgram;
}
void SetPSConstant4f(int const_number, float f1, float f2, float f3, float f4)
{
if( lastPSconstants[const_number][0] != f1 || lastPSconstants[const_number][1] != f2 ||
@ -63,6 +76,25 @@ void SetPSConstant4fv(int const_number, const float *f)
void PixelShaderCache::Init()
{
char pmatrixprog[1024];
sprintf(pmatrixprog,"uniform sampler samp0 : register(s0);\n"
"uniform float4 cColMatrix[5] : register(c%d);\n"
"void main(\n"
"out float4 ocol0 : COLOR0,\n"
" in float3 uv0 : TEXCOORD0){\n"
"float4 texcol = tex2D(samp0,uv0.xy);\n"
"ocol0 = float4(dot(texcol,cColMatrix[0]),dot(texcol,cColMatrix[1]),dot(texcol,cColMatrix[2]),dot(texcol,cColMatrix[3])) + cColMatrix[4];\n"
"}\n",C_COLORMATRIX);
char pcopyprog[1024];
sprintf(pcopyprog,"uniform sampler samp0 : register(s0);\n"
"void main(\n"
"out float4 ocol0 : COLOR0,\n"
" in float3 uv0 : TEXCOORD0){\n"
"ocol0 = tex2D(samp0,uv0.xy);\n"
"}\n");
s_ColorMatrixProgram = D3D::CompilePixelShader(pmatrixprog, (int)strlen(pmatrixprog));
s_ColorCopyProgram = D3D::CompilePixelShader(pcopyprog, (int)strlen(pcopyprog));
Clear();
}
@ -80,6 +112,12 @@ void PixelShaderCache::Clear()
void PixelShaderCache::Shutdown()
{
if(s_ColorMatrixProgram)
s_ColorMatrixProgram->Release();
s_ColorMatrixProgram = NULL;
if(s_ColorCopyProgram)
s_ColorCopyProgram->Release();
s_ColorCopyProgram=NULL;
Clear();
}