mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-19 19:49:07 +02:00
Add gpu timer to background
This commit is contained in:
parent
4017bea60f
commit
5ab21588f2
2 changed files with 21 additions and 1 deletions
|
@ -291,6 +291,7 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
||||||
RenderArgs* args = renderContext->args;
|
RenderArgs* args = renderContext->args;
|
||||||
doInBatch(args->_context, [&](gpu::Batch& batch) {
|
doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||||
args->_batch = &batch;
|
args->_batch = &batch;
|
||||||
|
_gpuTimer.begin(batch);
|
||||||
|
|
||||||
auto lightingFBO = DependencyManager::get<FramebufferCache>()->getLightingFramebuffer();
|
auto lightingFBO = DependencyManager::get<FramebufferCache>()->getLightingFramebuffer();
|
||||||
|
|
||||||
|
@ -310,8 +311,11 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
||||||
batch.setViewTransform(viewMat);
|
batch.setViewTransform(viewMat);
|
||||||
|
|
||||||
renderItems(sceneContext, renderContext, inItems);
|
renderItems(sceneContext, renderContext, inItems);
|
||||||
|
_gpuTimer.end(batch);
|
||||||
});
|
});
|
||||||
args->_batch = nullptr;
|
args->_batch = nullptr;
|
||||||
|
|
||||||
|
std::static_pointer_cast<Config>(renderContext->jobConfig)->gpuTime = _gpuTimer.getAverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Blit::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
void Blit::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||||
|
|
|
@ -82,11 +82,27 @@ protected:
|
||||||
static gpu::PipelinePointer _opaquePipeline; //lazy evaluation hence mutable
|
static gpu::PipelinePointer _opaquePipeline; //lazy evaluation hence mutable
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DrawBackgroundDeferredConfig : public render::Job::Config {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(double gpuTime READ getGpuTime)
|
||||||
|
public:
|
||||||
|
double getGpuTime() { return gpuTime; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class DrawBackgroundDeferred;
|
||||||
|
double gpuTime;
|
||||||
|
};
|
||||||
|
|
||||||
class DrawBackgroundDeferred {
|
class DrawBackgroundDeferred {
|
||||||
public:
|
public:
|
||||||
|
using Config = DrawBackgroundDeferredConfig;
|
||||||
|
using JobModel = render::Job::ModelI<DrawBackgroundDeferred, render::ItemBounds, Config>;
|
||||||
|
|
||||||
|
void configure(const Config& config) {}
|
||||||
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const render::ItemBounds& inItems);
|
void run(const render::SceneContextPointer& sceneContext, const render::RenderContextPointer& renderContext, const render::ItemBounds& inItems);
|
||||||
|
|
||||||
using JobModel = render::Job::ModelI<DrawBackgroundDeferred, render::ItemBounds>;
|
protected:
|
||||||
|
gpu::RangeTimer _gpuTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawOverlay3DConfig : public render::Job::Config {
|
class DrawOverlay3DConfig : public render::Job::Config {
|
||||||
|
|
Loading…
Reference in a new issue