D3D and Opengl:
reverted a tiny leftover of my safe texture cache commit D3D renamed the SSAA modes to use samples as MSAA now they are 2,25x and 4x. OpenGL: fixed a nasty logical bug introduced in 4984 that causes efb corruption when efb to texture is used re enabled shader caching as it was not producing errors. fixed efb misalignment caused by integer rounding still a bit misaligned but many games will look better now git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5020 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a9db66a41a
commit
811cfb059e
|
@ -163,8 +163,8 @@ void Enumerate()
|
|||
|
||||
// Add SuperSamples modes
|
||||
a.aa_levels.push_back(AALevel("None", D3DMULTISAMPLE_NONE, 0));
|
||||
a.aa_levels.push_back(AALevel("1.5x SSAA", D3DMULTISAMPLE_NONE, 0));
|
||||
a.aa_levels.push_back(AALevel("2x SSAA", D3DMULTISAMPLE_NONE, 0));
|
||||
a.aa_levels.push_back(AALevel("2.25x SSAA", D3DMULTISAMPLE_NONE, 0));
|
||||
a.aa_levels.push_back(AALevel("4x SSAA", D3DMULTISAMPLE_NONE, 0));
|
||||
//Add multisample modes
|
||||
DWORD qlevels = 0;
|
||||
if (D3DERR_NOTAVAILABLE != D3D::D3D->CheckDeviceMultiSampleType(
|
||||
|
|
|
@ -166,7 +166,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
|
|||
// each other stored in a single texture, and uses the palette to make different characters
|
||||
// visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
|
||||
// we must make sure that texture with different tluts get different IDs.
|
||||
u64 tlutHash = TexDecoder_GetTlutHash(&texMem[tlutaddr], TexDecoder_GetPaletteSize(tex_format));
|
||||
u64 tlutHash = TexDecoder_GetTlutHash(&texMem[tlutaddr], (tex_format == GX_TF_C4) ? 32 : 128);
|
||||
texHash ^= tlutHash;
|
||||
if (g_ActiveConfig.bSafeTextureCache)
|
||||
texID ^= tlutHash;
|
||||
|
|
|
@ -265,10 +265,12 @@ GLuint FramebufferManager::GetEFBDepthTexture(const EFBRectangle& sourceRc) cons
|
|||
TargetRectangle FramebufferManager::ConvertEFBRectangle(const EFBRectangle& rc) const
|
||||
{
|
||||
TargetRectangle result;
|
||||
result.left = rc.left * Renderer::GetTargetWidth() / EFB_WIDTH;
|
||||
result.top = Renderer::GetTargetHeight() - (rc.top * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||
result.right = rc.right * Renderer::GetTargetWidth() / EFB_WIDTH ;
|
||||
result.bottom = Renderer::GetTargetHeight() - (rc.bottom * Renderer::GetTargetHeight() / EFB_HEIGHT);
|
||||
float XScale = Renderer::GetTargetScaleX();
|
||||
float YScale = Renderer::GetTargetScaleY();
|
||||
result.left = rc.left * XScale;
|
||||
result.top = Renderer::GetTargetHeight() - (rc.top * YScale);
|
||||
result.right = rc.right * XScale ;
|
||||
result.bottom = Renderer::GetTargetHeight() - (rc.bottom * YScale);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
|||
void PixelShaderCache::DisableShader()
|
||||
{
|
||||
CurrentShader = 0;
|
||||
//if(ShaderEnabled)
|
||||
if(ShaderEnabled)
|
||||
{
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, CurrentShader);
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
|
@ -311,7 +311,7 @@ void PixelShaderCache::DisableShader()
|
|||
void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
//The caching here breakes Super Mario Sunshine i'm still trying to figure out wy
|
||||
//if(ShaderEnabled /*&& CurrentShader != Shader*/)
|
||||
if(ShaderEnabled /*&& CurrentShader != Shader*/)
|
||||
{
|
||||
CurrentShader = Shader;
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, CurrentShader);
|
||||
|
@ -321,13 +321,13 @@ void PixelShaderCache::SetCurrentShader(GLuint Shader)
|
|||
//Enable Fragment program and bind initial program
|
||||
void PixelShaderCache::EnableShader(GLuint Shader)
|
||||
{
|
||||
//if(!ShaderEnabled)
|
||||
if(!ShaderEnabled)
|
||||
{
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
ShaderEnabled = true;
|
||||
CurrentShader = 0;
|
||||
}
|
||||
//if(CurrentShader != Shader)
|
||||
if(CurrentShader != Shader)
|
||||
{
|
||||
CurrentShader = Shader;
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, CurrentShader);
|
||||
|
|
|
@ -172,7 +172,7 @@ void SetDefaultRectTexParams()
|
|||
if (glGetError() != GL_NO_ERROR) {
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
GL_REPORT_ERROR();
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
@ -1083,7 +1083,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
|
|||
|
||||
bool last_copy_efb_to_ram = !g_ActiveConfig.bCopyEFBToTexture;
|
||||
UpdateActiveConfig();
|
||||
if (last_copy_efb_to_ram != g_ActiveConfig.bCopyEFBToTexture)
|
||||
if (last_copy_efb_to_ram != (!g_ActiveConfig.bCopyEFBToTexture))
|
||||
TextureMngr::ClearRenderTargets();
|
||||
|
||||
// For testing zbuffer targets.
|
||||
|
|
|
@ -275,7 +275,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
|||
// each other stored in a single texture, and uses the palette to make different characters
|
||||
// visible or invisible. Thus, unless we want to recreate the textures for every drawn character,
|
||||
// we must make sure that texture with different tluts get different IDs.
|
||||
u64 tlutHash = TexDecoder_GetTlutHash(&texMem[tlutaddr], TexDecoder_GetPaletteSize(tex_format));
|
||||
u64 tlutHash = TexDecoder_GetTlutHash(&texMem[tlutaddr], (tex_format == GX_TF_C4) ? 32 : 128);
|
||||
texHash ^= tlutHash;
|
||||
if (g_ActiveConfig.bSafeTextureCache)
|
||||
texID ^= tlutHash;
|
||||
|
@ -301,6 +301,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
|||
glEnable(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D);
|
||||
// entry.isRectangle ? TextureMngr::EnableTex2D(texstage) : TextureMngr::EnableTexRECT(texstage);
|
||||
glBindTexture(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D, entry.texture);
|
||||
GL_REPORT_ERRORD();
|
||||
if (entry.mode.hex != tm0.hex)
|
||||
entry.SetTextureParameters(tm0);
|
||||
//DebugLog("%cC addr: %08x | fmt: %i | e.hash: %08x | w:%04i h:%04i", g_ActiveConfig.bSafeTextureCache ? 'S' : 'U'
|
||||
|
@ -315,6 +316,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
|
|||
if (width == entry.w && height == entry.h && FullFormat == entry.fmt)
|
||||
{
|
||||
glBindTexture(entry.isRectangle ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D, entry.texture);
|
||||
GL_REPORT_ERRORD();
|
||||
if (entry.mode.hex != tm0.hex)
|
||||
entry.SetTextureParameters(tm0);
|
||||
skip_texture_create = true;
|
||||
|
@ -634,19 +636,20 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
|
|||
{
|
||||
glGenTextures(1, (GLuint *)&entry.texture);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
|
||||
GL_REPORT_ERRORD();
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, gl_iformat, w, h, 0, gl_format, gl_type, NULL);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else
|
||||
{
|
||||
_assert_(entry.texture);
|
||||
GL_REPORT_ERROR();
|
||||
GL_REPORT_ERRORD();
|
||||
if (entry.w == w && entry.h == h && entry.isRectangle && entry.fmt == copyfmt)
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, entry.texture);
|
||||
// for some reason mario sunshine errors here...
|
||||
// Beyond Good and Evil does too, occasionally.
|
||||
GL_REPORT_ERROR();
|
||||
GL_REPORT_ERRORD();
|
||||
} else {
|
||||
// Delete existing texture.
|
||||
glDeleteTextures(1,(GLuint *)&entry.texture);
|
||||
|
|
|
@ -246,7 +246,7 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
|||
|
||||
void VertexShaderCache::DisableShader()
|
||||
{
|
||||
//if (ShaderEnabled)
|
||||
if (ShaderEnabled)
|
||||
{
|
||||
CurrentShader = 0;
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, CurrentShader);
|
||||
|
@ -255,11 +255,10 @@ void VertexShaderCache::DisableShader()
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Why are these if statements commented out?
|
||||
|
||||
void VertexShaderCache::SetCurrentShader(GLuint Shader)
|
||||
{
|
||||
//if (ShaderEnabled && CurrentShader != Shader)
|
||||
if (ShaderEnabled && CurrentShader != Shader)
|
||||
{
|
||||
CurrentShader = Shader;
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, CurrentShader);
|
||||
|
@ -268,13 +267,13 @@ void VertexShaderCache::SetCurrentShader(GLuint Shader)
|
|||
|
||||
void VertexShaderCache::EnableShader(GLuint Shader)
|
||||
{
|
||||
//if (!ShaderEnabled)
|
||||
if (!ShaderEnabled)
|
||||
{
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
ShaderEnabled= true;
|
||||
CurrentShader = 0;
|
||||
}
|
||||
//if (CurrentShader != Shader)
|
||||
if (CurrentShader != Shader)
|
||||
{
|
||||
CurrentShader = Shader;
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, CurrentShader);
|
||||
|
|
Loading…
Reference in New Issue