mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Merge pull request #10244 from samcake/ambient
Cleaning the Engine/Task/Job interface
This commit is contained in:
commit
a668ed0409
53 changed files with 181 additions and 192 deletions
|
@ -244,16 +244,16 @@ Item {
|
||||||
id: octreeCol
|
id: octreeCol
|
||||||
spacing: 4; x: 4; y: 4;
|
spacing: 4; x: 4; y: 4;
|
||||||
StatText {
|
StatText {
|
||||||
text: " Frame timing:"
|
text: "Engine: " + root.engineFrameTime.toFixed(1) + " ms"
|
||||||
}
|
}
|
||||||
StatText {
|
StatText {
|
||||||
text: " Batch: " + root.batchFrameTime.toFixed(1) + " ms"
|
text: "Batch: " + root.batchFrameTime.toFixed(1) + " ms"
|
||||||
}
|
}
|
||||||
StatText {
|
StatText {
|
||||||
text: " GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
|
text: "GPU: " + root.gpuFrameTime.toFixed(1) + " ms"
|
||||||
}
|
}
|
||||||
StatText {
|
StatText {
|
||||||
text: " Avatar: " + root.avatarSimulationTime.toFixed(1) + " ms"
|
text: "Avatar: " + root.avatarSimulationTime.toFixed(1) + " ms"
|
||||||
}
|
}
|
||||||
StatText {
|
StatText {
|
||||||
text: "Triangles: " + root.triangles +
|
text: "Triangles: " + root.triangles +
|
||||||
|
|
|
@ -335,6 +335,8 @@ void Stats::updateStats(bool force) {
|
||||||
// Update Frame timing (in ms)
|
// Update Frame timing (in ms)
|
||||||
STAT_UPDATE(gpuFrameTime, (float)gpuContext->getFrameTimerGPUAverage());
|
STAT_UPDATE(gpuFrameTime, (float)gpuContext->getFrameTimerGPUAverage());
|
||||||
STAT_UPDATE(batchFrameTime, (float)gpuContext->getFrameTimerBatchAverage());
|
STAT_UPDATE(batchFrameTime, (float)gpuContext->getFrameTimerBatchAverage());
|
||||||
|
auto config = qApp->getRenderEngine()->getConfiguration().get();
|
||||||
|
STAT_UPDATE(engineFrameTime, (float) config->getCPURunTime());
|
||||||
STAT_UPDATE(avatarSimulationTime, (float)avatarManager->getAvatarSimulationTime());
|
STAT_UPDATE(avatarSimulationTime, (float)avatarManager->getAvatarSimulationTime());
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -128,6 +128,7 @@ class Stats : public QQuickItem {
|
||||||
STATS_PROPERTY(int, gpuFreeMemory, 0)
|
STATS_PROPERTY(int, gpuFreeMemory, 0)
|
||||||
STATS_PROPERTY(float, gpuFrameTime, 0)
|
STATS_PROPERTY(float, gpuFrameTime, 0)
|
||||||
STATS_PROPERTY(float, batchFrameTime, 0)
|
STATS_PROPERTY(float, batchFrameTime, 0)
|
||||||
|
STATS_PROPERTY(float, engineFrameTime, 0)
|
||||||
STATS_PROPERTY(float, avatarSimulationTime, 0)
|
STATS_PROPERTY(float, avatarSimulationTime, 0)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -250,6 +251,7 @@ signals:
|
||||||
void gpuFreeMemoryChanged();
|
void gpuFreeMemoryChanged();
|
||||||
void gpuFrameTimeChanged();
|
void gpuFrameTimeChanged();
|
||||||
void batchFrameTimeChanged();
|
void batchFrameTimeChanged();
|
||||||
|
void engineFrameTimeChanged();
|
||||||
void avatarSimulationTimeChanged();
|
void avatarSimulationTimeChanged();
|
||||||
void rectifiedTextureCountChanged();
|
void rectifiedTextureCountChanged();
|
||||||
void decimatedTextureCountChanged();
|
void decimatedTextureCountChanged();
|
||||||
|
|
|
@ -338,7 +338,7 @@ void AmbientOcclusionEffect::updateGaussianDistribution() {
|
||||||
GaussianDistribution::evalSampling(coefs, Parameters::GAUSSIAN_COEFS_LENGTH, _parametersBuffer->getBlurRadius(), _parametersBuffer->getBlurDeviation());
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ const gpu::PipelinePointer& DebugAmbientOcclusion::getDebugPipeline() {
|
||||||
return _debugPipeline;
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public:
|
||||||
AmbientOcclusionEffect();
|
AmbientOcclusionEffect();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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
|
// Class describing the uniform buffer with all the parameters common to the AO shaders
|
||||||
|
@ -200,7 +200,7 @@ public:
|
||||||
DebugAmbientOcclusion();
|
DebugAmbientOcclusion();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ const gpu::PipelinePointer& Antialiasing::getBlendPipeline() {
|
||||||
return _blendPipeline;
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
Antialiasing();
|
Antialiasing();
|
||||||
~Antialiasing();
|
~Antialiasing();
|
||||||
void configure(const Config& config) {}
|
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& getAntialiasingPipeline();
|
||||||
const gpu::PipelinePointer& getBlendPipeline();
|
const gpu::PipelinePointer& getBlendPipeline();
|
||||||
|
|
|
@ -391,7 +391,7 @@ void DebugDeferredBuffer::configure(const Config& config) {
|
||||||
_size = config.size;
|
_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) {
|
if (_mode == Off) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
~DebugDeferredBuffer();
|
~DebugDeferredBuffer();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
protected:
|
||||||
friend class DebugDeferredBufferConfig;
|
friend class DebugDeferredBufferConfig;
|
||||||
|
|
|
@ -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) {
|
if (!frameTransform) {
|
||||||
frameTransform = std::make_shared<DeferredFrameTransform>();
|
frameTransform = std::make_shared<DeferredFrameTransform>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
|
|
||||||
GenerateDeferredFrameTransform() {}
|
GenerateDeferredFrameTransform() {}
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform);
|
void run(const render::RenderContextPointer& renderContext, DeferredFrameTransformPointer& frameTransform);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
|
@ -479,7 +479,7 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
|
||||||
return _spotLightMesh;
|
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<FramebufferCache>();
|
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||||
auto framebufferSize = framebufferCache->getFrameBufferSize();
|
auto framebufferSize = framebufferCache->getFrameBufferSize();
|
||||||
|
@ -512,7 +512,7 @@ void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, con
|
||||||
primaryFramebuffer = _primaryFramebuffer;
|
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 args = renderContext->args;
|
||||||
|
|
||||||
auto primaryFramebuffer = inputs.get0();
|
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 DeferredFrameTransformPointer& frameTransform,
|
||||||
const DeferredFramebufferPointer& deferredFramebuffer,
|
const DeferredFramebufferPointer& deferredFramebuffer,
|
||||||
const LightingModelPointer& lightingModel,
|
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 DeferredFrameTransformPointer& frameTransform,
|
||||||
const DeferredFramebufferPointer& deferredFramebuffer,
|
const DeferredFramebufferPointer& deferredFramebuffer,
|
||||||
const LightingModelPointer& lightingModel,
|
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 args = renderContext->args;
|
||||||
auto& batch = (*args->_batch);
|
auto& batch = (*args->_batch);
|
||||||
{
|
{
|
||||||
|
@ -792,7 +792,7 @@ RenderDeferred::RenderDeferred() {
|
||||||
void RenderDeferred::configure(const Config& config) {
|
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");
|
PROFILE_RANGE(render, "DeferredLighting");
|
||||||
|
|
||||||
auto deferredTransform = inputs.get0();
|
auto deferredTransform = inputs.get0();
|
||||||
|
@ -813,11 +813,11 @@ void RenderDeferred::run(const SceneContextPointer& sceneContext, const RenderCo
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
_gpuTimer->begin(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);
|
_gpuTimer->end(batch);
|
||||||
args->_context->appendFrameBatch(batch);
|
args->_context->appendFrameBatch(batch);
|
||||||
|
|
|
@ -127,7 +127,7 @@ class PreparePrimaryFramebuffer {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::ModelO<PreparePrimaryFramebuffer, gpu::FramebufferPointer>;
|
using JobModel = render::Job::ModelO<PreparePrimaryFramebuffer, gpu::FramebufferPointer>;
|
||||||
|
|
||||||
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;
|
gpu::FramebufferPointer _primaryFramebuffer;
|
||||||
};
|
};
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
using JobModel = render::Job::ModelIO<PrepareDeferred, Inputs, Outputs>;
|
using JobModel = render::Job::ModelIO<PrepareDeferred, Inputs, Outputs>;
|
||||||
|
|
||||||
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;
|
DeferredFramebufferPointer _deferredFramebuffer;
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,7 @@ class RenderDeferredSetup {
|
||||||
public:
|
public:
|
||||||
// using JobModel = render::Job::ModelI<RenderDeferredSetup, DeferredFrameTransformPointer>;
|
// using JobModel = render::Job::ModelI<RenderDeferredSetup, DeferredFrameTransformPointer>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext,
|
void run(const render::RenderContextPointer& renderContext,
|
||||||
const DeferredFrameTransformPointer& frameTransform,
|
const DeferredFrameTransformPointer& frameTransform,
|
||||||
const DeferredFramebufferPointer& deferredFramebuffer,
|
const DeferredFramebufferPointer& deferredFramebuffer,
|
||||||
const LightingModelPointer& lightingModel,
|
const LightingModelPointer& lightingModel,
|
||||||
|
@ -163,7 +163,7 @@ class RenderDeferredLocals {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::ModelI<RenderDeferredLocals, DeferredFrameTransformPointer>;
|
using JobModel = render::Job::ModelI<RenderDeferredLocals, DeferredFrameTransformPointer>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext,
|
void run(const render::RenderContextPointer& renderContext,
|
||||||
const DeferredFrameTransformPointer& frameTransform,
|
const DeferredFrameTransformPointer& frameTransform,
|
||||||
const DeferredFramebufferPointer& deferredFramebuffer,
|
const DeferredFramebufferPointer& deferredFramebuffer,
|
||||||
const LightingModelPointer& lightingModel,
|
const LightingModelPointer& lightingModel,
|
||||||
|
@ -181,7 +181,7 @@ class RenderDeferredCleanup {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::Model<RenderDeferredCleanup>;
|
using JobModel = render::Job::Model<RenderDeferredCleanup>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
void run(const render::RenderContextPointer& renderContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
using RenderDeferredConfig = render::GPUJobConfig;
|
using RenderDeferredConfig = render::GPUJobConfig;
|
||||||
|
@ -196,7 +196,7 @@ public:
|
||||||
|
|
||||||
void configure(const Config& config);
|
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;
|
RenderDeferredSetup setupJob;
|
||||||
RenderDeferredLocals lightsJob;
|
RenderDeferredLocals lightsJob;
|
||||||
|
|
|
@ -68,7 +68,7 @@ const gpu::PipelinePointer& HitEffect::getHitEffectPipeline() {
|
||||||
return _hitEffectPipeline;
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
HitEffect();
|
HitEffect();
|
||||||
~HitEffect();
|
~HitEffect();
|
||||||
void configure(const Config& config) {}
|
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();
|
const gpu::PipelinePointer& getHitEffectPipeline();
|
||||||
|
|
||||||
|
|
|
@ -558,7 +558,7 @@ void LightClusteringPass::configure(const Config& config) {
|
||||||
_freeze = config.freeze;
|
_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 args = renderContext->args;
|
||||||
|
|
||||||
auto deferredTransform = inputs.get0();
|
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)) {
|
if (!(doDrawClusterFromDepth || doDrawContent || doDrawGrid)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ public:
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
protected:
|
||||||
LightClustersPointer _lightClusters;
|
LightClustersPointer _lightClusters;
|
||||||
|
@ -221,7 +221,7 @@ public:
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
protected:
|
||||||
gpu::BufferPointer _gridBuffer;
|
gpu::BufferPointer _gridBuffer;
|
||||||
|
|
|
@ -179,7 +179,7 @@ void MakeLightingModel::configure(const Config& config) {
|
||||||
_lightingModel->setWireframe(config.enableWireframe);
|
_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;
|
lightingModel = _lightingModel;
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ public:
|
||||||
MakeLightingModel();
|
MakeLightingModel();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
private:
|
||||||
LightingModelPointer _lightingModel;
|
LightingModelPointer _lightingModel;
|
||||||
|
|
|
@ -218,14 +218,14 @@ void RenderDeferredTask::build(JobModel& task, const render::Varying& input, ren
|
||||||
task.addJob<Blit>("Blit", primaryFramebuffer);
|
task.addJob<Blit>("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;
|
timer = _gpuTimer;
|
||||||
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||||
_gpuTimer->begin(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) {
|
gpu::doInBatch(renderContext->args->_context, [&](gpu::Batch& batch) {
|
||||||
timer->end(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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont
|
||||||
ShapeKey globalKey = keyBuilder.build();
|
ShapeKey globalKey = keyBuilder.build();
|
||||||
args->_globalShapeKey = globalKey._flags.to_ulong();
|
args->_globalShapeKey = globalKey._flags.to_ulong();
|
||||||
|
|
||||||
renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
||||||
|
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
args->_globalShapeKey = 0;
|
args->_globalShapeKey = 0;
|
||||||
|
@ -281,7 +281,7 @@ void DrawDeferred::run(const SceneContextPointer& sceneContext, const RenderCont
|
||||||
config->setNumDrawn((int)inItems.size());
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -319,9 +319,9 @@ void DrawStateSortDeferred::run(const SceneContextPointer& sceneContext, const R
|
||||||
args->_globalShapeKey = globalKey._flags.to_ulong();
|
args->_globalShapeKey = globalKey._flags.to_ulong();
|
||||||
|
|
||||||
if (_stateSort) {
|
if (_stateSort) {
|
||||||
renderStateSortShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
renderStateSortShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
||||||
} else {
|
} else {
|
||||||
renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn, globalKey);
|
||||||
}
|
}
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
args->_globalShapeKey = 0;
|
args->_globalShapeKey = 0;
|
||||||
|
@ -336,7 +336,7 @@ DrawOverlay3D::DrawOverlay3D(bool opaque) :
|
||||||
initOverlay3DPipelines(*_shapePlumber);
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ void DrawOverlay3D::run(const SceneContextPointer& sceneContext, const RenderCon
|
||||||
// Setup lighting model for all items;
|
// Setup lighting model for all items;
|
||||||
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
batch.setUniformBuffer(render::ShapePipeline::Slot::LIGHTING_MODEL, lightingModel->getParametersBuffer());
|
||||||
|
|
||||||
renderShapes(sceneContext, renderContext, _shapePlumber, inItems, _maxDrawn);
|
renderShapes(renderContext, _shapePlumber, inItems, _maxDrawn);
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -403,7 +403,7 @@ gpu::PipelinePointer DrawStencilDeferred::getOpaquePipeline() {
|
||||||
return _opaquePipeline;
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ void DrawStencilDeferred::run(const SceneContextPointer& sceneContext, const Ren
|
||||||
args->_batch = nullptr;
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
||||||
batch.setProjectionTransform(projMat);
|
batch.setProjectionTransform(projMat);
|
||||||
batch.setViewTransform(viewMat);
|
batch.setViewTransform(viewMat);
|
||||||
|
|
||||||
renderItems(sceneContext, renderContext, inItems);
|
renderItems(renderContext, inItems);
|
||||||
// _gpuTimer.end(batch);
|
// _gpuTimer.end(batch);
|
||||||
});
|
});
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
|
@ -466,7 +466,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
||||||
// std::static_pointer_cast<Config>(renderContext->jobConfig)->gpuTime = _gpuTimer.getAverage();
|
// std::static_pointer_cast<Config>(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);
|
||||||
assert(renderContext->args->_context);
|
assert(renderContext->args->_context);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
BeginGPURangeTimer(const std::string& name) : _gpuTimer(std::make_shared<gpu::RangeTimer>(name)) {}
|
BeginGPURangeTimer(const std::string& name) : _gpuTimer(std::make_shared<gpu::RangeTimer>(name)) {}
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer);
|
void run(const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gpu::RangeTimerPointer _gpuTimer;
|
gpu::RangeTimerPointer _gpuTimer;
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
EndGPURangeTimer() {}
|
EndGPURangeTimer() {}
|
||||||
|
|
||||||
void configure(const Config& config) {}
|
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:
|
protected:
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
DrawDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {}
|
DrawDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {}
|
||||||
|
|
||||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
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:
|
protected:
|
||||||
render::ShapePlumberPointer _shapePlumber;
|
render::ShapePlumberPointer _shapePlumber;
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
DrawStateSortDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {}
|
DrawStateSortDeferred(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {}
|
||||||
|
|
||||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; _stateSort = config.stateSort; }
|
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:
|
protected:
|
||||||
render::ShapePlumberPointer _shapePlumber;
|
render::ShapePlumberPointer _shapePlumber;
|
||||||
|
@ -125,7 +125,7 @@ class DrawStencilDeferred {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::ModelI<DrawStencilDeferred, std::shared_ptr<DeferredFramebuffer>>;
|
using JobModel = render::Job::ModelI<DrawStencilDeferred, std::shared_ptr<DeferredFramebuffer>>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const std::shared_ptr<DeferredFramebuffer>& deferredFramebuffer);
|
void run(const render::RenderContextPointer& renderContext, const std::shared_ptr<DeferredFramebuffer>& deferredFramebuffer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gpu::PipelinePointer _opaquePipeline;
|
gpu::PipelinePointer _opaquePipeline;
|
||||||
|
@ -143,7 +143,7 @@ public:
|
||||||
using JobModel = render::Job::ModelI<DrawBackgroundDeferred, Inputs, Config>;
|
using JobModel = render::Job::ModelI<DrawBackgroundDeferred, Inputs, Config>;
|
||||||
|
|
||||||
void configure(const Config& config) {}
|
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:
|
protected:
|
||||||
gpu::RangeTimerPointer _gpuTimer;
|
gpu::RangeTimerPointer _gpuTimer;
|
||||||
|
@ -177,7 +177,7 @@ public:
|
||||||
DrawOverlay3D(bool opaque);
|
DrawOverlay3D(bool opaque);
|
||||||
|
|
||||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
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:
|
protected:
|
||||||
render::ShapePlumberPointer _shapePlumber;
|
render::ShapePlumberPointer _shapePlumber;
|
||||||
|
@ -189,7 +189,7 @@ class Blit {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::ModelI<Blit, gpu::FramebufferPointer>;
|
using JobModel = render::Job::ModelI<Blit, gpu::FramebufferPointer>;
|
||||||
|
|
||||||
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 {
|
class RenderDeferredTask {
|
||||||
|
|
|
@ -59,7 +59,7 @@ void RenderForwardTask::build(JobModel& task, const render::Varying& input, rend
|
||||||
task.addJob<Blit>("Blit", framebuffer);
|
task.addJob<Blit>("Blit", framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void PrepareFramebuffer::run(const RenderContextPointer& renderContext,
|
||||||
gpu::FramebufferPointer& framebuffer) {
|
gpu::FramebufferPointer& framebuffer) {
|
||||||
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||||
auto framebufferSize = framebufferCache->getFrameBufferSize();
|
auto framebufferSize = framebufferCache->getFrameBufferSize();
|
||||||
|
@ -100,7 +100,7 @@ void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const Rend
|
||||||
framebuffer = _framebuffer;
|
framebuffer = _framebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Draw::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void Draw::run(const RenderContextPointer& renderContext,
|
||||||
const Inputs& items) {
|
const Inputs& items) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void Draw::run(const SceneContextPointer& sceneContext, const RenderContextPoint
|
||||||
batch.setModelTransform(Transform());
|
batch.setModelTransform(Transform());
|
||||||
|
|
||||||
// Render items
|
// Render items
|
||||||
renderStateSortShapes(sceneContext, renderContext, _shapePlumber, items, -1);
|
renderStateSortShapes(renderContext, _shapePlumber, items, -1);
|
||||||
});
|
});
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ const gpu::PipelinePointer Stencil::getPipeline() {
|
||||||
return _stencilPipeline;
|
return _stencilPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stencil::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void Stencil::run(const RenderContextPointer& renderContext) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
|
@ -158,7 +158,7 @@ void Stencil::run(const SceneContextPointer& sceneContext, const RenderContextPo
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void DrawBackground::run(const RenderContextPointer& renderContext,
|
||||||
const Inputs& background) {
|
const Inputs& background) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ void DrawBackground::run(const SceneContextPointer& sceneContext, const RenderCo
|
||||||
batch.setProjectionTransform(projMat);
|
batch.setProjectionTransform(projMat);
|
||||||
batch.setViewTransform(viewMat);
|
batch.setViewTransform(viewMat);
|
||||||
|
|
||||||
renderItems(sceneContext, renderContext, background);
|
renderItems(renderContext, background);
|
||||||
});
|
});
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
using Inputs = gpu::FramebufferPointer;
|
using Inputs = gpu::FramebufferPointer;
|
||||||
using JobModel = render::Job::ModelO<PrepareFramebuffer, Inputs>;
|
using JobModel = render::Job::ModelO<PrepareFramebuffer, Inputs>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext,
|
void run(const render::RenderContextPointer& renderContext,
|
||||||
gpu::FramebufferPointer& framebuffer);
|
gpu::FramebufferPointer& framebuffer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
using JobModel = render::Job::ModelI<Draw, Inputs>;
|
using JobModel = render::Job::ModelI<Draw, Inputs>;
|
||||||
|
|
||||||
Draw(const render::ShapePlumberPointer& shapePlumber) : _shapePlumber(shapePlumber) {}
|
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);
|
const Inputs& items);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -55,7 +55,7 @@ class Stencil {
|
||||||
public:
|
public:
|
||||||
using JobModel = render::Job::Model<Stencil>;
|
using JobModel = render::Job::Model<Stencil>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext);
|
void run(const render::RenderContextPointer& renderContext);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const gpu::PipelinePointer getPipeline();
|
const gpu::PipelinePointer getPipeline();
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
using Inputs = render::ItemBounds;
|
using Inputs = render::ItemBounds;
|
||||||
using JobModel = render::Job::ModelI<DrawBackground, Inputs>;
|
using JobModel = render::Job::ModelI<DrawBackground, Inputs>;
|
||||||
|
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext,
|
void run(const render::RenderContextPointer& renderContext,
|
||||||
const Inputs& background);
|
const Inputs& background);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
using namespace render;
|
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) {
|
const render::ShapeBounds& inShapes) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
@ -74,7 +74,7 @@ void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const
|
||||||
if (items.first.isSkinned()) {
|
if (items.first.isSkinned()) {
|
||||||
skinnedShapeKeys.push_back(items.first);
|
skinnedShapeKeys.push_back(items.first);
|
||||||
} else {
|
} 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;
|
args->_pipeline = shadowSkinnedPipeline;
|
||||||
batch.setPipeline(shadowSkinnedPipeline->pipeline);
|
batch.setPipeline(shadowSkinnedPipeline->pipeline);
|
||||||
for (const auto& key : skinnedShapeKeys) {
|
for (const auto& key : skinnedShapeKeys) {
|
||||||
renderItems(sceneContext, renderContext, inShapes.at(key));
|
renderItems(renderContext, inShapes.at(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
args->_pipeline = nullptr;
|
args->_pipeline = nullptr;
|
||||||
|
@ -139,7 +139,7 @@ void RenderShadowTask::configure(const Config& configuration) {
|
||||||
// Task::configure(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<DeferredLightingEffect>()->getLightStage();
|
auto lightStage = DependencyManager::get<DeferredLightingEffect>()->getLightStage();
|
||||||
const auto globalShadow = lightStage->getShadow(0);
|
const auto globalShadow = lightStage->getShadow(0);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void RenderShadowSetup::run(const SceneContextPointer& sceneContext, const rende
|
||||||
args->_renderMode = RenderArgs::SHADOW_RENDER_MODE;
|
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;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
// Reset the render args
|
// Reset the render args
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
using JobModel = render::Job::ModelI<RenderShadowMap, render::ShapeBounds>;
|
using JobModel = render::Job::ModelI<RenderShadowMap, render::ShapeBounds>;
|
||||||
|
|
||||||
RenderShadowMap(render::ShapePlumberPointer shapePlumber) : _shapePlumber{ shapePlumber } {}
|
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);
|
const render::ShapeBounds& inShapes);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -56,14 +56,14 @@ class RenderShadowSetup {
|
||||||
public:
|
public:
|
||||||
using Output = RenderArgs::RenderMode;
|
using Output = RenderArgs::RenderMode;
|
||||||
using JobModel = render::Job::ModelO<RenderShadowSetup, Output>;
|
using JobModel = render::Job::ModelO<RenderShadowSetup, Output>;
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, Output& output);
|
void run(const render::RenderContextPointer& renderContext, Output& output);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderShadowTeardown {
|
class RenderShadowTeardown {
|
||||||
public:
|
public:
|
||||||
using Input = RenderArgs::RenderMode;
|
using Input = RenderArgs::RenderMode;
|
||||||
using JobModel = render::Job::ModelI<RenderShadowTeardown, Input>;
|
using JobModel = render::Job::ModelI<RenderShadowTeardown, Input>;
|
||||||
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
|
#endif // hifi_RenderShadowTask_h
|
||||||
|
|
|
@ -134,7 +134,7 @@ void SubsurfaceScattering::configure(const Config& config) {
|
||||||
_scatteringResource->setShowDiffusedNormal(config.showDiffusedNormal);
|
_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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
SubsurfaceScattering();
|
SubsurfaceScattering();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
private:
|
||||||
SubsurfaceScatteringResourcePointer _scatteringResource;
|
SubsurfaceScatteringResourcePointer _scatteringResource;
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
DebugSubsurfaceScattering();
|
DebugSubsurfaceScattering();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ LinearDepthPass::LinearDepthPass() {
|
||||||
void LinearDepthPass::configure(const Config& config) {
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ public:
|
||||||
LinearDepthPass();
|
LinearDepthPass();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
private:
|
||||||
typedef gpu::BufferView UniformBufferView;
|
typedef gpu::BufferView UniformBufferView;
|
||||||
|
@ -169,7 +169,7 @@ public:
|
||||||
SurfaceGeometryPass();
|
SurfaceGeometryPass();
|
||||||
|
|
||||||
void configure(const Config& config);
|
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<Parameters>().curvatureInfo.x; }
|
float getCurvatureDepthThreshold() const { return _parametersBuffer.get<Parameters>().curvatureInfo.x; }
|
||||||
|
|
|
@ -88,7 +88,7 @@ void ToneMappingDeferred::configure(const Config& config) {
|
||||||
_toneMappingEffect.setToneCurve((ToneMappingEffect::ToneCurve)config.curve);
|
_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 lightingBuffer = inputs.get0()->getRenderBuffer(0);
|
||||||
auto destFbo = inputs.get1();
|
auto destFbo = inputs.get1();
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
using JobModel = render::Job::ModelI<ToneMappingDeferred, Inputs, Config>;
|
using JobModel = render::Job::ModelI<ToneMappingDeferred, Inputs, Config>;
|
||||||
|
|
||||||
void configure(const Config& config);
|
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;
|
ToneMappingEffect _toneMappingEffect;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ public:
|
||||||
BlurGaussian(bool generateOutputFramebuffer = false);
|
BlurGaussian(bool generateOutputFramebuffer = false);
|
||||||
|
|
||||||
void configure(const Config& config);
|
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:
|
protected:
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
BlurGaussianDepthAware(bool generateNewOutput = false, const BlurParamsPointer& params = BlurParamsPointer());
|
BlurGaussianDepthAware(bool generateNewOutput = false, const BlurParamsPointer& params = BlurParamsPointer());
|
||||||
|
|
||||||
void configure(const Config& config);
|
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; }
|
const BlurParamsPointer& getParameters() const { return _parameters; }
|
||||||
|
|
||||||
|
|
|
@ -16,20 +16,13 @@
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
class SceneContext {
|
class JobConfig;
|
||||||
public:
|
|
||||||
ScenePointer _scene;
|
|
||||||
|
|
||||||
SceneContext() {}
|
|
||||||
};
|
|
||||||
using SceneContextPointer = std::shared_ptr<SceneContext>;
|
|
||||||
|
|
||||||
class JobConfig;
|
|
||||||
|
|
||||||
class RenderContext {
|
class RenderContext {
|
||||||
public:
|
public:
|
||||||
RenderArgs* args;
|
RenderArgs* args;
|
||||||
std::shared_ptr<JobConfig> jobConfig{ nullptr };
|
std::shared_ptr<JobConfig> jobConfig{ nullptr };
|
||||||
|
ScenePointer _scene;
|
||||||
};
|
};
|
||||||
using RenderContextPointer = std::shared_ptr<RenderContext>;
|
using RenderContextPointer = std::shared_ptr<RenderContext>;
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,10 @@ void render::cullItems(const RenderContextPointer& renderContext, const CullFunc
|
||||||
details._rendered += (int)outItems.size();
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
outItems.clear();
|
outItems.clear();
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ void FetchSpatialTree::configure(const Config& config) {
|
||||||
_lodAngle = config.lodAngle;
|
_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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
// start fresh
|
// start fresh
|
||||||
outSelection.clear();
|
outSelection.clear();
|
||||||
|
@ -112,12 +112,12 @@ void CullSpatialSelection::configure(const Config& config) {
|
||||||
_skipCulling = config.skipCulling;
|
_skipCulling = config.skipCulling;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CullSpatialSelection::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void CullSpatialSelection::run(const RenderContextPointer& renderContext,
|
||||||
const ItemSpatialTree::ItemSelection& inSelection, ItemBounds& outItems) {
|
const ItemSpatialTree::ItemSelection& inSelection, ItemBounds& outItems) {
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
auto& details = args->_details.edit(_detailType);
|
auto& details = args->_details.edit(_detailType);
|
||||||
details._considered += (int)inSelection.numItems();
|
details._considered += (int)inSelection.numItems();
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace render {
|
||||||
class FetchNonspatialItems {
|
class FetchNonspatialItems {
|
||||||
public:
|
public:
|
||||||
using JobModel = Job::ModelO<FetchNonspatialItems, ItemBounds>;
|
using JobModel = Job::ModelO<FetchNonspatialItems, ItemBounds>;
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, ItemBounds& outItems);
|
void run(const RenderContextPointer& renderContext, ItemBounds& outItems);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FetchSpatialTreeConfig : public Job::Config {
|
class FetchSpatialTreeConfig : public Job::Config {
|
||||||
|
@ -63,7 +63,7 @@ namespace render {
|
||||||
ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() };
|
ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() };
|
||||||
|
|
||||||
void configure(const Config& config);
|
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 {
|
class CullSpatialSelectionConfig : public Job::Config {
|
||||||
|
@ -106,7 +106,7 @@ namespace render {
|
||||||
ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() };
|
ItemFilter _filter{ ItemFilter::Builder::opaqueShape().withoutLayered() };
|
||||||
|
|
||||||
void configure(const Config& config);
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,12 +84,11 @@ void DrawSceneOctree::configure(const Config& config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawSceneOctree::run(const SceneContextPointer& sceneContext,
|
void DrawSceneOctree::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
|
||||||
const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
|
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
std::static_pointer_cast<Config>(renderContext->jobConfig)->numAllocatedCells = (int)scene->getSpatialTree().getNumAllocatedCells();
|
std::static_pointer_cast<Config>(renderContext->jobConfig)->numAllocatedCells = (int)scene->getSpatialTree().getNumAllocatedCells();
|
||||||
std::static_pointer_cast<Config>(renderContext->jobConfig)->numFreeCells = (int)scene->getSpatialTree().getNumFreeCells();
|
std::static_pointer_cast<Config>(renderContext->jobConfig)->numFreeCells = (int)scene->getSpatialTree().getNumFreeCells();
|
||||||
|
@ -196,12 +195,11 @@ void DrawItemSelection::configure(const Config& config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DrawItemSelection::run(const SceneContextPointer& sceneContext,
|
void DrawItemSelection::run(const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
|
||||||
const RenderContextPointer& renderContext, const ItemSpatialTree::ItemSelection& inSelection) {
|
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
glm::mat4 projMat;
|
glm::mat4 projMat;
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace render {
|
||||||
DrawSceneOctree() {}
|
DrawSceneOctree() {}
|
||||||
|
|
||||||
void configure(const Config& config);
|
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 getDrawCellBoundsPipeline();
|
||||||
const gpu::PipelinePointer getDrawLODReticlePipeline();
|
const gpu::PipelinePointer getDrawLODReticlePipeline();
|
||||||
|
@ -129,7 +129,7 @@ namespace render {
|
||||||
DrawItemSelection() {}
|
DrawItemSelection() {}
|
||||||
|
|
||||||
void configure(const Config& config);
|
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();
|
const gpu::PipelinePointer getDrawItemBoundPipeline();
|
||||||
};
|
};
|
||||||
|
|
|
@ -103,13 +103,11 @@ void DrawStatus::configure(const Config& config) {
|
||||||
_showNetwork = config.showNetwork;
|
_showNetwork = config.showNetwork;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawStatus::run(const SceneContextPointer& sceneContext,
|
void DrawStatus::run(const RenderContextPointer& renderContext, const ItemBounds& inItems) {
|
||||||
const RenderContextPointer& renderContext,
|
|
||||||
const ItemBounds& inItems) {
|
|
||||||
assert(renderContext->args);
|
assert(renderContext->args);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
const int NUM_STATUS_VEC4_PER_ITEM = 2;
|
const int NUM_STATUS_VEC4_PER_ITEM = 2;
|
||||||
const int VEC4_LENGTH = 4;
|
const int VEC4_LENGTH = 4;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace render {
|
||||||
DrawStatus(const gpu::TexturePointer statusIconMap) { setStatusIconMap(statusIconMap); }
|
DrawStatus(const gpu::TexturePointer statusIconMap) { setStatusIconMap(statusIconMap); }
|
||||||
|
|
||||||
void configure(const Config& config);
|
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 getDrawItemBoundsPipeline();
|
||||||
const gpu::PipelinePointer getDrawItemStatusPipeline();
|
const gpu::PipelinePointer getDrawItemStatusPipeline();
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
void render::renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems) {
|
void render::renderItems(const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
int numItemsToDraw = (int)inItems.size();
|
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) {
|
const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
int numItemsToDraw = (int)inItems.size();
|
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) {
|
const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems, const ShapeKey& globalKey) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
int numItemsToDraw = (int)inItems.size();
|
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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
@ -131,7 +131,7 @@ void DrawLight::run(const SceneContextPointer& sceneContext, const RenderContext
|
||||||
// render lights
|
// render lights
|
||||||
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
renderItems(sceneContext, renderContext, inLights, _maxDrawn);
|
renderItems(renderContext, inLights, _maxDrawn);
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ const gpu::PipelinePointer DrawBounds::getPipeline() {
|
||||||
return _boundsPipeline;
|
return _boundsPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawBounds::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void DrawBounds::run(const RenderContextPointer& renderContext,
|
||||||
const Inputs& items) {
|
const Inputs& items) {
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
void renderItems(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, int maxDrawnItems = -1);
|
void renderItems(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 renderShapes(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 renderStateSortShapes(const RenderContextPointer& renderContext, const ShapePlumberPointer& shapeContext, const ItemBounds& inItems, int maxDrawnItems = -1, const ShapeKey& globalKey = ShapeKey());
|
||||||
|
|
||||||
class DrawLightConfig : public Job::Config {
|
class DrawLightConfig : public Job::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
using JobModel = Job::ModelI<DrawLight, ItemBounds, Config>;
|
using JobModel = Job::ModelI<DrawLight, ItemBounds, Config>;
|
||||||
|
|
||||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
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:
|
protected:
|
||||||
int _maxDrawn; // initialized by Config
|
int _maxDrawn; // initialized by Config
|
||||||
};
|
};
|
||||||
|
@ -59,7 +59,7 @@ public:
|
||||||
using JobModel = render::Job::ModelI<DrawBounds, Inputs, Config>;
|
using JobModel = render::Job::ModelI<DrawBounds, Inputs, Config>;
|
||||||
|
|
||||||
void configure(const Config& configuration) {}
|
void configure(const Config& configuration) {}
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext,
|
void run(const render::RenderContextPointer& renderContext,
|
||||||
const Inputs& items);
|
const Inputs& items);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
Engine::Engine() : Task("Engine", EngineTask::JobModel::create()),
|
Engine::Engine() : Task("Engine", EngineTask::JobModel::create()),
|
||||||
_sceneContext(std::make_shared<SceneContext>()),
|
|
||||||
_renderContext(std::make_shared<RenderContext>())
|
_renderContext(std::make_shared<RenderContext>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,18 +32,16 @@ namespace render {
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
// Register the scene
|
// Register the scene
|
||||||
void registerScene(const ScenePointer& scene) { _sceneContext->_scene = scene; }
|
void registerScene(const ScenePointer& scene) { _renderContext->_scene = scene; }
|
||||||
|
|
||||||
// Push a RenderContext
|
// acces the RenderContext
|
||||||
void setRenderContext(const RenderContext& renderContext) { (*_renderContext) = renderContext; }
|
|
||||||
RenderContextPointer getRenderContext() const { return _renderContext; }
|
RenderContextPointer getRenderContext() const { return _renderContext; }
|
||||||
|
|
||||||
// Render a frame
|
// Render a frame
|
||||||
// Must have a scene registered and a context set
|
// 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:
|
protected:
|
||||||
SceneContextPointer _sceneContext;
|
|
||||||
RenderContextPointer _renderContext;
|
RenderContextPointer _renderContext;
|
||||||
};
|
};
|
||||||
using EnginePointer = std::shared_ptr<Engine>;
|
using EnginePointer = std::shared_ptr<Engine>;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
void EngineStats::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void EngineStats::run(const RenderContextPointer& renderContext) {
|
||||||
// Tick time
|
// Tick time
|
||||||
|
|
||||||
quint64 msecsElapsed = _frameTimer.restart();
|
quint64 msecsElapsed = _frameTimer.restart();
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace render {
|
||||||
EngineStats() { _frameTimer.start(); }
|
EngineStats() { _frameTimer.start(); }
|
||||||
|
|
||||||
void configure(const Config& configuration) {}
|
void configure(const Config& configuration) {}
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext);
|
void run(const RenderContextPointer& renderContext);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
void FilterLayeredItems::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
void FilterLayeredItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
// Clear previous values
|
// Clear previous values
|
||||||
outItems.clear();
|
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();
|
outItems.clear();
|
||||||
std::static_pointer_cast<Config>(renderContext->jobConfig)->setNumItems((int)inItems.size());
|
std::static_pointer_cast<Config>(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) {
|
void SelectItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||||
auto selection = sceneContext->_scene->getSelection(_name);
|
auto selection = renderContext->_scene->getSelection(_name);
|
||||||
const auto& selectedItems = selection.getItems();
|
const auto& selectedItems = selection.getItems();
|
||||||
outItems.clear();
|
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) {
|
void SelectSortItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||||
auto selection = sceneContext->_scene->getSelection(_name);
|
auto selection = renderContext->_scene->getSelection(_name);
|
||||||
const auto& selectedItems = selection.getItems();
|
const auto& selectedItems = selection.getItems();
|
||||||
outItems.clear();
|
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) {
|
void MetaToSubItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
// Now we have a selection of items to render
|
// Now we have a selection of items to render
|
||||||
outItems.clear();
|
outItems.clear();
|
||||||
|
|
|
@ -41,8 +41,8 @@ namespace render {
|
||||||
ItemFilterArray _filters;
|
ItemFilterArray _filters;
|
||||||
|
|
||||||
void configure(const Config& config) {}
|
void configure(const Config& config) {}
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBoundsArray& outItems) {
|
void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBoundsArray& outItems) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
|
|
||||||
// Clear previous values
|
// Clear previous values
|
||||||
for (size_t i = 0; i < NUM_FILTERS; i++) {
|
for (size_t i = 0; i < NUM_FILTERS; i++) {
|
||||||
|
@ -73,7 +73,7 @@ namespace render {
|
||||||
|
|
||||||
int _keepLayer { 0 };
|
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
|
// SliceItems job config defining the slice range
|
||||||
|
@ -107,7 +107,7 @@ namespace render {
|
||||||
_rangeLength = config.rangeLength;
|
_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
|
// Keep items belonging to the job selection
|
||||||
|
@ -118,7 +118,7 @@ namespace render {
|
||||||
std::string _name;
|
std::string _name;
|
||||||
SelectItems(const Selection::Name& name) : _name(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
|
// Same as SelectItems but reorder the output to match the selection order
|
||||||
|
@ -129,7 +129,7 @@ namespace render {
|
||||||
std::string _name;
|
std::string _name;
|
||||||
SelectSortItems(const Selection::Name& name) : _name(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
|
// From meta-Items, generate the sub-items
|
||||||
|
@ -139,7 +139,7 @@ namespace render {
|
||||||
|
|
||||||
MetaToSubItems() {}
|
MetaToSubItems() {}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems);
|
void run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemIDs& outItems);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
assert(renderContext->args->hasViewFrustum());
|
assert(renderContext->args->hasViewFrustum());
|
||||||
|
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
RenderArgs* args = renderContext->args;
|
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) {
|
void PipelineSortShapes::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ShapeBounds& outShapes) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = renderContext->_scene;
|
||||||
outShapes.clear();
|
outShapes.clear();
|
||||||
|
|
||||||
for (const auto& item : inItems) {
|
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.clear();
|
||||||
outShapes.reserve(inShapes.size());
|
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;
|
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) {
|
void DepthSortItems::run(const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||||
depthSortItems(sceneContext, renderContext, _frontToBack, inItems, outItems);
|
depthSortItems(renderContext, _frontToBack, inItems, outItems);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
#include "Engine.h"
|
#include "Engine.h"
|
||||||
|
|
||||||
namespace render {
|
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 {
|
class PipelineSortShapes {
|
||||||
public:
|
public:
|
||||||
using JobModel = Job::ModelIO<PipelineSortShapes, ItemBounds, ShapeBounds>;
|
using JobModel = Job::ModelIO<PipelineSortShapes, ItemBounds, ShapeBounds>;
|
||||||
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 {
|
class DepthSortShapes {
|
||||||
|
@ -30,7 +30,7 @@ namespace render {
|
||||||
bool _frontToBack;
|
bool _frontToBack;
|
||||||
DepthSortShapes(bool frontToBack = true) : _frontToBack(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 {
|
class DepthSortItems {
|
||||||
|
@ -40,7 +40,7 @@ namespace render {
|
||||||
bool _frontToBack;
|
bool _frontToBack;
|
||||||
DepthSortItems(bool frontToBack = true) : _frontToBack(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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -451,17 +451,17 @@ template<class T> void jobConfigure(T&, const JobConfig&) {
|
||||||
template<class T> void jobConfigure(T&, const TaskConfig&) {
|
template<class T> void jobConfigure(T&, const TaskConfig&) {
|
||||||
// nop, as the default TaskConfig was used, so the data does not need a configure method
|
// nop, as the default TaskConfig was used, so the data does not need a configure method
|
||||||
}
|
}
|
||||||
template <class T> void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const JobNoIO& input, JobNoIO& output) {
|
template <class T> void jobRun(T& data, const RenderContextPointer& renderContext, const JobNoIO& input, JobNoIO& output) {
|
||||||
data.run(sceneContext, renderContext);
|
data.run(renderContext);
|
||||||
}
|
}
|
||||||
template <class T, class I> void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const I& input, JobNoIO& output) {
|
template <class T, class I> void jobRun(T& data, const RenderContextPointer& renderContext, const I& input, JobNoIO& output) {
|
||||||
data.run(sceneContext, renderContext, input);
|
data.run(renderContext, input);
|
||||||
}
|
}
|
||||||
template <class T, class O> void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const JobNoIO& input, O& output) {
|
template <class T, class O> void jobRun(T& data, const RenderContextPointer& renderContext, const JobNoIO& input, O& output) {
|
||||||
data.run(sceneContext, renderContext, output);
|
data.run(renderContext, output);
|
||||||
}
|
}
|
||||||
template <class T, class I, class O> void jobRun(T& data, const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const I& input, O& output) {
|
template <class T, class I, class O> void jobRun(T& data, const RenderContextPointer& renderContext, const I& input, O& output) {
|
||||||
data.run(sceneContext, renderContext, input, output);
|
data.run(renderContext, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The guts of a job
|
// The guts of a job
|
||||||
|
@ -479,7 +479,7 @@ public:
|
||||||
virtual QConfigPointer& getConfiguration() { return _config; }
|
virtual QConfigPointer& getConfiguration() { return _config; }
|
||||||
virtual void applyConfiguration() = 0;
|
virtual void applyConfiguration() = 0;
|
||||||
|
|
||||||
virtual void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) = 0;
|
virtual void run(const RenderContextPointer& renderContext) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setCPURunTime(double mstime) { std::static_pointer_cast<Config>(_config)->setCPURunTime(mstime); }
|
void setCPURunTime(double mstime) { std::static_pointer_cast<Config>(_config)->setCPURunTime(mstime); }
|
||||||
|
@ -529,10 +529,10 @@ public:
|
||||||
jobConfigure(_data, *std::static_pointer_cast<C>(_config));
|
jobConfigure(_data, *std::static_pointer_cast<C>(_config));
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) override {
|
void run(const RenderContextPointer& renderContext) override {
|
||||||
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
renderContext->jobConfig = std::static_pointer_cast<Config>(_config);
|
||||||
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->isEnabled()) {
|
if (renderContext->jobConfig->alwaysEnabled || renderContext->jobConfig->isEnabled()) {
|
||||||
jobRun(_data, sceneContext, renderContext, _input.get<I>(), _output.edit<O>());
|
jobRun(_data, renderContext, _input.get<I>(), _output.edit<O>());
|
||||||
}
|
}
|
||||||
renderContext->jobConfig.reset();
|
renderContext->jobConfig.reset();
|
||||||
}
|
}
|
||||||
|
@ -554,12 +554,12 @@ public:
|
||||||
return concept->_data;
|
return concept->_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void run(const RenderContextPointer& renderContext) {
|
||||||
PerformanceTimer perfTimer(_name.c_str());
|
PerformanceTimer perfTimer(_name.c_str());
|
||||||
PROFILE_RANGE(render, _name.c_str());
|
PROFILE_RANGE(render, _name.c_str());
|
||||||
auto start = usecTimestampNow();
|
auto start = usecTimestampNow();
|
||||||
|
|
||||||
_concept->run(sceneContext, renderContext);
|
_concept->run(renderContext);
|
||||||
|
|
||||||
_concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0);
|
_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<C>(_config);
|
auto config = std::static_pointer_cast<C>(_config);
|
||||||
if (config->alwaysEnabled || config->enabled) {
|
if (config->alwaysEnabled || config->enabled) {
|
||||||
for (auto job : _jobs) {
|
for (auto job : _jobs) {
|
||||||
job.run(sceneContext, renderContext);
|
job.run(renderContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,17 +97,17 @@ void TestWindow::beginFrame() {
|
||||||
#ifdef DEFERRED_LIGHTING
|
#ifdef DEFERRED_LIGHTING
|
||||||
|
|
||||||
gpu::FramebufferPointer primaryFramebuffer;
|
gpu::FramebufferPointer primaryFramebuffer;
|
||||||
_preparePrimaryFramebuffer.run(_sceneContext, _renderContext, primaryFramebuffer);
|
_preparePrimaryFramebuffer.run(_renderContext, primaryFramebuffer);
|
||||||
|
|
||||||
DeferredFrameTransformPointer frameTransform;
|
DeferredFrameTransformPointer frameTransform;
|
||||||
_generateDeferredFrameTransform.run(_sceneContext, _renderContext, frameTransform);
|
_generateDeferredFrameTransform.run(_renderContext, frameTransform);
|
||||||
|
|
||||||
LightingModelPointer lightingModel;
|
LightingModelPointer lightingModel;
|
||||||
_generateLightingModel.run(_sceneContext, _renderContext, lightingModel);
|
_generateLightingModel.run(_renderContext, lightingModel);
|
||||||
|
|
||||||
_prepareDeferredInputs.edit0() = primaryFramebuffer;
|
_prepareDeferredInputs.edit0() = primaryFramebuffer;
|
||||||
_prepareDeferredInputs.edit1() = lightingModel;
|
_prepareDeferredInputs.edit1() = lightingModel;
|
||||||
_prepareDeferred.run(_sceneContext, _renderContext, _prepareDeferredInputs, _prepareDeferredOutputs);
|
_prepareDeferred.run(_renderContext, _prepareDeferredInputs, _prepareDeferredOutputs);
|
||||||
|
|
||||||
|
|
||||||
_renderDeferredInputs.edit0() = frameTransform; // Pass the deferredFrameTransform
|
_renderDeferredInputs.edit0() = frameTransform; // Pass the deferredFrameTransform
|
||||||
|
@ -144,7 +144,7 @@ void TestWindow::endFrame() {
|
||||||
batch.setResourceTexture(0, nullptr);
|
batch.setResourceTexture(0, nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
_renderDeferred.run(_sceneContext, _renderContext, _renderDeferredInputs);
|
_renderDeferred.run(_renderContext, _renderDeferredInputs);
|
||||||
|
|
||||||
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
|
gpu::doInBatch(_renderArgs->_context, [&](gpu::Batch& batch) {
|
||||||
PROFILE_RANGE_BATCH(batch, "blit");
|
PROFILE_RANGE_BATCH(batch, "blit");
|
||||||
|
|
|
@ -31,7 +31,6 @@ protected:
|
||||||
#ifdef DEFERRED_LIGHTING
|
#ifdef DEFERRED_LIGHTING
|
||||||
// Prepare the ShapePipelines
|
// Prepare the ShapePipelines
|
||||||
render::ShapePlumberPointer _shapePlumber { std::make_shared<render::ShapePlumber>() };
|
render::ShapePlumberPointer _shapePlumber { std::make_shared<render::ShapePlumber>() };
|
||||||
render::SceneContextPointer _sceneContext{ std::make_shared<render::SceneContext>() };
|
|
||||||
render::RenderContextPointer _renderContext{ std::make_shared<render::RenderContext>() };
|
render::RenderContextPointer _renderContext{ std::make_shared<render::RenderContext>() };
|
||||||
gpu::PipelinePointer _opaquePipeline;
|
gpu::PipelinePointer _opaquePipeline;
|
||||||
model::LightPointer _light { std::make_shared<model::Light>() };
|
model::LightPointer _light { std::make_shared<model::Light>() };
|
||||||
|
|
Loading…
Reference in a new issue