a lot of modifications here :)

first fixed scaling when updating backbuffer to make it friendly with encoders, now frame dumping must work without errors in any codec.
clean screenshot and frame dumping code now is more correct, faster and stable.
improve safe texture cache, improving the distribution of the hash algorithm, including tlut hash in the final hash of the texture, and making use of a 64 bit hash to make it more accurate.
clean a lot of code and corrected some missused vertex formats when drawing full screen quads.
and biggest change last:
implemented pseudo antialiasing: a image post-process algorithm that mimics antialiazing and is fare more easier to implement in this scenario.
you can change the intensity of the effect changing the values of the antialiasing combo. the right value depends on the game.
for example mkwii looks awesome with 8x.
please try all the changes and let me know the results.
if something is broken, please let me know and will fix it asap.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5000 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2010-02-03 03:52:50 +00:00
parent afbf86eaee
commit 9e2bbec47f
17 changed files with 354 additions and 172 deletions

View File

@ -41,6 +41,8 @@ const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
static float GC_ALIGNED16(lastVSconstants[C_FOGPARAMS + 8][4]);
static LPDIRECT3DVERTEXSHADER9 SimpleVertexShader;
static LPDIRECT3DVERTEXSHADER9 FSAAVertexShader;
LinearDiskCache g_vs_disk_cache;
LPDIRECT3DVERTEXSHADER9 VertexShaderCache::GetSimpleVertexShader()
@ -48,6 +50,11 @@ LPDIRECT3DVERTEXSHADER9 VertexShaderCache::GetSimpleVertexShader()
return SimpleVertexShader;
}
LPDIRECT3DVERTEXSHADER9 VertexShaderCache::GetFSAAVertexShader()
{
return FSAAVertexShader;
}
void SetVSConstant4f(int const_number, float f1, float f2, float f3, float f4)
{
if (lastVSconstants[const_number][0] != f1 ||
@ -152,22 +159,51 @@ void VertexShaderCache::Init()
sprintf(vSimpleProg,"struct VSOUTPUT\n"
"{\n"
"float4 vPosition : POSITION;\n"
"float4 Color : COLOR0;\n"
"float4 vTexCoord : TEXCOORD0;\n"
"float4 vTexCoord1 : TEXCOORD1;\n"
"float4 vColor0 : COLOR0;\n"
"float2 vTexCoord : TEXCOORD0;\n"
"};\n"
"VSOUTPUT main( float4 inPosition : POSITION, float4 inUV : TEXCOORD0,float4 inColor : COLOR0)\n"
"void main(out VSOUTPUT OUT,in float4 inPosition : POSITION,in float2 inTEX0 : TEXCOORD0,in float4 inColor0: COLOR0)\n"
"{\n"
"VSOUTPUT OUT = (VSOUTPUT)0;\n"
"OUT.vPosition = inPosition;\n"
"OUT.Color = inColor;\n"
"OUT.vTexCoord = inUV;\n"
"OUT.vTexCoord1 = inPosition.zzzz;\n"
"return OUT;\n"
"OUT.vPosition = inPosition;\n"
"OUT.vColor0 = inColor0;\n"
"OUT.vTexCoord = inTEX0;\n"
"}\n");
SimpleVertexShader = D3D::CompileAndCreateVertexShader(vSimpleProg, (int)strlen(vSimpleProg));
char *vFSAAProg = new char[2048];
sprintf(vFSAAProg, "struct VSOUTPUT\n"
"{\n"
"float4 vPosition : POSITION;\n"
"float4 vColor0 : COLOR0;\n"
"float4 vTexCoord : TEXCOORD0;\n"
"float4 vTexCoord1 : TEXCOORD1;\n"
"float4 vTexCoord2 : TEXCOORD2;\n"
"float4 vTexCoord3 : TEXCOORD3;\n"
"float4 vTexCoord4 : TEXCOORD4;\n"
"float2 vTexCoord5 : TEXCOORD5;\n"
"float2 vTexCoord6 : TEXCOORD6;\n"
"float2 vTexCoord7 : TEXCOORD7;\n"
"};\n"
"void main( out VSOUTPUT OUT,in float4 inPosition : POSITION,in float2 inTEX0 : TEXCOORD0,in float2 inTEX1 : TEXCOORD1,in float2 inTEX2 : TEXCOORD2)\n"
"{\n"
"OUT.vPosition = inPosition;\n"
"OUT.vColor0 = float4(inTEX2.x / inTEX2.y,0.0f,0.0f,0.0f);\n"
"OUT.vTexCoord = inTEX0.xyyx + (float4(-1.0f,-1.0f,-0.45f,-0.45f) * inTEX1.xyyx);\n"
"OUT.vTexCoord1 = inTEX0.xyyx + (float4( 0.0f,-1.0f,-0.45f, 0.45f) * inTEX1.xyyx);\n"
"OUT.vTexCoord2 = inTEX0.xyyx + (float4( 1.0f,-1.0f, 0.45f,-0.45f) * inTEX1.xyyx);\n"
"OUT.vTexCoord3 = inTEX0.xyyx + (float4(-1.0f, 1.0f, 0.45f, 0.45f) * inTEX1.xyyx);\n"
"OUT.vTexCoord4 = inTEX0.xyyx + (float4( 0.0f, 1.0f, 0.0f, 0.0f) * inTEX1.xyyx);\n"
"OUT.vTexCoord5 = inTEX0 + (float2( 1.0f, 1.0f) * inTEX1);\n"
"OUT.vTexCoord6 = inTEX0 + (float2( 1.0f, 0.0f) * inTEX1);\n"
"OUT.vTexCoord7 = inTEX0 + (float2(-1.0f, 0.0f) * inTEX1);\n"
"}\n");
FSAAVertexShader = D3D::CompileAndCreateVertexShader(vFSAAProg, (int)strlen(vFSAAProg));
Clear();
delete [] vFSAAProg;
delete [] vSimpleProg;
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
@ -195,6 +231,10 @@ void VertexShaderCache::Shutdown()
{
if (SimpleVertexShader)
SimpleVertexShader->Release();
SimpleVertexShader = NULL;
if (FSAAVertexShader)
FSAAVertexShader->Release();
FSAAVertexShader = NULL;
Clear();
g_vs_disk_cache.Sync();
g_vs_disk_cache.Close();