Merge branch 'master' into GLSL-master

Conflicts:
	CMakeLists.txt
	Source/Core/DolphinWX/CMakeLists.txt
	Source/Core/DolphinWX/Src/GLInterface.h
	Source/Core/VideoCommon/Src/PixelShaderGen.cpp
	Source/Core/VideoCommon/Src/TextureCacheBase.cpp
	Source/Core/VideoCommon/Src/VertexManagerBase.cpp
	Source/Plugins/Plugin_VideoDX11/Src/VertexManager.cpp
	Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp
	Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj
	Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcxproj.filters
	Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
	Source/Plugins/Plugin_VideoOGL/Src/PixelShaderCache.cpp
	Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
	Source/Plugins/Plugin_VideoOGL/Src/VertexManager.cpp
	Source/Plugins/Plugin_VideoOGL/Src/VertexShaderCache.cpp
	Source/Plugins/Plugin_VideoOGL/Src/main.cpp
This commit is contained in:
degasus
2013-03-06 15:59:29 +01:00
443 changed files with 16217 additions and 6374 deletions

View File

@ -129,7 +129,10 @@ void TextureCache::Cleanup()
TexCache::iterator tcend = textures.end();
while (iter != tcend)
{
if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) // TODO: Deleting EFB copies might not be a good idea here...
if ( frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount
// EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted
&& ! iter->second->IsEfbCopy() )
{
delete iter->second;
textures.erase(iter++);
@ -318,7 +321,7 @@ static TextureCache::TCacheEntryBase* ReturnEntry(unsigned int stage, TextureCac
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
u32 const address, unsigned int width, unsigned int height, int const texformat,
unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int const maxlevel, bool const from_tmem)
unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int maxlevel, bool const from_tmem)
{
if (0 == address)
return NULL;
@ -345,7 +348,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
full_format = texformat | (tlutfmt << 16);
const u32 texture_size = TexDecoder_GetTextureSizeInBytes(expandedWidth, expandedHeight, texformat);
const u8* src_data;
if (from_tmem)
src_data = &texMem[bpmem.tex[stage / 4].texImage1[stage % 4].tmem_even * TMEM_LINE_SIZE];
@ -372,6 +375,11 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
tex_hash ^= tlut_hash;
}
// D3D doesn't like when the specified mipmap count would require more than one 1x1-sized LOD in the mipmap chain
// e.g. 64x64 with 7 LODs would have the mipmap chain 64x64,32x32,16x16,8x8,4x4,2x2,1x1,1x1, so we limit the mipmap count to 6 there
while (g_ActiveConfig.backend_info.bUseMinimalMipCount && max(expandedWidth, expandedHeight) >> maxlevel == 0)
--maxlevel;
TCacheEntryBase *entry = textures[texID];
if (entry)
{
@ -456,7 +464,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
const bool using_custom_lods = using_custom_texture && CheckForCustomTextureLODs(tex_hash, texformat, texLevels);
// Only load native mips if their dimensions fit to our virtual texture dimensions
const bool use_native_mips = use_mipmaps && !using_custom_lods && (width == nativeW && height == nativeH);
texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1;
texLevels = (use_native_mips || using_custom_lods) ? texLevels : 1; // TODO: Should be forced to 1 for non-pow2 textures (e.g. efb copies with automatically adjusted IR)
// create the entry/texture
if (NULL == entry)
@ -476,15 +484,20 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
}
else
{
// load texture (CreateTexture also loads level 0)
entry->Load(width, height, expandedWidth, 0);
}
entry->SetGeneralParameters(address, texture_size, full_format, entry->num_mipmaps);
entry->SetDimensions(nativeW, nativeH, width, height);
entry->hash = tex_hash;
if (entry->IsEfbCopy() && !g_ActiveConfig.bCopyEFBToTexture) entry->type = TCET_EC_DYNAMIC;
else entry->type = TCET_NORMAL;
// load texture
entry->Load(stage, width, height, expandedWidth, 0);
if (entry->IsEfbCopy() && !g_ActiveConfig.bCopyEFBToTexture)
entry->type = TCET_EC_DYNAMIC;
else
entry->type = TCET_NORMAL;
if (g_ActiveConfig.bDumpTextures && !using_custom_texture)
DumpTexture(entry, 0);
@ -518,7 +531,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
TexDecoder_Decode(temp, mip_src_data, expanded_mip_width, expanded_mip_height, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures);
mip_src_data += TexDecoder_GetTextureSizeInBytes(expanded_mip_width, expanded_mip_height, texformat);
entry->Load(stage, mip_width, mip_height, expanded_mip_width, level);
entry->Load(mip_width, mip_height, expanded_mip_width, level);
if (g_ActiveConfig.bDumpTextures)
DumpTexture(entry, level);
@ -532,7 +545,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
unsigned int mip_height = CalculateLevelSize(height, level);
LoadCustomTexture(tex_hash, texformat, level, mip_width, mip_height);
entry->Load(stage, mip_width, mip_height, mip_width, level);
entry->Load(mip_width, mip_height, mip_width, level);
}
}
}