From c98f8a96d2d504d6d383a4dec6ec44c254ba41f0 Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Sat, 5 Jun 2010 00:01:18 +0000 Subject: HUGE commit :) in general cleanup and bugfix disable pierre patch for the moment as it causes problem in some games and hopefully fix the remaining missing textures for nvidia users in opengl. make the code in pixelshadergen looks nice and readable. D3D: this is a ultra experimental commit please check for regressions or error. make the efb Scale / super sampling level customizable to improve the output quality and let the user configure quality according to his hardware. is everyone likes this change will translate it to opengl please test git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5612 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp') diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 4e9ae42a66..f17a1774ea 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -188,7 +188,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, if (!g_ActiveConfig.bSafeTextureCache) hash_value = ((u32 *)ptr)[0]; - if (entry.isRenderTarget || ((address == entry.addr) && (hash_value == entry.hash) && FullFormat == entry.fmt)) + if (entry.isRenderTarget || ((address == entry.addr) && (hash_value == entry.hash) && FullFormat == entry.fmt && entry.MipLevels <= maxlevel)) { entry.frameCount = frameCount; D3D::SetTexture(stage, entry.texture); @@ -200,7 +200,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, // instead of destroying it and having to create a new one. // Might speed up movie playback very, very slightly. - if (width == entry.w && height==entry.h && FullFormat == entry.fmt) + if (width == entry.w && height==entry.h && FullFormat == entry.fmt && entry.MipLevels == maxlevel) { skip_texture_create = true; } @@ -286,6 +286,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, TexLevels = (isPow2 && UseNativeMips && (maxlevel > 0)) ? (int)(log((double)TexLevels)/log((double)2)) + 1 : ((isPow2)? 0 : 1); if(TexLevels > maxlevel && maxlevel > 0) TexLevels = maxlevel; + entry.MipLevels = maxlevel; if (!skip_texture_create) { entry.texture = D3D::CreateTexture2D((BYTE*)temp, width, height, expandedWidth, d3d_fmt, swap_r_b, TexLevels); @@ -361,25 +362,11 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo 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 - float SuperSampleCompensation = 1.0f; + float SuperSampleCompensation = (g_ActiveConfig.iMultisampleMode % 3) + 1; + SuperSampleCompensation = 1.0f / SuperSampleCompensation; float xScale = Renderer::GetTargetScaleX(); float yScale = Renderer::GetTargetScaleY(); - if(g_ActiveConfig.iMultisampleMode > 0 && g_ActiveConfig.iMultisampleMode < 4) - { - switch (g_ActiveConfig.iMultisampleMode) - { - case 1: - break; - case 2: - SuperSampleCompensation = 0.5f; - break; - case 3: - SuperSampleCompensation = 1.0f/3.0f; - break; - default: - break; - }; - } + int Scaledtex_w = (g_ActiveConfig.bCopyEFBScaled)?((int)(xScale * SuperSampleCompensation * tex_w)):tex_w; int Scaledtex_h = (g_ActiveConfig.bCopyEFBScaled)?((int)(yScale * SuperSampleCompensation * tex_h)):tex_h; @@ -585,7 +572,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo Scaledtex_w, Scaledtex_h, ((bformat != FOURCC_RAWZ && bformat != D3DFMT_D24X8) && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(SSAAMode): PixelShaderCache::GetColorMatrixProgram(SSAAMode), - (SSAAMode != 0)? VertexShaderCache::GetFSAAVertexShader() : VertexShaderCache::GetSimpleVertexShader()); + VertexShaderCache::GetSimpleVertexShader(SSAAMode)); D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER); -- cgit v1.2.3