diff options
author | Andy Nichols <andy.nichols@theqtcompany.com> | 2015-08-07 16:59:09 +0200 |
---|---|---|
committer | Andy Nichols <andy.nichols@theqtcompany.com> | 2015-08-08 12:55:47 +0000 |
commit | 6c3d6e7eb7c80caee1891ace34f95b4a5a901f9c (patch) | |
tree | 5cdf131a309e430bdbde3b817e60a18c9e2b99d5 | |
parent | 038ab21c9811351f632a457ff5a931e55d21f17a (diff) |
Fix Attribute Parameter mapping
When using a shader that has different attribute names than the expected
standard attributes, and there is a mapping between the two, currently
the attributes fail to be found because we are still using the standard
name instead of the mapped one. This change fixes this behavior to allow
attribute names to be mapped as intended.
Change-Id: I8f264e348dab5257c55206065bc2900c8c3cff46
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/render/backend/qgraphicscontext.cpp | 6 | ||||
-rw-r--r-- | src/render/backend/qgraphicscontext_p.h | 2 | ||||
-rw-r--r-- | src/render/backend/renderer.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/render/backend/qgraphicscontext.cpp b/src/render/backend/qgraphicscontext.cpp index 141761fa1..24c627786 100644 --- a/src/render/backend/qgraphicscontext.cpp +++ b/src/render/backend/qgraphicscontext.cpp @@ -869,7 +869,7 @@ void QGraphicsContext::setUniforms(QUniformPack &uniforms) m_activeShader->updateUniforms(this, uniforms); } -void QGraphicsContext::specifyAttribute(const RenderAttribute *attribute, RenderBuffer *buffer) +void QGraphicsContext::specifyAttribute(const RenderAttribute *attribute, RenderBuffer *buffer, const QString &shaderName) { if (attribute == Q_NULLPTR || buffer == Q_NULLPTR) return; @@ -878,9 +878,9 @@ void QGraphicsContext::specifyAttribute(const RenderAttribute *attribute, Render buf.bind(); QOpenGLShaderProgram* prog = activeShader(); - int location = prog->attributeLocation(attribute->name()); + int location = prog->attributeLocation(shaderName); if (location < 0) { - qCWarning(Backend) << "failed to resolve location for attribute:" << attribute->name(); + qCWarning(Backend) << "failed to resolve location for attribute:" << shaderName; return; } prog->enableAttributeArray(location); diff --git a/src/render/backend/qgraphicscontext_p.h b/src/render/backend/qgraphicscontext_p.h index f53d2c650..04f498ba6 100644 --- a/src/render/backend/qgraphicscontext_p.h +++ b/src/render/backend/qgraphicscontext_p.h @@ -128,7 +128,7 @@ public: void setRenderer(Renderer *renderer); - void specifyAttribute(const RenderAttribute *attribute, RenderBuffer *buffer); + void specifyAttribute(const RenderAttribute *attribute, RenderBuffer *buffer, const QString &shaderName); void specifyIndices(RenderBuffer *buffer); void updateBuffer(RenderBuffer *buffer); diff --git a/src/render/backend/renderer.cpp b/src/render/backend/renderer.cpp index 1c285a045..bf4a810b8 100644 --- a/src/render/backend/renderer.cpp +++ b/src/render/backend/renderer.cpp @@ -1008,7 +1008,7 @@ RenderAttribute *Renderer::updateBuffersAndAttributes(RenderGeometry *geometry, // Vertex Attribute } else if (command->m_parameterAttributeToShaderNames.contains(attribute->name())) { if (attribute->isDirty() || forceUpdate) - m_graphicsContext->specifyAttribute(attribute, buffer); + m_graphicsContext->specifyAttribute(attribute, buffer, command->m_parameterAttributeToShaderNames.value(attribute->name())); estimatedCount = qMax(attribute->count(), estimatedCount); } |