Commit 07025aa3 by Shahbaz Youssefi Committed by Commit Bot

Overlay: Widget for vk::DynamicBuffer allocations

Bug: angleproject:5690 Change-Id: Idfa591903627bbebffe306b387e95cbec1195338 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2725767Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 9946051a
......@@ -276,9 +276,9 @@
"src/libANGLE/renderer/vulkan/shaders/gen/OverlayCull.comp.00000005.inc":
"83626be8291a8a4364076cf82e714507",
"src/libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000000.inc":
"e43c8665a64cef72cba7c1526dec83f0",
"06bf671d56aede3201803753718221dc",
"src/libANGLE/renderer/vulkan/shaders/gen/OverlayDraw.comp.00000001.inc":
"e3635028140a86e202d185282d87b59e",
"355a732629869769dd876ac920557cce",
"src/libANGLE/renderer/vulkan/shaders/src/BlitResolve.frag":
"0b16d3ad95d7dbc2ce7175462152e4f9",
"src/libANGLE/renderer/vulkan/shaders/src/BlitResolve.frag.json":
......@@ -322,7 +322,7 @@
"src/libANGLE/renderer/vulkan/shaders/src/OverlayCull.comp.json":
"e5fd5bb63707753601e197635316430e",
"src/libANGLE/renderer/vulkan/shaders/src/OverlayDraw.comp":
"dcc246b398b2e07a869a264666499362",
"b8576748a0916c8d59fc8b02e294f5a8",
"src/libANGLE/renderer/vulkan/shaders/src/OverlayDraw.comp.json":
"af79e5153c99cdb1e6b551b11bbf7f6b",
"src/libANGLE/renderer/vulkan/vk_internal_shaders_autogen.cpp":
......
{
"src/libANGLE/Overlay_autogen.cpp":
"128fa40e019753033fd63b6d322d6dc2",
"77cb799b7e7cd9cea1a04e143ce55162",
"src/libANGLE/Overlay_autogen.h":
"d919dd0ad59e5ac81c96909a613b5063",
"4e4b35f85231fdf717540eff5da6e388",
"src/libANGLE/gen_overlay_widgets.py":
"d14bb9becb623817675e4ff758b6d4f4",
"src/libANGLE/overlay_widgets.json":
"93205f3d9585228428bc62463f478dc6"
"3ee58a46e52247a5a366b47c1094e38d"
}
\ No newline at end of file
......@@ -43,7 +43,7 @@ constexpr angle::PackedEnumMap<WidgetType, WidgetInternalType> kWidgetTypeToInte
constexpr size_t kMaxRenderableTextWidgets = 32;
constexpr size_t kMaxRenderableGraphWidgets = 32;
constexpr size_t kMaxTextLength = 256;
constexpr size_t kMaxGraphDataSize = 64;
constexpr size_t kMaxGraphDataSize = 256;
constexpr angle::PackedEnumMap<WidgetInternalType, size_t> kWidgetInternalTypeMaxWidgets = {
{WidgetInternalType::Text, kMaxRenderableTextWidgets},
......@@ -446,6 +446,21 @@ void AppendWidgetDataHelper::AppendVulkanDescriptorSetAllocations(const overlay:
AppendRunningGraphCommon(widget, imageExtent, textWidget, graphWidget, widgetCounts, format);
}
void AppendWidgetDataHelper::AppendVulkanDynamicBufferAllocations(const overlay::Widget *widget,
const gl::Extents &imageExtent,
TextWidgetData *textWidget,
GraphWidgetData *graphWidget,
OverlayWidgetCounts *widgetCounts)
{
auto format = [](size_t maxValue) {
std::ostringstream text;
text << "DynamicBuffer Allocations (Max: " << maxValue << ")";
return text.str();
};
AppendRunningGraphCommon(widget, imageExtent, textWidget, graphWidget, widgetCounts, format);
}
std::ostream &AppendWidgetDataHelper::OutputPerSecond(std::ostream &out,
const overlay::PerSecond *perSecond)
{
......
......@@ -317,6 +317,49 @@ void Overlay::initOverlayWidgets()
widget->description.color[3] = 1.0f;
}
}
{
RunningGraph *widget = new RunningGraph(120);
{
const int32_t fontSize = GetFontSize(0, kLargeFont);
const int32_t offsetX = -50;
const int32_t offsetY = -50;
const int32_t width = 5 * static_cast<uint32_t>(widget->runningValues.size());
const int32_t height = 100;
widget->type = WidgetType::RunningGraph;
widget->fontSize = fontSize;
widget->coords[0] = offsetX - width;
widget->coords[1] = offsetY - height;
widget->coords[2] = offsetX;
widget->coords[3] = offsetY;
widget->color[0] = 0.0f;
widget->color[1] = 0.78431372549f;
widget->color[2] = 0.294117647059f;
widget->color[3] = 0.78431372549f;
}
mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations].reset(widget);
{
const int32_t fontSize = GetFontSize(kFontLayerSmall, kLargeFont);
const int32_t offsetX =
mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations]->coords[2];
const int32_t offsetY =
mState.mOverlayWidgets[WidgetId::VulkanDynamicBufferAllocations]->coords[1];
const int32_t width = 40 * kFontGlyphWidths[fontSize];
const int32_t height = kFontGlyphHeights[fontSize];
widget->description.type = WidgetType::Text;
widget->description.fontSize = fontSize;
widget->description.coords[0] = offsetX - width;
widget->description.coords[1] = offsetY - height;
widget->description.coords[2] = offsetX;
widget->description.coords[3] = offsetY;
widget->description.color[0] = 0.0f;
widget->description.color[1] = 0.78431372549f;
widget->description.color[2] = 0.294117647059f;
widget->description.color[3] = 1.0f;
}
}
}
} // namespace gl
......@@ -28,6 +28,8 @@ enum class WidgetId
VulkanWriteDescriptorSetCount,
// Descriptor Set Allocations.
VulkanDescriptorSetAllocations,
// Buffer Allocations Made By vk::DynamicBuffer.
VulkanDynamicBufferAllocations,
InvalidEnum,
EnumCount = InvalidEnum,
......@@ -42,6 +44,7 @@ enum class WidgetId
PROC(VulkanRenderPassBufferCount) \
PROC(VulkanSecondaryCommandBufferPoolWaste) \
PROC(VulkanWriteDescriptorSetCount) \
PROC(VulkanDescriptorSetAllocations)
PROC(VulkanDescriptorSetAllocations) \
PROC(VulkanDynamicBufferAllocations)
} // namespace gl
......@@ -132,6 +132,22 @@
"font": "small",
"length": 40
}
},
{
"name": "VulkanDynamicBufferAllocations",
"comment": "Buffer Allocations Made By vk::DynamicBuffer.",
"type": "RunningGraph(120)",
"color": [0, 200, 75, 200],
"coords": [-50, -50],
"bar_width": 5,
"height": 100,
"description": {
"color": [0, 200, 75, 255],
"coords": ["VulkanDynamicBufferAllocations.right.align",
"VulkanDynamicBufferAllocations.top.adjacent"],
"font": "small",
"length": 40
}
}
]
}
......@@ -1832,6 +1832,12 @@ void ContextVk::updateOverlayOnPresent()
descriptorSetAllocationCount->next();
mPerfCounters.descriptorSetAllocations = descriptorSetAllocations;
}
{
gl::RunningGraphWidget *dynamicBufferAllocations =
overlay->getRunningGraphWidget(gl::WidgetId::VulkanDynamicBufferAllocations);
dynamicBufferAllocations->next();
}
}
void ContextVk::addOverlayUsedBuffersCount(vk::CommandBufferHelper *commandBuffer)
......
......@@ -223,7 +223,10 @@ void main()
if (blendedWidgets.a > 0)
{
const vec4 color = imageLoad(blendOutput, ivec2(imageCoords));
blendedColor += color.rgb * color.a * blendedWidgets.a;
// Note: assume color.a is 1. We don't have a use-case for correct blending of
// semi-transparent applications, but we do encounter applications that contain garbage
// in the alpha channel.
blendedColor += color.rgb * blendedWidgets.a;
}
imageStore(blendOutput, ivec2(imageCoords), vec4(blendedColor, 1));
}
......
......@@ -1736,6 +1736,16 @@ DynamicBuffer::~DynamicBuffer()
angle::Result DynamicBuffer::allocateNewBuffer(ContextVk *contextVk)
{
// Gather statistics
const gl::OverlayType *overlay = contextVk->getOverlay();
if (overlay->isEnabled())
{
gl::RunningGraphWidget *dynamicBufferAllocations =
overlay->getRunningGraphWidget(gl::WidgetId::VulkanDynamicBufferAllocations);
dynamicBufferAllocations->add(1);
}
// Allocate the buffer
ASSERT(!mBuffer);
mBuffer = std::make_unique<BufferHelper>();
......
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