vulkan: Uses debug output setting to enable debug layers.

This commit is contained in:
Vincent Lejeune 2016-03-11 20:38:30 +01:00
commit 26ff4fd6b7

View file

@ -11,12 +11,10 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
#include "Emu/state.h"
#include "VulkanAPI.h" #include "VulkanAPI.h"
#include "../GCM.h" #include "../GCM.h"
//Set to 9 to enable all debug layers. Will cause significant slowdowns. Eventually to be replaced with GUI checkbox
#define VK_ENABLED_LAYER_COUNT 0
namespace rsx namespace rsx
{ {
class texture; class texture;
@ -166,22 +164,18 @@ namespace vk
"VK_KHR_swapchain" "VK_KHR_swapchain"
}; };
const char *validation_layers[] = std::vector<const char *> layers;
{
"VK_LAYER_LUNARG_threading", "VK_LAYER_LUNARG_mem_tracker", if (rpcs3::config.rsx.d3d12.debug_output.value())
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_draw_state", layers.push_back("VK_LAYER_LUNARG_standard_validation");
"VK_LAYER_LUNARG_param_checker", "VK_LAYER_LUNARG_swapchain",
"VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_image",
"VK_LAYER_GOOGLE_unique_objects",
};
VkDeviceCreateInfo device; VkDeviceCreateInfo device;
device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
device.pNext = NULL; device.pNext = NULL;
device.queueCreateInfoCount = 1; device.queueCreateInfoCount = 1;
device.pQueueCreateInfos = &queue; device.pQueueCreateInfos = &queue;
device.enabledLayerCount = VK_ENABLED_LAYER_COUNT; device.enabledLayerCount = layers.size();
device.ppEnabledLayerNames = validation_layers; device.ppEnabledLayerNames = layers.data();
device.enabledExtensionCount = 1; device.enabledExtensionCount = 1;
device.ppEnabledExtensionNames = requested_extensions; device.ppEnabledExtensionNames = requested_extensions;
device.pEnabledFeatures = nullptr; device.pEnabledFeatures = nullptr;
@ -1011,21 +1005,17 @@ namespace vk
"VK_EXT_debug_report", "VK_EXT_debug_report",
}; };
const char *validation_layers[] = std::vector<const char *> layers;
{
"VK_LAYER_LUNARG_threading", "VK_LAYER_LUNARG_mem_tracker", if (rpcs3::config.rsx.d3d12.debug_output.value())
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_draw_state", layers.push_back("VK_LAYER_LUNARG_standard_validation");
"VK_LAYER_LUNARG_param_checker", "VK_LAYER_LUNARG_swapchain",
"VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_image",
"VK_LAYER_GOOGLE_unique_objects",
};
VkInstanceCreateInfo instance_info; VkInstanceCreateInfo instance_info;
instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instance_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instance_info.pNext = nullptr; instance_info.pNext = nullptr;
instance_info.pApplicationInfo = &app; instance_info.pApplicationInfo = &app;
instance_info.enabledLayerCount = VK_ENABLED_LAYER_COUNT; instance_info.enabledLayerCount = layers.size();
instance_info.ppEnabledLayerNames = validation_layers; instance_info.ppEnabledLayerNames = layers.data();
instance_info.enabledExtensionCount = 3; instance_info.enabledExtensionCount = 3;
instance_info.ppEnabledExtensionNames = requested_extensions; instance_info.ppEnabledExtensionNames = requested_extensions;