mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-04 03:35:19 +02:00
Merge pull request #17312 from hrydgard/show-present-mode
List Vulkan present modes in system info, show the current one
This commit is contained in:
@@ -62,7 +62,7 @@ std::string VulkanVendorString(uint32_t vendorId) {
|
||||
}
|
||||
}
|
||||
|
||||
const char *PresentModeString(VkPresentModeKHR presentMode) {
|
||||
const char *VulkanPresentModeToString(VkPresentModeKHR presentMode) {
|
||||
switch (presentMode) {
|
||||
case VK_PRESENT_MODE_IMMEDIATE_KHR: return "IMMEDIATE";
|
||||
case VK_PRESENT_MODE_MAILBOX_KHR: return "MAILBOX";
|
||||
@@ -1233,16 +1233,19 @@ bool VulkanContext::InitSwapchain() {
|
||||
surfCapabilities_.maxImageExtent.width, surfCapabilities_.maxImageExtent.height,
|
||||
swapChainExtent_.width, swapChainExtent_.height);
|
||||
|
||||
availablePresentModes_.clear();
|
||||
// TODO: Find a better way to specify the prioritized present mode while being able
|
||||
// to fall back in a sensible way.
|
||||
VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR;
|
||||
std::string modes = "";
|
||||
for (size_t i = 0; i < presentModeCount; i++) {
|
||||
modes += PresentModeString(presentModes[i]);
|
||||
modes += VulkanPresentModeToString(presentModes[i]);
|
||||
if (i != presentModeCount - 1) {
|
||||
modes += ", ";
|
||||
}
|
||||
availablePresentModes_.push_back(presentModes[i]);
|
||||
}
|
||||
|
||||
INFO_LOG(G3D, "Supported present modes: %s", modes.c_str());
|
||||
for (size_t i = 0; i < presentModeCount; i++) {
|
||||
bool match = false;
|
||||
@@ -1276,7 +1279,7 @@ bool VulkanContext::InitSwapchain() {
|
||||
}
|
||||
|
||||
INFO_LOG(G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d",
|
||||
swapchainPresentMode, PresentModeString(swapchainPresentMode),
|
||||
swapchainPresentMode, VulkanPresentModeToString(swapchainPresentMode),
|
||||
desiredNumberOfSwapChainImages, surfCapabilities_.maxImageCount);
|
||||
|
||||
// We mostly follow the practices from
|
||||
@@ -1356,6 +1359,8 @@ bool VulkanContext::InitSwapchain() {
|
||||
swap_chain_info.clipped = true;
|
||||
swap_chain_info.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
|
||||
presentMode_ = swapchainPresentMode;
|
||||
|
||||
// Don't ask for TRANSFER_DST for the swapchain image, we don't use that.
|
||||
// if (surfCapabilities_.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)
|
||||
// swap_chain_info.imageUsage |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
|
||||
@@ -375,6 +375,14 @@ public:
|
||||
return surfFormats_;
|
||||
}
|
||||
|
||||
VkPresentModeKHR GetPresentMode() const {
|
||||
return presentMode_;
|
||||
}
|
||||
|
||||
std::vector<VkPresentModeKHR> GetAvailablePresentModes() const {
|
||||
return availablePresentModes_;
|
||||
}
|
||||
|
||||
private:
|
||||
bool ChooseQueue();
|
||||
|
||||
@@ -462,6 +470,9 @@ private:
|
||||
VkSurfaceCapabilitiesKHR surfCapabilities_{};
|
||||
std::vector<VkSurfaceFormatKHR> surfFormats_{};
|
||||
|
||||
VkPresentModeKHR presentMode_;
|
||||
std::vector<VkPresentModeKHR> availablePresentModes_;
|
||||
|
||||
std::vector<VkCommandBuffer> cmdQueue_;
|
||||
|
||||
VmaAllocator allocator_ = VK_NULL_HANDLE;
|
||||
@@ -487,6 +498,7 @@ bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *sourceCode,
|
||||
|
||||
const char *VulkanColorSpaceToString(VkColorSpaceKHR colorSpace);
|
||||
const char *VulkanFormatToString(VkFormat format);
|
||||
const char *VulkanPresentModeToString(VkPresentModeKHR presentMode);
|
||||
|
||||
std::string FormatDriverVersion(const VkPhysicalDeviceProperties &props);
|
||||
|
||||
|
||||
@@ -1527,7 +1527,6 @@ std::vector<std::string> VKContext::GetFeatureList() const {
|
||||
AddFeature(features, "geometryShader", available.geometryShader, enabled.geometryShader);
|
||||
AddFeature(features, "depthBounds", available.depthBounds, enabled.depthBounds);
|
||||
AddFeature(features, "depthClamp", available.depthClamp, enabled.depthClamp);
|
||||
AddFeature(features, "fillModeNonSolid", available.fillModeNonSolid, enabled.fillModeNonSolid);
|
||||
AddFeature(features, "pipelineStatisticsQuery", available.pipelineStatisticsQuery, enabled.pipelineStatisticsQuery);
|
||||
AddFeature(features, "samplerAnisotropy", available.samplerAnisotropy, enabled.samplerAnisotropy);
|
||||
AddFeature(features, "textureCompressionBC", available.textureCompressionBC, enabled.textureCompressionBC);
|
||||
|
||||
+14
-5
@@ -784,20 +784,29 @@ void SystemInfoScreen::CreateViews() {
|
||||
}
|
||||
}
|
||||
} else if (GetGPUBackend() == GPUBackend::VULKAN) {
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
// Vulkan specific code here, can't be bothered to abstract.
|
||||
// OK because of above check.
|
||||
|
||||
tabHolder->AddTab(si->T("Vulkan Features"), gpuExtensionsScroll);
|
||||
VulkanContext *vk = (VulkanContext *)draw->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
|
||||
gpuExtensions->Add(new ItemHeader(si->T("Vulkan Features")));
|
||||
std::vector<std::string> features = draw->GetFeatureList();
|
||||
for (auto &feature : features) {
|
||||
gpuExtensions->Add(new TextView(feature, new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
}
|
||||
|
||||
#if !PPSSPP_PLATFORM(UWP)
|
||||
|
||||
// Vulkan specific code here, can't be bothered to abstract.
|
||||
// OK because of above check.
|
||||
gpuExtensions->Add(new ItemHeader(si->T("Present Modes")));
|
||||
for (auto mode : vk->GetAvailablePresentModes()) {
|
||||
std::string str = VulkanPresentModeToString(mode);
|
||||
if (mode == vk->GetPresentMode()) {
|
||||
str += std::string(" (") + di->T("Current") + ")";
|
||||
}
|
||||
gpuExtensions->Add(new TextView(VulkanPresentModeToString(mode), new LayoutParams(FILL_PARENT, WRAP_CONTENT)))->SetFocusable(true);
|
||||
}
|
||||
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user