FramebufferManager: Bind only the first framebuffer layer when the EFB only has one layer.
This commit is contained in:
parent
6d5e9cb5b1
commit
42bb48bd46
|
@ -135,8 +135,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
|||
// Bind resolved textures to resolved framebuffer.
|
||||
glGenFramebuffers(1, &m_resolvedFramebuffer);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_resolvedFramebuffer);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_resolvedColorTexture, 0);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_resolvedDepthTexture, 0);
|
||||
FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, resolvedType, m_resolvedColorTexture, 0);
|
||||
FramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, resolvedType, m_resolvedDepthTexture, 0);
|
||||
}
|
||||
|
||||
// Create XFB framebuffer; targets will be created elsewhere.
|
||||
|
@ -145,8 +145,8 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
|
|||
// Bind target textures to EFB framebuffer.
|
||||
glGenFramebuffers(1, &m_efbFramebuffer);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_efbFramebuffer);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_efbColor, 0);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_efbDepth, 0);
|
||||
FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_textureType, m_efbColor, 0);
|
||||
FramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_textureType, m_efbDepth, 0);
|
||||
|
||||
// EFB framebuffer is currently bound, make sure to clear its alpha value to 1.f
|
||||
glViewport(0, 0, m_targetWidth, m_targetHeight);
|
||||
|
@ -343,6 +343,21 @@ void FramebufferManager::SetFramebuffer(GLuint fb)
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, fb != 0 ? fb : GetEFBFramebuffer());
|
||||
}
|
||||
|
||||
void FramebufferManager::FramebufferTexture(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
|
||||
{
|
||||
if (textarget == GL_TEXTURE_2D_ARRAY || textarget == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)
|
||||
{
|
||||
if (m_EFBLayers > 1)
|
||||
glFramebufferTexture(target, attachment, texture, level);
|
||||
else
|
||||
glFramebufferTextureLayer(target, attachment, texture, level, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
}
|
||||
|
||||
// Apply AA if enabled
|
||||
GLuint FramebufferManager::ResolveAndGetRenderTarget(const EFBRectangle &source_rect)
|
||||
{
|
||||
|
@ -367,7 +382,7 @@ void FramebufferManager::ReinterpretPixelData(unsigned int convtype)
|
|||
src_texture = m_efbColor;
|
||||
m_efbColor = m_efbColorSwap;
|
||||
m_efbColorSwap = src_texture;
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_efbColor, 0);
|
||||
FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, m_textureType, m_efbColor, 0);
|
||||
|
||||
glViewport(0,0, m_targetWidth, m_targetHeight);
|
||||
glActiveTexture(GL_TEXTURE0 + 9);
|
||||
|
@ -399,7 +414,7 @@ void XFBSource::CopyEFB(float Gamma)
|
|||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, FramebufferManager::GetXFBFramebuffer());
|
||||
|
||||
// Bind texture.
|
||||
glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
|
||||
FramebufferManager::FramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_ARRAY, texture, 0);
|
||||
|
||||
glBlitFramebuffer(
|
||||
0, 0, texWidth, texHeight,
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
static GLuint GetResolvedFramebuffer() { return m_resolvedFramebuffer; }
|
||||
|
||||
static void SetFramebuffer(GLuint fb);
|
||||
static void FramebufferTexture(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
|
||||
// If in MSAA mode, this will perform a resolve of the specified rectangle, and return the resolve target as a texture ID.
|
||||
// Thus, this call may be expensive. Don't repeat it unnecessarily.
|
||||
|
|
|
@ -207,10 +207,6 @@ static void GLAPIENTRY ClearDepthf(GLfloat depthval)
|
|||
{
|
||||
glClearDepth(depthval);
|
||||
}
|
||||
static void GLAPIENTRY FramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
|
||||
{
|
||||
glFramebufferTextureLayer(target, attachment, texture, level, 0);
|
||||
}
|
||||
|
||||
static void InitDriverInfo()
|
||||
{
|
||||
|
@ -474,11 +470,6 @@ Renderer::Renderer()
|
|||
glClearDepthf = ClearDepthf;
|
||||
}
|
||||
|
||||
if (GLExtensions::Version() < 320 || GLInterface->GetMode() != GLInterfaceMode::MODE_OPENGL)
|
||||
{
|
||||
glFramebufferTexture = FramebufferTexture;
|
||||
}
|
||||
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = GLExtensions::Supports("GL_ARB_blend_func_extended");
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = !DriverDetails::HasBug(DriverDetails::BUG_PRIMITIVERESTART) &&
|
||||
((GLExtensions::Version() >= 310) || GLExtensions::Supports("GL_NV_primitive_restart"));
|
||||
|
|
|
@ -226,7 +226,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture(
|
|||
|
||||
glGenFramebuffers(1, &entry->framebuffer);
|
||||
FramebufferManager::SetFramebuffer(entry->framebuffer);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, entry->texture, 0);
|
||||
FramebufferManager::FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_ARRAY, entry->texture, 0);
|
||||
|
||||
SetStage();
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destTextur
|
|||
// switch to texture converter frame buffer
|
||||
// attach destTexture as color destination
|
||||
FramebufferManager::SetFramebuffer(s_texConvFrameBuffer[1]);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, destTexture, 0);
|
||||
FramebufferManager::FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_ARRAY, destTexture, 0);
|
||||
|
||||
// activate source texture
|
||||
// set srcAddr as data for source texture
|
||||
|
|
Loading…
Reference in New Issue