OpenGL Renderer: When running a GPU Scaling Factor of 3x and 4x, increase the MSAA sample size limit from 8xMSAA to 16xMSAA.
This commit is contained in:
parent
2379dc1e41
commit
a05e03e2cc
|
@ -1454,6 +1454,40 @@ FragmentColor* OpenGLRenderer::GetFramebuffer()
|
||||||
return (this->willFlipAndConvertFramebufferOnGPU && this->isPBOSupported) ? this->_mappedFramebuffer : GPU->GetEngineMain()->Get3DFramebufferMain();
|
return (this->willFlipAndConvertFramebufferOnGPU && this->isPBOSupported) ? this->_mappedFramebuffer : GPU->GetEngineMain()->Get3DFramebufferMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GLsizei OpenGLRenderer::GetLimitedMultisampleSize() const
|
||||||
|
{
|
||||||
|
GLsizei deviceMultisamples = this->_deviceInfo.maxSamples;
|
||||||
|
GLsizei maxMultisamples = OGLMaxMultisamples_Tier1;
|
||||||
|
|
||||||
|
if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier1) &&
|
||||||
|
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier1) )
|
||||||
|
{
|
||||||
|
maxMultisamples = OGLMaxMultisamples_Tier1;
|
||||||
|
}
|
||||||
|
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier2) &&
|
||||||
|
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier2) )
|
||||||
|
{
|
||||||
|
maxMultisamples = OGLMaxMultisamples_Tier2;
|
||||||
|
}
|
||||||
|
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * OGLMaxMultisamplesScaleLimit_Tier3) &&
|
||||||
|
(this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * OGLMaxMultisamplesScaleLimit_Tier3) )
|
||||||
|
{
|
||||||
|
maxMultisamples = OGLMaxMultisamples_Tier3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxMultisamples = OGLMaxMultisamples_Tier4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deviceMultisamples > maxMultisamples)
|
||||||
|
{
|
||||||
|
deviceMultisamples = maxMultisamples;
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceMultisamples;
|
||||||
|
}
|
||||||
|
|
||||||
OpenGLTexture* OpenGLRenderer::GetLoadedTextureFromPolygon(const POLY &thePoly, bool enableTexturing)
|
OpenGLTexture* OpenGLRenderer::GetLoadedTextureFromPolygon(const POLY &thePoly, bool enableTexturing)
|
||||||
{
|
{
|
||||||
OpenGLTexture *theTexture = (OpenGLTexture *)texCache.GetTexture(thePoly.texParam, thePoly.texPalette);
|
OpenGLTexture *theTexture = (OpenGLTexture *)texCache.GetTexture(thePoly.texParam, thePoly.texPalette);
|
||||||
|
@ -1878,31 +1912,9 @@ Render3DError OpenGLRenderer_1_2::InitExtensions()
|
||||||
|
|
||||||
if (maxSamplesOGL >= 2)
|
if (maxSamplesOGL >= 2)
|
||||||
{
|
{
|
||||||
GLint maxMultisamples = OGLMaxMultisamples_Tier1;
|
GLsizei sampleSize = this->GetLimitedMultisampleSize();
|
||||||
|
|
||||||
if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
error = this->CreateMultisampledFBO(sampleSize);
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
}
|
|
||||||
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 2) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier2;
|
|
||||||
}
|
|
||||||
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 8) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 8) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSamplesOGL > maxMultisamples)
|
|
||||||
{
|
|
||||||
maxSamplesOGL = maxMultisamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = this->CreateMultisampledFBO(maxSamplesOGL);
|
|
||||||
if (error != OGLERROR_NOERR)
|
if (error != OGLERROR_NOERR)
|
||||||
{
|
{
|
||||||
this->isMultisampledFBOSupported = false;
|
this->isMultisampledFBOSupported = false;
|
||||||
|
@ -4469,41 +4481,18 @@ Render3DError OpenGLRenderer_1_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
|
|
||||||
if (this->isMultisampledFBOSupported)
|
if (this->isMultisampledFBOSupported)
|
||||||
{
|
{
|
||||||
GLsizei maxSamplesOGL = (GLsizei)this->_deviceInfo.maxSamples;
|
GLsizei sampleSize = this->GetLimitedMultisampleSize();
|
||||||
GLint maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
|
|
||||||
if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
}
|
|
||||||
else if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 2) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier2;
|
|
||||||
}
|
|
||||||
else if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 8) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 8) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSamplesOGL > maxMultisamples)
|
|
||||||
{
|
|
||||||
maxSamplesOGL = maxMultisamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGColorID);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGColorID);
|
||||||
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleSize, GL_RGBA, w, h);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGPolyID);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGPolyID);
|
||||||
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleSize, GL_RGBA, w, h);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGFogAttrID);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGFogAttrID);
|
||||||
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleSize, GL_RGBA, w, h);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGDepthStencilID);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGDepthStencilID);
|
||||||
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, maxSamplesOGL, GL_DEPTH24_STENCIL8_EXT, w, h);
|
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleSize, GL_DEPTH24_STENCIL8_EXT, w, h);
|
||||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGDepthStencilAlphaID);
|
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, OGLRef.rboMSGDepthStencilAlphaID);
|
||||||
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, maxSamplesOGL, GL_DEPTH24_STENCIL8_EXT, w, h);
|
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, sampleSize, GL_DEPTH24_STENCIL8_EXT, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
const size_t newFramebufferColorSizeBytes = w * h * sizeof(FragmentColor);
|
||||||
|
|
|
@ -284,10 +284,17 @@ EXTERNOGLEXT(PFNGLTEXBUFFERPROC, glTexBuffer) // Core in v3.1
|
||||||
|
|
||||||
enum OGLMaxMultisamples
|
enum OGLMaxMultisamples
|
||||||
{
|
{
|
||||||
OGLMaxMultisamples_Tier1 = 32,
|
OGLMaxMultisamples_Tier1 = 32,
|
||||||
OGLMaxMultisamples_Tier2 = 16,
|
OGLMaxMultisamples_Tier2 = 16,
|
||||||
OGLMaxMultisamples_Tier3 = 8,
|
OGLMaxMultisamples_Tier3 = 8,
|
||||||
OGLMaxMultisamples_Tier4 = 4,
|
OGLMaxMultisamples_Tier4 = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OGLMaxMultisamplesScaleLimit
|
||||||
|
{
|
||||||
|
OGLMaxMultisamplesScaleLimit_Tier1 = 1,
|
||||||
|
OGLMaxMultisamplesScaleLimit_Tier2 = 4,
|
||||||
|
OGLMaxMultisamplesScaleLimit_Tier3 = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
enum OGLVertexAttributeID
|
enum OGLVertexAttributeID
|
||||||
|
@ -717,6 +724,7 @@ public:
|
||||||
void SetVersion(unsigned int major, unsigned int minor, unsigned int revision);
|
void SetVersion(unsigned int major, unsigned int minor, unsigned int revision);
|
||||||
|
|
||||||
virtual FragmentColor* GetFramebuffer();
|
virtual FragmentColor* GetFramebuffer();
|
||||||
|
virtual GLsizei GetLimitedMultisampleSize() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpenGLRenderer_1_2 : public OpenGLRenderer
|
class OpenGLRenderer_1_2 : public OpenGLRenderer
|
||||||
|
|
|
@ -703,31 +703,9 @@ Render3DError OpenGLRenderer_3_2::InitExtensions()
|
||||||
|
|
||||||
if (maxSamplesOGL >= 2)
|
if (maxSamplesOGL >= 2)
|
||||||
{
|
{
|
||||||
GLint maxMultisamples = OGLMaxMultisamples_Tier1;
|
GLsizei sampleSize = this->GetLimitedMultisampleSize();
|
||||||
|
|
||||||
if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
error = this->CreateMultisampledFBO(sampleSize);
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
}
|
|
||||||
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 2) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier2;
|
|
||||||
}
|
|
||||||
else if ( (this->_framebufferWidth <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 8) && (this->_framebufferHeight <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 8) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSamplesOGL > maxMultisamples)
|
|
||||||
{
|
|
||||||
maxSamplesOGL = maxMultisamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
error = this->CreateMultisampledFBO(maxSamplesOGL);
|
|
||||||
if (error != OGLERROR_NOERR)
|
if (error != OGLERROR_NOERR)
|
||||||
{
|
{
|
||||||
this->isMultisampledFBOSupported = false;
|
this->isMultisampledFBOSupported = false;
|
||||||
|
@ -2026,50 +2004,27 @@ Render3DError OpenGLRenderer_3_2::SetFramebufferSize(size_t w, size_t h)
|
||||||
|
|
||||||
if (this->isMultisampledFBOSupported)
|
if (this->isMultisampledFBOSupported)
|
||||||
{
|
{
|
||||||
GLsizei maxSamplesOGL = (GLsizei)this->_deviceInfo.maxSamples;
|
GLsizei sampleSize = this->GetLimitedMultisampleSize();
|
||||||
GLint maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
|
|
||||||
if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier1;
|
|
||||||
}
|
|
||||||
else if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 2) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier2;
|
|
||||||
}
|
|
||||||
else if ( (w <= GPU_FRAMEBUFFER_NATIVE_WIDTH * 8) && (h <= GPU_FRAMEBUFFER_NATIVE_HEIGHT * 8) )
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxMultisamples = OGLMaxMultisamples_Tier4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxSamplesOGL > maxMultisamples)
|
|
||||||
{
|
|
||||||
maxSamplesOGL = maxMultisamples;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->willUsePerSampleZeroDstPass)
|
if (this->willUsePerSampleZeroDstPass)
|
||||||
{
|
{
|
||||||
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, OGLRef.texMSGColorID);
|
glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, OGLRef.texMSGColorID);
|
||||||
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, maxSamplesOGL, GL_RGBA, w, h, GL_TRUE);
|
glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, sampleSize, GL_RGBA, w, h, GL_TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGColorID);
|
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGColorID);
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleSize, GL_RGBA, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGPolyID);
|
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGPolyID);
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleSize, GL_RGBA, w, h);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGFogAttrID);
|
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGFogAttrID);
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesOGL, GL_RGBA, w, h);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleSize, GL_RGBA, w, h);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGDepthStencilID);
|
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGDepthStencilID);
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesOGL, GL_DEPTH24_STENCIL8, w, h);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleSize, GL_DEPTH24_STENCIL8, w, h);
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGDepthStencilAlphaID);
|
glBindRenderbuffer(GL_RENDERBUFFER, OGLRef.rboMSGDepthStencilAlphaID);
|
||||||
glRenderbufferStorageMultisample(GL_RENDERBUFFER, maxSamplesOGL, GL_DEPTH24_STENCIL8, w, h);
|
glRenderbufferStorageMultisample(GL_RENDERBUFFER, sampleSize, GL_DEPTH24_STENCIL8, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilAlphaID);
|
glBindTexture(GL_TEXTURE_2D, OGLRef.texGDepthStencilAlphaID);
|
||||||
|
|
Loading…
Reference in New Issue