From d0ab2359f5b4b23dcd017ed6abb2c063deb98a85 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Wed, 9 Dec 2015 13:23:07 +0100 Subject: GraphicsContext: use GLBuffer instead of QOpenGLBuffer This will be needed to simplify the process of binding SSBO/UBO buffers. Change-Id: Ice3bb97381328c5bddf1c9e46af30b4814ff2572 Note: ShaderData UBO handling temporarly disabled. Reviewed-by: Paul Lemire --- src/render/backend/managers_p.h | 2 +- src/render/backend/renderview.cpp | 71 ++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 35 deletions(-) (limited to 'src/render/backend') diff --git a/src/render/backend/managers_p.h b/src/render/backend/managers_p.h index 94089795c..e3b9cb9d7 100644 --- a/src/render/backend/managers_p.h +++ b/src/render/backend/managers_p.h @@ -284,7 +284,7 @@ public: class GLBufferManager : public Qt3DCore::QResourceManager< GLBuffer, - BufferShaderKey, + Qt3DCore::QNodeId, 16, Qt3DCore::ArrayAllocatingPolicy, Qt3DCore::ObjectLevelLockingPolicy> diff --git a/src/render/backend/renderview.cpp b/src/render/backend/renderview.cpp index 22aa581a7..120142c51 100644 --- a/src/render/backend/renderview.cpp +++ b/src/render/backend/renderview.cpp @@ -621,41 +621,44 @@ void RenderView::setUniformBlockValue(QUniformPack &uniformPack, Shader *shader, // Note: we assume that if a buffer is shared accross multiple shaders // then it implies that they share the same layout - BufferShaderKey uboKey(shaderData->peerUuid(), - shader->peerUuid()); - - BlockToUBO uniformBlockUBO; - uniformBlockUBO.m_blockIndex = block.m_index; - uniformBlockUBO.m_shaderDataID = shaderData->peerUuid(); - bool uboNeedsUpdate = false; - - // build UBO at uboId if not created before - if (!m_manager->glBufferManager()->contains(uboKey)) { - m_manager->glBufferManager()->getOrCreateResource(uboKey); - uboNeedsUpdate = true; - } - - // If shaderData has been updated (property has changed or one of the nested properties has changed) - // foreach property defined in the QShaderData, we try to fill the value of the corresponding active uniform(s) - // for all the updated properties (all the properties if the UBO was just created) - if (shaderData->updateViewTransform(*m_data->m_viewMatrix) || uboNeedsUpdate) { - // Clear previous values remaining in the hash - m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear(); - // Update only update properties if uboNeedsUpdate is true, otherwise update the whole block - m_data->m_uniformBlockBuilder.updatedPropertiesOnly = uboNeedsUpdate; - // Retrieve names and description of each active uniforms in the uniform block - m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForUniformBlock(block.m_index); - // Builds the name-value map for the block - m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, block.m_name); - if (!uboNeedsUpdate) - shaderData->markDirty(); - // copy the name-value map into the BlockToUBO - uniformBlockUBO.m_updatedProperties = m_data->m_uniformBlockBuilder.activeUniformNamesToValue; - uboNeedsUpdate = true; - } - uniformBlockUBO.m_needsUpdate = uboNeedsUpdate; - uniformPack.setUniformBuffer(uniformBlockUBO); + // Temporarly disabled + + // BufferShaderKey uboKey(shaderData->peerUuid(), + // shader->peerUuid()); + + // BlockToUBO uniformBlockUBO; + // uniformBlockUBO.m_blockIndex = block.m_index; + // uniformBlockUBO.m_shaderDataID = shaderData->peerUuid(); + // bool uboNeedsUpdate = false; + + // // build UBO at uboId if not created before + // if (!m_manager->glBufferManager()->contains(uboKey)) { + // m_manager->glBufferManager()->getOrCreateResource(uboKey); + // uboNeedsUpdate = true; + // } + + // // If shaderData has been updated (property has changed or one of the nested properties has changed) + // // foreach property defined in the QShaderData, we try to fill the value of the corresponding active uniform(s) + // // for all the updated properties (all the properties if the UBO was just created) + // if (shaderData->updateViewTransform(*m_data->m_viewMatrix) || uboNeedsUpdate) { + // // Clear previous values remaining in the hash + // m_data->m_uniformBlockBuilder.activeUniformNamesToValue.clear(); + // // Update only update properties if uboNeedsUpdate is true, otherwise update the whole block + // m_data->m_uniformBlockBuilder.updatedPropertiesOnly = uboNeedsUpdate; + // // Retrieve names and description of each active uniforms in the uniform block + // m_data->m_uniformBlockBuilder.uniforms = shader->activeUniformsForUniformBlock(block.m_index); + // // Builds the name-value map for the block + // m_data->m_uniformBlockBuilder.buildActiveUniformNameValueMapStructHelper(shaderData, block.m_name); + // if (!uboNeedsUpdate) + // shaderData->markDirty(); + // // copy the name-value map into the BlockToUBO + // uniformBlockUBO.m_updatedProperties = m_data->m_uniformBlockBuilder.activeUniformNamesToValue; + // uboNeedsUpdate = true; + // } + + // uniformBlockUBO.m_needsUpdate = uboNeedsUpdate; + // uniformPack.setUniformBuffer(uniformBlockUBO); } } -- cgit v1.2.3