From 9d792f79f1629d97b89b16044f7b875f1a311560 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 3 Mar 2019 14:32:03 +0100 Subject: [PATCH] - add vulkan info to startup log --- src/rendering/vulkan/system/vk_device.cpp | 3 -- src/rendering/vulkan/system/vk_device.h | 2 + .../vulkan/system/vk_framebuffer.cpp | 41 +++++++++++++++++++ src/rendering/vulkan/system/vk_framebuffer.h | 1 + 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/rendering/vulkan/system/vk_device.cpp b/src/rendering/vulkan/system/vk_device.cpp index 176045054..eaf966158 100644 --- a/src/rendering/vulkan/system/vk_device.cpp +++ b/src/rendering/vulkan/system/vk_device.cpp @@ -290,10 +290,7 @@ void VulkanDevice::selectPhysicalDevice() for (const auto &device : devices) { - VkPhysicalDeviceProperties deviceProperties; vkGetPhysicalDeviceProperties(device, &deviceProperties); - - VkPhysicalDeviceFeatures deviceFeatures; vkGetPhysicalDeviceFeatures(device, &deviceFeatures); bool isUsableDevice = deviceProperties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU && deviceFeatures.geometryShader && deviceFeatures.samplerAnisotropy; diff --git a/src/rendering/vulkan/system/vk_device.h b/src/rendering/vulkan/system/vk_device.h index 6beeb6554..ad124151b 100644 --- a/src/rendering/vulkan/system/vk_device.h +++ b/src/rendering/vulkan/system/vk_device.h @@ -44,6 +44,8 @@ public: std::vector availableLayers; std::vector extensions; std::vector availableDeviceExtensions; + VkPhysicalDeviceProperties deviceProperties; + VkPhysicalDeviceFeatures deviceFeatures; uint32_t findMemoryType(uint32_t typeFilter, VkMemoryPropertyFlags properties); diff --git a/src/rendering/vulkan/system/vk_framebuffer.cpp b/src/rendering/vulkan/system/vk_framebuffer.cpp index 4cf1fb483..a464a8589 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.cpp +++ b/src/rendering/vulkan/system/vk_framebuffer.cpp @@ -88,6 +88,13 @@ VulkanFrameBuffer::~VulkanFrameBuffer() void VulkanFrameBuffer::InitializeState() { + static bool first = true; + if (first) + { + PrintStartupLog(); + first = false; + } + gl_vendorstring = "Vulkan"; hwcaps = RFL_SHADER_STORAGE_BUFFER | RFL_BUFFER_STORAGE; @@ -573,3 +580,37 @@ VulkanCommandBuffer *VulkanFrameBuffer::GetDrawCommands() } return mDrawCommands.get(); } + +void VulkanFrameBuffer::PrintStartupLog() +{ + FString deviceType; + switch (device->deviceProperties.deviceType) + { + case VK_PHYSICAL_DEVICE_TYPE_OTHER: deviceType = "other"; break; + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: deviceType = "integrated gpu"; break; + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: deviceType = "discrete gpu"; break; + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: deviceType = "virtual gpu"; break; + case VK_PHYSICAL_DEVICE_TYPE_CPU: deviceType = "cpu"; break; + default: deviceType.Format("%d", (int)device->deviceProperties.deviceType); break; + } + + FString apiVersion, driverVersion; + apiVersion.Format("%d.%d.%d", VK_VERSION_MAJOR(device->deviceProperties.apiVersion), VK_VERSION_MINOR(device->deviceProperties.apiVersion), VK_VERSION_PATCH(device->deviceProperties.apiVersion)); + driverVersion.Format("%d.%d.%d", VK_VERSION_MAJOR(device->deviceProperties.apiVersion), VK_VERSION_MINOR(device->deviceProperties.apiVersion), VK_VERSION_PATCH(device->deviceProperties.apiVersion)); + + Printf("Vulkan device: %s\n", device->deviceProperties.deviceName); + Printf("Vulkan device type: %s\n", deviceType.GetChars()); + Printf("Vulkan version: %s (api) %s (driver)\n", apiVersion.GetChars(), driverVersion.GetChars()); + + Printf(PRINT_LOG, "Vulkan extensions:"); + for (const VkExtensionProperties &p : device->availableDeviceExtensions) + { + Printf(PRINT_LOG, " %s", p.extensionName); + } + Printf(PRINT_LOG, "\n"); + + const auto &limits = device->deviceProperties.limits; + Printf("Max. texture size: %d\n", limits.maxImageDimension2D); + Printf("Max. uniform buffer range: %d\n", limits.maxUniformBufferRange); + Printf("Min. uniform buffer offset alignment: %d\n", limits.minUniformBufferOffsetAlignment); +} diff --git a/src/rendering/vulkan/system/vk_framebuffer.h b/src/rendering/vulkan/system/vk_framebuffer.h index a5dea6ef7..3d2fb98d3 100644 --- a/src/rendering/vulkan/system/vk_framebuffer.h +++ b/src/rendering/vulkan/system/vk_framebuffer.h @@ -75,6 +75,7 @@ public: private: sector_t *RenderViewpoint(FRenderViewpoint &mainvp, AActor * camera, IntRect * bounds, float fov, float ratio, float fovratio, bool mainview, bool toscreen); void DrawScene(HWDrawInfo *di, int drawmode); + void PrintStartupLog(); std::unique_ptr mShaderManager; std::unique_ptr mSamplerManager;