diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-02-22 17:26:55 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-02-23 17:26:25 +0100 |
commit | 46366a14a41ec6db5ab4ab72c473a4a4e187d484 (patch) | |
tree | 1c6e43dbe195ddd88825cfaec7141ad42dfda1f4 /src/gui/rhi/qrhigles2.cpp | |
parent | ce54e07dacd99ae9d532b6398cdeedc287ee2743 (diff) |
rhi: gl: Fix multisample texture specification
...so that MSAA is actually effective.
Pick-to: 6.7 6.6
Change-Id: I4bf85df1312773ec29154a51c9c8464912e6ef8a
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 29b6e60386..154ace305b 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -5470,8 +5470,16 @@ bool QGles2Texture::create() } } } else { - rhiD->f->glTexImage2D(target, 0, GLint(glintformat), size.width(), size.height(), - 0, glformat, gltype, nullptr); + // 2D texture. For multisample textures the GLES 3.1 + // glStorage2DMultisample must be used for portability. + if (m_sampleCount > 1 && rhiD->caps.multisampledTexture) { + // internal format must be sized + rhiD->f->glTexStorage2DMultisample(target, m_sampleCount, glsizedintformat, + size.width(), size.height(), GL_TRUE); + } else { + rhiD->f->glTexImage2D(target, 0, GLint(glintformat), size.width(), size.height(), + 0, glformat, gltype, nullptr); + } } } else { // Must be specified with immutable storage functions otherwise @@ -5482,6 +5490,9 @@ bool QGles2Texture::create() else if (!is1D && (is3D || isArray)) rhiD->f->glTexStorage3D(target, mipLevelCount, glsizedintformat, size.width(), size.height(), is3D ? qMax(1, m_depth) : qMax(0, m_arraySize)); + else if (m_sampleCount > 1) + rhiD->f->glTexStorage2DMultisample(target, m_sampleCount, glsizedintformat, + size.width(), size.height(), GL_TRUE); else rhiD->f->glTexStorage2D(target, mipLevelCount, glsizedintformat, size.width(), is1D ? qMax(0, m_arraySize) : size.height()); |