mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +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;
|
||||
doInBatch(args->_context, [&](gpu::Batch& batch) {
|
||||
args->_batch = &batch;
|
||||
_gpuTimer.begin(batch);
|
||||
|
||||
auto lightingFBO = DependencyManager::get<FramebufferCache>()->getLightingFramebuffer();
|
||||
|
||||
|
@ -310,8 +311,11 @@ void DrawBackgroundDeferred::run(const SceneContextPointer& sceneContext, const
|
|||
batch.setViewTransform(viewMat);
|
||||
|
||||
renderItems(sceneContext, renderContext, inItems);
|
||||
_gpuTimer.end(batch);
|
||||
});
|
||||
args->_batch = nullptr;
|
||||
|
||||
std::static_pointer_cast<Config>(renderContext->jobConfig)->gpuTime = _gpuTimer.getAverage();
|
||||
}
|
||||
|
||||
void Blit::run(const SceneContextPointer& sceneContext, const RenderContextPointer& renderContext) {
|
||||
|
|
|
@ -82,11 +82,27 @@ protected:
|
|||
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 {
|
||||
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);
|
||||
|
||||
using JobModel = render::Job::ModelI<DrawBackgroundDeferred, render::ItemBounds>;
|
||||
protected:
|
||||
gpu::RangeTimer _gpuTimer;
|
||||
};
|
||||
|
||||
class DrawOverlay3DConfig : public render::Job::Config {
|
||||
|
|
Loading…
Reference in a new issue