From 4292962ea2fa8630ae57d7aedd99bc8c5e469ac2 Mon Sep 17 00:00:00 2001 From: Nolan Check Date: Sat, 20 Jun 2009 09:29:28 +0000 Subject: [PATCH] Changes for OpenGL plugin: - Render targets should not have an alpha channel - Use correct source rectangle for render-to-texture effects - Use "GL_INTENSITY8" instead of just "GL_INTENSITY" (makes no difference) The background of the "Stage Clear" screen in SSBM is now fixed! git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3502 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 10 +++++----- .../Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp | 5 ++++- Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 7431b3f5ec..09d7acf5c0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -330,7 +330,7 @@ bool Renderer::Init() glGenTextures(1, (GLuint *)&s_RenderTarget); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_RenderTarget); // Create our main color render target as a texture rectangle of the desired size. - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, s_targetwidth, s_targetheight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 3, s_targetwidth, s_targetheight, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); SetDefaultRectTexParams(); // Create the depth target texture @@ -370,9 +370,9 @@ bool Renderer::Init() glGenRenderbuffersEXT(1, &s_RenderTarget); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_RenderTarget); if (s_MSAACoverageSamples) { - glRenderbufferStorageMultisampleCoverageNV(GL_RENDERBUFFER_EXT, s_MSAACoverageSamples, s_MSAASamples, GL_RGBA, s_targetwidth, s_targetheight); + glRenderbufferStorageMultisampleCoverageNV(GL_RENDERBUFFER_EXT, s_MSAACoverageSamples, s_MSAASamples, GL_RGB, s_targetwidth, s_targetheight); } else { - glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, s_MSAASamples, GL_RGBA, s_targetwidth, s_targetheight); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, s_MSAASamples, GL_RGB, s_targetwidth, s_targetheight); } glGenRenderbuffersEXT(1, &s_DepthTarget); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_DepthTarget); @@ -398,12 +398,12 @@ bool Renderer::Init() // Generate the resolve targets. glGenTextures(1, (GLuint *)&s_ResolvedRenderTarget); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_ResolvedRenderTarget); - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, s_targetwidth, s_targetheight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 3, s_targetwidth, s_targetheight, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); SetDefaultRectTexParams(); // Generate the resolve targets. glGenTextures(1, (GLuint *)&s_ResolvedDepthTarget); glBindTexture(GL_TEXTURE_RECTANGLE_ARB, s_ResolvedDepthTarget); - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT, s_targetwidth, s_targetheight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_DEPTH_COMPONENT24, s_targetwidth, s_targetheight, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); SetDefaultRectTexParams(); // Attach our resolve targets to our resolved FBO. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp index 6b17535689..db55a97fb8 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp @@ -250,7 +250,10 @@ void EncodeToRam(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyf u8 *dest_ptr = Memory_GetPtr(address); - u32 source_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(source) : Renderer::ResolveAndGetRenderTarget(source); + TRectangle scaledTargetSource; + source.Scale(Renderer::GetTargetScaleX(), Renderer::GetTargetScaleY(), &scaledTargetSource); + + u32 source_texture = bFromZBuffer ? Renderer::ResolveAndGetDepthTarget(scaledTargetSource) : Renderer::ResolveAndGetRenderTarget(scaledTargetSource); int width = source.right - source.left; int height = source.bottom - source.top; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp index 530eb1acbe..6ed06146bf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureMngr.cpp @@ -417,7 +417,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width break; case PC_TEX_FMT_I8: gl_format = GL_LUMINANCE; - gl_iformat = GL_INTENSITY; + gl_iformat = GL_INTENSITY8; gl_type = GL_UNSIGNED_BYTE; break; case PC_TEX_FMT_IA8: