Enable some wordwrapping in shader viewer, show variant bitmask

This commit is contained in:
Henrik Rydgård 2022-12-13 16:26:38 +01:00
parent 80a0c97e9e
commit 427cae67cb
2 changed files with 13 additions and 9 deletions

View file

@ -475,13 +475,14 @@ std::string PipelineManagerVulkan::DebugGetObjectString(std::string id, DebugSha
VulkanPipelineKey pipelineKey;
pipelineKey.FromString(id);
VulkanPipeline *iter = pipelines_.Get(pipelineKey);
if (!iter) {
return "";
VulkanPipeline *pipeline = pipelines_.Get(pipelineKey);
if (!pipeline) {
return "N/A (missing)";
}
u32 variants = pipeline->GetVariantsBitmask();
std::string str = pipelineKey.GetDescription(stringType);
return StringFromFormat("%p: %s", iter, str.c_str());
std::string keyDescription = pipelineKey.GetDescription(stringType);
return StringFromFormat("%s. v: %08x", keyDescription.c_str(), variants);
}
std::string VulkanPipelineKey::GetDescription(DebugShaderStringType stringType) const {
@ -672,6 +673,7 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha
uint32_t size = 0;
if (loadRawPipelineCache) {
NOTICE_LOG(G3D, "WARNING: Using the badly tested raw pipeline cache path!!!!");
// WARNING: Do not use this path until after reading and implementing https://zeux.io/2019/07/17/serializing-pipeline-cache/ !
bool success = fread(&size, sizeof(size), 1, file) == 1;
if (!size || !success) {
@ -707,12 +709,14 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha
} else {
vkMergePipelineCaches(vulkan_->GetDevice(), pipelineCache_, 1, &cache);
}
NOTICE_LOG(G3D, "Loaded Vulkan pipeline cache (%d bytes).", (int)size);
NOTICE_LOG(G3D, "Loaded Vulkan binary pipeline cache (%d bytes).", (int)size);
// Note that after loading the cache, it's still a good idea to pre-create the various pipelines.
} else {
if (!pipelineCache_) {
VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO };
VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_);
if (res != VK_SUCCESS) {
WARN_LOG(G3D, "vkCreatePipelineCache failed (%08x), highly unexpected", (u32)res);
return false;
}
}
@ -721,7 +725,7 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha
// Read the number of pipelines.
bool failed = fread(&size, sizeof(size), 1, file) != 1;
NOTICE_LOG(G3D, "Creating %d pipelines...", size);
NOTICE_LOG(G3D, "Creating %d pipelines from cache...", size);
int pipelineCreateFailCount = 0;
for (uint32_t i = 0; i < size; i++) {
if (failed || cancelCache_) {

View file

@ -1215,7 +1215,7 @@ void ShaderViewScreen::CreateViews() {
LinearLayout *layout = new LinearLayout(ORIENT_VERTICAL);
root_ = layout;
layout->Add(new TextView(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC)));
layout->Add(new TextView(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SHORT_DESC), FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, false));
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0));
scroll->SetTag("DevShaderView");
@ -1229,7 +1229,7 @@ void ShaderViewScreen::CreateViews() {
SplitString(gpu->DebugGetShaderString(id_, type_, SHADER_STRING_SOURCE_CODE), '\n', lines);
for (auto line : lines) {
lineLayout->Add(new TextView(line, FLAG_DYNAMIC_ASCII, true));
lineLayout->Add(new TextView(line, FLAG_DYNAMIC_ASCII | FLAG_WRAP_TEXT, true));
}
layout->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);