diff options
author | Paul Lemire <paul.lemire350@gmail.com> | 2015-08-02 20:49:45 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2015-08-07 09:39:00 +0000 |
commit | f9923c6454ab42f738c1645a7618e7bd555d6807 (patch) | |
tree | 3e1ccd59fad38595bd2ed5c130adf78e96bbfc03 /src | |
parent | 62c8cb2488f7ea5b7df65cf33ba8f8236fc81c8a (diff) |
Add LoadBufferJob class
One LoadBufferJob will be created per unique dirty buffer so that buffer data
loading can be easily parallelized.
Change-Id: Icb0e4fcb2f0262d9a5eb349a01d30788f5138c0b
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/render/backend/jobs/loadbufferjob.cpp | 72 | ||||
-rw-r--r-- | src/render/backend/jobs/loadbufferjob_p.h | 76 | ||||
-rw-r--r-- | src/render/backend/jobs/render-jobs.pri | 6 |
3 files changed, 152 insertions, 2 deletions
diff --git a/src/render/backend/jobs/loadbufferjob.cpp b/src/render/backend/jobs/loadbufferjob.cpp new file mode 100644 index 000000000..32b8cbdf1 --- /dev/null +++ b/src/render/backend/jobs/loadbufferjob.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Paul Lemire +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "loadbufferjob_p.h" +#include <Qt3DRenderer/private/renderbuffer_p.h> +#include <Qt3DRenderer/private/managers_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +namespace Render { + + +LoadBufferJob::LoadBufferJob(const HBuffer &handle) + : QAspectJob() + , m_handle(handle) + , m_renderer(Q_NULLPTR) +{ +} + +LoadBufferJob::~LoadBufferJob() +{ +} + +void LoadBufferJob::run() +{ + // TO DO: Load a job functor + + // Unset the dirty flag on the buffer + RenderBuffer *buffer = m_renderer->bufferManager()->data(m_handle); + buffer->unsetDirty(); +} + +} // Render + +} // Qt3D + +QT_END_NAMESPACE diff --git a/src/render/backend/jobs/loadbufferjob_p.h b/src/render/backend/jobs/loadbufferjob_p.h new file mode 100644 index 000000000..af1f32b37 --- /dev/null +++ b/src/render/backend/jobs/loadbufferjob_p.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2015 Paul Lemire +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3D_RENDER_LOADBUFFERJOB_H +#define QT3D_RENDER_LOADBUFFERJOB_H + +#include <QSharedPointer> +#include <Qt3DCore/qaspectjob.h> +#include <Qt3DRenderer/private/handle_types_p.h> + +QT_BEGIN_NAMESPACE + +namespace Qt3D { + +namespace Render { + +class Renderer; + +class LoadBufferJob : public Qt3D::QAspectJob +{ +public: + explicit LoadBufferJob(const HBuffer &handle); + ~LoadBufferJob(); + + void setRenderer(Renderer *renderer) { m_renderer = renderer; } + + // TO DO: Add a set functor method in here + +protected: + void run() Q_DECL_OVERRIDE; + HBuffer m_handle; + Renderer *m_renderer; +}; + +typedef QSharedPointer<LoadBufferJob> LoadBufferJobPtr; + +} // Render + +} // Qt3D + +QT_END_NAMESPACE + +#endif // QT3D_RENDER_LOADBUFFERJOB_H diff --git a/src/render/backend/jobs/render-jobs.pri b/src/render/backend/jobs/render-jobs.pri index fefc18001..2a4f4ddee 100644 --- a/src/render/backend/jobs/render-jobs.pri +++ b/src/render/backend/jobs/render-jobs.pri @@ -9,7 +9,8 @@ HEADERS += \ $$PWD/loadscenejob_p.h \ $$PWD/framecleanupjob_p.h \ $$PWD/framepreparationjob_p.h \ - $$PWD/loadtexturedatajob_p.h + $$PWD/loadtexturedatajob_p.h \ + $$PWD/loadbufferjob_p.h SOURCES += \ $$PWD/updateworldtransformjob.cpp \ @@ -20,4 +21,5 @@ SOURCES += \ $$PWD/loadscenejob.cpp \ $$PWD/framecleanupjob.cpp \ $$PWD/framepreparationjob.cpp \ - $$PWD/loadtexturedatajob.cpp + $$PWD/loadtexturedatajob.cpp \ + $$PWD/loadbufferjob.cpp |