Skip to content

Commit

Permalink
OGL: Don't use texture arrays for MSAA.
Browse files Browse the repository at this point in the history
This solves a performance regression on AMD cards.
We don't currently support stereoscopy for MSAA anyway.
  • Loading branch information
CrossVR committed Dec 3, 2014
1 parent a888df1 commit 40920b3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Source/Core/VideoBackends/OGL/FramebufferManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,17 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
}
else
{
m_textureType = GL_TEXTURE_2D_MULTISAMPLE_ARRAY;
m_textureType = GL_TEXTURE_2D_MULTISAMPLE;
GLenum resolvedType = GL_TEXTURE_2D_ARRAY;

glBindTexture(m_textureType, m_efbColor);
glTexImage3DMultisample(m_textureType, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight, m_EFBLayers, false);
glTexImage2DMultisample(m_textureType, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight, false);

glBindTexture(m_textureType, m_efbDepth);
glTexImage3DMultisample(m_textureType, m_msaaSamples, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, m_EFBLayers, false);
glTexImage2DMultisample(m_textureType, m_msaaSamples, GL_DEPTH_COMPONENT24, m_targetWidth, m_targetHeight, false);

glBindTexture(m_textureType, m_efbColorSwap);
glTexImage3DMultisample(m_textureType, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight, m_EFBLayers, false);
glTexImage2DMultisample(m_textureType, m_msaaSamples, GL_RGBA, m_targetWidth, m_targetHeight, false);
glBindTexture(m_textureType, 0);

// Although we are able to access the multisampled texture directly, we don't do it everywhere.
Expand Down Expand Up @@ -181,9 +181,9 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
// This will lead to sample shading, but it's the only way to not loose
// the values of each sample.
sampler =
"SAMPLER_BINDING(9) uniform sampler2DMSArray samp9;\n"
"SAMPLER_BINDING(9) uniform sampler2DMS samp9;\n"
"vec4 sampleEFB(ivec2 pos) {\n"
" return texelFetch(samp9, ivec3(pos, 0), gl_SampleID);\n"
" return texelFetch(samp9, pos, gl_SampleID);\n"
"}\n";
}
else
Expand All @@ -192,11 +192,11 @@ FramebufferManager::FramebufferManager(int targetWidth, int targetHeight, int ms
std::stringstream samples;
samples << m_msaaSamples;
sampler =
"SAMPLER_BINDING(9) uniform sampler2DMSArray samp9;\n"
"SAMPLER_BINDING(9) uniform sampler2DMS samp9;\n"
"vec4 sampleEFB(ivec2 pos) {\n"
" vec4 color = vec4(0.0, 0.0, 0.0, 0.0);\n"
" for(int i=0; i<" + samples.str() + "; i++)\n"
" color += texelFetch(samp9, ivec3(pos, 0), i);\n"
" color += texelFetch(samp9, pos, i);\n"
" return color / " + samples.str() + ";\n"
"}\n";
}
Expand Down

5 comments on commit 40920b3

@mwoehlke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um... I don't know about regressions, but this broke rendering. I can't turn on AA any more; if I do, the entire render pipe just... breaks, giving nothing but garbage memory as output.

@CrossVR
Copy link
Contributor Author

@CrossVR CrossVR commented on 40920b3 Dec 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix one GPU, break another I guess. What are your system specifications?

@CrossVR
Copy link
Contributor Author

@CrossVR CrossVR commented on 40920b3 Dec 4, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think PR #1651 fixes the regression you're encountering.

@mwoehlke
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AMD/ATI] Cayman PRO [Radeon HD 6950]
mesa 10.3.3-1.20141110.fc20.x86_64

Assuming you mean 42bb48b, yes, that seems to fix it. Thanks!

@CrossVR
Copy link
Contributor Author

@CrossVR CrossVR commented on 40920b3 Dec 5, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to hear it, I think we've nailed down all regressions related to stereoscopic 3D now.

Please sign in to comment.