Skip to content

Commit

Permalink
Remove Vulkan (and Windows.h) include from DevScreens.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 14, 2023
1 parent b941f40 commit ed4941f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
20 changes: 20 additions & 0 deletions Common/GPU/Vulkan/thin3d_vulkan.cpp
Expand Up @@ -392,6 +392,26 @@ class VKContext : public DrawContext {
}
return list;
}
std::vector<std::string> GetPresentModeList(const char *currentMarkerString) const override {
std::vector<std::string> list;
for (auto mode : vulkan_->GetAvailablePresentModes()) {
std::string str = VulkanPresentModeToString(mode);
if (mode == vulkan_->GetPresentMode()) {
str += std::string(" (") + currentMarkerString + ")";
}
list.push_back(str);
}
return list;
}
std::vector<std::string> GetSurfaceFormatList() const override {
std::vector<std::string> list;
for (auto &format : vulkan_->SurfaceFormats()) {
std::string str = StringFromFormat("%s : %s", VulkanFormatToString(format.format), VulkanColorSpaceToString(format.colorSpace));
list.push_back(str);
}
return list;
}

uint32_t GetSupportedShaderLanguages() const override {
return (uint32_t)ShaderLanguage::GLSL_VULKAN;
}
Expand Down
2 changes: 2 additions & 0 deletions Common/GPU/thin3d.h
Expand Up @@ -698,6 +698,8 @@ class DrawContext {
virtual std::vector<std::string> GetFeatureList() const { return std::vector<std::string>(); }
virtual std::vector<std::string> GetExtensionList(bool device, bool enabledOnly) const { return std::vector<std::string>(); }
virtual std::vector<std::string> GetDeviceList() const { return std::vector<std::string>(); }
virtual std::vector<std::string> GetPresentModeList(const char *currentMarkerString) const { return std::vector<std::string>(); }
virtual std::vector<std::string> GetSurfaceFormatList() const { return std::vector<std::string>(); }

// Describes the primary shader language that this implementation prefers.
const ShaderLanguageDesc &GetShaderLanguageDesc() {
Expand Down
27 changes: 4 additions & 23 deletions UI/DevScreens.cpp
Expand Up @@ -34,9 +34,6 @@
#include "Common/System/OSD.h"
#include "Common/GPU/OpenGL/GLFeatures.h"

#if !PPSSPP_PLATFORM(UWP)
#include "Common/GPU/Vulkan/VulkanContext.h"
#endif
#include "Common/File/AndroidStorage.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Data/Encoding/Utf8.h"
Expand Down Expand Up @@ -72,9 +69,7 @@
#include "UI/ControlMappingScreen.h"
#include "UI/GameSettingsScreen.h"


#ifdef _WIN32
#include "Common/CommonWindows.h"
// Want to avoid including the full header here as it includes d3dx.h
int GetD3DCompilerVersion();
#endif
Expand Down Expand Up @@ -799,11 +794,6 @@ void SystemInfoScreen::CreateTabs() {
}
} else if (GetGPUBackend() == GPUBackend::VULKAN) {
LinearLayout *gpuExtensions = AddTab("DevSystemInfoOGLExt", si->T("Vulkan Features"));
#if !PPSSPP_PLATFORM(UWP)
// Vulkan specific code here, can't be bothered to abstract.
// OK because of above check.

VulkanContext *vk = (VulkanContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);

CollapsibleSection *vulkanFeatures = gpuExtensions->Add(new CollapsibleSection(si->T("Vulkan Features")));
std::vector<std::string> features = draw->GetFeatureList();
Expand All @@ -812,23 +802,14 @@ void SystemInfoScreen::CreateTabs() {
}

CollapsibleSection *presentModes = gpuExtensions->Add(new CollapsibleSection(si->T("Present Modes")));
for (auto mode : vk->GetAvailablePresentModes()) {
std::string str = VulkanPresentModeToString(mode);
if (mode == vk->GetPresentMode()) {
str += std::string(" (") + di->T("Current") + ")";
}
presentModes->Add(new TextView(str, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
for (auto mode : draw->GetPresentModeList(di->T("Current"))) {
presentModes->Add(new TextView(mode, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}

CollapsibleSection *colorFormats = gpuExtensions->Add(new CollapsibleSection(si->T("Display Color Formats")));
if (vk) {
for (auto &format : vk->SurfaceFormats()) {
std::string line = StringFromFormat("%s : %s", VulkanFormatToString(format.format), VulkanColorSpaceToString(format.colorSpace));
colorFormats->Add(new TextView(line,
new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
for (auto &format : draw->GetSurfaceFormatList()) {
colorFormats->Add(new TextView(format, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
#endif

CollapsibleSection *enabledExtensions = gpuExtensions->Add(new CollapsibleSection(std::string(si->T("Vulkan Extensions")) + " (" + di->T("Enabled") + ")"));
std::vector<std::string> extensions = draw->GetExtensionList(true, true);
Expand Down

0 comments on commit ed4941f

Please sign in to comment.