mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
vulkan: The GPU profiler could end up writing massive amounts of text, fix some bugs around that.
This commit is contained in:
1 parent
fc34a93ac2
commit
26ab81c102
3 files changed
+14
-10
No files matched your search
@@ -495,8 +495,12 @@ void DrawBuffer::DrawTextRect(int font, const char *text, float x, float y, floa
|
||||
// ROTATE_* doesn't yet work right.
|
||||
void DrawBuffer::DrawText(int font, const char *text, float x, float y, Color color, int align) {
|
||||
// rough estimate
|
||||
if (count_ + strlen(text) * 6 > MAX_VERTS) {
|
||||
size_t textLen = strlen(text);
|
||||
if (count_ + textLen * 6 > MAX_VERTS) {
|
||||
Flush(true);
|
||||
if (textLen * 6 >= MAX_VERTS) {
|
||||
textLen = std::min(MAX_VERTS / 6 - 10, (int)textLen);
|
||||
}
|
||||
}
|
||||
|
||||
const AtlasFont &atlasfont = *atlas->fonts[font];
|
||||
@@ -508,14 +512,14 @@ void DrawBuffer::DrawText(int font, const char *text, float x, float y, Color co
|
||||
}
|
||||
|
||||
if (align & ROTATE_90DEG_LEFT) {
|
||||
x -= atlasfont.ascend*fontscaley;
|
||||
x -= atlasfont.ascend * fontscaley;
|
||||
// y += h;
|
||||
} else {
|
||||
y += atlasfont.ascend * fontscaley;
|
||||
}
|
||||
else
|
||||
y += atlasfont.ascend*fontscaley;
|
||||
float sx = x;
|
||||
UTF8 utf(text);
|
||||
while (true) {
|
||||
for (size_t i = 0; i < textLen; i++) {
|
||||
if (utf.end())
|
||||
break;
|
||||
cval = utf.next();
|
||||
|
||||
@@ -469,7 +469,7 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector<VKRStep *> &st
|
||||
break;
|
||||
}
|
||||
|
||||
if (profile) {
|
||||
if (profile && profile->timestampDescriptions.size() + 1 < MAX_TIMESTAMP_QUERIES) {
|
||||
vkCmdWriteTimestamp(cmd, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, profile->queryPool, (uint32_t)profile->timestampDescriptions.size());
|
||||
profile->timestampDescriptions.push_back(StepToString(step));
|
||||
}
|
||||
|
||||
@@ -85,6 +85,10 @@ enum class VKRRunType {
|
||||
SYNC,
|
||||
};
|
||||
|
||||
enum {
|
||||
MAX_TIMESTAMP_QUERIES = 128,
|
||||
};
|
||||
|
||||
class VulkanRenderManager {
|
||||
public:
|
||||
VulkanRenderManager(VulkanContext *vulkan);
|
||||
@@ -299,10 +303,6 @@ private:
|
||||
|
||||
FrameData frameData_[VulkanContext::MAX_INFLIGHT_FRAMES];
|
||||
|
||||
enum {
|
||||
MAX_TIMESTAMP_QUERIES = 256,
|
||||
};
|
||||
|
||||
// Submission time state
|
||||
int curWidth_ = -1;
|
||||
int curHeight_ = -1;
|
||||
|
||||
Reference in new issue
Block a user