let's keep experimenting:

almost fixed real xfb in d3d, i say almost because there are some minor scalling problems. hope will fix them soon.
implemented a more intelligent index generator to emulate more accurately the behavior of the gc.
please give me feedback on this changes.
enjoy :)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5465 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado
2010-05-22 21:58:43 +00:00
parent b1a79b822d
commit 782d9111e5
7 changed files with 234 additions and 86 deletions

View File

@ -1285,14 +1285,15 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
// ---------------------------------------------------------------------
// Count FPS.
// -------------
static int fpscount = 0;
static int fpscount = 1;
static unsigned long lasttime;
++fpscount;
if(XFBWrited)
++fpscount;
if (Common::Timer::GetTimeMs() - lasttime > 1000)
{
lasttime = Common::Timer::GetTimeMs();
s_fps = fpscount - 1;
fpscount = 0;
fpscount = 1;
}
// Begin new frame
@ -1307,7 +1308,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
D3D::dev->SetDepthStencilSurface(FBManager.GetEFBDepthRTSurface());
UpdateViewport();
VertexShaderManager::SetViewportChanged();
g_VideoInitialize.pCopiedToXFB(true);
g_VideoInitialize.pCopiedToXFB(XFBWrited);
XFBWrited = false;
}

View File

@ -64,8 +64,8 @@ void CreateRgbToYuyvProgram()
" out float4 ocol0 : COLOR0,\n"
" in float2 uv0 : TEXCOORD0)\n"
"{\n"
" float2 uv1 = float2(uv0.x + (1.0f/blkDims.z), uv0.y);\n"
" float3 c0 = tex2D(samp0, uv0.xy).rgb;\n"
" float2 uv1 = float2((uv0.x + 1.0f)/ blkDims.z, uv0.y / blkDims.w);\n"
" float3 c0 = tex2D(samp0, uv0.xy / blkDims.zw).rgb;\n"
" float3 c1 = tex2D(samp0, uv1).rgb;\n"
" float3 y_const = float3(0.257f,0.504f,0.098f);\n"
" float3 u_const = float3(-0.148f,-0.291f,0.439f);\n"
@ -92,9 +92,8 @@ void CreateYuyvToRgbProgram()
" out float4 ocol0 : COLOR0,\n"
" in float2 uv0 : TEXCOORD0)\n"
"{\n"
" float4 c0 = tex2D(samp0, uv0).rgba;\n"
" float f = step(0.5, frac(uv0.x * blkDims.z));\n"
" float4 c0 = tex2D(samp0, uv0 / blkDims.zw).rgba;\n"
" float f = step(0.5, frac(uv0.x));\n"
" float y = lerp(c0.b, c0.r, f);\n"
" float yComp = 1.164f * (y - 0.0625f);\n"
" float uComp = c0.g - 0.5f;\n"
@ -443,12 +442,12 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, LPDIRECT3DTEXTURE
RECT sourcerect;
sourcerect.bottom = srcHeight;
sourcerect.left = 0;
sourcerect.left = -1;
sourcerect.right = srcFmtWidth;
sourcerect.top = 0;
sourcerect.top = -1;
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
TextureConversionShader::SetShaderParameters(
(float)srcFmtWidth,
@ -462,8 +461,8 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, LPDIRECT3DTEXTURE
D3D::drawShadedTexQuad(
s_srcTexture,
&sourcerect,
srcFmtWidth ,
srcHeight,
1 ,
1,
s_yuyvToRgbProgram,
VertexShaderCache::GetSimpleVertexShader());

View File

@ -101,12 +101,12 @@ void AddIndices(int _primitive, int _numVertices)
{
switch (_primitive)
{
case GX_DRAW_QUADS: if ((_numVertices % 4) == 0 ) {IndexGenerator::AddQuads(_numVertices);} else {IndexGenerator::AddFan(_numVertices);} break;
case GX_DRAW_TRIANGLES: if ((_numVertices % 3) == 0 ) {IndexGenerator::AddList(_numVertices);} else {IndexGenerator::AddStrip(_numVertices);} break;
case GX_DRAW_QUADS: IndexGenerator::AddQuads(_numVertices); break;
case GX_DRAW_TRIANGLES: IndexGenerator::AddList(_numVertices); break;
case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(_numVertices); break;
case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(_numVertices); break;
case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(_numVertices); break;
case GX_DRAW_LINES: if ((_numVertices % 2) == 0 ) {IndexGenerator::AddLineList(_numVertices);} else {IndexGenerator::AddLineStrip(_numVertices);} break;
case GX_DRAW_LINES: IndexGenerator::AddLineList(_numVertices); break;
case GX_DRAW_POINTS: IndexGenerator::AddPoints(_numVertices); break;
}
}