diff options
11 files changed, 15 insertions, 207 deletions
diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp index 02b523b7c..0ebbb2558 100644 --- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp +++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext.cpp @@ -1224,114 +1224,6 @@ QSurfaceFormat SubmissionContext::format() const noexcept return QSurfaceFormat::defaultFormat(); } -// It will be easier if the QGraphicContext applies the QUniformPack -// than the other way around -bool SubmissionContext::setParameters(ShaderParameterPack ¶meterPack, RHIShader *shader) -{ -// static const int irradianceId = StringToInt::lookupId(QLatin1String("envLight_irradiance")); -// static const int specularId = StringToInt::lookupId(QLatin1String("envLight_specular")); - // Activate textures and update TextureUniform in the pack - // with the correct textureUnit - - // Set the pinned texture of the previous material texture - // to pinable so that we should easily find an available texture unit - // m_textureContext.deactivateTexturesWithScope(TextureSubmissionContext::TextureScopeMaterial); - // Update the uniforms with the correct texture unit id's -// PackUniformHash &uniformValues = parameterPack.uniforms(); - - // Fill Texture Uniform Value with proper texture units - // so that they can be applied as regular uniforms in a second step - for (size_t i = 0; i < parameterPack.textures().size(); ++i) { - RHI_UNIMPLEMENTED; - //* const ShaderParameterPack::NamedResource &namedTex = parameterPack.textures().at(i); - //* // Given a Texture QNodeId, we retrieve the associated shared RHITexture - //* if (uniformValues.contains(namedTex.glslNameId)) { - //* RHITexture *t = - //m_renderer->rhiResourceManagers()->rhiTextureManager()->lookupResource(namedTex.nodeId); - //* if (t != nullptr) { - //* UniformValue &texUniform = uniformValues.value(namedTex.glslNameId); - //* if (texUniform.valueType() == UniformValue::TextureValue) { - //* const int texUnit = - //m_textureContext.activateTexture(TextureSubmissionContext::TextureScopeMaterial, m_gl, t); - //* texUniform.data<int>()[namedTex.uniformArrayIndex] = texUnit; - //* if (texUnit == -1) { - //* if (namedTex.glslNameId != irradianceId && - //* namedTex.glslNameId != specularId) { - //* // Only return false if we are not dealing with env light textures - //* qCWarning(Backend) << "Unable to find suitable Texture Unit"; - //* return false; - //* } - //* } - //* } - //* } - //* } - } - - // TO DO: We could cache the binding points somehow and only do the binding when necessary - // for SSBO and UBO - - // Bind Shader Storage block to SSBO and update SSBO - const auto &blockToSSBOs = parameterPack.shaderStorageBuffers(); - for (const BlockToSSBO &b : blockToSSBOs) { - RHI_UNIMPLEMENTED; - Buffer *cpuBuffer = - m_renderer->nodeManagers()->bufferManager()->lookupResource(b.m_bufferID); - RHIBuffer *ssbo = rhiBufferForRenderBuffer(cpuBuffer); - // bindShaderStorageBlock - // This is currently not required as we are introspecting the bindingIndex - // value from the shaders and not replacing them, making such a call useless - // bindShaderStorageBlock(shader->programId(), b.m_blockIndex, b.m_bindingIndex); - // bindShaderStorageBlock(shader->programId(), b.m_blockIndex, b.m_bindingIndex); - // Needed to avoid conflict where the buffer would already - // be bound as a VertexArray - bindRHIBuffer(ssbo, RHIBuffer::ShaderStorageBuffer); - // TO DO: This should update QRhiShaderResourceBinding - - // TO DO: Make sure that there's enough binding points - } - - // Bind UniformBlocks to UBO and update UBO from Buffer - // TO DO: Convert ShaderData to Buffer so that we can use that generic process - const auto &blockToUBOs = parameterPack.uniformBuffers(); - int uboIndex = 0; - for (const BlockToUBO &b : blockToUBOs) { - RHI_UNIMPLEMENTED; - Buffer *cpuBuffer = - m_renderer->nodeManagers()->bufferManager()->lookupResource(b.m_bufferID); - RHIBuffer *ubo = rhiBufferForRenderBuffer(cpuBuffer); - // bindUniformBlock(shader->programId(), b.m_blockIndex, uboIndex); - // Needed to avoid conflict where the buffer would already - // be bound as a VertexArray - bindRHIBuffer(ubo, RHIBuffer::UniformBuffer); - // TO DO: This should update QRhiShaderResourceBinding - - -// ubo->bindBufferBase(this, uboIndex++, RHIBuffer::UniformBuffer); - // TO DO: Make sure that there's enough binding points - } - - /* - // Update uniforms in the Default Uniform Block - const PackUniformHash& values = parameterPack.uniforms(); - const auto &activeUniformsIndices = parameterPack.submissionUniformIndices(); - const std::vector<ShaderUniform> &shaderUniforms = shader->uniforms(); - - for (const int shaderUniformIndex : activeUniformsIndices) { - const ShaderUniform &uniform = shaderUniforms[shaderUniformIndex]; - values.apply(uniform.m_nameId, [&] (const UniformValue& v) { - // skip invalid textures/images - if (!((v.valueType() == UniformValue::TextureValue || - v.valueType() == UniformValue::ShaderImageValue) && - *v.constData<int>() == -1)) - applyUniform(uniform, v); - }); - - } - */ - // if not all data is valid, the next frame will be rendered immediately - return true; -} - void SubmissionContext::updateBuffer(Buffer *buffer) { const QHash<Qt3DCore::QNodeId, HRHIBuffer>::iterator it = @@ -1466,87 +1358,6 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, Q_UNUSED(outputAttachmentPoint); Q_UNUSED(interpolationMethod); RHI_UNIMPLEMENTED; - //* GLuint inputFboId = defaultFboId; - //* bool inputBufferIsDefault = true; - //* if (!inputRenderTargetId.isNull()) { - //* RenderTarget *renderTarget = - //m_renderer->nodeManagers()->renderTargetManager()->lookupResource(inputRenderTargetId); - //* if (renderTarget) { - //* AttachmentPack attachments(renderTarget, - //m_renderer->nodeManagers()->attachmentManager()); - //* if (m_renderTargets.contains(inputRenderTargetId)) - //* inputFboId = updateRenderTarget(inputRenderTargetId, attachments, false); - //* else - //* inputFboId = createRenderTarget(inputRenderTargetId, attachments); - //* } - //* inputBufferIsDefault = false; - //* } - //* - //* GLuint outputFboId = defaultFboId; - //* bool outputBufferIsDefault = true; - //* if (!outputRenderTargetId.isNull()) { - //* RenderTarget *renderTarget = - //m_renderer->nodeManagers()->renderTargetManager()->lookupResource(outputRenderTargetId); - //* if (renderTarget) { - //* AttachmentPack attachments(renderTarget, - //m_renderer->nodeManagers()->attachmentManager()); - //* if (m_renderTargets.contains(outputRenderTargetId)) - //* outputFboId = updateRenderTarget(outputRenderTargetId, attachments, false); - //* else - //* outputFboId = createRenderTarget(outputRenderTargetId, attachments); - //* } - //* outputBufferIsDefault = false; - //* } - //* - //* // Up until this point the input and output rects are normal Qt rectangles. - //* // Convert them to GL rectangles (Y at bottom). - //* const int inputFboHeight = inputFboId == defaultFboId ? m_surfaceSize.height() : - //m_renderTargetsSize[inputFboId].height(); - //* const GLint srcX0 = inputRect.left(); - //* const GLint srcY0 = inputFboHeight - (inputRect.top() + inputRect.height()); - //* const GLint srcX1 = srcX0 + inputRect.width(); - //* const GLint srcY1 = srcY0 + inputRect.height(); - //* - //* const int outputFboHeight = outputFboId == defaultFboId ? m_surfaceSize.height() : - //m_renderTargetsSize[outputFboId].height(); - //* const GLint dstX0 = outputRect.left(); - //* const GLint dstY0 = outputFboHeight - (outputRect.top() + outputRect.height()); - //* const GLint dstX1 = dstX0 + outputRect.width(); - //* const GLint dstY1 = dstY0 + outputRect.height(); - //* - //* //Get the last bounded framebuffers - //* const GLuint lastDrawFboId = boundFrameBufferObject(); - //* - //* // Activate input framebuffer for reading - //* bindFramebuffer(inputFboId, GraphicsHelperInterface::FBORead); - //* - //* // Activate output framebuffer for writing - //* bindFramebuffer(outputFboId, GraphicsHelperInterface::FBODraw); - //* - //* //Bind texture - //* if (!inputBufferIsDefault) - //* readBuffer(GL_COLOR_ATTACHMENT0 + inputAttachmentPoint); - //* - //* if (!outputBufferIsDefault) { - //* // Note that we use glDrawBuffers, not glDrawBuffer. The - //* // latter is not available with GLES. - //* const int buf = outputAttachmentPoint; - //* drawBuffers(1, &buf); - //* } - //* - //* // Blit framebuffer - //* const GLenum mode = interpolationMethod ? GL_NEAREST : GL_LINEAR; - //* m_glHelper->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, - //* dstX0, dstY0, dstX1, dstY1, - //* GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT, - //* mode); - //* - //* // Reset draw buffer - //* bindFramebuffer(lastDrawFboId, GraphicsHelperInterface::FBOReadAndDraw); - //* if (outputAttachmentPoint != QRenderTargetOutput::Color0) { - //* const int buf = QRenderTargetOutput::Color0; - //* drawBuffers(1, &buf); - //* } } namespace { diff --git a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h index e164564a4..f48c11234 100644 --- a/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h +++ b/src/plugins/renderers/rhi/graphicshelpers/submissioncontext_p.h @@ -170,9 +170,6 @@ public: bool hasRHIBufferForBuffer(Buffer *buffer); RHIBuffer *rhiBufferForRenderBuffer(Buffer *buf); - // Parameters - bool setParameters(ShaderParameterPack ¶meterPack, RHIShader *shader); - // RenderState void applyStateSet(const RenderStateSet *ss, QRhiGraphicsPipeline *graphicsPipeline); StateVariant *getState(RenderStateSet *ss, StateMask type) const; diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp index aea3e7e4c..d77b40d76 100644 --- a/src/plugins/renderers/rhi/renderer/renderer.cpp +++ b/src/plugins/renderers/rhi/renderer/renderer.cpp @@ -1018,6 +1018,7 @@ void Renderer::buildGraphicsPipelines(RHIGraphicsPipeline *graphicsPipeline, return QRhiGraphicsPipeline::Points; } } + return QRhiGraphicsPipeline::Points; }; pipeline->setTopology(rhiTopologyFromQt3DTopology(cmd.m_primitiveType)); @@ -1338,8 +1339,7 @@ Renderer::prepareCommandsSubmission(const std::vector<RenderView *> &renderViews for (size_t i = 0; i < renderViewCount;) { std::vector<RenderView *> sameRenderTargetRVs; - std::vector<QRhiBuffer *> rvUbos; - RenderView *refRV = renderViews.at(i); + RenderView *refRV = renderViews[i]; sameRenderTargetRVs.push_back(refRV); for (i = i + 1; i < renderViewCount; ++i) { diff --git a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp index 97f35b880..5aa5f7548 100644 --- a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp +++ b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp @@ -243,7 +243,7 @@ public: // QThread interface protected: - void run() + void run() override { int i = 0; int max = 65535; @@ -313,7 +313,7 @@ public: // QThread interface protected: - void run() + void run() override { int i = 0; int max = 65535; diff --git a/tests/auto/core/qscheduler/tst_qscheduler.cpp b/tests/auto/core/qscheduler/tst_qscheduler.cpp index b3ef21c17..a0df4b935 100644 --- a/tests/auto/core/qscheduler/tst_qscheduler.cpp +++ b/tests/auto/core/qscheduler/tst_qscheduler.cpp @@ -44,7 +44,7 @@ class JobPrivate : public QAspectJobPrivate public: // QAspectJobPrivate interface - void postFrame(QAspectManager *aspectManager) + void postFrame(QAspectManager *aspectManager) override { Q_ASSERT(aspectManager); m_postFrameCalled = true; @@ -129,7 +129,7 @@ public: private: // QAbstractAspect interface - std::vector<QAspectJobPtr> jobsToExecute(qint64) + std::vector<QAspectJobPtr> jobsToExecute(qint64) override { return { m_first, m_second }; } diff --git a/tests/auto/input/utils/tst_utils.cpp b/tests/auto/input/utils/tst_utils.cpp index 87c5cd6a0..5e791b99e 100644 --- a/tests/auto/input/utils/tst_utils.cpp +++ b/tests/auto/input/utils/tst_utils.cpp @@ -43,8 +43,8 @@ public: FakeBackendDevice() : Qt3DInput::QAbstractPhysicalDeviceBackendNode(Qt3DCore::QBackendNode::ReadOnly) {} - float axisValue(int) const { return 0.0f; } - bool isButtonPressed(int) const { return false; } + float axisValue(int) const override { return 0.0f; } + bool isButtonPressed(int) const override { return false; } }; class FakeInputDeviceIntegration : public Qt3DInput::QInputDeviceIntegration diff --git a/tests/auto/render/entity/tst_entity.cpp b/tests/auto/render/entity/tst_entity.cpp index f81bc5c92..d14142ca0 100644 --- a/tests/auto/render/entity/tst_entity.cpp +++ b/tests/auto/render/entity/tst_entity.cpp @@ -74,7 +74,7 @@ public: CompleteVisitor(NodeManagers *manager) : EntityVisitor(manager) { } int count = 0; - Operation visit(Entity *) { count++; return Continue; } + Operation visit(Entity *) override { count++; return Continue; } }; class EnabledVisitor : public EntityVisitor @@ -83,7 +83,7 @@ public: EnabledVisitor(NodeManagers *manager) : EntityVisitor(manager) { } int count = 0; - Operation visit(Entity *e) { count++; return e->isEnabled() ? Continue : Prune; } + Operation visit(Entity *e) override { count++; return e->isEnabled() ? Continue : Prune; } }; class tst_RenderEntity : public QObject diff --git a/tests/auto/render/qcamera/tst_qcamera.cpp b/tests/auto/render/qcamera/tst_qcamera.cpp index 26a103c95..4e8da68cf 100644 --- a/tests/auto/render/qcamera/tst_qcamera.cpp +++ b/tests/auto/render/qcamera/tst_qcamera.cpp @@ -114,8 +114,8 @@ public: ~TestAspect(); - void onRegistered() { QRenderAspect::onRegistered(); } - void onUnregistered() { QRenderAspect::onUnregistered(); } + void onRegistered() override { QRenderAspect::onRegistered(); } + void onUnregistered() override { QRenderAspect::onUnregistered(); } Qt3DRender::Render::NodeManagers *nodeManagers() const { return d_func()->m_renderer->nodeManagers(); } Qt3DRender::Render::FrameGraphNode *frameGraphRoot() const { return d_func()->m_renderer->frameGraphRoot(); } diff --git a/tests/manual/paintedtexture-cpp/scene.cpp b/tests/manual/paintedtexture-cpp/scene.cpp index e5ef6730f..5931d003c 100644 --- a/tests/manual/paintedtexture-cpp/scene.cpp +++ b/tests/manual/paintedtexture-cpp/scene.cpp @@ -71,7 +71,7 @@ public: } protected: - void paint(QPainter *painter) + void paint(QPainter *painter) override { int w = painter->device()->width(); int h = painter->device()->height(); diff --git a/tests/manual/rendercapture-qml-fbo/rendercaptureprovider.h b/tests/manual/rendercapture-qml-fbo/rendercaptureprovider.h index 82095e1f6..bc0f54963 100644 --- a/tests/manual/rendercapture-qml-fbo/rendercaptureprovider.h +++ b/tests/manual/rendercapture-qml-fbo/rendercaptureprovider.h @@ -70,7 +70,7 @@ public: m_image = reply->image(); } - virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) + virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override { Q_UNUSED(id); Q_UNUSED(requestedSize); diff --git a/tests/manual/rendercapture-qml/rendercaptureprovider.h b/tests/manual/rendercapture-qml/rendercaptureprovider.h index 82095e1f6..bc0f54963 100644 --- a/tests/manual/rendercapture-qml/rendercaptureprovider.h +++ b/tests/manual/rendercapture-qml/rendercaptureprovider.h @@ -70,7 +70,7 @@ public: m_image = reply->image(); } - virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) + virtual QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override { Q_UNUSED(id); Q_UNUSED(requestedSize); |