diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/render/backend/jobs/renderviewjobutils.cpp | 9 | ||||
-rw-r--r-- | src/render/backend/rendershader.cpp | 20 |
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; } |