mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
big changes here:
- Eliminate the useless check for cpu modifications option from efb to ram as it must be enabled always - use constant names in dx11 for buffer length calculation instead to simplify code reading - implemented scaled efb copy in opengl, still bugy in some games, the option is not in the gui but will add it when it works perfect - Change the depth calculation behavior: if the game use z textures is exactly the same as before. if the game do not use z texture calculate z values in the vertex shader. the advantage id this approach is that early z culling is applied, improving fill rate. this mus speed up things, even with ssaa and msaa enabled. please test for regression and enjoy. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5896 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -59,8 +59,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogDX,wxDialog)
|
||||
EVT_CHECKBOX(ID_DISABLEFOG, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_OVERLAYFPS, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_ENABLEEFBCOPY, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_EFBTORAM, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_VERIFYTEXTUREMODIFICATIONS, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_EFBTORAM, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_RADIOBUTTON(ID_EFBTOTEX, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_ENABLEHOTKEY, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_WIREFRAME, GFXConfigDialogDX::AdvancedSettingsChanged)
|
||||
@ -138,8 +137,7 @@ void GFXConfigDialogDX::InitializeGUIValues()
|
||||
m_OverlayFPS->SetValue(g_Config.bShowFPS);
|
||||
|
||||
m_CopyEFB->SetValue(!g_Config.bEFBCopyDisable);
|
||||
g_Config.bCopyEFBToTexture ? m_Radio_CopyEFBToGL->SetValue(true) : m_Radio_CopyEFBToRAM->SetValue(true);
|
||||
m_VerifyTextureModification->SetValue(g_Config.bVerifyTextureModificationsByCPU);
|
||||
g_Config.bCopyEFBToTexture ? m_Radio_CopyEFBToGL->SetValue(true) : m_Radio_CopyEFBToRAM->SetValue(true);
|
||||
m_EnableHotkeys->SetValue(g_Config.bOSDHotKey);
|
||||
m_WireFrame->SetValue(g_Config.bWireFrame);
|
||||
m_EnableXFB->SetValue(g_Config.bUseXFB);
|
||||
@ -301,7 +299,6 @@ void GFXConfigDialogDX::CreateGUIControls()
|
||||
m_CopyEFB = new wxCheckBox( m_PageAdvanced, ID_ENABLEEFBCOPY, wxT("Enable EFB Copy"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_EnableHotkeys = new wxCheckBox( m_PageAdvanced, ID_ENABLEHOTKEY, wxT("Enable Hotkey"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToRAM = new wxRadioButton( m_PageAdvanced, ID_EFBTORAM, wxT("To RAM (accuracy)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_VerifyTextureModification = new wxCheckBox( m_PageAdvanced, ID_VERIFYTEXTUREMODIFICATIONS, wxT("Check for textures modified by the cpu"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Radio_CopyEFBToGL = new wxRadioButton( m_PageAdvanced, ID_EFBTOTEX, wxT("To Texture (performance, resolution)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_WireFrame = new wxCheckBox( m_PageAdvanced, ID_WIREFRAME, wxT("Enable Wireframe"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_EnableRealXFB = new wxCheckBox( m_PageAdvanced, ID_ENABLEREALXFB, wxT("Enable Real XFB"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
@ -334,12 +331,11 @@ void GFXConfigDialogDX::CreateGUIControls()
|
||||
sSettings->Add( m_CopyEFB, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sSettings->Add( m_EnableHotkeys, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 20 );
|
||||
sSettings->Add( m_Radio_CopyEFBToRAM, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 10 );
|
||||
sSettings->Add( m_VerifyTextureModification, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 10 );
|
||||
sSettings->Add( m_Radio_CopyEFBToGL, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 10 );
|
||||
sSettings->Add( m_Radio_CopyEFBToGL, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 10 );
|
||||
sSettings->Add( m_WireFrame, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 20 );
|
||||
sSettings->Add( m_EnableRealXFB, wxGBPosition( 5, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 20 );
|
||||
sSettings->Add( m_EnableXFB, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sSettings->Add( m_UseNativeMips, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sSettings->Add( m_EnableRealXFB, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxLEFT, 20 );
|
||||
sSettings->Add( m_EnableXFB, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sSettings->Add( m_UseNativeMips, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
|
||||
sbSettings->Add( sSettings, 0, wxEXPAND, 5 );
|
||||
sAdvanced->Add( sbSettings, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
@ -466,9 +462,6 @@ void GFXConfigDialogDX::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
break;
|
||||
case ID_EFBTORAM:
|
||||
g_Config.bCopyEFBToTexture = false;
|
||||
case ID_VERIFYTEXTUREMODIFICATIONS:
|
||||
g_Config.bVerifyTextureModificationsByCPU = m_VerifyTextureModification->IsChecked();
|
||||
break;
|
||||
case ID_EFBTOTEX:
|
||||
g_Config.bCopyEFBToTexture = true;
|
||||
break;
|
||||
@ -532,7 +525,6 @@ void GFXConfigDialogDX::UpdateGUI()
|
||||
|
||||
// Disable the Copy to options when EFBCopy is disabled
|
||||
m_Radio_CopyEFBToRAM->Enable(!g_Config.bEFBCopyDisable);
|
||||
m_VerifyTextureModification->Enable(!g_Config.bEFBCopyDisable && !g_Config.bCopyEFBToTexture);
|
||||
m_Radio_CopyEFBToGL->Enable(!g_Config.bEFBCopyDisable);
|
||||
|
||||
// Disable/Enable Safe Texture Cache options
|
||||
|
@ -112,7 +112,6 @@ class GFXConfigDialogDX : public wxDialog
|
||||
wxCheckBox *m_OverlayFPS;
|
||||
wxCheckBox *m_CopyEFB;
|
||||
wxRadioButton *m_Radio_CopyEFBToRAM;
|
||||
wxCheckBox *m_VerifyTextureModification;
|
||||
wxRadioButton *m_Radio_CopyEFBToGL;
|
||||
wxCheckBox *m_EnableHotkeys;
|
||||
wxCheckBox *m_WireFrame;
|
||||
@ -150,7 +149,6 @@ class GFXConfigDialogDX : public wxDialog
|
||||
ID_OVERLAYFPS,
|
||||
ID_ENABLEEFBCOPY,
|
||||
ID_EFBTORAM,
|
||||
ID_VERIFYTEXTUREMODIFICATIONS,
|
||||
ID_EFBTOTEX,
|
||||
ID_ENABLEHOTKEY,
|
||||
ID_WIREFRAME,
|
||||
|
@ -266,7 +266,7 @@ void PixelShaderCache::Clear()
|
||||
iter->second.Destroy();
|
||||
PixelShaders.clear();
|
||||
|
||||
for (int i = 0; i < (C_COLORMATRIX + 16) * 4; i++)
|
||||
for (int i = 0; i < C_PENVCONST_END * 4; i++)
|
||||
lastPSconstants[i / 4][i % 4] = -100000000.0f;
|
||||
memset(&last_pixel_shader_uid, 0xFF, sizeof(last_pixel_shader_uid));
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void TextureCache::Cleanup()
|
||||
if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second.frameCount)
|
||||
{
|
||||
iter->second.Destroy(false);
|
||||
iter = textures.erase(iter);
|
||||
textures.erase(iter++);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -160,7 +160,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
u32 texID = address;
|
||||
u64 texHash;
|
||||
u32 FullFormat = tex_format;
|
||||
bool TextureIsDinamic = false;
|
||||
bool TextureisDynamic = false;
|
||||
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
|
||||
u32 FullFormat = (tex_format | (tlutfmt << 16));
|
||||
|
||||
@ -196,9 +196,9 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
|
||||
if (!g_ActiveConfig.bSafeTextureCache)
|
||||
{
|
||||
if(entry.isRenderTarget || entry.isDinamic)
|
||||
if(entry.isRenderTarget || entry.isDynamic)
|
||||
{
|
||||
if(!g_ActiveConfig.bCopyEFBToTexture && g_ActiveConfig.bVerifyTextureModificationsByCPU)
|
||||
if(!g_ActiveConfig.bCopyEFBToTexture)
|
||||
{
|
||||
hash_value = TexDecoder_GetHash64(ptr,TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, tex_format),g_ActiveConfig.iSafeTextureCache_ColorSamples);
|
||||
if ((tex_format == GX_TF_C4) || (tex_format == GX_TF_C8) || (tex_format == GX_TF_C14X2))
|
||||
@ -218,19 +218,19 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
}
|
||||
else
|
||||
{
|
||||
if(entry.isRenderTarget || entry.isDinamic)
|
||||
if(entry.isRenderTarget || entry.isDynamic)
|
||||
{
|
||||
if(g_ActiveConfig.bCopyEFBToTexture || !g_ActiveConfig.bVerifyTextureModificationsByCPU)
|
||||
if(g_ActiveConfig.bCopyEFBToTexture)
|
||||
{
|
||||
hash_value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (((entry.isRenderTarget || entry.isDinamic) && hash_value == entry.hash && address == entry.addr)
|
||||
if (((entry.isRenderTarget || entry.isDynamic) && hash_value == entry.hash && address == entry.addr)
|
||||
|| ((address == entry.addr) && (hash_value == entry.hash) && FullFormat == entry.fmt/* && entry.MipLevels == maxlevel*/))
|
||||
{
|
||||
entry.frameCount = frameCount;
|
||||
entry.isDinamic = false;
|
||||
entry.isDynamic = false;
|
||||
D3D::SetTexture(stage, entry.texture);
|
||||
return &entry;
|
||||
}
|
||||
@ -239,11 +239,11 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
// Let's reload the new texture data into the same texture,
|
||||
// instead of destroying it and having to create a new one.
|
||||
// Might speed up movie playback very, very slightly.
|
||||
TextureIsDinamic = (entry.isRenderTarget || entry.isDinamic) && !g_ActiveConfig.bCopyEFBToTexture;
|
||||
TextureisDynamic = (entry.isRenderTarget || entry.isDynamic) && !g_ActiveConfig.bCopyEFBToTexture;
|
||||
|
||||
if (!entry.isRenderTarget &&
|
||||
((!entry.isDinamic && width == entry.w && height==entry.h && FullFormat == entry.fmt /* && entry.MipLevels < maxlevel*/)
|
||||
|| (entry.isDinamic && entry.w == width && entry.h == height)))
|
||||
((!entry.isDynamic && width == entry.w && height==entry.h && FullFormat == entry.fmt /* && entry.MipLevels < maxlevel*/)
|
||||
|| (entry.isDynamic && entry.w == width && entry.h == height)))
|
||||
{
|
||||
skip_texture_create = true;
|
||||
}
|
||||
@ -257,7 +257,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
|
||||
// Make an entry in the table
|
||||
TCacheEntry& entry = textures[texID];
|
||||
entry.isDinamic = TextureIsDinamic;
|
||||
entry.isDynamic = TextureisDynamic;
|
||||
PC_TexFormat pcfmt = PC_TEX_FMT_NONE;
|
||||
|
||||
if (g_ActiveConfig.bHiresTextures)
|
||||
@ -313,7 +313,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
}
|
||||
|
||||
entry.oldpixel = ((u32 *)ptr)[0];
|
||||
if (g_ActiveConfig.bSafeTextureCache || entry.isDinamic)
|
||||
if (g_ActiveConfig.bSafeTextureCache || entry.isDynamic)
|
||||
entry.hash = hash_value;
|
||||
else
|
||||
{
|
||||
@ -403,9 +403,6 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
||||
|
||||
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect)
|
||||
{
|
||||
int efb_w = source_rect.GetWidth();
|
||||
int efb_h = source_rect.GetHeight();
|
||||
|
||||
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
|
||||
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
|
||||
//compensate the texture grow if supersampling is enabled to conserve memory usage
|
||||
@ -420,14 +417,14 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||
TexCache::iterator iter;
|
||||
LPDIRECT3DTEXTURE9 tex = NULL;
|
||||
iter = textures.find(address);
|
||||
bool TextureIsDinamic = false;
|
||||
bool TextureisDynamic = false;
|
||||
if (iter != textures.end())
|
||||
{
|
||||
if ((iter->second.isRenderTarget && iter->second.Scaledw == Scaledtex_w && iter->second.Scaledh == Scaledtex_h)
|
||||
|| (iter->second.isDinamic && iter->second.w == tex_w && iter->second.h == tex_h))
|
||||
|| (iter->second.isDynamic && iter->second.w == tex_w && iter->second.h == tex_h))
|
||||
{
|
||||
tex = iter->second.texture;
|
||||
TextureIsDinamic = iter->second.isDinamic;
|
||||
TextureisDynamic = iter->second.isDynamic;
|
||||
iter->second.frameCount = frameCount;
|
||||
}
|
||||
else
|
||||
@ -439,7 +436,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||
textures.erase(iter);
|
||||
}
|
||||
}
|
||||
if(TextureIsDinamic)
|
||||
if(TextureisDynamic)
|
||||
{
|
||||
Scaledtex_w = tex_w;
|
||||
Scaledtex_h = tex_h;
|
||||
@ -457,7 +454,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||
entry.Scaledh = Scaledtex_h;
|
||||
entry.fmt = copyfmt;
|
||||
entry.isNonPow2 = true;
|
||||
entry.isDinamic = false;
|
||||
entry.isDynamic = false;
|
||||
D3D::dev->CreateTexture(Scaledtex_w, Scaledtex_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0);
|
||||
textures[address] = entry;
|
||||
tex = entry.texture;
|
||||
@ -468,7 +465,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
|
||||
|
||||
// We have to run a pixel shader, for color conversion.
|
||||
Renderer::ResetAPIState(); // reset any game specific settings
|
||||
if(!TextureIsDinamic || g_ActiveConfig.bCopyEFBToTexture)
|
||||
if(!TextureisDynamic || g_ActiveConfig.bCopyEFBToTexture)
|
||||
{
|
||||
|
||||
float colmat[16]= {0.0f};
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
float scaleX, scaleY; // Hires texutres need this
|
||||
|
||||
bool isRenderTarget;
|
||||
bool isDinamic;// mofified from cpu
|
||||
bool isDynamic;// mofified from cpu
|
||||
bool isNonPow2;
|
||||
|
||||
TCacheEntry()
|
||||
|
@ -450,10 +450,7 @@ u64 EncodeToRamFromTexture(u32 address,LPDIRECT3DTEXTURE9 source_texture,u32 Sou
|
||||
EncodeToRamUsingShader(texconv_shader, source_texture, scaledSource, dest_ptr, expandedWidth / samples, expandedHeight,readStride, true, bScaleByHalf > 0);
|
||||
TextureCache::MakeRangeDynamic(address,size_in_bytes);
|
||||
u64 Hashvalue = 0;
|
||||
if(g_ActiveConfig.bVerifyTextureModificationsByCPU)
|
||||
{
|
||||
Hashvalue = TexDecoder_GetHash64(dest_ptr,size_in_bytes,g_ActiveConfig.iSafeTextureCache_ColorSamples);
|
||||
}
|
||||
Hashvalue = TexDecoder_GetHash64(dest_ptr,size_in_bytes,g_ActiveConfig.iSafeTextureCache_ColorSamples);
|
||||
return Hashvalue;
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,6 @@ void Flush()
|
||||
}
|
||||
}
|
||||
|
||||
u32 nonpow2tex = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (usedtextures & (1 << i)) {
|
||||
|
@ -37,7 +37,7 @@
|
||||
VertexShaderCache::VSCache VertexShaderCache::vshaders;
|
||||
const VertexShaderCache::VSCacheEntry *VertexShaderCache::last_entry;
|
||||
|
||||
static float GC_ALIGNED16(lastVSconstants[C_FOGPARAMS + 8][4]);
|
||||
static float GC_ALIGNED16(lastVSconstants[C_VENVCONST_END][4]);
|
||||
#define MAX_SSAA_SHADERS 3
|
||||
|
||||
static LPDIRECT3DVERTEXSHADER9 SimpleVertexShader[MAX_SSAA_SHADERS];
|
||||
@ -218,7 +218,7 @@ void VertexShaderCache::Clear()
|
||||
iter->second.Destroy();
|
||||
vshaders.clear();
|
||||
|
||||
for (int i = 0; i < (C_FOGPARAMS + 8) * 4; i++)
|
||||
for (int i = 0; i < (C_VENVCONST_END * 4); i++)
|
||||
lastVSconstants[i / 4][i % 4] = -100000000.0f;
|
||||
memset(&last_vertex_shader_uid, 0xFF, sizeof(last_vertex_shader_uid));
|
||||
}
|
||||
|
Reference in New Issue
Block a user