removed render thread touching
This commit is contained in:
@@ -65,8 +65,16 @@ void RenderThread::Stop()
|
|||||||
|
|
||||||
RenderThread::Metrics RenderThread::GetMetrics() const
|
RenderThread::Metrics RenderThread::GetMetrics() const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
Metrics metrics;
|
||||||
return mMetrics;
|
metrics.renderedFrames = mRenderedFrames.load(std::memory_order_relaxed);
|
||||||
|
metrics.completedReadbacks = mCompletedReadbacks.load(std::memory_order_relaxed);
|
||||||
|
metrics.acquireMisses = mAcquireMisses.load(std::memory_order_relaxed);
|
||||||
|
metrics.pboQueueMisses = mPboQueueMisses.load(std::memory_order_relaxed);
|
||||||
|
metrics.clockOverruns = mClockOverruns.load(std::memory_order_relaxed);
|
||||||
|
metrics.skippedFrames = mSkippedFrames.load(std::memory_order_relaxed);
|
||||||
|
metrics.shaderBuildsCommitted = mShaderBuildsCommitted.load(std::memory_order_relaxed);
|
||||||
|
metrics.shaderBuildFailures = mShaderBuildFailures.load(std::memory_order_relaxed);
|
||||||
|
return metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::ThreadMain()
|
void RenderThread::ThreadMain()
|
||||||
@@ -126,19 +134,15 @@ void RenderThread::ThreadMain()
|
|||||||
renderer.RenderFrame(index);
|
renderer.RenderFrame(index);
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mPboQueueMisses.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.pboQueueMisses;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CountRendered();
|
CountRendered();
|
||||||
++frameIndex;
|
++frameIndex;
|
||||||
clock.MarkRendered(RenderCadenceClock::Clock::now());
|
clock.MarkRendered(RenderCadenceClock::Clock::now());
|
||||||
|
|
||||||
{
|
mClockOverruns.store(clock.OverrunCount(), std::memory_order_relaxed);
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mSkippedFrames.store(clock.SkippedFrameCount(), std::memory_order_relaxed);
|
||||||
mMetrics.clockOverruns = clock.OverrunCount();
|
|
||||||
mMetrics.skippedFrames = clock.SkippedFrameCount();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::size_t i = 0; i < mConfig.pboDepth * 2; ++i)
|
for (std::size_t i = 0; i < mConfig.pboDepth * 2; ++i)
|
||||||
@@ -177,20 +181,17 @@ void RenderThread::SignalStartupFailure(const std::string& error)
|
|||||||
|
|
||||||
void RenderThread::CountRendered()
|
void RenderThread::CountRendered()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mRenderedFrames.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.renderedFrames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::CountCompleted()
|
void RenderThread::CountCompleted()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mCompletedReadbacks.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.completedReadbacks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::CountAcquireMiss()
|
void RenderThread::CountAcquireMiss()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mAcquireMisses.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.acquireMisses;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::SubmitRuntimeShaderArtifact(const RuntimeShaderArtifact& artifact)
|
void RenderThread::SubmitRuntimeShaderArtifact(const RuntimeShaderArtifact& artifact)
|
||||||
@@ -228,8 +229,7 @@ void RenderThread::TryCommitReadyRuntimeShader(RuntimeShaderRenderer& runtimeSha
|
|||||||
RenderCadenceCompositor::LogLevel::Error,
|
RenderCadenceCompositor::LogLevel::Error,
|
||||||
"render-thread",
|
"render-thread",
|
||||||
"Runtime shader GL commit failed: " + commitError);
|
"Runtime shader GL commit failed: " + commitError);
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mShaderBuildFailures.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.shaderBuildFailures;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +237,5 @@ void RenderThread::TryCommitReadyRuntimeShader(RuntimeShaderRenderer& runtimeSha
|
|||||||
RenderCadenceCompositor::LogLevel::Log,
|
RenderCadenceCompositor::LogLevel::Log,
|
||||||
"render-thread",
|
"render-thread",
|
||||||
"Runtime shader committed: " + artifact.shaderId + ". " + artifact.message);
|
"Runtime shader committed: " + artifact.shaderId + ". " + artifact.message);
|
||||||
std::lock_guard<std::mutex> lock(mMetricsMutex);
|
mShaderBuildsCommitted.fetch_add(1, std::memory_order_relaxed);
|
||||||
++mMetrics.shaderBuildsCommitted;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,8 +70,14 @@ private:
|
|||||||
bool mStarted = false;
|
bool mStarted = false;
|
||||||
std::string mStartupError;
|
std::string mStartupError;
|
||||||
|
|
||||||
mutable std::mutex mMetricsMutex;
|
std::atomic<uint64_t> mRenderedFrames{ 0 };
|
||||||
Metrics mMetrics;
|
std::atomic<uint64_t> mCompletedReadbacks{ 0 };
|
||||||
|
std::atomic<uint64_t> mAcquireMisses{ 0 };
|
||||||
|
std::atomic<uint64_t> mPboQueueMisses{ 0 };
|
||||||
|
std::atomic<uint64_t> mClockOverruns{ 0 };
|
||||||
|
std::atomic<uint64_t> mSkippedFrames{ 0 };
|
||||||
|
std::atomic<uint64_t> mShaderBuildsCommitted{ 0 };
|
||||||
|
std::atomic<uint64_t> mShaderBuildFailures{ 0 };
|
||||||
|
|
||||||
std::mutex mShaderArtifactMutex;
|
std::mutex mShaderArtifactMutex;
|
||||||
bool mHasPendingShaderArtifact = false;
|
bool mHasPendingShaderArtifact = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user