From 0753ce5bdaf756b144ec6003e1df01388b9c3e8f Mon Sep 17 00:00:00 2001 From: degasus Date: Sat, 12 Oct 2013 16:34:06 +0200 Subject: [PATCH] ogl: use GL_RGBA instead of GL_RGBA8 8 bit per pixel is _everywhere_ the default, so we don't need to define it explicitly. Also we don't rely on exact 8 bit resolution. --- .../VideoBackends/OGL/Src/FramebufferManager.cpp | 16 +++++++--------- .../VideoBackends/OGL/Src/PostProcessing.cpp | 4 ++-- .../VideoBackends/OGL/Src/TextureConverter.cpp | 10 ++-------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp b/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp index f890a40764..4c395d7257 100644 --- a/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/OGL/Src/FramebufferManager.cpp @@ -66,16 +66,14 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms // alpha channel should be ignored if the EFB does not have one. // Create EFB target. - u32 depthType, rgbaType; + u32 depthType; if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA)) { depthType = GL_DEPTH_COMPONENT; - rgbaType = GL_RGBA; } else { depthType = GL_DEPTH_COMPONENT24; - rgbaType = GL_RGBA8; } glGenFramebuffers(1, &m_efbFramebuffer); glActiveTexture(GL_TEXTURE0 + 9); @@ -92,7 +90,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_efbColor); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(getFbType(), 0, rgbaType, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(getFbType(), 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(getFbType(), m_efbDepth); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); @@ -100,7 +98,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_resolvedColorTexture); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(getFbType(), 0, rgbaType, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(getFbType(), 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); // Bind target textures to the EFB framebuffer. @@ -126,9 +124,9 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindRenderbuffer(GL_RENDERBUFFER, m_efbColor); if (m_msaaCoverageSamples) - glRenderbufferStorageMultisampleCoverageNV(GL_RENDERBUFFER, m_msaaCoverageSamples, m_msaaSamples, GL_RGBA8, m_targetWidth, m_targetHeight); + glRenderbufferStorageMultisampleCoverageNV(GL_RENDERBUFFER, m_msaaCoverageSamples, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight); else - glRenderbufferStorageMultisample(GL_RENDERBUFFER, m_msaaSamples, GL_RGBA8, m_targetWidth, m_targetHeight); + glRenderbufferStorageMultisample(GL_RENDERBUFFER, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight); glBindRenderbuffer(GL_RENDERBUFFER, m_efbDepth); if (m_msaaCoverageSamples) @@ -157,7 +155,7 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms glBindTexture(getFbType(), m_resolvedColorTexture); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(getFbType(), 0, rgbaType, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(getFbType(), 0, GL_RGBA, m_targetWidth, m_targetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(getFbType(), m_resolvedDepthTexture); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); @@ -485,7 +483,7 @@ XFBSourceBase* FramebufferManager::CreateXFBSource(unsigned int target_width, un glActiveTexture(GL_TEXTURE0 + 9); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, target_width, target_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, target_width, target_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); return new XFBSource(texture); } diff --git a/Source/Core/VideoBackends/OGL/Src/PostProcessing.cpp b/Source/Core/VideoBackends/OGL/Src/PostProcessing.cpp index c1563a74e2..a748ab5085 100644 --- a/Source/Core/VideoBackends/OGL/Src/PostProcessing.cpp +++ b/Source/Core/VideoBackends/OGL/Src/PostProcessing.cpp @@ -52,7 +52,7 @@ void Init() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); // disable mipmaps glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindFramebuffer(GL_FRAMEBUFFER, s_fbo); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, s_texture, 0); FramebufferManager::SetFramebuffer(0); @@ -131,7 +131,7 @@ void Update ( u32 width, u32 height ) // alloc texture for framebuffer glActiveTexture(GL_TEXTURE0+9); glBindTexture(GL_TEXTURE_2D, s_texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glBindTexture(GL_TEXTURE_2D, 0); } } diff --git a/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp b/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp index 3c0db84ec1..693784054e 100644 --- a/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp +++ b/Source/Core/VideoBackends/OGL/Src/TextureConverter.cpp @@ -168,16 +168,10 @@ void Init() glBindTexture(getFbType(), s_srcTexture); glTexParameteri(getFbType(), GL_TEXTURE_MAX_LEVEL, 0); - u32 rgbaType; - if (DriverDetails::HasBug(DriverDetails::BUG_ISTEGRA)) - rgbaType = GL_RGBA; - else - rgbaType = GL_RGBA8; - glGenTextures(1, &s_dstTexture); glBindTexture(GL_TEXTURE_2D, s_dstTexture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - glTexImage2D(GL_TEXTURE_2D, 0, rgbaType, renderBufferWidth, renderBufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, renderBufferWidth, renderBufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); CreatePrograms(); } @@ -399,7 +393,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur } else { - glTexImage2D(getFbType(), 0, GL_RGBA8, (GLsizei)srcFmtWidth, (GLsizei)srcHeight, + glTexImage2D(getFbType(), 0, GL_RGBA, (GLsizei)srcFmtWidth, (GLsizei)srcHeight, 0, GL_BGRA, GL_UNSIGNED_BYTE, srcAddr); s_srcTextureWidth = (GLsizei)srcFmtWidth; s_srcTextureHeight = (GLsizei)srcHeight;