Add option to log available surface formats
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "Base/Logger.hpp"
|
||||
#include "Base/Utils.hpp"
|
||||
#include "Base/UI/IVulkanWindow.hpp"
|
||||
#include "Scene/DataFormat.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
namespace openVulkanoCpp::Vulkan
|
||||
@@ -131,12 +132,12 @@ namespace openVulkanoCpp::Vulkan
|
||||
std::vector<vk::PresentModeKHR> presentModes = device->physicalDevice.getSurfacePresentModesKHR(surface);
|
||||
#ifdef DEBUG
|
||||
std::string availableModes = "";
|
||||
for (const auto& presentMode : presentModes)
|
||||
{
|
||||
if (availableModes.length() > 0) availableModes += ", ";
|
||||
availableModes += vk::to_string(presentMode);
|
||||
}
|
||||
Logger::RENDER->debug("Available swap chain present modes {0}. Searching best mode for: vsync={1}", availableModes, useVsync);
|
||||
for (const auto& presentMode : presentModes)
|
||||
{
|
||||
if (availableModes.length() > 0) availableModes += ", ";
|
||||
availableModes += vk::to_string(presentMode);
|
||||
}
|
||||
Logger::RENDER->debug("Available swap chain present modes {0}. Searching best mode for: vsync={1}", availableModes, useVsync);
|
||||
#endif
|
||||
vk::PresentModeKHR mode = vk::PresentModeKHR::eFifo;
|
||||
if (useVsync)
|
||||
@@ -155,6 +156,18 @@ namespace openVulkanoCpp::Vulkan
|
||||
vk::SurfaceFormatKHR SwapChain::ChoseSurfaceFormat()
|
||||
{ //TODO allow to chose output format
|
||||
std::vector<vk::SurfaceFormatKHR> surfaceFormats = device->physicalDevice.getSurfaceFormatsKHR(surface);
|
||||
#ifdef DEBUG
|
||||
std::string sfList;
|
||||
surfaceFormats.reserve(260);
|
||||
for (const auto& surfaceFormat : surfaceFormats)
|
||||
{
|
||||
if (!sfList.empty()) sfList.append(", ");
|
||||
DataFormat format(static_cast<DataFormat::Format>(surfaceFormat.format));
|
||||
sfList.append("{ ").append(format.GetName()).append(", ");
|
||||
sfList.append(magic_enum::enum_name(surfaceFormat.colorSpace)).append(" }");
|
||||
}
|
||||
Logger::RENDER->info("Available surface formats: {}", sfList);
|
||||
#endif
|
||||
if(surfaceFormats.size() == 1 && surfaceFormats[0].format == vk::Format::eUndefined)
|
||||
{ // GPU does not have a preferred surface format
|
||||
return vk::SurfaceFormatKHR{ vk::Format::eB8G8R8A8Unorm, surfaceFormats[0].colorSpace };
|
||||
@@ -168,6 +181,7 @@ namespace openVulkanoCpp::Vulkan
|
||||
std::vector<IImage*> SwapChain::GetImages()
|
||||
{
|
||||
std::vector<IImage*> imgs;
|
||||
imgs.reserve(images.size());
|
||||
for (auto& image : images)
|
||||
{
|
||||
imgs.push_back(&image);
|
||||
|
||||
Reference in New Issue
Block a user