Vulkan: Add support for listing all the available surface formats in system info.

Enabling the EXT_swapchain_colorspace extension lets the driver expose
all the formats it really supports.

Used this to discover that my Galaxy S21 supports Display-P3 which is a wider
gamut than sRGB. Might be able to do some color boosting mode for fun.

Or, use this stuff to play around with HDR?
This commit is contained in:
Henrik Rydgård committed 2022-01-25 19:22:49 +01:00
1 parent 0e2f5d66b6
commit 8dc8fae16d
5 files changed
+108 -24

No files matched your search

+14
View File
@@ -24,6 +24,7 @@
#include "Common/System/NativeApp.h"
#include "Common/System/System.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
#include "Common/GPU/Vulkan/VulkanContext.h"
#include "Common/File/AndroidStorage.h"
#include "Common/Data/Text/I18n.h"
#include "Common/Net/HTTPClient.h"
@@ -55,6 +56,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
@@ -720,6 +722,18 @@ void SystemInfoScreen::CreateViews() {
for (auto &feature : features) {
gpuExtensions->Add(new TextView(feature, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
// Vulkan specific code here, can't be bothered to abstract.
gpuExtensions->Add(new ItemHeader(si->T("Display Color Formats")));
VulkanContext *vk = (VulkanContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
if (vk) {
for (auto &format : vk->SurfaceFormats()) {
std::string line = StringFromFormat("%s : %s", VulkanFormatToString(format.format), VulkanColorSpaceToString(format.colorSpace));
gpuExtensions->Add(new TextView(line,
new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
}
}
gpuExtensions->Add(new ItemHeader(si->T("Vulkan Extensions")));
std::vector<std::string> extensions = draw->GetExtensionList();
for (auto &extension : extensions) {