diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2c353453..406fb5aeb1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,7 @@ endforeach() file(GLOB_RECURSE JS_SRC scripts/*.js) add_custom_target(js SOURCES ${JS_SRC}) +GroupSources("scripts") if (UNIX) install( diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ac44be18f2..0006bdd778 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -65,6 +65,7 @@ set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QT_RESOURCES}") file(GLOB_RECURSE QML_SRC resources/qml/*.qml resources/qml/*.js) add_custom_target(qml SOURCES ${QML_SRC}) +GroupSources("resources/qml") if (UNIX) install( diff --git a/interface/resources/qml/Stats.qml b/interface/resources/qml/Stats.qml index d6459afd08..98e7f61ff7 100644 --- a/interface/resources/qml/Stats.qml +++ b/interface/resources/qml/Stats.qml @@ -244,16 +244,16 @@ Item { id: octreeCol spacing: 4; x: 4; y: 4; StatText { - text: " Frame timing:" + text: "Engine: " + root.engineFrameTime.toFixed(1) + " ms" } StatText { - text: " Batch: " + root.batchFrameTime.toFixed(1) + " ms" + text: "Batch: " + root.batchFrameTime.toFixed(1) + " ms" } StatText { - text: " GPU: " + root.gpuFrameTime.toFixed(1) + " ms" + text: "GPU: " + root.gpuFrameTime.toFixed(1) + " ms" } StatText { - text: " Avatar: " + root.avatarSimulationTime.toFixed(1) + " ms" + text: "Avatar: " + root.avatarSimulationTime.toFixed(1) + " ms" } StatText { text: "Triangles: " + root.triangles + diff --git a/interface/resources/sounds/snap.wav b/interface/resources/sounds/snap.wav index bb562e1db9..e5b86c0c71 100644 Binary files a/interface/resources/sounds/snap.wav and b/interface/resources/sounds/snap.wav differ diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index cd76704d34..717fdba842 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -594,7 +594,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo _aboutToQuit(false), _notifiedPacketVersionMismatchThisDomain(false), _maxOctreePPS(maxOctreePacketsPerSecond.get()), - _lastFaceTrackerUpdate(0) + _lastFaceTrackerUpdate(0), + _snapshotSound(nullptr) { auto steamClient = PluginManager::getInstance()->getSteamClientPlugin(); setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning())); @@ -1454,6 +1455,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo return entityServerNode && !isPhysicsEnabled(); }); + QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); + _snapshotSound = DependencyManager::get()->getSound(QUrl::fromLocalFile(inf.absoluteFilePath())); + QVariant testProperty = property(hifi::properties::TEST); qDebug() << testProperty; if (testProperty.isValid()) { @@ -1776,12 +1780,17 @@ void Application::cleanupBeforeQuit() { // stop QML DependencyManager::destroy(); + if (_snapshotSoundInjector != nullptr) { + _snapshotSoundInjector->stop(); + } + // stop audio after QML, as there are unexplained audio crashes originating in qtwebengine // stop the AudioClient, synchronously QMetaObject::invokeMethod(DependencyManager::get().data(), "stop", Qt::BlockingQueuedConnection); + // destroy Audio so it and its threads have a chance to go down safely DependencyManager::destroy(); DependencyManager::destroy(); @@ -6406,15 +6415,24 @@ void Application::loadAddAvatarBookmarkDialog() const { } void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRatio) { - postLambdaEvent([notify, includeAnimated, aspectRatio, this] { - QMediaPlayer* player = new QMediaPlayer(); - QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav"); - player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath())); - player->play(); + + //keep sound thread out of event loop scope + AudioInjectorOptions options; + options.localOnly = true; + options.stereo = true; + + if (_snapshotSoundInjector) { + _snapshotSoundInjector->setOptions(options); + _snapshotSoundInjector->restart(); + } else { + QByteArray samples = _snapshotSound->getByteArray(); + _snapshotSoundInjector = AudioInjector::playSound(samples, options); + } + + postLambdaEvent([notify, includeAnimated, aspectRatio, this] { // Get a screenshot and save it QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio)); - // If we're not doing an animated snapshot as well... if (!includeAnimated || !(SnapshotAnimated::alsoTakeAnimatedSnapshot.get())) { // Tell the dependency manager that the capture of the still snapshot has taken place. @@ -6425,6 +6443,7 @@ void Application::takeSnapshot(bool notify, bool includeAnimated, float aspectRa } }); } + void Application::shareSnapshot(const QString& path, const QUrl& href) { postLambdaEvent([path, href] { // not much to do here, everything is done in snapshot code... @@ -6782,6 +6801,13 @@ void Application::updateDisplayMode() { if (!active) { qFatal("Failed to activate fallback plugin"); } + + // We've changed the selection - it should be reflected in the menu + QAction* action = menu->getActionForOption(newDisplayPlugin->getName()); + if (!action) { + qFatal("Failed to find activated plugin"); + } + action->setChecked(true); } _offscreenContext->makeCurrent(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 55c8303905..dff1de2860 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -73,6 +73,7 @@ #include #include +#include "Sound.h" class OffscreenGLCanvas; class GLCanvas; @@ -80,6 +81,7 @@ class FaceTracker; class MainWindow; class AssetUpload; class CompositorHelper; +class AudioInjector; namespace controller { class StateController; @@ -683,6 +685,8 @@ private: QTimer _addAssetToWorldErrorTimer; FileScriptingInterface* _fileDownload; + AudioInjector* _snapshotSoundInjector { nullptr }; + SharedSoundPointer _snapshotSound; }; diff --git a/interface/src/avatar/SkeletonModel.cpp b/interface/src/avatar/SkeletonModel.cpp index 0c11fa456d..81a5bf38dc 100644 --- a/interface/src/avatar/SkeletonModel.cpp +++ b/interface/src/avatar/SkeletonModel.cpp @@ -242,7 +242,7 @@ void SkeletonModel::updateAttitude() { void SkeletonModel::simulate(float deltaTime, bool fullUpdate) { updateAttitude(); if (fullUpdate) { - setBlendshapeCoefficients(_owningAvatar->getHead()->getBlendshapeCoefficients()); + setBlendshapeCoefficients(_owningAvatar->getHead()->getSummedBlendshapeCoefficients()); Model::simulate(deltaTime, fullUpdate); diff --git a/interface/src/ui/Stats.cpp b/interface/src/ui/Stats.cpp index dc612b0129..01740b88ca 100644 --- a/interface/src/ui/Stats.cpp +++ b/interface/src/ui/Stats.cpp @@ -335,6 +335,8 @@ void Stats::updateStats(bool force) { // Update Frame timing (in ms) STAT_UPDATE(gpuFrameTime, (float)gpuContext->getFrameTimerGPUAverage()); STAT_UPDATE(batchFrameTime, (float)gpuContext->getFrameTimerBatchAverage()); + auto config = qApp->getRenderEngine()->getConfiguration().get(); + STAT_UPDATE(engineFrameTime, (float) config->getCPURunTime()); STAT_UPDATE(avatarSimulationTime, (float)avatarManager->getAvatarSimulationTime()); diff --git a/interface/src/ui/Stats.h b/interface/src/ui/Stats.h index 85cf2caab9..a2ed125008 100644 --- a/interface/src/ui/Stats.h +++ b/interface/src/ui/Stats.h @@ -128,6 +128,7 @@ class Stats : public QQuickItem { STATS_PROPERTY(int, gpuFreeMemory, 0) STATS_PROPERTY(float, gpuFrameTime, 0) STATS_PROPERTY(float, batchFrameTime, 0) + STATS_PROPERTY(float, engineFrameTime, 0) STATS_PROPERTY(float, avatarSimulationTime, 0) public: @@ -250,6 +251,7 @@ signals: void gpuFreeMemoryChanged(); void gpuFrameTimeChanged(); void batchFrameTimeChanged(); + void engineFrameTimeChanged(); void avatarSimulationTimeChanged(); void rectifiedTextureCountChanged(); void decimatedTextureCountChanged(); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 9802630cf5..20894104ff 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -967,6 +967,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) { const int coefficientsSize = sizeof(float) * numCoefficients; PACKET_READ_CHECK(FaceTrackerCoefficients, coefficientsSize); _headData->_blendshapeCoefficients.resize(numCoefficients); // make sure there's room for the copy! + _headData->_baseBlendshapeCoefficients.resize(numCoefficients); memcpy(_headData->_blendshapeCoefficients.data(), sourceBuffer, coefficientsSize); sourceBuffer += coefficientsSize; int numBytesRead = sourceBuffer - startSection; diff --git a/libraries/avatars/src/HeadData.cpp b/libraries/avatars/src/HeadData.cpp index 909c6a613e..271ce133a2 100644 --- a/libraries/avatars/src/HeadData.cpp +++ b/libraries/avatars/src/HeadData.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -38,6 +39,8 @@ HeadData::HeadData(AvatarData* owningAvatar) : _rightEyeBlink(0.0f), _averageLoudness(0.0f), _browAudioLift(0.0f), + _baseBlendshapeCoefficients(QVector(0, 0.0f)), + _currBlendShapeCoefficients(QVector(0, 0.0f)), _owningAvatar(owningAvatar) { @@ -86,6 +89,24 @@ static const QMap& getBlendshapesLookupMap() { return blendshapeLookupMap; } +const QVector& HeadData::getSummedBlendshapeCoefficients() { + int maxSize = std::max(_baseBlendshapeCoefficients.size(), _blendshapeCoefficients.size()); + if (_currBlendShapeCoefficients.size() != maxSize) { + _currBlendShapeCoefficients.resize(maxSize); + } + + for (int i = 0; i < maxSize; i++) { + if (i >= _baseBlendshapeCoefficients.size()) { + _currBlendShapeCoefficients[i] = _blendshapeCoefficients[i]; + } else if (i >= _blendshapeCoefficients.size()) { + _currBlendShapeCoefficients[i] = _baseBlendshapeCoefficients[i]; + } else { + _currBlendShapeCoefficients[i] = _baseBlendshapeCoefficients[i] + _blendshapeCoefficients[i]; + } + } + + return _currBlendShapeCoefficients; +} void HeadData::setBlendshape(QString name, float val) { const auto& blendshapeLookupMap = getBlendshapesLookupMap(); @@ -96,7 +117,10 @@ void HeadData::setBlendshape(QString name, float val) { if (_blendshapeCoefficients.size() <= it.value()) { _blendshapeCoefficients.resize(it.value() + 1); } - _blendshapeCoefficients[it.value()] = val; + if (_baseBlendshapeCoefficients.size() <= it.value()) { + _baseBlendshapeCoefficients.resize(it.value() + 1); + } + _baseBlendshapeCoefficients[it.value()] = val; } } diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index 6c468daefd..dbed0a6a65 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -59,6 +59,7 @@ public: void setBlendshape(QString name, float val); const QVector& getBlendshapeCoefficients() const { return _blendshapeCoefficients; } + const QVector& getSummedBlendshapeCoefficients(); void setBlendshapeCoefficients(const QVector& blendshapeCoefficients) { _blendshapeCoefficients = blendshapeCoefficients; } const glm::vec3& getLookAtPosition() const { return _lookAtPosition; } @@ -92,6 +93,8 @@ protected: float _browAudioLift; QVector _blendshapeCoefficients; + QVector _baseBlendshapeCoefficients; + QVector _currBlendShapeCoefficients; AvatarData* _owningAvatar; private: diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.cpp b/libraries/render-utils/src/AmbientOcclusionEffect.cpp index 678d8b1baf..9f4a71ef08 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.cpp +++ b/libraries/render-utils/src/AmbientOcclusionEffect.cpp @@ -338,7 +338,7 @@ void AmbientOcclusionEffect::updateGaussianDistribution() { GaussianDistribution::evalSampling(coefs, Parameters::GAUSSIAN_COEFS_LENGTH, _parametersBuffer->getBlurRadius(), _parametersBuffer->getBlurDeviation()); } -void AmbientOcclusionEffect::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { +void AmbientOcclusionEffect::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -478,7 +478,7 @@ const gpu::PipelinePointer& DebugAmbientOcclusion::getDebugPipeline() { return _debugPipeline; } -void DebugAmbientOcclusion::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs) { +void DebugAmbientOcclusion::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); diff --git a/libraries/render-utils/src/AmbientOcclusionEffect.h b/libraries/render-utils/src/AmbientOcclusionEffect.h index 4e41926f9f..92d0f1d375 100644 --- a/libraries/render-utils/src/AmbientOcclusionEffect.h +++ b/libraries/render-utils/src/AmbientOcclusionEffect.h @@ -114,7 +114,7 @@ public: AmbientOcclusionEffect(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); // Class describing the uniform buffer with all the parameters common to the AO shaders @@ -200,7 +200,7 @@ public: DebugAmbientOcclusion(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); private: diff --git a/libraries/render-utils/src/AntialiasingEffect.cpp b/libraries/render-utils/src/AntialiasingEffect.cpp index f11d62acbe..9a81320416 100644 --- a/libraries/render-utils/src/AntialiasingEffect.cpp +++ b/libraries/render-utils/src/AntialiasingEffect.cpp @@ -100,7 +100,7 @@ const gpu::PipelinePointer& Antialiasing::getBlendPipeline() { return _blendPipeline; } -void Antialiasing::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceBuffer) { +void Antialiasing::run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceBuffer) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); diff --git a/libraries/render-utils/src/AntialiasingEffect.h b/libraries/render-utils/src/AntialiasingEffect.h index bc0ab28d95..e403032b4e 100644 --- a/libraries/render-utils/src/AntialiasingEffect.h +++ b/libraries/render-utils/src/AntialiasingEffect.h @@ -31,7 +31,7 @@ public: Antialiasing(); ~Antialiasing(); void configure(const Config& config) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceBuffer); + void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceBuffer); const gpu::PipelinePointer& getAntialiasingPipeline(); const gpu::PipelinePointer& getBlendPipeline(); diff --git a/libraries/render-utils/src/DebugDeferredBuffer.cpp b/libraries/render-utils/src/DebugDeferredBuffer.cpp index e534628c83..a67d20c6b0 100644 --- a/libraries/render-utils/src/DebugDeferredBuffer.cpp +++ b/libraries/render-utils/src/DebugDeferredBuffer.cpp @@ -391,7 +391,7 @@ void DebugDeferredBuffer::configure(const Config& config) { _size = config.size; } -void DebugDeferredBuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void DebugDeferredBuffer::run(const RenderContextPointer& renderContext, const Inputs& inputs) { if (_mode == Off) { return; } diff --git a/libraries/render-utils/src/DebugDeferredBuffer.h b/libraries/render-utils/src/DebugDeferredBuffer.h index be775e052f..bd5618f5be 100644 --- a/libraries/render-utils/src/DebugDeferredBuffer.h +++ b/libraries/render-utils/src/DebugDeferredBuffer.h @@ -45,7 +45,7 @@ public: ~DebugDeferredBuffer(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: friend class DebugDeferredBufferConfig; diff --git a/libraries/render-utils/src/DeferredFrameTransform.cpp b/libraries/render-utils/src/DeferredFrameTransform.cpp index 2f9d7b016a..b1166437db 100644 --- a/libraries/render-utils/src/DeferredFrameTransform.cpp +++ b/libraries/render-utils/src/DeferredFrameTransform.cpp @@ -63,7 +63,7 @@ void DeferredFrameTransform::update(RenderArgs* args) { } } -void GenerateDeferredFrameTransform::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform) { +void GenerateDeferredFrameTransform::run(const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform) { if (!frameTransform) { frameTransform = std::make_shared(); } diff --git a/libraries/render-utils/src/DeferredFrameTransform.h b/libraries/render-utils/src/DeferredFrameTransform.h index df47396a38..84be943998 100644 --- a/libraries/render-utils/src/DeferredFrameTransform.h +++ b/libraries/render-utils/src/DeferredFrameTransform.h @@ -70,7 +70,7 @@ public: GenerateDeferredFrameTransform() {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform); + void run(const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform); private: }; diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index dc1822c0f5..7167e8cba8 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -479,7 +479,7 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { return _spotLightMesh; } -void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, gpu::FramebufferPointer& primaryFramebuffer) { +void PreparePrimaryFramebuffer::run(const RenderContextPointer& renderContext, gpu::FramebufferPointer& primaryFramebuffer) { auto framebufferCache = DependencyManager::get(); auto framebufferSize = framebufferCache->getFrameBufferSize(); @@ -512,7 +512,7 @@ void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, con primaryFramebuffer = _primaryFramebuffer; } -void PrepareDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { +void PrepareDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { auto args = renderContext->args; auto primaryFramebuffer = inputs.get0(); @@ -553,7 +553,7 @@ void PrepareDeferred::run(const SceneContextPointer& sceneContext, const RenderC } -void RenderDeferredSetup::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, +void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, @@ -681,7 +681,7 @@ RenderDeferredLocals::RenderDeferredLocals() : } -void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, +void RenderDeferredLocals::run(const render::RenderContextPointer& renderContext, const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, @@ -746,7 +746,7 @@ void RenderDeferredLocals::run(const render::SceneContextPointer& sceneContext, } } -void RenderDeferredCleanup::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) { +void RenderDeferredCleanup::run(const render::RenderContextPointer& renderContext) { auto args = renderContext->args; auto& batch = (*args->_batch); { @@ -792,7 +792,7 @@ RenderDeferred::RenderDeferred() { void RenderDeferred::configure(const Config& config) { } -void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void RenderDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) { PROFILE_RANGE(render, "DeferredLighting"); auto deferredTransform = inputs.get0(); @@ -813,11 +813,11 @@ void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderCo args->_batch = &batch; _gpuTimer->begin(batch); - setupJob.run(sceneContext, renderContext, deferredTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, ssaoFramebuffer, subsurfaceScatteringResource); + setupJob.run(renderContext, deferredTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, ssaoFramebuffer, subsurfaceScatteringResource); - lightsJob.run(sceneContext, renderContext, deferredTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, lightClusters); + lightsJob.run(renderContext, deferredTransform, deferredFramebuffer, lightingModel, surfaceGeometryFramebuffer, lightClusters); - cleanupJob.run(sceneContext, renderContext); + cleanupJob.run(renderContext); _gpuTimer->end(batch); args->_context->appendFrameBatch(batch); diff --git a/libraries/render-utils/src/DeferredLightingEffect.h b/libraries/render-utils/src/DeferredLightingEffect.h index d2b8dd42b2..c5e694cb18 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.h +++ b/libraries/render-utils/src/DeferredLightingEffect.h @@ -127,7 +127,7 @@ class PreparePrimaryFramebuffer { public: using JobModel = render::Job::ModelO; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::FramebufferPointer& primaryFramebuffer); + void run(const render::RenderContextPointer& renderContext, gpu::FramebufferPointer& primaryFramebuffer); gpu::FramebufferPointer _primaryFramebuffer; }; @@ -141,7 +141,7 @@ public: using JobModel = render::Job::ModelIO; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); DeferredFramebufferPointer _deferredFramebuffer; }; @@ -150,7 +150,7 @@ class RenderDeferredSetup { public: // using JobModel = render::Job::ModelI; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, @@ -163,7 +163,7 @@ class RenderDeferredLocals { public: using JobModel = render::Job::ModelI; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const DeferredFrameTransformPointer& frameTransform, const DeferredFramebufferPointer& deferredFramebuffer, const LightingModelPointer& lightingModel, @@ -181,7 +181,7 @@ class RenderDeferredCleanup { public: using JobModel = render::Job::Model; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + void run(const render::RenderContextPointer& renderContext); }; using RenderDeferredConfig = render::GPUJobConfig; @@ -196,7 +196,7 @@ public: void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); RenderDeferredSetup setupJob; RenderDeferredLocals lightsJob; diff --git a/libraries/render-utils/src/HitEffect.cpp b/libraries/render-utils/src/HitEffect.cpp index 9fb4c5bcd4..319e94384f 100644 --- a/libraries/render-utils/src/HitEffect.cpp +++ b/libraries/render-utils/src/HitEffect.cpp @@ -68,7 +68,7 @@ const gpu::PipelinePointer& HitEffect::getHitEffectPipeline() { return _hitEffectPipeline; } -void HitEffect::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext) { +void HitEffect::run(const render::RenderContextPointer& renderContext) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; diff --git a/libraries/render-utils/src/HitEffect.h b/libraries/render-utils/src/HitEffect.h index ea14ac231d..d025d2d980 100644 --- a/libraries/render-utils/src/HitEffect.h +++ b/libraries/render-utils/src/HitEffect.h @@ -26,7 +26,7 @@ public: HitEffect(); ~HitEffect(); void configure(const Config& config) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + void run(const render::RenderContextPointer& renderContext); const gpu::PipelinePointer& getHitEffectPipeline(); diff --git a/libraries/render-utils/src/LightClusters.cpp b/libraries/render-utils/src/LightClusters.cpp index d6c20f8f28..4145264b2d 100644 --- a/libraries/render-utils/src/LightClusters.cpp +++ b/libraries/render-utils/src/LightClusters.cpp @@ -558,7 +558,7 @@ void LightClusteringPass::configure(const Config& config) { _freeze = config.freeze; } -void LightClusteringPass::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output) { +void LightClusteringPass::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output) { auto args = renderContext->args; auto deferredTransform = inputs.get0(); @@ -697,7 +697,7 @@ const gpu::PipelinePointer DebugLightClusters::getDrawClusterContentPipeline() { } -void DebugLightClusters::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs) { +void DebugLightClusters::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { if (!(doDrawClusterFromDepth || doDrawContent || doDrawGrid)) { return; } diff --git a/libraries/render-utils/src/LightClusters.h b/libraries/render-utils/src/LightClusters.h index d27a6e1d92..105d6fb139 100644 --- a/libraries/render-utils/src/LightClusters.h +++ b/libraries/render-utils/src/LightClusters.h @@ -176,7 +176,7 @@ public: void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& output); protected: LightClustersPointer _lightClusters; @@ -221,7 +221,7 @@ public: void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: gpu::BufferPointer _gridBuffer; diff --git a/libraries/render-utils/src/LightingModel.cpp b/libraries/render-utils/src/LightingModel.cpp index bd321bad95..30801ac69e 100644 --- a/libraries/render-utils/src/LightingModel.cpp +++ b/libraries/render-utils/src/LightingModel.cpp @@ -179,7 +179,7 @@ void MakeLightingModel::configure(const Config& config) { _lightingModel->setWireframe(config.enableWireframe); } -void MakeLightingModel::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel) { +void MakeLightingModel::run(const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel) { lightingModel = _lightingModel; diff --git a/libraries/render-utils/src/LightingModel.h b/libraries/render-utils/src/LightingModel.h index c1189d5160..26fb4faac5 100644 --- a/libraries/render-utils/src/LightingModel.h +++ b/libraries/render-utils/src/LightingModel.h @@ -171,7 +171,7 @@ public: MakeLightingModel(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel); + void run(const render::RenderContextPointer& renderContext, LightingModelPointer& lightingModel); private: LightingModelPointer _lightingModel; diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 35bf9c0bde..08d4f0fc68 100644 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -218,14 +218,14 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren task.addJob("Blit", primaryFramebuffer); } -void BeginGPURangeTimer::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) { +void BeginGPURangeTimer::run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) { timer = _gpuTimer; gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) { _gpuTimer->begin(batch); }); } -void EndGPURangeTimer::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer) { +void EndGPURangeTimer::run(const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer) { gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) { timer->end(batch); }); @@ -235,7 +235,7 @@ void EndGPURangeTimer::run(const render::SceneContextPointer& sceneContext, cons } -void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void DrawDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -272,7 +272,7 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont ShapeKey globalKey = keyBuilder.build(); args->_globalShapeKey = globalKey._flags.to_ulong(); - renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); + renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); args->_batch = nullptr; args->_globalShapeKey = 0; @@ -281,7 +281,7 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont config->setNumDrawn((int)inItems.size()); } -void DrawStateSortDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void DrawStateSortDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -319,9 +319,9 @@ void DrawStateSortDeferred::run(const SceneContextPointer& sceneContext, const R args->_globalShapeKey = globalKey._flags.to_ulong(); if (_stateSort) { - renderStateSortShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); + renderStateSortShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); } else { - renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); + renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey); } args->_batch = nullptr; args->_globalShapeKey = 0; @@ -336,7 +336,7 @@ DrawOverlay3D::DrawOverlay3D(bool opaque) : initOverlay3DPipelines(*_shapePlumber); } -void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void DrawOverlay3D::run(const RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -378,7 +378,7 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon // Setup lighting model for all items; batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer()); - renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn); + renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn); args->_batch = nullptr; }); } @@ -403,7 +403,7 @@ gpu::PipelinePointer DrawStencilDeferred::getOpaquePipeline() { return _opaquePipeline; } -void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const DeferredFramebufferPointer& deferredFramebuffer) { +void DrawStencilDeferred::run(const RenderContextPointer& renderContext, const DeferredFramebufferPointer& deferredFramebuffer) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -430,7 +430,7 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren args->_batch = nullptr; } -void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& inputs) { +void DrawBackgroundDeferred::run(const RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -458,7 +458,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const batch.setProjectionTransform(projMat); batch.setViewTransform(viewMat); - renderItems(sceneContext, renderContext, inItems); + renderItems(renderContext, inItems); // _gpuTimer.end(batch); }); args->_batch = nullptr; @@ -466,7 +466,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const // std::static_pointer_cast(renderContext->jobConfig)->gpuTime = _gpuTimer.getAverage(); } -void Blit::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) { +void Blit::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) { assert(renderContext->args); assert(renderContext->args->_context); diff --git a/libraries/render-utils/src/RenderDeferredTask.h b/libraries/render-utils/src/RenderDeferredTask.h index 660cae88b0..12ecd5ecaf 100644 --- a/libraries/render-utils/src/RenderDeferredTask.h +++ b/libraries/render-utils/src/RenderDeferredTask.h @@ -23,7 +23,7 @@ public: BeginGPURangeTimer(const std::string& name) : _gpuTimer(std::make_shared(name)) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer); + void run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer); protected: gpu::RangeTimerPointer _gpuTimer; @@ -39,7 +39,7 @@ public: EndGPURangeTimer() {} void configure(const Config& config) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer); + void run(const render::RenderContextPointer& renderContext, const gpu::RangeTimerPointer& timer); protected: }; @@ -74,7 +74,7 @@ public: DrawDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} void configure(const Config& config) { _maxDrawn = config.maxDrawn; } - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: render::ShapePlumberPointer _shapePlumber; @@ -112,7 +112,7 @@ public: DrawStateSortDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} void configure(const Config& config) { _maxDrawn = config.maxDrawn; _stateSort = config.stateSort; } - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: render::ShapePlumberPointer _shapePlumber; @@ -125,7 +125,7 @@ class DrawStencilDeferred { public: using JobModel = render::Job::ModelI>; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const std::shared_ptr& deferredFramebuffer); + void run(const render::RenderContextPointer& renderContext, const std::shared_ptr& deferredFramebuffer); protected: gpu::PipelinePointer _opaquePipeline; @@ -143,7 +143,7 @@ public: using JobModel = render::Job::ModelI; void configure(const Config& config) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: gpu::RangeTimerPointer _gpuTimer; @@ -177,7 +177,7 @@ public: DrawOverlay3D(bool opaque); void configure(const Config& config) { _maxDrawn = config.maxDrawn; } - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); protected: render::ShapePlumberPointer _shapePlumber; @@ -189,7 +189,7 @@ class Blit { public: using JobModel = render::Job::ModelI; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer); + void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer); }; class RenderDeferredTask { diff --git a/libraries/render-utils/src/RenderForwardTask.cpp b/libraries/render-utils/src/RenderForwardTask.cpp index 8a9d7dfbf3..46a7128fee 100755 --- a/libraries/render-utils/src/RenderForwardTask.cpp +++ b/libraries/render-utils/src/RenderForwardTask.cpp @@ -59,7 +59,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend task.addJob("Blit", framebuffer); } -void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void PrepareFramebuffer::run(const RenderContextPointer& renderContext, gpu::FramebufferPointer& framebuffer) { auto framebufferCache = DependencyManager::get(); auto framebufferSize = framebufferCache->getFrameBufferSize(); @@ -100,7 +100,7 @@ void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const Rend framebuffer = _framebuffer; } -void Draw::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void Draw::run(const RenderContextPointer& renderContext, const Inputs& items) { RenderArgs* args = renderContext->args; @@ -117,7 +117,7 @@ void Draw::run(const SceneContextPointer& sceneContext, const RenderContextPoint batch.setModelTransform(Transform()); // Render items - renderStateSortShapes(sceneContext, renderContext, _shapePlumber, items, -1); + renderStateSortShapes(renderContext, _shapePlumber, items, -1); }); args->_batch = nullptr; } @@ -142,7 +142,7 @@ const gpu::PipelinePointer Stencil::getPipeline() { return _stencilPipeline; } -void Stencil::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { +void Stencil::run(const RenderContextPointer& renderContext) { RenderArgs* args = renderContext->args; gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { @@ -158,7 +158,7 @@ void Stencil::run(const SceneContextPointer& sceneContext, const RenderContextPo args->_batch = nullptr; } -void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void DrawBackground::run(const RenderContextPointer& renderContext, const Inputs& background) { RenderArgs* args = renderContext->args; @@ -177,7 +177,7 @@ void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderCo batch.setProjectionTransform(projMat); batch.setViewTransform(viewMat); - renderItems(sceneContext, renderContext, background); + renderItems(renderContext, background); }); args->_batch = nullptr; } diff --git a/libraries/render-utils/src/RenderForwardTask.h b/libraries/render-utils/src/RenderForwardTask.h index f78ce8f317..63d087b3c5 100755 --- a/libraries/render-utils/src/RenderForwardTask.h +++ b/libraries/render-utils/src/RenderForwardTask.h @@ -31,7 +31,7 @@ public: using Inputs = gpu::FramebufferPointer; using JobModel = render::Job::ModelO; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, gpu::FramebufferPointer& framebuffer); private: @@ -44,7 +44,7 @@ public: using JobModel = render::Job::ModelI; Draw(const render::ShapePlumberPointer& shapePlumber) : _shapePlumber(shapePlumber) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const Inputs& items); private: @@ -55,7 +55,7 @@ class Stencil { public: using JobModel = render::Job::Model; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext); + void run(const render::RenderContextPointer& renderContext); private: const gpu::PipelinePointer getPipeline(); @@ -67,7 +67,7 @@ public: using Inputs = render::ItemBounds; using JobModel = render::Job::ModelI; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const Inputs& background); }; diff --git a/libraries/render-utils/src/RenderShadowTask.cpp b/libraries/render-utils/src/RenderShadowTask.cpp index ddfe038a1a..0a4371cccd 100644 --- a/libraries/render-utils/src/RenderShadowTask.cpp +++ b/libraries/render-utils/src/RenderShadowTask.cpp @@ -31,7 +31,7 @@ using namespace render; -void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, +void RenderShadowMap::run(const render::RenderContextPointer& renderContext, const render::ShapeBounds& inShapes) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -74,7 +74,7 @@ void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const if (items.first.isSkinned()) { skinnedShapeKeys.push_back(items.first); } else { - renderItems(sceneContext, renderContext, items.second); + renderItems(renderContext, items.second); } } @@ -82,7 +82,7 @@ void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const args->_pipeline = shadowSkinnedPipeline; batch.setPipeline(shadowSkinnedPipeline->pipeline); for (const auto& key : skinnedShapeKeys) { - renderItems(sceneContext, renderContext, inShapes.at(key)); + renderItems(renderContext, inShapes.at(key)); } args->_pipeline = nullptr; @@ -139,7 +139,7 @@ void RenderShadowTask::configure(const Config& configuration) { // Task::configure(configuration); } -void RenderShadowSetup::run(const SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, Output& output) { +void RenderShadowSetup::run(const render::RenderContextPointer& renderContext, Output& output) { auto lightStage = DependencyManager::get()->getLightStage(); const auto globalShadow = lightStage->getShadow(0); @@ -157,7 +157,7 @@ void RenderShadowSetup::run(const SceneContextPointer& sceneContext, const rende args->_renderMode = RenderArgs::SHADOW_RENDER_MODE; } -void RenderShadowTeardown::run(const SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Input& input) { +void RenderShadowTeardown::run(const render::RenderContextPointer& renderContext, const Input& input) { RenderArgs* args = renderContext->args; // Reset the render args diff --git a/libraries/render-utils/src/RenderShadowTask.h b/libraries/render-utils/src/RenderShadowTask.h index 9190034b2e..a044028e4d 100644 --- a/libraries/render-utils/src/RenderShadowTask.h +++ b/libraries/render-utils/src/RenderShadowTask.h @@ -24,7 +24,7 @@ public: using JobModel = render::Job::ModelI; RenderShadowMap(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const render::ShapeBounds& inShapes); protected: @@ -56,14 +56,14 @@ class RenderShadowSetup { public: using Output = RenderArgs::RenderMode; using JobModel = render::Job::ModelO; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, Output& output); + void run(const render::RenderContextPointer& renderContext, Output& output); }; class RenderShadowTeardown { public: using Input = RenderArgs::RenderMode; using JobModel = render::Job::ModelI; - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Input& input); + void run(const render::RenderContextPointer& renderContext, const Input& input); }; #endif // hifi_RenderShadowTask_h diff --git a/libraries/render-utils/src/SubsurfaceScattering.cpp b/libraries/render-utils/src/SubsurfaceScattering.cpp index a57657a353..c92acc11ad 100644 --- a/libraries/render-utils/src/SubsurfaceScattering.cpp +++ b/libraries/render-utils/src/SubsurfaceScattering.cpp @@ -134,7 +134,7 @@ void SubsurfaceScattering::configure(const Config& config) { _scatteringResource->setShowDiffusedNormal(config.showDiffusedNormal); } -void SubsurfaceScattering::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, Outputs& outputs) { +void SubsurfaceScattering::run(const render::RenderContextPointer& renderContext, Outputs& outputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -506,7 +506,7 @@ gpu::PipelinePointer DebugSubsurfaceScattering::getShowLUTPipeline() { } -void DebugSubsurfaceScattering::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs) { +void DebugSubsurfaceScattering::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); diff --git a/libraries/render-utils/src/SubsurfaceScattering.h b/libraries/render-utils/src/SubsurfaceScattering.h index 715d9bc77b..30021fae40 100644 --- a/libraries/render-utils/src/SubsurfaceScattering.h +++ b/libraries/render-utils/src/SubsurfaceScattering.h @@ -132,7 +132,7 @@ public: SubsurfaceScattering(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, Outputs& outputs); + void run(const render::RenderContextPointer& renderContext, Outputs& outputs); private: SubsurfaceScatteringResourcePointer _scatteringResource; @@ -170,7 +170,7 @@ public: DebugSubsurfaceScattering(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); private: diff --git a/libraries/render-utils/src/SurfaceGeometryPass.cpp b/libraries/render-utils/src/SurfaceGeometryPass.cpp index a4a83bb6c5..164aca0624 100644 --- a/libraries/render-utils/src/SurfaceGeometryPass.cpp +++ b/libraries/render-utils/src/SurfaceGeometryPass.cpp @@ -133,7 +133,7 @@ LinearDepthPass::LinearDepthPass() { void LinearDepthPass::configure(const Config& config) { } -void LinearDepthPass::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { +void LinearDepthPass::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -404,7 +404,7 @@ void SurfaceGeometryPass::configure(const Config& config) { } -void SurfaceGeometryPass::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { +void SurfaceGeometryPass::run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); diff --git a/libraries/render-utils/src/SurfaceGeometryPass.h b/libraries/render-utils/src/SurfaceGeometryPass.h index 6d830f9a28..859bcaa07a 100644 --- a/libraries/render-utils/src/SurfaceGeometryPass.h +++ b/libraries/render-utils/src/SurfaceGeometryPass.h @@ -74,7 +74,7 @@ public: LinearDepthPass(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); private: typedef gpu::BufferView UniformBufferView; @@ -169,7 +169,7 @@ public: SurfaceGeometryPass(); void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs, Outputs& outputs); float getCurvatureDepthThreshold() const { return _parametersBuffer.get().curvatureInfo.x; } diff --git a/libraries/render-utils/src/ToneMappingEffect.cpp b/libraries/render-utils/src/ToneMappingEffect.cpp index 24c62fb7c2..d54481d246 100644 --- a/libraries/render-utils/src/ToneMappingEffect.cpp +++ b/libraries/render-utils/src/ToneMappingEffect.cpp @@ -88,7 +88,7 @@ void ToneMappingDeferred::configure(const Config& config) { _toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve); } -void ToneMappingDeferred::run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs) { +void ToneMappingDeferred::run(const render::RenderContextPointer& renderContext, const Inputs& inputs) { auto lightingBuffer = inputs.get0()->getRenderBuffer(0); auto destFbo = inputs.get1(); diff --git a/libraries/render-utils/src/ToneMappingEffect.h b/libraries/render-utils/src/ToneMappingEffect.h index 9e8b3f6aa4..13dffd16a7 100644 --- a/libraries/render-utils/src/ToneMappingEffect.h +++ b/libraries/render-utils/src/ToneMappingEffect.h @@ -89,7 +89,7 @@ public: using JobModel = render::Job::ModelI; void configure(const Config& config); - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const Inputs& inputs); + void run(const render::RenderContextPointer& renderContext, const Inputs& inputs); ToneMappingEffect _toneMappingEffect; }; diff --git a/libraries/render/src/render/BlurTask.cpp b/libraries/render/src/render/BlurTask.cpp index b0329b22a5..2fc7dc0ea0 100644 --- a/libraries/render/src/render/BlurTask.cpp +++ b/libraries/render/src/render/BlurTask.cpp @@ -200,7 +200,7 @@ void BlurGaussian::configure(const Config& config) { } -void BlurGaussian::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceFramebuffer, gpu::FramebufferPointer& blurredFramebuffer) { +void BlurGaussian::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceFramebuffer, gpu::FramebufferPointer& blurredFramebuffer) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); @@ -308,7 +308,7 @@ void BlurGaussianDepthAware::configure(const Config& config) { } -void BlurGaussianDepthAware::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& SourceAndDepth, gpu::FramebufferPointer& blurredFramebuffer) { +void BlurGaussianDepthAware::run(const RenderContextPointer& renderContext, const Inputs& SourceAndDepth, gpu::FramebufferPointer& blurredFramebuffer) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); diff --git a/libraries/render/src/render/BlurTask.h b/libraries/render/src/render/BlurTask.h index a00a444af7..f023aabfe7 100644 --- a/libraries/render/src/render/BlurTask.h +++ b/libraries/render/src/render/BlurTask.h @@ -105,7 +105,7 @@ public: BlurGaussian(bool generateOutputFramebuffer = false); void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceFramebuffer, gpu::FramebufferPointer& blurredFramebuffer); + void run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& sourceFramebuffer, gpu::FramebufferPointer& blurredFramebuffer); protected: @@ -141,7 +141,7 @@ public: BlurGaussianDepthAware(bool generateNewOutput = false, const BlurParamsPointer& params = BlurParamsPointer()); void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const Inputs& SourceAndDepth, gpu::FramebufferPointer& blurredFramebuffer); + void run(const RenderContextPointer& renderContext, const Inputs& SourceAndDepth, gpu::FramebufferPointer& blurredFramebuffer); const BlurParamsPointer& getParameters() const { return _parameters; } diff --git a/libraries/render/src/render/Context.h b/libraries/render/src/render/Context.h index 04cf373146..cb0fc65d40 100644 --- a/libraries/render/src/render/Context.h +++ b/libraries/render/src/render/Context.h @@ -16,20 +16,13 @@ namespace render { -class SceneContext { -public: - ScenePointer _scene; - - SceneContext() {} -}; -using SceneContextPointer = std::shared_ptr; - -class JobConfig; + class JobConfig; class RenderContext { public: RenderArgs* args; std::shared_ptr jobConfig{ nullptr }; + ScenePointer _scene; }; using RenderContextPointer = std::shared_ptr; diff --git a/libraries/render/src/render/CullTask.cpp b/libraries/render/src/render/CullTask.cpp index e4ba5af13f..4fc53d99f9 100644 --- a/libraries/render/src/render/CullTask.cpp +++ b/libraries/render/src/render/CullTask.cpp @@ -61,10 +61,10 @@ void render::cullItems(const RenderContextPointer& renderContext, const CullFunc details._rendered += (int)outItems.size(); } -void FetchNonspatialItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems) { +void FetchNonspatialItems::run(const RenderContextPointer& renderContext, ItemBounds& outItems) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; outItems.clear(); @@ -82,11 +82,11 @@ void FetchSpatialTree::configure(const Config& config) { _lodAngle = config.lodAngle; } -void FetchSpatialTree::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemSpatialTree::ItemSelection& outSelection) { +void FetchSpatialTree::run(const RenderContextPointer& renderContext, ItemSpatialTree::ItemSelection& outSelection) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; // start fresh outSelection.clear(); @@ -112,12 +112,12 @@ void CullSpatialSelection::configure(const Config& config) { _skipCulling = config.skipCulling; } -void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void CullSpatialSelection::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection, ItemBounds& outItems) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; auto& details = args->_details.edit(_detailType); details._considered += (int)inSelection.numItems(); diff --git a/libraries/render/src/render/CullTask.h b/libraries/render/src/render/CullTask.h index 243b16e733..fae2a342a1 100644 --- a/libraries/render/src/render/CullTask.h +++ b/libraries/render/src/render/CullTask.h @@ -25,7 +25,7 @@ namespace render { class FetchNonspatialItems { public: using JobModel = Job::ModelO; - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, ItemBounds& outItems); }; class FetchSpatialTreeConfig : public Job::Config { @@ -63,7 +63,7 @@ namespace render { ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() }; void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemSpatialTree::ItemSelection& outSelection); + void run(const RenderContextPointer& renderContext, ItemSpatialTree::ItemSelection& outSelection); }; class CullSpatialSelectionConfig : public Job::Config { @@ -106,7 +106,7 @@ namespace render { ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() }; void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection, ItemBounds& outItems); }; } diff --git a/libraries/render/src/render/DrawSceneOctree.cpp b/libraries/render/src/render/DrawSceneOctree.cpp index eac3113662..c48a9ddbe3 100644 --- a/libraries/render/src/render/DrawSceneOctree.cpp +++ b/libraries/render/src/render/DrawSceneOctree.cpp @@ -84,12 +84,11 @@ void DrawSceneOctree::configure(const Config& config) { } -void DrawSceneOctree::run(const SceneContextPointer& sceneContext, - const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) { +void DrawSceneOctree::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; std::static_pointer_cast(renderContext->jobConfig)->numAllocatedCells = (int)scene->getSpatialTree().getNumAllocatedCells(); std::static_pointer_cast(renderContext->jobConfig)->numFreeCells = (int)scene->getSpatialTree().getNumFreeCells(); @@ -196,12 +195,11 @@ void DrawItemSelection::configure(const Config& config) { } -void DrawItemSelection::run(const SceneContextPointer& sceneContext, - const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) { +void DrawItemSelection::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { glm::mat4 projMat; diff --git a/libraries/render/src/render/DrawSceneOctree.h b/libraries/render/src/render/DrawSceneOctree.h index 530b7accac..4838e34c57 100644 --- a/libraries/render/src/render/DrawSceneOctree.h +++ b/libraries/render/src/render/DrawSceneOctree.h @@ -71,7 +71,7 @@ namespace render { DrawSceneOctree() {} void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& selection); + void run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& selection); const gpu::PipelinePointer getDrawCellBoundsPipeline(); const gpu::PipelinePointer getDrawLODReticlePipeline(); @@ -129,7 +129,7 @@ namespace render { DrawItemSelection() {} void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& selection); + void run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& selection); const gpu::PipelinePointer getDrawItemBoundPipeline(); }; diff --git a/libraries/render/src/render/DrawStatus.cpp b/libraries/render/src/render/DrawStatus.cpp index ec0a64d7a5..d6275a8d7a 100644 --- a/libraries/render/src/render/DrawStatus.cpp +++ b/libraries/render/src/render/DrawStatus.cpp @@ -103,13 +103,11 @@ void DrawStatus::configure(const Config& config) { _showNetwork = config.showNetwork; } -void DrawStatus::run(const SceneContextPointer& sceneContext, - const RenderContextPointer& renderContext, - const ItemBounds& inItems) { +void DrawStatus::run(const RenderContextPointer& renderContext, const ItemBounds& inItems) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; const int NUM_STATUS_VEC4_PER_ITEM = 2; const int VEC4_LENGTH = 4; diff --git a/libraries/render/src/render/DrawStatus.h b/libraries/render/src/render/DrawStatus.h index e60cb58779..2e0adb4653 100644 --- a/libraries/render/src/render/DrawStatus.h +++ b/libraries/render/src/render/DrawStatus.h @@ -45,7 +45,7 @@ namespace render { DrawStatus(const gpu::TexturePointer statusIconMap) { setStatusIconMap(statusIconMap); } void configure(const Config& config); - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems); const gpu::PipelinePointer getDrawItemBoundsPipeline(); const gpu::PipelinePointer getDrawItemStatusPipeline(); diff --git a/libraries/render/src/render/DrawTask.cpp b/libraries/render/src/render/DrawTask.cpp index 3deb15a320..ed9975e2e5 100755 --- a/libraries/render/src/render/DrawTask.cpp +++ b/libraries/render/src/render/DrawTask.cpp @@ -25,8 +25,8 @@ using namespace render; -void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems) { - auto& scene = sceneContext->_scene; +void render::renderItems(const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems) { + auto& scene = renderContext->_scene; RenderArgs* args = renderContext->args; int numItemsToDraw = (int)inItems.size(); @@ -55,9 +55,9 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons } } -void render::renderShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void render::renderShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) { - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; RenderArgs* args = renderContext->args; int numItemsToDraw = (int)inItems.size(); @@ -70,9 +70,9 @@ void render::renderShapes(const SceneContextPointer& sceneContext, const RenderC } } -void render::renderStateSortShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void render::renderStateSortShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) { - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; RenderArgs* args = renderContext->args; int numItemsToDraw = (int)inItems.size(); @@ -123,7 +123,7 @@ void render::renderStateSortShapes(const SceneContextPointer& sceneContext, cons } } -void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inLights) { +void DrawLight::run(const RenderContextPointer& renderContext, const ItemBounds& inLights) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); RenderArgs* args = renderContext->args; @@ -131,7 +131,7 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext // render lights gpu::doInBatch(args->_context, [&](gpu::Batch& batch) { args->_batch = &batch; - renderItems(sceneContext, renderContext, inLights, _maxDrawn); + renderItems(renderContext, inLights, _maxDrawn); args->_batch = nullptr; }); @@ -163,7 +163,7 @@ const gpu::PipelinePointer DrawBounds::getPipeline() { return _boundsPipeline; } -void DrawBounds::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, +void DrawBounds::run(const RenderContextPointer& renderContext, const Inputs& items) { RenderArgs* args = renderContext->args; diff --git a/libraries/render/src/render/DrawTask.h b/libraries/render/src/render/DrawTask.h index 9a74802888..317aaf1e25 100755 --- a/libraries/render/src/render/DrawTask.h +++ b/libraries/render/src/render/DrawTask.h @@ -16,9 +16,9 @@ namespace render { -void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems = -1); -void renderShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems = -1, const ShapeKey& globalKey = ShapeKey()); -void renderStateSortShapes(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems = -1, const ShapeKey& globalKey = ShapeKey()); +void renderItems(const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems = -1); +void renderShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems = -1, const ShapeKey& globalKey = ShapeKey()); +void renderStateSortShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems = -1, const ShapeKey& globalKey = ShapeKey()); class DrawLightConfig : public Job::Config { Q_OBJECT @@ -43,7 +43,7 @@ public: using JobModel = Job::ModelI; void configure(const Config& config) { _maxDrawn = config.maxDrawn; } - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inLights); + void run(const RenderContextPointer& renderContext, const ItemBounds& inLights); protected: int _maxDrawn; // initialized by Config }; @@ -59,7 +59,7 @@ public: using JobModel = render::Job::ModelI; void configure(const Config& configuration) {} - void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, + void run(const render::RenderContextPointer& renderContext, const Inputs& items); private: diff --git a/libraries/render/src/render/Engine.cpp b/libraries/render/src/render/Engine.cpp index 08efb7b281..b3372a9305 100644 --- a/libraries/render/src/render/Engine.cpp +++ b/libraries/render/src/render/Engine.cpp @@ -35,7 +35,6 @@ public: }; Engine::Engine() : Task("Engine", EngineTask::JobModel::create()), - _sceneContext(std::make_shared()), _renderContext(std::make_shared()) { } diff --git a/libraries/render/src/render/Engine.h b/libraries/render/src/render/Engine.h index de8340c33e..68d86e6c16 100644 --- a/libraries/render/src/render/Engine.h +++ b/libraries/render/src/render/Engine.h @@ -32,18 +32,16 @@ namespace render { void load(); // Register the scene - void registerScene(const ScenePointer& scene) { _sceneContext->_scene = scene; } + void registerScene(const ScenePointer& scene) { _renderContext->_scene = scene; } - // Push a RenderContext - void setRenderContext(const RenderContext& renderContext) { (*_renderContext) = renderContext; } + // acces the RenderContext RenderContextPointer getRenderContext() const { return _renderContext; } // Render a frame // Must have a scene registered and a context set - void run() { assert(_sceneContext && _renderContext); Task::run(_sceneContext, _renderContext); } + void run() { assert(_renderContext); Task::run(_renderContext); } protected: - SceneContextPointer _sceneContext; RenderContextPointer _renderContext; }; using EnginePointer = std::shared_ptr; diff --git a/libraries/render/src/render/EngineStats.cpp b/libraries/render/src/render/EngineStats.cpp index 2cb23bb41c..ce116ed2c5 100644 --- a/libraries/render/src/render/EngineStats.cpp +++ b/libraries/render/src/render/EngineStats.cpp @@ -14,7 +14,7 @@ using namespace render; -void EngineStats::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { +void EngineStats::run(const RenderContextPointer& renderContext) { // Tick time quint64 msecsElapsed = _frameTimer.restart(); diff --git a/libraries/render/src/render/EngineStats.h b/libraries/render/src/render/EngineStats.h index a5ebf88498..8fd38eb501 100644 --- a/libraries/render/src/render/EngineStats.h +++ b/libraries/render/src/render/EngineStats.h @@ -99,7 +99,7 @@ namespace render { EngineStats() { _frameTimer.start(); } void configure(const Config& configuration) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext); + void run(const RenderContextPointer& renderContext); }; } diff --git a/libraries/render/src/render/FilterTask.cpp b/libraries/render/src/render/FilterTask.cpp index f1ab6b844a..f6b765cd9d 100644 --- a/libraries/render/src/render/FilterTask.cpp +++ b/libraries/render/src/render/FilterTask.cpp @@ -21,8 +21,8 @@ using namespace render; -void FilterLayeredItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - auto& scene = sceneContext->_scene; +void FilterLayeredItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { + auto& scene = renderContext->_scene; // Clear previous values outItems.clear(); @@ -36,7 +36,7 @@ void FilterLayeredItems::run(const SceneContextPointer& sceneContext, const Rend } } -void SliceItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { +void SliceItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { outItems.clear(); std::static_pointer_cast(renderContext->jobConfig)->setNumItems((int)inItems.size()); @@ -51,8 +51,8 @@ void SliceItems::run(const SceneContextPointer& sceneContext, const RenderContex } -void SelectItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - auto selection = sceneContext->_scene->getSelection(_name); +void SelectItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { + auto selection = renderContext->_scene->getSelection(_name); const auto& selectedItems = selection.getItems(); outItems.clear(); @@ -67,8 +67,8 @@ void SelectItems::run(const SceneContextPointer& sceneContext, const RenderConte } } -void SelectSortItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - auto selection = sceneContext->_scene->getSelection(_name); +void SelectSortItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { + auto selection = renderContext->_scene->getSelection(_name); const auto& selectedItems = selection.getItems(); outItems.clear(); @@ -98,8 +98,8 @@ void SelectSortItems::run(const SceneContextPointer& sceneContext, const RenderC } } -void MetaToSubItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems) { - auto& scene = sceneContext->_scene; +void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems) { + auto& scene = renderContext->_scene; // Now we have a selection of items to render outItems.clear(); diff --git a/libraries/render/src/render/FilterTask.h b/libraries/render/src/render/FilterTask.h index 00019fa1ae..1c4611ee9f 100644 --- a/libraries/render/src/render/FilterTask.h +++ b/libraries/render/src/render/FilterTask.h @@ -41,8 +41,8 @@ namespace render { ItemFilterArray _filters; void configure(const Config& config) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBoundsArray& outItems) { - auto& scene = sceneContext->_scene; + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBoundsArray& outItems) { + auto& scene = renderContext->_scene; // Clear previous values for (size_t i = 0; i < NUM_FILTERS; i++) { @@ -73,7 +73,7 @@ namespace render { int _keepLayer { 0 }; - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; // SliceItems job config defining the slice range @@ -107,7 +107,7 @@ namespace render { _rangeLength = config.rangeLength; } - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; // Keep items belonging to the job selection @@ -118,7 +118,7 @@ namespace render { std::string _name; SelectItems(const Selection::Name& name) : _name(name) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; // Same as SelectItems but reorder the output to match the selection order @@ -129,7 +129,7 @@ namespace render { std::string _name; SelectSortItems(const Selection::Name& name) : _name(name) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; // From meta-Items, generate the sub-items @@ -139,7 +139,7 @@ namespace render { MetaToSubItems() {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems); }; } diff --git a/libraries/render/src/render/SortTask.cpp b/libraries/render/src/render/SortTask.cpp index 28860aa410..5b7ead4b6a 100644 --- a/libraries/render/src/render/SortTask.cpp +++ b/libraries/render/src/render/SortTask.cpp @@ -40,11 +40,11 @@ struct BackToFrontSort { } }; -void render::depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems) { +void render::depthSortItems(const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems) { assert(renderContext->args); assert(renderContext->args->hasViewFrustum()); - auto& scene = sceneContext->_scene; + auto& scene = renderContext->_scene; RenderArgs* args = renderContext->args; @@ -80,8 +80,8 @@ void render::depthSortItems(const SceneContextPointer& sceneContext, const Rende } } -void PipelineSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes) { - auto& scene = sceneContext->_scene; +void PipelineSortShapes::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes) { + auto& scene = renderContext->_scene; outShapes.clear(); for (const auto& item : inItems) { @@ -100,7 +100,7 @@ void PipelineSortShapes::run(const SceneContextPointer& sceneContext, const Rend } } -void DepthSortShapes::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes) { +void DepthSortShapes::run(const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes) { outShapes.clear(); outShapes.reserve(inShapes.size()); @@ -111,10 +111,10 @@ void DepthSortShapes::run(const SceneContextPointer& sceneContext, const RenderC outItems = outShapes.insert(std::make_pair(pipeline.first, ItemBounds{})).first; } - depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems->second); + depthSortItems(renderContext, _frontToBack, inItems, outItems->second); } } -void DepthSortItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { - depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems); +void DepthSortItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) { + depthSortItems(renderContext, _frontToBack, inItems, outItems); } diff --git a/libraries/render/src/render/SortTask.h b/libraries/render/src/render/SortTask.h index eb341192aa..dfeb22d540 100644 --- a/libraries/render/src/render/SortTask.h +++ b/libraries/render/src/render/SortTask.h @@ -15,12 +15,12 @@ #include "Engine.h" namespace render { - void depthSortItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems); + void depthSortItems(const RenderContextPointer& renderContext, bool frontToBack, const ItemBounds& inItems, ItemBounds& outItems); class PipelineSortShapes { public: using JobModel = Job::ModelIO; - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes); }; class DepthSortShapes { @@ -30,7 +30,7 @@ namespace render { bool _frontToBack; DepthSortShapes(bool frontToBack = true) : _frontToBack(frontToBack) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes); + void run(const RenderContextPointer& renderContext, const ShapeBounds& inShapes, ShapeBounds& outShapes); }; class DepthSortItems { @@ -40,7 +40,7 @@ namespace render { bool _frontToBack; DepthSortItems(bool frontToBack = true) : _frontToBack(frontToBack) {} - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); + void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems); }; } diff --git a/libraries/render/src/render/Task.h b/libraries/render/src/render/Task.h index 03824bd14d..1035b74340 100644 --- a/libraries/render/src/render/Task.h +++ b/libraries/render/src/render/Task.h @@ -451,17 +451,17 @@ template void jobConfigure(T&, const JobConfig&) { template void jobConfigure(T&, const TaskConfig&) { // nop, as the default TaskConfig was used, so the data does not need a configure method } -template void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const JobNoIO& input, JobNoIO& output) { - data.run(sceneContext, renderContext); +template void jobRun(T& data, const RenderContextPointer& renderContext, const JobNoIO& input, JobNoIO& output) { + data.run(renderContext); } -template void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const I& input, JobNoIO& output) { - data.run(sceneContext, renderContext, input); +template void jobRun(T& data, const RenderContextPointer& renderContext, const I& input, JobNoIO& output) { + data.run(renderContext, input); } -template void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const JobNoIO& input, O& output) { - data.run(sceneContext, renderContext, output); +template void jobRun(T& data, const RenderContextPointer& renderContext, const JobNoIO& input, O& output) { + data.run(renderContext, output); } -template void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const I& input, O& output) { - data.run(sceneContext, renderContext, input, output); +template void jobRun(T& data, const RenderContextPointer& renderContext, const I& input, O& output) { + data.run(renderContext, input, output); } // The guts of a job @@ -479,7 +479,7 @@ public: virtual QConfigPointer& getConfiguration() { return _config; } virtual void applyConfiguration() = 0; - virtual void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) = 0; + virtual void run(const RenderContextPointer& renderContext) = 0; protected: void setCPURunTime(double mstime) { std::static_pointer_cast(_config)->setCPURunTime(mstime); } @@ -529,10 +529,10 @@ public: jobConfigure(_data, *std::static_pointer_cast(_config)); } - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) override { + void run(const RenderContextPointer& renderContext) override { renderContext->jobConfig = std::static_pointer_cast(_config); if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->isEnabled()) { - jobRun(_data, sceneContext, renderContext, _input.get(), _output.edit()); + jobRun(_data, renderContext, _input.get(), _output.edit()); } renderContext->jobConfig.reset(); } @@ -554,12 +554,12 @@ public: return concept->_data; } - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) { + void run(const RenderContextPointer& renderContext) { PerformanceTimer perfTimer(_name.c_str()); PROFILE_RANGE(render, _name.c_str()); auto start = usecTimestampNow(); - _concept->run(sceneContext, renderContext); + _concept->run(renderContext); _concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0); } @@ -669,11 +669,11 @@ public: } } - void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) override { + void run(const RenderContextPointer& renderContext) override { auto config = std::static_pointer_cast(_config); if (config->alwaysEnabled || config->enabled) { for (auto job : _jobs) { - job.run(sceneContext, renderContext); + job.run(renderContext); } } } diff --git a/tests/gpu-test/src/TestWindow.cpp b/tests/gpu-test/src/TestWindow.cpp index 0ca1ad2297..d62467f510 100644 --- a/tests/gpu-test/src/TestWindow.cpp +++ b/tests/gpu-test/src/TestWindow.cpp @@ -97,17 +97,17 @@ void TestWindow::beginFrame() { #ifdef DEFERRED_LIGHTING gpu::FramebufferPointer primaryFramebuffer; - _preparePrimaryFramebuffer.run(_sceneContext, _renderContext, primaryFramebuffer); + _preparePrimaryFramebuffer.run(_renderContext, primaryFramebuffer); DeferredFrameTransformPointer frameTransform; - _generateDeferredFrameTransform.run(_sceneContext, _renderContext, frameTransform); + _generateDeferredFrameTransform.run(_renderContext, frameTransform); LightingModelPointer lightingModel; - _generateLightingModel.run(_sceneContext, _renderContext, lightingModel); + _generateLightingModel.run(_renderContext, lightingModel); _prepareDeferredInputs.edit0() = primaryFramebuffer; _prepareDeferredInputs.edit1() = lightingModel; - _prepareDeferred.run(_sceneContext, _renderContext, _prepareDeferredInputs, _prepareDeferredOutputs); + _prepareDeferred.run(_renderContext, _prepareDeferredInputs, _prepareDeferredOutputs); _renderDeferredInputs.edit0() = frameTransform; // Pass the deferredFrameTransform @@ -144,7 +144,7 @@ void TestWindow::endFrame() { batch.setResourceTexture(0, nullptr); }); - _renderDeferred.run(_sceneContext, _renderContext, _renderDeferredInputs); + _renderDeferred.run(_renderContext, _renderDeferredInputs); gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) { PROFILE_RANGE_BATCH(batch, "blit"); diff --git a/tests/gpu-test/src/TestWindow.h b/tests/gpu-test/src/TestWindow.h index c8d09825aa..fd059f3e32 100644 --- a/tests/gpu-test/src/TestWindow.h +++ b/tests/gpu-test/src/TestWindow.h @@ -31,7 +31,6 @@ protected: #ifdef DEFERRED_LIGHTING // Prepare the ShapePipelines render::ShapePlumberPointer _shapePlumber { std::make_shared() }; - render::SceneContextPointer _sceneContext{ std::make_shared() }; render::RenderContextPointer _renderContext{ std::make_shared() }; gpu::PipelinePointer _opaquePipeline; model::LightPointer _light { std::make_shared() };