Add sample ValidationCache; slightly adjust vk::su::createInstance. (#357)

This commit is contained in:
Andreas Süßenbach
2019-07-09 09:25:48 +02:00
committed by Markus Tavenrath
parent b0bfcfdab5
commit 36691e4946
28 changed files with 42 additions and 63 deletions

View File

@@ -169,12 +169,21 @@ namespace vk
return device->createGraphicsPipelineUnique(pipelineCache.get(), graphicsPipelineCreateInfo);
}
vk::UniqueInstance createInstance(std::string const& appName, std::string const& engineName, std::vector<std::string> const& extensions, uint32_t apiVersion)
vk::UniqueInstance createInstance(std::string const& appName, std::string const& engineName, std::vector<std::string> const& layers, std::vector<std::string> const& extensions,
uint32_t apiVersion)
{
std::vector<char const*> enabledLayers;
enabledLayers.reserve(layers.size());
for (auto const& layer : layers)
{
enabledLayers.push_back(layer.data());
}
#if !defined(NDEBUG)
// Enable standard validation layer to find as much errors as possible!
enabledLayers.push_back("VK_LAYER_KHRONOS_validation");
if (std::find(layers.begin(), layers.end(), "VK_LAYER_KHRONOS_validation") == layers.end())
{
enabledLayers.push_back("VK_LAYER_KHRONOS_validation");
}
#endif
std::vector<char const*> enabledExtensions;
@@ -823,15 +832,15 @@ namespace vk
std::ostream& operator<<(std::ostream& os, vk::su::UUID const& uuid)
{
os << std::setfill('0');
os << std::setfill('0') << std::hex;
for (int j = 0; j < VK_UUID_SIZE; ++j)
{
os << std::hex << std::setw(2) << static_cast<uint32_t>(uuid.m_data[j]);
os << std::setw(2) << static_cast<uint32_t>(uuid.m_data[j]);
if (j == 3 || j == 5 || j == 7 || j == 9)
{
std::cout << '-';
}
}
os << std::setfill(' ');
os << std::setfill(' ') << std::dec;
return os;
}

View File

@@ -262,7 +262,8 @@ namespace vk
std::pair<vk::ShaderModule, vk::SpecializationInfo const*> const& fragmentShaderData, uint32_t vertexStride,
std::vector<std::pair<vk::Format, uint32_t>> const& vertexInputAttributeFormatOffset, vk::FrontFace frontFace, bool depthBuffered,
vk::UniquePipelineLayout const& pipelineLayout, vk::UniqueRenderPass const& renderPass);
vk::UniqueInstance createInstance(std::string const& appName, std::string const& engineName, std::vector<std::string> const& extensions = {}, uint32_t apiVersion = VK_API_VERSION_1_0);
vk::UniqueInstance createInstance(std::string const& appName, std::string const& engineName, std::vector<std::string> const& layers = {}, std::vector<std::string> const& extensions = {},
uint32_t apiVersion = VK_API_VERSION_1_0);
vk::UniqueRenderPass createRenderPass(vk::UniqueDevice &device, vk::Format colorFormat, vk::Format depthFormat, vk::AttachmentLoadOp loadOp = vk::AttachmentLoadOp::eClear, vk::ImageLayout colorFinalLayout = vk::ImageLayout::ePresentSrcKHR);
VkBool32 debugReportCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData);
uint32_t findGraphicsQueueFamilyIndex(std::vector<vk::QueueFamilyProperties> const& queueFamilyProperties);