From 575cc890b7cef575edc864264dc4e120a2b82a67 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Sun, 13 Mar 2016 17:05:03 +0100 Subject: [PATCH] Turn off annoying "debug flicker" I used to see if we were swapping buffers properly early on Also minor logging changes, refine the false-positive debug layer check --- Common/Vulkan/VulkanContext.cpp | 6 +++++- Windows/GPU/WindowsVulkanContext.cpp | 5 +++-- ext/native/thin3d/thin3d_vulkan.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index 21ed7c4a22..7f9f10d537 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -110,14 +110,18 @@ VulkanContext::VulkanContext(const char *app_name, int app_ver, uint32_t flags) VkResult res = vkCreateInstance(&inst_info, NULL, &instance_); if (res != VK_SUCCESS) { - ELOG("Failed to create instance: %d", res); if (res == VK_ERROR_LAYER_NOT_PRESENT) { + WLOG("Validation on but layers not available - dropping layers"); // Drop the validation layers and try again. instance_layer_names.clear(); device_layer_names.clear(); inst_info.enabledLayerCount = 0; inst_info.ppEnabledLayerNames = NULL; res = vkCreateInstance(&inst_info, NULL, &instance_); + if (res != VK_SUCCESS) + ELOG("Failed to create instance even without validation: %d", res); + } else { + ELOG("Failed to create instance : %d", res); } } assert(res == VK_SUCCESS); diff --git a/Windows/GPU/WindowsVulkanContext.cpp b/Windows/GPU/WindowsVulkanContext.cpp index 57b43f96d8..5d9e0b79c4 100644 --- a/Windows/GPU/WindowsVulkanContext.cpp +++ b/Windows/GPU/WindowsVulkanContext.cpp @@ -119,8 +119,9 @@ static VkBool32 VKAPI_CALL Vulkan_Dbg(VkDebugReportFlagsEXT msgFlags, VkDebugRep } message << "[" << pLayerPrefix << "] " << ObjTypeToString(objType) << " Code " << msgCode << " : " << pMsg << "\n"; - // Getting some bizarre false positive for mapping image memory. - if (msgCode == 6) + // Getting some bizarre false positives for mapping image memory. + // https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/121 + if (msgCode == 6 && !memcmp(pMsg, "Cannot map", 10)) return false; #ifdef _WIN32 diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 63c967c2d5..f547e58cb0 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -680,8 +680,10 @@ void Thin3DVKContext::Begin(bool clear, uint32_t colorval, float depthVal, int s VkClearValue clearVal[2] = {}; Uint8x4ToFloat4(colorval, clearVal[0].color.float32); - if (frameNum_ & 1) - clearVal[0].color.float32[2] = 1.0f; + // // Debug flicker - used to see if we swap at all. no longer necessary + // if (frameNum_ & 1) + // clearVal[0].color.float32[2] = 1.0f; + clearVal[1].depthStencil.depth = depthVal; clearVal[1].depthStencil.stencil = stencilVal;