diff options
author | Inho Lee <inho.lee@qt.io> | 2020-09-16 14:38:58 +0200 |
---|---|---|
committer | Inho Lee <inho.lee@qt.io> | 2020-09-21 11:36:14 +0200 |
commit | 2a7d6e2779bf0c7915396a8af0e1048d254debc3 (patch) | |
tree | a0f02b0039d9c437432152c22e593c4a6f816779 /src/gui/rhi/qrhigles2.cpp | |
parent | 0148c6925ec3b6b9a9d2f57ae44fea292a6625e1 (diff) |
Support signed integer attributes on QRHI
Previous UIntAttributes feature is renamed as IntAttributes.
Change-Id: I4b4a87a0eebf37291da832605f7bee8fb2d4e62b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhigles2.cpp')
-rw-r--r-- | src/gui/rhi/qrhigles2.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/gui/rhi/qrhigles2.cpp b/src/gui/rhi/qrhigles2.cpp index 4440182264..39c01b1144 100644 --- a/src/gui/rhi/qrhigles2.cpp +++ b/src/gui/rhi/qrhigles2.cpp @@ -553,7 +553,7 @@ bool QRhiGles2::create(QRhi::Flags flags) caps.nonBaseLevelFramebufferTexture = true; caps.texelFetch = caps.ctxMajor >= 3; // 3.0 or ES 3.0 - caps.uintAttributes = caps.ctxMajor >= 3; // 3.0 or ES 3.0 + caps.intAttributes = caps.ctxMajor >= 3; // 3.0 or ES 3.0 caps.screenSpaceDerivatives = f->hasOpenGLExtension(QOpenGLExtensions::StandardDerivatives); // TO DO: We could also check for ARB_texture_multisample but it is not @@ -928,8 +928,8 @@ bool QRhiGles2::isFeatureSupported(QRhi::Feature feature) const return caps.texelFetch; case QRhi::RenderToNonBaseMipLevel: return caps.nonBaseLevelFramebufferTexture; - case QRhi::UIntAttributes: - return caps.uintAttributes; + case QRhi::IntAttributes: + return caps.intAttributes; case QRhi::ScreenSpaceDerivatives: return caps.screenSpaceDerivatives; case QRhi::ReadBackAnyTextureFormat: @@ -2253,18 +2253,34 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb) type = GL_UNSIGNED_INT; size = 1; break; + case QRhiVertexInputAttribute::SInt4: + type = GL_INT; + size = 4; + break; + case QRhiVertexInputAttribute::SInt3: + type = GL_INT; + size = 3; + break; + case QRhiVertexInputAttribute::SInt2: + type = GL_INT; + size = 2; + break; + case QRhiVertexInputAttribute::SInt: + type = GL_INT; + size = 1; + break; default: break; } const int locationIdx = it->location(); quint32 ofs = it->offset() + cmd.args.bindVertexBuffer.offset; - if (type == GL_UNSIGNED_INT) { - if (caps.uintAttributes) { + if (type == GL_UNSIGNED_INT || type == GL_INT) { + if (caps.intAttributes) { f->glVertexAttribIPointer(GLuint(locationIdx), size, type, stride, reinterpret_cast<const GLvoid *>(quintptr(ofs))); } else { - qWarning("Current RHI backend does not support UIntAttributes. Check supported features."); + qWarning("Current RHI backend does not support IntAttributes. Check supported features."); // This is a trick to disable this attribute if (locationIdx < TRACKED_ATTRIB_COUNT) enabledAttribArrays[locationIdx] = true; |