summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-02-27 10:06:57 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-02-28 16:29:52 +0000
commitbc7afda3ece9be46bef1ac2308f3b2ce598e5f00 (patch)
tree08a3b22d5903502129f13a2eff024d6094185091 /src
parentb1362121ee144760f8b17392b064719e543e28b0 (diff)
RenderShader: Fix for absence of instance names in UBO
- Also added debug logging in RenderShader for the Shaders logging category - This restores the deferred-example rendering which was broken since 3abbf9227ada8f68821a5ad473bba4f52e625fb5 Change-Id: Ie1b39c903f8c33f7d9b859317ae185c42043a9e2 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/render/backend/jobs/renderviewjobutils.cpp9
-rw-r--r--src/render/backend/rendershader.cpp20
2 files changed, 22 insertions, 7 deletions
diff --git a/src/render/backend/jobs/renderviewjobutils.cpp b/src/render/backend/jobs/renderviewjobutils.cpp
index 3d341ed2d..4e056c79b 100644
--- a/src/render/backend/jobs/renderviewjobutils.cpp
+++ b/src/render/backend/jobs/renderviewjobutils.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "renderviewjobutils_p.h"
+#include "renderlogging_p.h"
#include <Qt3DRenderer/qopenglfilter.h>
#include <Qt3DRenderer/sphere.h>
@@ -376,8 +377,10 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
}
} else { // Array of scalar/vec qmlPropertyName[0]
QString varName = blockName + QStringLiteral(".") + qmlPropertyName + QStringLiteral("[0]");
- if (uniforms.contains(varName))
+ if (uniforms.contains(varName)) {
+ qCDebug(Shaders) << "UBO array member " << varName << " set for update";
activeUniformNamesToValue.insert(varName, value);
+ }
}
} else if (value.userType() == qNodeIdTypeId) { // Struct qmlPropertyName.structMember
RenderShaderData *rSubShaderData = shaderDataManager->lookupResource(value.value<QNodeId>());
@@ -387,8 +390,10 @@ void UniformBlockValueBuilder::buildActiveUniformNameValueMapHelper(const QStrin
qmlPropertyName);
} else { // Scalar / Vec
QString varName = blockName + QStringLiteral(".") + qmlPropertyName;
- if (uniforms.contains(varName))
+ if (uniforms.contains(varName)) {
+ qCDebug(Shaders) << "UBO scalar member " << varName << " set for update";
activeUniformNamesToValue.insert(varName, value);
+ }
}
}
diff --git a/src/render/backend/rendershader.cpp b/src/render/backend/rendershader.cpp
index 48818615b..8d11443da 100644
--- a/src/render/backend/rendershader.cpp
+++ b/src/render/backend/rendershader.cpp
@@ -35,8 +35,8 @@
****************************************************************************/
#include "rendershader_p.h"
+#include "renderlogging_p.h"
-#include <QDebug>
#include <QFile>
#include <QOpenGLContext>
#include <QOpenGLShaderProgram>
@@ -297,8 +297,10 @@ void RenderShader::initializeUniforms(const QVector<ShaderUniform> &uniformsDesc
for (int i = 0; i < uniformsDescription.size(); i++) {
m_uniformsNames[i] = uniformsDescription[i].m_name;
- if (uniformsDescription[i].m_blockIndex == -1) // Uniform is in default block
+ if (uniformsDescription[i].m_blockIndex == -1) { // Uniform is in default block
+ qCDebug(Shaders) << "Active Uniform in Default Block " << uniformsDescription[i].m_name;
activeUniformsInDefaultBlock.insert(uniformsDescription[i].m_name, uniformsDescription[i]);
+ }
}
m_blockIndexToShaderUniforms.insert(-1, activeUniformsInDefaultBlock);
}
@@ -307,8 +309,10 @@ void RenderShader::initializeAttributes(const QVector<ShaderAttribute> &attribut
{
m_attributes = attributesDescription;
m_attributesNames.resize(attributesDescription.size());
- for (int i = 0; i < attributesDescription.size(); i++)
+ for (int i = 0; i < attributesDescription.size(); i++) {
m_attributesNames[i] = attributesDescription[i].m_name;
+ qCDebug(Shaders) << "Active Attribute " << attributesDescription[i].m_name;
+ }
}
void RenderShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &uniformBlockDescription)
@@ -317,6 +321,7 @@ void RenderShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &un
m_uniformBlockNames.resize(uniformBlockDescription.size());
for (int i = 0; i < uniformBlockDescription.size(); ++i) {
m_uniformBlockNames[i] = uniformBlockDescription[i].m_name;
+ qCDebug(Shaders) << "Initializing Uniform Block " << m_uniformBlockNames[i];
// Find all active uniforms for the shader block
QVector<ShaderUniform>::const_iterator uniformsIt = m_uniforms.begin();
@@ -328,8 +333,13 @@ void RenderShader::initializeUniformBlocks(const QVector<ShaderUniformBlock> &un
QHash<QString, ShaderUniform> activeUniformsInBlock;
while (uniformsIt != uniformsEnd && uniformNamesIt != uniformNamesEnd) {
- if (uniformsIt->m_blockIndex == uniformBlockDescription[i].m_index)
- activeUniformsInBlock.insert(*uniformNamesIt, *uniformsIt);
+ if (uniformsIt->m_blockIndex == uniformBlockDescription[i].m_index) {
+ QString uniformName = *uniformNamesIt;
+ if (!m_uniformBlockNames[i].isEmpty() && !uniformName.startsWith(m_uniformBlockNames[i]))
+ uniformName = m_uniformBlockNames[i] + QStringLiteral(".") + *uniformNamesIt;
+ activeUniformsInBlock.insert(uniformName, *uniformsIt);
+ qCDebug(Shaders) << "Active Uniform Block " << uniformName << " in block " << m_uniformBlockNames[i];
+ }
++uniformsIt;
++uniformNamesIt;
}