Permalink
Browse files

DevScreens: In shader viewer tabs, show the number of each shader type.

  • Loading branch information...
hrydgard committed Nov 13, 2017
1 parent 04e313e commit 0f100142191c57a24c17c7a8095b2e114035ff9a
Showing with 7 additions and 4 deletions.
  1. +6 −3 UI/DevScreens.cpp
  2. +1 −1 UI/DevScreens.h
View
@@ -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<std::string> 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);
}
}
View
@@ -152,7 +152,7 @@ class ShaderListScreen : public UIDialogScreenWithBackground {
void CreateViews() override;
private:
void ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
UI::EventReturn OnShaderClick(UI::EventParams &e);

0 comments on commit 0f10014

Please sign in to comment.