Small fixes:

in opengl correct an error introduced by mi in efb to ram alignment, it's seems to fix SMS but it missalign a lot of other games, so revert to the default. must solve truncated coins in NSMB.
revert alpha testing values to the values in rev 4812 as they fix some games.
in d3d dynamized the Render target size so it will change at runtime when viewport exceed it size, in the worse case it will cause a missing frame when resizing but in the games I tested is not noticeable at all
This must solve all the remaining viewports problems in nvidia cards, in ati this is not needed.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4888 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2010-01-19 15:00:45 +00:00
parent c0a86df00e
commit c4c809f6b1
4 changed files with 48 additions and 29 deletions

View File

@ -18,7 +18,7 @@
#include "LinearDiskCache.h"
static const char ID[4] = {'D', 'C', 'A', 'C'};
const int version = 1; // TODO: Get from SVN_REV
const int version = 4888; // TODO: Get from SVN_REV
LinearDiskCache::LinearDiskCache()
: file_(NULL), num_entries_(0) {

View File

@ -871,12 +871,12 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con
static const char *tevAlphaFuncsTable[] =
{
"(false)", //ALPHACMP_NEVER 0
"(prev.a <= %s - (0.5f/255.0f))", //ALPHACMP_LESS 1
"(abs( prev.a - %s ) < (1.0f/255.0f))", //ALPHACMP_EQUAL 2
"(prev.a < %s + (0.5f/255.0f))", //ALPHACMP_LEQUAL 3
"(prev.a >= %s + (0.5f/255.0f))", //ALPHACMP_GREATER 4
"(abs( prev.a - %s ) >= (1.0f/255.0f))", //ALPHACMP_NEQUAL 5
"(prev.a > %s - (0.5f/255.0f))", //ALPHACMP_GEQUAL 6
"(prev.a <= %s - (0.25f/255.0f))", //ALPHACMP_LESS 1
"(abs( prev.a - %s ) < (0.5f/255.0f))", //ALPHACMP_EQUAL 2
"(prev.a < %s + (0.25f/255.0f))", //ALPHACMP_LEQUAL 3
"(prev.a >= %s + (0.25f/255.0f))", //ALPHACMP_GREATER 4
"(abs( prev.a - %s ) >= (0.5f/255.0f))", //ALPHACMP_NEQUAL 5
"(prev.a > %s - (0.25f/255.0f))", //ALPHACMP_GEQUAL 6
"(true)" //ALPHACMP_ALWAYS 7
};

View File

@ -116,7 +116,7 @@ void WriteSwizzler(char*& p, u32 format,bool HLSL)
}
else
{
WRITE(p, " sampleUv = sampleUv + float2(1.0f,-1.0f);\n");
WRITE(p, " sampleUv = sampleUv;\n");
}
}

View File

@ -58,8 +58,7 @@ static int s_backbuffer_height;
static float xScale;
static float yScale;
static int FULL_EFB_WIDTH = EFB_WIDTH;
static int FULL_EFB_HEIGHT = EFB_HEIGHT;
static bool AUTO_ADJUST_RENDERTARGET_SIZE = false;
static int s_recordWidth;
static int s_recordHeight;
@ -272,21 +271,11 @@ bool Renderer::Init()
xScale = (float)s_target_width / (float)EFB_WIDTH;
yScale = (float)s_target_height / (float)EFB_HEIGHT;
if (!D3D::IsATIDevice())
{
FULL_EFB_WIDTH = 2 * EFB_WIDTH;
FULL_EFB_HEIGHT = 2 * EFB_HEIGHT;
s_Fulltarget_width = FULL_EFB_WIDTH * xScale;
s_Fulltarget_height = FULL_EFB_HEIGHT * yScale;
}
else
{
s_Fulltarget_width = s_target_width;
s_Fulltarget_height = s_target_height;
}
s_Fulltarget_width = s_backbuffer_width;
s_Fulltarget_height = s_backbuffer_height;
//apply automatic resizing only is not an ati card, ati can handle large viewports :)
AUTO_ADJUST_RENDERTARGET_SIZE = true;//!D3D::IsATIDevice();
s_LastFrameDumped = false;
s_AVIDumping = false;
@ -843,10 +832,6 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y)
}
// mtx.m[0][3] = pMatrix[1]; // -0.5f/s_target_width; <-- fix d3d pixel center?
// mtx.m[1][3] = pMatrix[3]; // +0.5f/s_target_height; <-- fix d3d pixel center?
// Called from VertexShaderManager
// Called from VertexShaderManager
void UpdateViewport()
{
@ -883,7 +868,41 @@ void UpdateViewport()
Y += Height;
Height *= -1;
}
if(AUTO_ADJUST_RENDERTARGET_SIZE)
{
bool sizeChanged = false;
if(X < 0)
{
s_Fulltarget_width -= 2 * X;
X = 0;
sizeChanged=true;
}
if(Y < 0)
{
s_Fulltarget_height -= 2 * Y;
Y = 0;
sizeChanged=true;
}
if(X + Width > s_Fulltarget_width)
{
s_Fulltarget_width += (X + Width - s_Fulltarget_width) * 2;
sizeChanged=true;
}
if(Y + Height > s_Fulltarget_height)
{
s_Fulltarget_height += (Y + Height - s_Fulltarget_height) * 2;
sizeChanged=true;
}
if(sizeChanged)
{
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
FBManager::Destroy();
FBManager::Create();
D3D::dev->SetRenderTarget(0, FBManager::GetEFBColorRTSurface());
D3D::dev->SetDepthStencilSurface(FBManager::GetEFBDepthRTSurface());
}
}
vp.X = X;
vp.Y = Y;
vp.Width = Width;