mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 03:59:18 +02:00
Trying to improve the Job/Task classes and testing it with the ZoneRenderer
This commit is contained in:
parent
e6844f4294
commit
b65448bcbe
19 changed files with 143 additions and 103 deletions
|
@ -1880,9 +1880,9 @@ void Application::initializeGL() {
|
||||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||||
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
||||||
if (QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD)) {
|
if (QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD)) {
|
||||||
_renderEngine->addJob<RenderForwardTask>("Forward", items.get<RenderFetchCullSortTask::Output>());
|
_renderEngine->addJob<RenderForwardTask>("Forward", items);
|
||||||
} else {
|
} else {
|
||||||
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", items.get<RenderFetchCullSortTask::Output>());
|
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", items);
|
||||||
}
|
}
|
||||||
_renderEngine->load();
|
_renderEngine->load();
|
||||||
_renderEngine->registerScene(_main3DScene);
|
_renderEngine->registerScene(_main3DScene);
|
||||||
|
|
|
@ -368,7 +368,7 @@ bool EntityTreeRenderer::applyLayeredZones() {
|
||||||
qCWarning(entitiesrenderer) << "EntityTreeRenderer::applyLayeredZones(), Unexpected null scene, possibly during application shutdown";
|
qCWarning(entitiesrenderer) << "EntityTreeRenderer::applyLayeredZones(), Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,9 @@ using namespace render;
|
||||||
extern void initOverlay3DPipelines(render::ShapePlumber& plumber);
|
extern void initOverlay3DPipelines(render::ShapePlumber& plumber);
|
||||||
extern void initDeferredPipelines(render::ShapePlumber& plumber);
|
extern void initDeferredPipelines(render::ShapePlumber& plumber);
|
||||||
|
|
||||||
RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
|
void RenderDeferredTask::build(render::Task& task, const render::Varying& input, render::Varying& output) {
|
||||||
|
auto items = input.get<Input>();
|
||||||
|
|
||||||
// Prepare the ShapePipelines
|
// Prepare the ShapePipelines
|
||||||
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
||||||
initDeferredPipelines(*shapePlumber);
|
initDeferredPipelines(*shapePlumber);
|
||||||
|
@ -67,130 +69,130 @@ RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
|
||||||
|
|
||||||
// Filter the non antialiaased overlays
|
// Filter the non antialiaased overlays
|
||||||
const int LAYER_NO_AA = 3;
|
const int LAYER_NO_AA = 3;
|
||||||
const auto nonAAOverlays = addJob<FilterLayeredItems>("Filter2DWebOverlays", overlayOpaques, LAYER_NO_AA);
|
const auto nonAAOverlays = task.addJob<FilterLayeredItems>("Filter2DWebOverlays", overlayOpaques, LAYER_NO_AA);
|
||||||
|
|
||||||
// Prepare deferred, generate the shared Deferred Frame Transform
|
// Prepare deferred, generate the shared Deferred Frame Transform
|
||||||
const auto deferredFrameTransform = addJob<GenerateDeferredFrameTransform>("DeferredFrameTransform");
|
const auto deferredFrameTransform = task.addJob<GenerateDeferredFrameTransform>("DeferredFrameTransform");
|
||||||
const auto lightingModel = addJob<MakeLightingModel>("LightingModel");
|
const auto lightingModel = task.addJob<MakeLightingModel>("LightingModel");
|
||||||
|
|
||||||
|
|
||||||
// GPU jobs: Start preparing the primary, deferred and lighting buffer
|
// GPU jobs: Start preparing the primary, deferred and lighting buffer
|
||||||
const auto primaryFramebuffer = addJob<PreparePrimaryFramebuffer>("PreparePrimaryBuffer");
|
const auto primaryFramebuffer = task.addJob<PreparePrimaryFramebuffer>("PreparePrimaryBuffer");
|
||||||
|
|
||||||
const auto opaqueRangeTimer = addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques");
|
const auto opaqueRangeTimer = task.addJob<BeginGPURangeTimer>("BeginOpaqueRangeTimer", "DrawOpaques");
|
||||||
|
|
||||||
const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).hasVarying();
|
const auto prepareDeferredInputs = PrepareDeferred::Inputs(primaryFramebuffer, lightingModel).hasVarying();
|
||||||
const auto prepareDeferredOutputs = addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs);
|
const auto prepareDeferredOutputs = task.addJob<PrepareDeferred>("PrepareDeferred", prepareDeferredInputs);
|
||||||
const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0);
|
const auto deferredFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(0);
|
||||||
const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1);
|
const auto lightingFramebuffer = prepareDeferredOutputs.getN<PrepareDeferred::Outputs>(1);
|
||||||
|
|
||||||
// Render opaque objects in DeferredBuffer
|
// Render opaque objects in DeferredBuffer
|
||||||
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).hasVarying();
|
const auto opaqueInputs = DrawStateSortDeferred::Inputs(opaques, lightingModel).hasVarying();
|
||||||
addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber);
|
task.addJob<DrawStateSortDeferred>("DrawOpaqueDeferred", opaqueInputs, shapePlumber);
|
||||||
|
|
||||||
// Once opaque is all rendered create stencil background
|
// Once opaque is all rendered create stencil background
|
||||||
addJob<DrawStencilDeferred>("DrawOpaqueStencil", deferredFramebuffer);
|
task.addJob<DrawStencilDeferred>("DrawOpaqueStencil", deferredFramebuffer);
|
||||||
|
|
||||||
addJob<EndGPURangeTimer>("OpaqueRangeTimer", opaqueRangeTimer);
|
task.addJob<EndGPURangeTimer>("OpaqueRangeTimer", opaqueRangeTimer);
|
||||||
|
|
||||||
|
|
||||||
// Opaque all rendered
|
// Opaque all rendered
|
||||||
|
|
||||||
// Linear Depth Pass
|
// Linear Depth Pass
|
||||||
const auto linearDepthPassInputs = LinearDepthPass::Inputs(deferredFrameTransform, deferredFramebuffer).hasVarying();
|
const auto linearDepthPassInputs = LinearDepthPass::Inputs(deferredFrameTransform, deferredFramebuffer).hasVarying();
|
||||||
const auto linearDepthPassOutputs = addJob<LinearDepthPass>("LinearDepth", linearDepthPassInputs);
|
const auto linearDepthPassOutputs = task.addJob<LinearDepthPass>("LinearDepth", linearDepthPassInputs);
|
||||||
const auto linearDepthTarget = linearDepthPassOutputs.getN<LinearDepthPass::Outputs>(0);
|
const auto linearDepthTarget = linearDepthPassOutputs.getN<LinearDepthPass::Outputs>(0);
|
||||||
|
|
||||||
// Curvature pass
|
// Curvature pass
|
||||||
const auto surfaceGeometryPassInputs = SurfaceGeometryPass::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
const auto surfaceGeometryPassInputs = SurfaceGeometryPass::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
||||||
const auto surfaceGeometryPassOutputs = addJob<SurfaceGeometryPass>("SurfaceGeometry", surfaceGeometryPassInputs);
|
const auto surfaceGeometryPassOutputs = task.addJob<SurfaceGeometryPass>("SurfaceGeometry", surfaceGeometryPassInputs);
|
||||||
const auto surfaceGeometryFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(0);
|
const auto surfaceGeometryFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(0);
|
||||||
const auto curvatureFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(1);
|
const auto curvatureFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(1);
|
||||||
const auto midCurvatureNormalFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(2);
|
const auto midCurvatureNormalFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(2);
|
||||||
const auto lowCurvatureNormalFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(3);
|
const auto lowCurvatureNormalFramebuffer = surfaceGeometryPassOutputs.getN<SurfaceGeometryPass::Outputs>(3);
|
||||||
|
|
||||||
// Simply update the scattering resource
|
// Simply update the scattering resource
|
||||||
const auto scatteringResource = addJob<SubsurfaceScattering>("Scattering");
|
const auto scatteringResource = task.addJob<SubsurfaceScattering>("Scattering");
|
||||||
|
|
||||||
// AO job
|
// AO job
|
||||||
const auto ambientOcclusionInputs = AmbientOcclusionEffect::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
const auto ambientOcclusionInputs = AmbientOcclusionEffect::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget).hasVarying();
|
||||||
const auto ambientOcclusionOutputs = addJob<AmbientOcclusionEffect>("AmbientOcclusion", ambientOcclusionInputs);
|
const auto ambientOcclusionOutputs = task.addJob<AmbientOcclusionEffect>("AmbientOcclusion", ambientOcclusionInputs);
|
||||||
const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
const auto ambientOcclusionFramebuffer = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(0);
|
||||||
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
const auto ambientOcclusionUniforms = ambientOcclusionOutputs.getN<AmbientOcclusionEffect::Outputs>(1);
|
||||||
|
|
||||||
|
|
||||||
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
// Draw Lights just add the lights to the current list of lights to deal with. NOt really gpu job for now.
|
||||||
addJob<DrawLight>("DrawLight", lights);
|
task.addJob<DrawLight>("DrawLight", lights);
|
||||||
|
|
||||||
// Light Clustering
|
// Light Clustering
|
||||||
// Create the cluster grid of lights, cpu job for now
|
// Create the cluster grid of lights, cpu job for now
|
||||||
const auto lightClusteringPassInputs = LightClusteringPass::Inputs(deferredFrameTransform, lightingModel, linearDepthTarget).hasVarying();
|
const auto lightClusteringPassInputs = LightClusteringPass::Inputs(deferredFrameTransform, lightingModel, linearDepthTarget).hasVarying();
|
||||||
const auto lightClusters = addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
|
const auto lightClusters = task.addJob<LightClusteringPass>("LightClustering", lightClusteringPassInputs);
|
||||||
|
|
||||||
|
|
||||||
// DeferredBuffer is complete, now let's shade it into the LightingBuffer
|
// DeferredBuffer is complete, now let's shade it into the LightingBuffer
|
||||||
const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
const auto deferredLightingInputs = RenderDeferred::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
||||||
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource, lightClusters).hasVarying();
|
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource, lightClusters).hasVarying();
|
||||||
|
|
||||||
addJob<RenderDeferred>("RenderDeferred", deferredLightingInputs);
|
task.addJob<RenderDeferred>("RenderDeferred", deferredLightingInputs);
|
||||||
|
|
||||||
// Use Stencil and draw background in Lighting buffer to complete filling in the opaque
|
// Use Stencil and draw background in Lighting buffer to complete filling in the opaque
|
||||||
const auto backgroundInputs = DrawBackgroundDeferred::Inputs(background, lightingModel).hasVarying();
|
const auto backgroundInputs = DrawBackgroundDeferred::Inputs(background, lightingModel).hasVarying();
|
||||||
addJob<DrawBackgroundDeferred>("DrawBackgroundDeferred", backgroundInputs);
|
task.addJob<DrawBackgroundDeferred>("DrawBackgroundDeferred", backgroundInputs);
|
||||||
|
|
||||||
|
|
||||||
// Render transparent objects forward in LightingBuffer
|
// Render transparent objects forward in LightingBuffer
|
||||||
const auto transparentsInputs = DrawDeferred::Inputs(transparents, lightingModel).hasVarying();
|
const auto transparentsInputs = DrawDeferred::Inputs(transparents, lightingModel).hasVarying();
|
||||||
addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
|
task.addJob<DrawDeferred>("DrawTransparentDeferred", transparentsInputs, shapePlumber);
|
||||||
|
|
||||||
// LIght Cluster Grid Debuging job
|
// LIght Cluster Grid Debuging job
|
||||||
{
|
{
|
||||||
const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, linearDepthTarget, lightClusters).hasVarying();
|
const auto debugLightClustersInputs = DebugLightClusters::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel, linearDepthTarget, lightClusters).hasVarying();
|
||||||
addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
|
task.addJob<DebugLightClusters>("DebugLightClusters", debugLightClustersInputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto toneAndPostRangeTimer = addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
const auto toneAndPostRangeTimer = task.addJob<BeginGPURangeTimer>("BeginToneAndPostRangeTimer", "PostToneOverlaysAntialiasing");
|
||||||
|
|
||||||
// Lighting Buffer ready for tone mapping
|
// Lighting Buffer ready for tone mapping
|
||||||
const auto toneMappingInputs = render::Varying(ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer));
|
const auto toneMappingInputs = render::Varying(ToneMappingDeferred::Inputs(lightingFramebuffer, primaryFramebuffer));
|
||||||
addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
task.addJob<ToneMappingDeferred>("ToneMapping", toneMappingInputs);
|
||||||
|
|
||||||
{ // DEbug the bounds of the rendered items, still look at the zbuffer
|
{ // DEbug the bounds of the rendered items, still look at the zbuffer
|
||||||
addJob<DrawBounds>("DrawMetaBounds", metas);
|
task.addJob<DrawBounds>("DrawMetaBounds", metas);
|
||||||
addJob<DrawBounds>("DrawOpaqueBounds", opaques);
|
task.addJob<DrawBounds>("DrawOpaqueBounds", opaques);
|
||||||
addJob<DrawBounds>("DrawTransparentBounds", transparents);
|
task.addJob<DrawBounds>("DrawTransparentBounds", transparents);
|
||||||
|
|
||||||
|
task.addJob<ZoneRendererTask>("ZoneRenderer", opaques);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overlays
|
// Overlays
|
||||||
const auto overlayOpaquesInputs = DrawOverlay3D::Inputs(overlayOpaques, lightingModel).hasVarying();
|
const auto overlayOpaquesInputs = DrawOverlay3D::Inputs(overlayOpaques, lightingModel).hasVarying();
|
||||||
const auto overlayTransparentsInputs = DrawOverlay3D::Inputs(overlayTransparents, lightingModel).hasVarying();
|
const auto overlayTransparentsInputs = DrawOverlay3D::Inputs(overlayTransparents, lightingModel).hasVarying();
|
||||||
addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
task.addJob<DrawOverlay3D>("DrawOverlay3DOpaque", overlayOpaquesInputs, true);
|
||||||
addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
task.addJob<DrawOverlay3D>("DrawOverlay3DTransparent", overlayTransparentsInputs, false);
|
||||||
|
|
||||||
{ // DEbug the bounds of the rendered OVERLAY items, still look at the zbuffer
|
{ // DEbug the bounds of the rendered OVERLAY items, still look at the zbuffer
|
||||||
addJob<DrawBounds>("DrawOverlayOpaqueBounds", overlayOpaques);
|
task.addJob<DrawBounds>("DrawOverlayOpaqueBounds", overlayOpaques);
|
||||||
addJob<DrawBounds>("DrawOverlayTransparentBounds", overlayTransparents);
|
task.addJob<DrawBounds>("DrawOverlayTransparentBounds", overlayTransparents);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debugging stages
|
// Debugging stages
|
||||||
{
|
{
|
||||||
// Debugging Deferred buffer job
|
// Debugging Deferred buffer job
|
||||||
const auto debugFramebuffers = render::Varying(DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer));
|
const auto debugFramebuffers = render::Varying(DebugDeferredBuffer::Inputs(deferredFramebuffer, linearDepthTarget, surfaceGeometryFramebuffer, ambientOcclusionFramebuffer));
|
||||||
addJob<DebugDeferredBuffer>("DebugDeferredBuffer", debugFramebuffers);
|
task.addJob<DebugDeferredBuffer>("DebugDeferredBuffer", debugFramebuffers);
|
||||||
|
|
||||||
const auto debugSubsurfaceScatteringInputs = DebugSubsurfaceScattering::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
const auto debugSubsurfaceScatteringInputs = DebugSubsurfaceScattering::Inputs(deferredFrameTransform, deferredFramebuffer, lightingModel,
|
||||||
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource).hasVarying();
|
surfaceGeometryFramebuffer, ambientOcclusionFramebuffer, scatteringResource).hasVarying();
|
||||||
addJob<DebugSubsurfaceScattering>("DebugScattering", debugSubsurfaceScatteringInputs);
|
task.addJob<DebugSubsurfaceScattering>("DebugScattering", debugSubsurfaceScatteringInputs);
|
||||||
|
|
||||||
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).hasVarying();
|
const auto debugAmbientOcclusionInputs = DebugAmbientOcclusion::Inputs(deferredFrameTransform, deferredFramebuffer, linearDepthTarget, ambientOcclusionUniforms).hasVarying();
|
||||||
addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
task.addJob<DebugAmbientOcclusion>("DebugAmbientOcclusion", debugAmbientOcclusionInputs);
|
||||||
|
|
||||||
addJob<ZoneRendererTask>("ZoneRenderer", opaques);
|
|
||||||
|
|
||||||
// Scene Octree Debugging job
|
// Scene Octree Debugging job
|
||||||
{
|
{
|
||||||
addJob<DrawSceneOctree>("DrawSceneOctree", spatialSelection);
|
task.addJob<DrawSceneOctree>("DrawSceneOctree", spatialSelection);
|
||||||
addJob<DrawItemSelection>("DrawItemSelection", spatialSelection);
|
task.addJob<DrawItemSelection>("DrawItemSelection", spatialSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Status icon rendering job
|
// Status icon rendering job
|
||||||
|
@ -198,22 +200,22 @@ RenderDeferredTask::RenderDeferredTask(RenderFetchCullSortTask::Output items) {
|
||||||
// Grab a texture map representing the different status icons and assign that to the drawStatsuJob
|
// Grab a texture map representing the different status icons and assign that to the drawStatsuJob
|
||||||
auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg";
|
auto iconMapPath = PathUtils::resourcesPath() + "icons/statusIconAtlas.svg";
|
||||||
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath, NetworkTexture::STRICT_TEXTURE);
|
auto statusIconMap = DependencyManager::get<TextureCache>()->getImageTexture(iconMapPath, NetworkTexture::STRICT_TEXTURE);
|
||||||
addJob<DrawStatus>("DrawStatus", opaques, DrawStatus(statusIconMap));
|
task.addJob<DrawStatus>("DrawStatus", opaques, DrawStatus(statusIconMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// AA job to be revisited
|
// AA job to be revisited
|
||||||
addJob<Antialiasing>("Antialiasing", primaryFramebuffer);
|
task.addJob<Antialiasing>("Antialiasing", primaryFramebuffer);
|
||||||
|
|
||||||
// Draw 2DWeb non AA
|
// Draw 2DWeb non AA
|
||||||
const auto nonAAOverlaysInputs = DrawOverlay3D::Inputs(nonAAOverlays, lightingModel).hasVarying();
|
const auto nonAAOverlaysInputs = DrawOverlay3D::Inputs(nonAAOverlays, lightingModel).hasVarying();
|
||||||
addJob<DrawOverlay3D>("Draw2DWebSurfaces", nonAAOverlaysInputs, false);
|
task.addJob<DrawOverlay3D>("Draw2DWebSurfaces", nonAAOverlaysInputs, false);
|
||||||
|
|
||||||
addJob<EndGPURangeTimer>("ToneAndPostRangeTimer", toneAndPostRangeTimer);
|
task.addJob<EndGPURangeTimer>("ToneAndPostRangeTimer", toneAndPostRangeTimer);
|
||||||
|
|
||||||
// Blit!
|
// Blit!
|
||||||
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::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, gpu::RangeTimerPointer& timer) {
|
||||||
|
|
|
@ -194,9 +194,12 @@ public:
|
||||||
|
|
||||||
class RenderDeferredTask : public render::Task {
|
class RenderDeferredTask : public render::Task {
|
||||||
public:
|
public:
|
||||||
using JobModel = Model<RenderDeferredTask>;
|
using Input = RenderFetchCullSortTask::Output;
|
||||||
|
using JobModel = render::Task::ModelI<RenderDeferredTask, Input>;
|
||||||
|
|
||||||
RenderDeferredTask(RenderFetchCullSortTask::Output items);
|
RenderDeferredTask() {}
|
||||||
|
|
||||||
|
void build(render::Task& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderDeferredTask_h
|
#endif // hifi_RenderDeferredTask_h
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
using namespace render;
|
using namespace render;
|
||||||
extern void initForwardPipelines(ShapePlumber& plumber);
|
extern void initForwardPipelines(ShapePlumber& plumber);
|
||||||
|
|
||||||
RenderForwardTask::RenderForwardTask(RenderFetchCullSortTask::Output items) {
|
void RenderForwardTask::build(render::Task& task, const render::Varying& input, render::Varying& output) {
|
||||||
|
auto items = input.get<Input>();
|
||||||
|
|
||||||
// Prepare the ShapePipelines
|
// Prepare the ShapePipelines
|
||||||
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
ShapePlumberPointer shapePlumber = std::make_shared<ShapePlumber>();
|
||||||
initForwardPipelines(*shapePlumber);
|
initForwardPipelines(*shapePlumber);
|
||||||
|
@ -44,17 +46,17 @@ RenderForwardTask::RenderForwardTask(RenderFetchCullSortTask::Output items) {
|
||||||
const auto background = items[RenderFetchCullSortTask::BACKGROUND];
|
const auto background = items[RenderFetchCullSortTask::BACKGROUND];
|
||||||
const auto spatialSelection = items[RenderFetchCullSortTask::SPATIAL_SELECTION];
|
const auto spatialSelection = items[RenderFetchCullSortTask::SPATIAL_SELECTION];
|
||||||
|
|
||||||
const auto framebuffer = addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
const auto framebuffer = task.addJob<PrepareFramebuffer>("PrepareFramebuffer");
|
||||||
|
|
||||||
addJob<Draw>("DrawOpaques", opaques, shapePlumber);
|
task.addJob<Draw>("DrawOpaques", opaques, shapePlumber);
|
||||||
addJob<Stencil>("Stencil");
|
task.addJob<Stencil>("Stencil");
|
||||||
addJob<DrawBackground>("DrawBackground", background);
|
task.addJob<DrawBackground>("DrawBackground", background);
|
||||||
|
|
||||||
// Bounds do not draw on stencil buffer, so they must come last
|
// Bounds do not draw on stencil buffer, so they must come last
|
||||||
addJob<DrawBounds>("DrawBounds", opaques);
|
task.addJob<DrawBounds>("DrawBounds", opaques);
|
||||||
|
|
||||||
// Blit!
|
// Blit!
|
||||||
addJob<Blit>("Blit", framebuffer);
|
task.addJob<Blit>("Blit", framebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
void PrepareFramebuffer::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext,
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
|
|
||||||
class RenderForwardTask : public render::Task {
|
class RenderForwardTask : public render::Task {
|
||||||
public:
|
public:
|
||||||
using JobModel = Model<RenderForwardTask>;
|
using Input = RenderFetchCullSortTask::Output;
|
||||||
|
using JobModel = render::Task::ModelI<RenderForwardTask, Input>;
|
||||||
|
|
||||||
RenderForwardTask(RenderFetchCullSortTask::Output items);
|
RenderForwardTask() {}
|
||||||
|
|
||||||
|
void build(render::Task& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PrepareFramebuffer {
|
class PrepareFramebuffer {
|
||||||
|
|
|
@ -90,7 +90,7 @@ void RenderShadowMap::run(const render::SceneContextPointer& sceneContext, const
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) {
|
void RenderShadowTask::build(render::Task& task, const render::Varying& input, render::Varying& output, CullFunctor cullFunctor) {
|
||||||
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
||||||
|
|
||||||
// Prepare the ShapePipeline
|
// Prepare the ShapePipeline
|
||||||
|
@ -115,22 +115,22 @@ RenderShadowTask::RenderShadowTask(CullFunctor cullFunctor) {
|
||||||
skinProgram, state);
|
skinProgram, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto cachedMode = addJob<RenderShadowSetup>("Setup");
|
const auto cachedMode = task.addJob<RenderShadowSetup>("Setup");
|
||||||
|
|
||||||
// CPU jobs:
|
// CPU jobs:
|
||||||
// Fetch and cull the items from the scene
|
// Fetch and cull the items from the scene
|
||||||
auto shadowFilter = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered();
|
auto shadowFilter = ItemFilter::Builder::visibleWorldItems().withTypeShape().withOpaque().withoutLayered();
|
||||||
const auto shadowSelection = addJob<FetchSpatialTree>("FetchShadowSelection", shadowFilter);
|
const auto shadowSelection = task.addJob<FetchSpatialTree>("FetchShadowSelection", shadowFilter);
|
||||||
const auto culledShadowSelection = addJob<CullSpatialSelection>("CullShadowSelection", shadowSelection, cullFunctor, RenderDetails::SHADOW, shadowFilter);
|
const auto culledShadowSelection = task.addJob<CullSpatialSelection>("CullShadowSelection", shadowSelection, cullFunctor, RenderDetails::SHADOW, shadowFilter);
|
||||||
|
|
||||||
// Sort
|
// Sort
|
||||||
const auto sortedPipelines = addJob<PipelineSortShapes>("PipelineSortShadowSort", culledShadowSelection);
|
const auto sortedPipelines = task.addJob<PipelineSortShapes>("PipelineSortShadowSort", culledShadowSelection);
|
||||||
const auto sortedShapes = addJob<DepthSortShapes>("DepthSortShadowMap", sortedPipelines);
|
const auto sortedShapes = task.addJob<DepthSortShapes>("DepthSortShadowMap", sortedPipelines);
|
||||||
|
|
||||||
// GPU jobs: Render to shadow map
|
// GPU jobs: Render to shadow map
|
||||||
addJob<RenderShadowMap>("RenderShadowMap", sortedShapes, shapePlumber);
|
task.addJob<RenderShadowMap>("RenderShadowMap", sortedShapes, shapePlumber);
|
||||||
|
|
||||||
addJob<RenderShadowTeardown>("Teardown", cachedMode);
|
task.addJob<RenderShadowTeardown>("Teardown", cachedMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderShadowTask::configure(const Config& configuration) {
|
void RenderShadowTask::configure(const Config& configuration) {
|
||||||
|
|
|
@ -44,9 +44,10 @@ signals:
|
||||||
class RenderShadowTask : public render::Task {
|
class RenderShadowTask : public render::Task {
|
||||||
public:
|
public:
|
||||||
using Config = RenderShadowTaskConfig;
|
using Config = RenderShadowTaskConfig;
|
||||||
using JobModel = Model<RenderShadowTask, Config>;
|
using JobModel = render::Task::Model<RenderShadowTask, Config>;
|
||||||
|
|
||||||
RenderShadowTask(render::CullFunctor shouldRender);
|
RenderShadowTask() {}
|
||||||
|
void build(render::Task& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor shouldRender);
|
||||||
|
|
||||||
void configure(const Config& configuration);
|
void configure(const Config& configuration);
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,13 +17,11 @@ using namespace render;
|
||||||
|
|
||||||
const Selection::Name ZoneRendererTask::ZONES_SELECTION { "RankedZones" };
|
const Selection::Name ZoneRendererTask::ZONES_SELECTION { "RankedZones" };
|
||||||
|
|
||||||
ZoneRendererTask::ZoneRendererTask(const Inputs& inputs) {
|
void ZoneRendererTask::build(render::Task& task, const Varying& input, Varying& ouput) {
|
||||||
|
|
||||||
const auto zoneItems = addJob<SelectItems>("FilterZones", inputs, ZONES_SELECTION);
|
const auto zoneItems = task.addJob<render::SelectItems>("FilterZones", input, ZONES_SELECTION.c_str());
|
||||||
|
|
||||||
// just draw them...
|
// just draw them...
|
||||||
addJob<DrawBounds>("DrawZones", zoneItems);
|
task.addJob<DrawBounds>("DrawZones", zoneItems);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "render/Engine.h"
|
#include "render/Engine.h"
|
||||||
|
|
||||||
class ZoneRendererConfig : public render::Job::Config {
|
class ZoneRendererConfig : public render::Task::Config {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int maxDrawn MEMBER maxDrawn NOTIFY dirty)
|
Q_PROPERTY(int maxDrawn MEMBER maxDrawn NOTIFY dirty)
|
||||||
public:
|
public:
|
||||||
|
@ -37,7 +37,9 @@ public:
|
||||||
using Config = ZoneRendererConfig;
|
using Config = ZoneRendererConfig;
|
||||||
using JobModel = Model<ZoneRendererTask, Config>;
|
using JobModel = Model<ZoneRendererTask, Config>;
|
||||||
|
|
||||||
ZoneRendererTask(const Inputs& inputs);
|
ZoneRendererTask() {}
|
||||||
|
|
||||||
|
void build(render::Task& task, const render::Varying& inputs, render::Varying& outputs);
|
||||||
|
|
||||||
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
void configure(const Config& config) { _maxDrawn = config.maxDrawn; }
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,9 @@ using namespace render;
|
||||||
Engine::Engine() :
|
Engine::Engine() :
|
||||||
_sceneContext(std::make_shared<SceneContext>()),
|
_sceneContext(std::make_shared<SceneContext>()),
|
||||||
_renderContext(std::make_shared<RenderContext>()) {
|
_renderContext(std::make_shared<RenderContext>()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void Engine::build() {
|
||||||
addJob<EngineStats>("Stats");
|
addJob<EngineStats>("Stats");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace render {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Engine();
|
Engine();
|
||||||
|
void build();
|
||||||
~Engine() = default;
|
~Engine() = default;
|
||||||
|
|
||||||
// Load any persisted settings, and set up the presets
|
// Load any persisted settings, and set up the presets
|
||||||
|
|
|
@ -57,6 +57,7 @@ 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 SceneContextPointer& sceneContext, const RenderContextPointer& renderContext, const ItemBounds& inItems, ItemBounds& outItems) {
|
||||||
auto& scene = sceneContext->_scene;
|
auto& scene = sceneContext->_scene;
|
||||||
|
|
||||||
|
outItems.clear();
|
||||||
auto selection = scene->getSelection(_name);
|
auto selection = scene->getSelection(_name);
|
||||||
const auto& selectedItems = selection.getItems();
|
const auto& selectedItems = selection.getItems();
|
||||||
if (!selectedItems.empty()) {
|
if (!selectedItems.empty()) {
|
||||||
|
|
|
@ -17,17 +17,17 @@
|
||||||
|
|
||||||
using namespace render;
|
using namespace render;
|
||||||
|
|
||||||
RenderFetchCullSortTask::RenderFetchCullSortTask(CullFunctor cullFunctor) {
|
void RenderFetchCullSortTask::build(Task& task, const Varying& input, Varying& output, CullFunctor cullFunctor) {
|
||||||
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
cullFunctor = cullFunctor ? cullFunctor : [](const RenderArgs*, const AABox&){ return true; };
|
||||||
|
|
||||||
// CPU jobs:
|
// CPU jobs:
|
||||||
// Fetch and cull the items from the scene
|
// Fetch and cull the items from the scene
|
||||||
auto spatialFilter = ItemFilter::Builder::visibleWorldItems().withoutLayered();
|
auto spatialFilter = ItemFilter::Builder::visibleWorldItems().withoutLayered();
|
||||||
const auto spatialSelection = addJob<FetchSpatialTree>("FetchSceneSelection", spatialFilter);
|
const auto spatialSelection = task.addJob<FetchSpatialTree>("FetchSceneSelection", spatialFilter);
|
||||||
const auto culledSpatialSelection = addJob<CullSpatialSelection>("CullSceneSelection", spatialSelection, cullFunctor, RenderDetails::ITEM, spatialFilter);
|
const auto culledSpatialSelection = task.addJob<CullSpatialSelection>("CullSceneSelection", spatialSelection, cullFunctor, RenderDetails::ITEM, spatialFilter);
|
||||||
|
|
||||||
// Overlays are not culled
|
// Overlays are not culled
|
||||||
const auto nonspatialSelection = addJob<FetchNonspatialItems>("FetchOverlaySelection");
|
const auto nonspatialSelection = task.addJob<FetchNonspatialItems>("FetchOverlaySelection");
|
||||||
|
|
||||||
// Multi filter visible items into different buckets
|
// Multi filter visible items into different buckets
|
||||||
const int NUM_SPATIAL_FILTERS = 4;
|
const int NUM_SPATIAL_FILTERS = 4;
|
||||||
|
@ -49,22 +49,22 @@ RenderFetchCullSortTask::RenderFetchCullSortTask(CullFunctor cullFunctor) {
|
||||||
ItemFilter::Builder::background()
|
ItemFilter::Builder::background()
|
||||||
} };
|
} };
|
||||||
const auto filteredSpatialBuckets =
|
const auto filteredSpatialBuckets =
|
||||||
addJob<MultiFilterItems<NUM_SPATIAL_FILTERS>>("FilterSceneSelection", culledSpatialSelection, spatialFilters)
|
task.addJob<MultiFilterItems<NUM_SPATIAL_FILTERS>>("FilterSceneSelection", culledSpatialSelection, spatialFilters)
|
||||||
.get<MultiFilterItems<NUM_SPATIAL_FILTERS>::ItemBoundsArray>();
|
.get<MultiFilterItems<NUM_SPATIAL_FILTERS>::ItemBoundsArray>();
|
||||||
const auto filteredNonspatialBuckets =
|
const auto filteredNonspatialBuckets =
|
||||||
addJob<MultiFilterItems<NUM_NON_SPATIAL_FILTERS>>("FilterOverlaySelection", nonspatialSelection, nonspatialFilters)
|
task.addJob<MultiFilterItems<NUM_NON_SPATIAL_FILTERS>>("FilterOverlaySelection", nonspatialSelection, nonspatialFilters)
|
||||||
.get<MultiFilterItems<NUM_NON_SPATIAL_FILTERS>::ItemBoundsArray>();
|
.get<MultiFilterItems<NUM_NON_SPATIAL_FILTERS>::ItemBoundsArray>();
|
||||||
|
|
||||||
// Extract opaques / transparents / lights / overlays
|
// Extract opaques / transparents / lights / overlays
|
||||||
const auto opaques = addJob<DepthSortItems>("DepthSortOpaque", filteredSpatialBuckets[OPAQUE_SHAPE_BUCKET]);
|
const auto opaques = task.addJob<DepthSortItems>("DepthSortOpaque", filteredSpatialBuckets[OPAQUE_SHAPE_BUCKET]);
|
||||||
const auto transparents = addJob<DepthSortItems>("DepthSortTransparent", filteredSpatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
const auto transparents = task.addJob<DepthSortItems>("DepthSortTransparent", filteredSpatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
||||||
const auto lights = filteredSpatialBuckets[LIGHT_BUCKET];
|
const auto lights = filteredSpatialBuckets[LIGHT_BUCKET];
|
||||||
const auto metas = filteredSpatialBuckets[META_BUCKET];
|
const auto metas = filteredSpatialBuckets[META_BUCKET];
|
||||||
|
|
||||||
const auto overlayOpaques = addJob<DepthSortItems>("DepthSortOverlayOpaque", filteredNonspatialBuckets[OPAQUE_SHAPE_BUCKET]);
|
const auto overlayOpaques = task.addJob<DepthSortItems>("DepthSortOverlayOpaque", filteredNonspatialBuckets[OPAQUE_SHAPE_BUCKET]);
|
||||||
const auto overlayTransparents = addJob<DepthSortItems>("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
const auto overlayTransparents = task.addJob<DepthSortItems>("DepthSortOverlayTransparent", filteredNonspatialBuckets[TRANSPARENT_SHAPE_BUCKET], DepthSortItems(false));
|
||||||
const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET];
|
const auto background = filteredNonspatialBuckets[BACKGROUND_BUCKET];
|
||||||
|
|
||||||
setOutput(Output{{
|
output = Varying(Output{{
|
||||||
opaques, transparents, lights, metas, overlayOpaques, overlayTransparents, background, spatialSelection }});
|
opaques, transparents, lights, metas, overlayOpaques, overlayTransparents, background, spatialSelection }});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
using Output = std::array<render::Varying, Buckets::NUM_BUCKETS>;
|
using Output = std::array<render::Varying, Buckets::NUM_BUCKETS>;
|
||||||
using JobModel = ModelO<RenderFetchCullSortTask>;
|
using JobModel = render::Task::ModelO<RenderFetchCullSortTask, Output>;
|
||||||
|
|
||||||
RenderFetchCullSortTask(render::CullFunctor cullFunctor);
|
RenderFetchCullSortTask() {}
|
||||||
|
|
||||||
|
void build(render::Task& task, const render::Varying& inputs, render::Varying& outputs, render::CullFunctor cullFunctor);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_RenderFetchCullSortTask_h
|
#endif // hifi_RenderFetchCullSortTask_h
|
||||||
|
|
|
@ -542,7 +542,10 @@ public:
|
||||||
|
|
||||||
template <class... A>
|
template <class... A>
|
||||||
Model(const Varying& input, A&&... args) :
|
Model(const Varying& input, A&&... args) :
|
||||||
Concept(std::make_shared<C>()), _data(Data(std::forward<A>(args)...)), _input(input), _output(Output()) {
|
Concept(std::make_shared<C>()),
|
||||||
|
_data(Data(std::forward<A>(args)...)),
|
||||||
|
_input(input),
|
||||||
|
_output(Output()) {
|
||||||
applyConfiguration();
|
applyConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,31 +588,47 @@ public:
|
||||||
_concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0);
|
_concept->setCPURunTime((double)(usecTimestampNow() - start) / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ConceptPointer _concept;
|
ConceptPointer _concept;
|
||||||
std::string _name = "";
|
std::string _name = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <class T, class... A> void jobBuild(T& data, const Varying& input, Varying& output, A&&... args) {
|
||||||
|
data.build(*(dynamic_cast<Task*>(&data)), input, output, std::forward<A>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
// A task is a specialized job to run a collection of other jobs
|
// A task is a specialized job to run a collection of other jobs
|
||||||
// It is defined with JobModel = Task::Model<T>
|
// It is defined with JobModel = Task::Model<T>
|
||||||
class Task {
|
class Task {
|
||||||
public:
|
public:
|
||||||
using Config = TaskConfig;
|
using Config = TaskConfig;
|
||||||
using QConfigPointer = Job::QConfigPointer;
|
using QConfigPointer = Job::QConfigPointer;
|
||||||
|
using None = Job::None;
|
||||||
|
using Concept = Job::Concept;
|
||||||
|
using Jobs = std::vector<Job>;
|
||||||
|
|
||||||
template <class T, class C = Config> class Model : public Job::Concept {
|
template <class T, class C = Config, class I = None, class O = None> class Model : public Concept {
|
||||||
public:
|
public:
|
||||||
using Data = T;
|
using Data = T;
|
||||||
using Config = C;
|
using Input = I;
|
||||||
using Input = Job::None;
|
using Output = O;
|
||||||
|
|
||||||
Data _data;
|
Data _data;
|
||||||
|
Varying _input;
|
||||||
|
Varying _output;
|
||||||
|
|
||||||
const Varying getOutput() const override { return _data._output; }
|
const Varying getInput() const override { return _input; }
|
||||||
|
const Varying getOutput() const override { return _output; }
|
||||||
|
|
||||||
template <class... A>
|
template <class... A>
|
||||||
Model(const Varying& input, A&&... args) :
|
Model(const Varying& input, A&&... args) :
|
||||||
Concept(nullptr), _data(Data(std::forward<A>(args)...)) {
|
Concept(nullptr),
|
||||||
|
_data(Data()),
|
||||||
|
_input(input) {
|
||||||
|
|
||||||
|
jobBuild(_data, _input, _output, std::forward<A>(args)...);
|
||||||
|
|
||||||
// Recreate the Config to use the templated type
|
// Recreate the Config to use the templated type
|
||||||
_data.template createConfiguration<C>();
|
_data.template createConfiguration<C>();
|
||||||
_config = _data.getConfiguration();
|
_config = _data.getConfiguration();
|
||||||
|
@ -621,7 +640,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) override {
|
void run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) override {
|
||||||
auto config = std::static_pointer_cast<Config>(_config);
|
auto config = std::static_pointer_cast<C>(_config);
|
||||||
if (config->alwaysEnabled || config->enabled) {
|
if (config->alwaysEnabled || config->enabled) {
|
||||||
for (auto job : _data._jobs) {
|
for (auto job : _data._jobs) {
|
||||||
job.run(sceneContext, renderContext);
|
job.run(sceneContext, renderContext);
|
||||||
|
@ -629,9 +648,9 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template <class T, class C = Config> using ModelO = Model<T, C>;
|
template <class T, class I, class C = Config> using ModelI = Model<T, C, I, None>;
|
||||||
|
template <class T, class O, class C = Config> using ModelO = Model<T, C, None, O>;
|
||||||
using Jobs = std::vector<Job>;
|
template <class T, class I, class O, class C = Config> using ModelIO = Model<T, C, I, O>;
|
||||||
|
|
||||||
// Create a new job in the container's queue; returns the job's output
|
// Create a new job in the container's queue; returns the job's output
|
||||||
template <class T, class... A> const Varying addJob(std::string name, const Varying& input, A&&... args) {
|
template <class T, class... A> const Varying addJob(std::string name, const Varying& input, A&&... args) {
|
||||||
|
@ -656,7 +675,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class O> void setOutput(O&& output) {
|
template <class O> void setOutput(O&& output) {
|
||||||
_output = Varying(output);
|
_concept->_output = Varying(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class C> void createConfiguration() {
|
template <class C> void createConfiguration() {
|
||||||
|
@ -688,7 +707,6 @@ public:
|
||||||
void configure(const QObject& configuration) {
|
void configure(const QObject& configuration) {
|
||||||
for (auto& job : _jobs) {
|
for (auto& job : _jobs) {
|
||||||
job.applyConfiguration();
|
job.applyConfiguration();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,12 +716,11 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <class T, class C> friend class Model;
|
|
||||||
|
|
||||||
QConfigPointer _config;
|
QConfigPointer _config;
|
||||||
Jobs _jobs;
|
Jobs _jobs;
|
||||||
Varying _output;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ var qml = Script.resolvePath('deferredLighting.qml');
|
||||||
var window = new OverlayWindow({
|
var window = new OverlayWindow({
|
||||||
title: 'Lighting',
|
title: 'Lighting',
|
||||||
source: qml,
|
source: qml,
|
||||||
width: 400, height:280,
|
width: 400, height:350,
|
||||||
});
|
});
|
||||||
window.setPosition(Window.innerWidth - 420, 50);
|
window.setPosition(Window.innerWidth - 420, 50);
|
||||||
window.closed.connect(function() { Script.stop(); });
|
window.closed.connect(function() { Script.stop(); });
|
||||||
|
|
|
@ -189,6 +189,11 @@ Column {
|
||||||
checked: Render.getConfig("DrawOverlayTransparentBounds")["enabled"]
|
checked: Render.getConfig("DrawOverlayTransparentBounds")["enabled"]
|
||||||
onCheckedChanged: { Render.getConfig("DrawOverlayTransparentBounds")["enabled"] = checked }
|
onCheckedChanged: { Render.getConfig("DrawOverlayTransparentBounds")["enabled"] = checked }
|
||||||
}
|
}
|
||||||
|
CheckBox {
|
||||||
|
text: "Zones"
|
||||||
|
checked: Render.getConfig("DrawZones")["enabled"]
|
||||||
|
onCheckedChanged: { Render.getConfig("DrawZones")["enabled"] = checked }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -543,9 +543,9 @@ public:
|
||||||
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
assert(items.canCast<RenderFetchCullSortTask::Output>());
|
||||||
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
static const QString RENDER_FORWARD = "HIFI_RENDER_FORWARD";
|
||||||
if (QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD)) {
|
if (QProcessEnvironment::systemEnvironment().contains(RENDER_FORWARD)) {
|
||||||
_renderEngine->addJob<RenderForwardTask>("RenderForwardTask", items.get<RenderFetchCullSortTask::Output>());
|
_renderEngine->addJob<RenderForwardTask>("RenderForwardTask", items);
|
||||||
} else {
|
} else {
|
||||||
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", items.get<RenderFetchCullSortTask::Output>());
|
_renderEngine->addJob<RenderDeferredTask>("RenderDeferredTask", items);
|
||||||
}
|
}
|
||||||
_renderEngine->load();
|
_renderEngine->load();
|
||||||
_renderEngine->registerScene(_main3DScene);
|
_renderEngine->registerScene(_main3DScene);
|
||||||
|
|
Loading…
Reference in a new issue