From 0f100142191c57a24c17c7a8095b2e114035ff9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 13 Nov 2017 11:13:38 +0100 Subject: [PATCH] DevScreens: In shader viewer tabs, show the number of each shader type. --- UI/DevScreens.cpp | 9 ++++++--- UI/DevScreens.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index c43039a5e2..2344342262 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -899,14 +899,17 @@ UI::EventReturn JitCompareScreen::OnCurrentBlock(UI::EventParams &e) { return UI::EVENT_DONE; } -void ShaderListScreen::ListShaders(DebugShaderType shaderType, UI::LinearLayout *view) { +int ShaderListScreen::ListShaders(DebugShaderType shaderType, UI::LinearLayout *view) { using namespace UI; std::vector shaderIds_ = gpu->DebugGetShaderIDs(shaderType); + int count = 0; for (auto id : shaderIds_) { Choice *choice = view->Add(new Choice(gpu->DebugGetShaderString(id, shaderType, SHADER_STRING_SHORT_DESC))); choice->SetTag(id); choice->OnClick.Handle(this, &ShaderListScreen::OnShaderClick); + count++; } + return count; } struct { DebugShaderType type; const char *name; } shaderTypes[] = { @@ -933,9 +936,9 @@ void ShaderListScreen::CreateViews() { for (size_t i = 0; i < ARRAY_SIZE(shaderTypes); i++) { ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0)); LinearLayout *shaderList = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, WRAP_CONTENT)); - ListShaders(shaderTypes[i].type, shaderList); + int count = ListShaders(shaderTypes[i].type, shaderList); scroll->Add(shaderList); - tabs_->AddTab(shaderTypes[i].name, scroll); + tabs_->AddTab(StringFromFormat("%s (%d)", shaderTypes[i].name, count), scroll); } } diff --git a/UI/DevScreens.h b/UI/DevScreens.h index 91cfde222f..6c37850c8b 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -152,7 +152,7 @@ public: void CreateViews() override; private: - void ListShaders(DebugShaderType shaderType, UI::LinearLayout *view); + int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view); UI::EventReturn OnShaderClick(UI::EventParams &e);