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.
This commit is contained in:
degasus 2013-10-12 16:34:06 +02:00
parent e9c2c16c93
commit 0753ce5bda
3 changed files with 11 additions and 19 deletions

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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;