Commit 6de7ee52 by Jamie Madill

Clean up overlay RenderPass count reporting.

This fixes the trace perf test to accurately report how many RPs in each frame. Instead of counting the RPs on a flush we now count only on a swap call. This won't work for offscreen surfaces which is fine - the overlay doesn't really have the same use for offscreen rendering. Also ignores the first frame in graph data so we can ignore the first setup frame in the trace tests. Also skips the redundant extra "flush" call that would generate an empty space in the RP graph. Gives a cleaner measurement for optimizing the XFB RP count. Bug: angleproject:4622 Change-Id: I5762c500cdb216700247095984ae62b4f8741602 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2215309Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 6820f77a
...@@ -136,17 +136,33 @@ class RunningGraph : public Widget ...@@ -136,17 +136,33 @@ class RunningGraph : public Widget
// Out of line constructor to satisfy chromium-style. // Out of line constructor to satisfy chromium-style.
RunningGraph(size_t n); RunningGraph(size_t n);
~RunningGraph() override; ~RunningGraph() override;
void add(size_t n) { runningValues[lastValueIndex] += n; }
void add(size_t n)
{
if (!ignoreFirstValue)
{
runningValues[lastValueIndex] += n;
}
}
void next() void next()
{ {
lastValueIndex = (lastValueIndex + 1) % runningValues.size(); if (ignoreFirstValue)
runningValues[lastValueIndex] = 0; {
ignoreFirstValue = false;
}
else
{
lastValueIndex = (lastValueIndex + 1) % runningValues.size();
runningValues[lastValueIndex] = 0;
}
} }
protected: protected:
std::vector<size_t> runningValues; std::vector<size_t> runningValues;
size_t lastValueIndex = 0; size_t lastValueIndex = 0;
Text description; Text description;
bool ignoreFirstValue = true;
friend class gl::Overlay; friend class gl::Overlay;
friend class gl::OverlayState; friend class gl::OverlayState;
......
...@@ -1543,15 +1543,18 @@ angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context, ...@@ -1543,15 +1543,18 @@ angle::Result ContextVk::handleDirtyDescriptorSets(const gl::Context *context,
return angle::Result::Continue; return angle::Result::Continue;
} }
angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo, void ContextVk::updateOverlayOnPresent()
vk::PrimaryCommandBuffer &&commandBuffer)
{ {
// Update overlay if active. // Update overlay if active.
gl::RunningGraphWidget *renderPassCount = gl::RunningGraphWidget *renderPassCount =
mState.getOverlay()->getRunningGraphWidget(gl::WidgetId::VulkanRenderPassCount); mState.getOverlay()->getRunningGraphWidget(gl::WidgetId::VulkanRenderPassCount);
renderPassCount->add(mRenderPassCommands->getAndResetCounter()); renderPassCount->add(mRenderPassCommands->getAndResetCounter());
renderPassCount->next(); renderPassCount->next();
}
angle::Result ContextVk::submitFrame(const VkSubmitInfo &submitInfo,
vk::PrimaryCommandBuffer &&commandBuffer)
{
if (vk::CommandBufferHelper::kEnableCommandStreamDiagnostics) if (vk::CommandBufferHelper::kEnableCommandStreamDiagnostics)
{ {
dumpCommandStreamDiagnostics(); dumpCommandStreamDiagnostics();
......
...@@ -524,6 +524,8 @@ class ContextVk : public ContextImpl, public vk::Context ...@@ -524,6 +524,8 @@ class ContextVk : public ContextImpl, public vk::Context
void beginOcclusionQuery(QueryVk *queryVk); void beginOcclusionQuery(QueryVk *queryVk);
void endOcclusionQuery(QueryVk *queryVk); void endOcclusionQuery(QueryVk *queryVk);
void updateOverlayOnPresent();
private: private:
// Dirty bits. // Dirty bits.
enum DirtyBitType : size_t enum DirtyBitType : size_t
......
...@@ -1631,6 +1631,8 @@ void WindowSurfaceVk::updateOverlay(ContextVk *contextVk) const ...@@ -1631,6 +1631,8 @@ void WindowSurfaceVk::updateOverlay(ContextVk *contextVk) const
overlay->getCountWidget(gl::WidgetId::VulkanValidationMessageCount) overlay->getCountWidget(gl::WidgetId::VulkanValidationMessageCount)
->add(validationMessageCount); ->add(validationMessageCount);
} }
contextVk->updateOverlayOnPresent();
} }
ANGLE_INLINE bool WindowSurfaceVk::overlayHasEnabledWidget(ContextVk *contextVk) const ANGLE_INLINE bool WindowSurfaceVk::overlayHasEnabledWidget(ContextVk *contextVk) const
......
...@@ -409,7 +409,8 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams ...@@ -409,7 +409,8 @@ ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams
mTestParams(testParams), mTestParams(testParams),
mIsTimestampQueryAvailable(false), mIsTimestampQueryAvailable(false),
mGLWindow(nullptr), mGLWindow(nullptr),
mOSWindow(nullptr) mOSWindow(nullptr),
mSwapEnabled(true)
{ {
// Force fast tests to make sure our slowest bots don't time out. // Force fast tests to make sure our slowest bots don't time out.
if (OneFrame()) if (OneFrame())
...@@ -676,7 +677,10 @@ void ANGLERenderTest::step() ...@@ -676,7 +677,10 @@ void ANGLERenderTest::step()
// internal command queue to the GPU. This is enabled for null back-end // internal command queue to the GPU. This is enabled for null back-end
// devices because some back-ends (e.g. Vulkan) also accumulate internal // devices because some back-ends (e.g. Vulkan) also accumulate internal
// command queues. // command queues.
mGLWindow->swap(); if (mSwapEnabled)
{
mGLWindow->swap();
}
mOSWindow->messageLoop(); mOSWindow->messageLoop();
#if defined(ANGLE_ENABLE_ASSERTS) #if defined(ANGLE_ENABLE_ASSERTS)
......
...@@ -155,6 +155,8 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -155,6 +155,8 @@ class ANGLERenderTest : public ANGLEPerfTest
void beginGLTraceEvent(const char *name, double hostTimeSec); void beginGLTraceEvent(const char *name, double hostTimeSec);
void endGLTraceEvent(const char *name, double hostTimeSec); void endGLTraceEvent(const char *name, double hostTimeSec);
void disableTestHarnessSwap() { mSwapEnabled = false; }
bool mIsTimestampQueryAvailable; bool mIsTimestampQueryAvailable;
private: private:
...@@ -172,6 +174,7 @@ class ANGLERenderTest : public ANGLEPerfTest ...@@ -172,6 +174,7 @@ class ANGLERenderTest : public ANGLEPerfTest
std::vector<const char *> mExtensionPrerequisites; std::vector<const char *> mExtensionPrerequisites;
angle::PlatformMethods mPlatformMethods; angle::PlatformMethods mPlatformMethods;
ConfigParameters mConfigParams; ConfigParameters mConfigParams;
bool mSwapEnabled;
GLuint mTimestampQuery; GLuint mTimestampQuery;
......
...@@ -111,6 +111,9 @@ TracePerfTest::TracePerfTest() ...@@ -111,6 +111,9 @@ TracePerfTest::TracePerfTest()
{ {
mSkipTest = true; mSkipTest = true;
} }
// We already swap in TracePerfTest::drawBenchmark, no need to swap again in the harness.
disableTestHarnessSwap();
} }
void TracePerfTest::initializeBenchmark() void TracePerfTest::initializeBenchmark()
...@@ -138,6 +141,7 @@ void TracePerfTest::initializeBenchmark() ...@@ -138,6 +141,7 @@ void TracePerfTest::initializeBenchmark()
// Potentially slow. Can load a lot of resources. // Potentially slow. Can load a lot of resources.
SetupReplay(params.testID); SetupReplay(params.testID);
glFinish();
ASSERT_TRUE(mEndFrame > mStartFrame); ASSERT_TRUE(mEndFrame > mStartFrame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment