mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-24 21:10:12 +00:00
samples: Remove C++14 codes
This commit is contained in:
parent
1572c0b1ba
commit
32d0bc6843
@ -21,8 +21,6 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
static char const* AppName = "EnableValidationWithCallback";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
|
||||
@ -46,35 +44,35 @@ VkBool32 debugMessageFunc(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity
|
||||
std::string message;
|
||||
|
||||
message += vk::to_string(static_cast<vk::DebugUtilsMessageSeverityFlagBitsEXT>(messageSeverity)) + ": " + vk::to_string(static_cast<vk::DebugUtilsMessageTypeFlagsEXT>(messageTypes)) + ":\n";
|
||||
message += "\t"s + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
|
||||
message += "\t"s + "messageIdNumber = " + std::to_string(pCallbackData->messageIdNumber) + "\n";
|
||||
message += "\t"s + "message = <" + pCallbackData->pMessage + ">\n";
|
||||
message += std::string("\t") + "messageIDName = <" + pCallbackData->pMessageIdName + ">\n";
|
||||
message += std::string("\t") + "messageIdNumber = " + std::to_string(pCallbackData->messageIdNumber) + "\n";
|
||||
message += std::string("\t") + "message = <" + pCallbackData->pMessage + ">\n";
|
||||
if (0 < pCallbackData->queueLabelCount)
|
||||
{
|
||||
message += "\t"s + "Queue Labels:\n";
|
||||
message += std::string("\t") + "Queue Labels:\n";
|
||||
for (uint8_t i = 0; i < pCallbackData->queueLabelCount; i++)
|
||||
{
|
||||
message += "\t\t"s + "labelName = <" + pCallbackData->pQueueLabels[i].pLabelName + ">\n";
|
||||
message += std::string("\t\t") + "labelName = <" + pCallbackData->pQueueLabels[i].pLabelName + ">\n";
|
||||
}
|
||||
}
|
||||
if (0 < pCallbackData->cmdBufLabelCount)
|
||||
{
|
||||
message += "\t"s + "CommandBuffer Labels:\n";
|
||||
message += std::string("\t") + "CommandBuffer Labels:\n";
|
||||
for (uint8_t i = 0; i < pCallbackData->cmdBufLabelCount; i++)
|
||||
{
|
||||
message += "\t\t"s + "labelName = <" + pCallbackData->pCmdBufLabels[i].pLabelName + ">\n";
|
||||
message += std::string("\t\t") + "labelName = <" + pCallbackData->pCmdBufLabels[i].pLabelName + ">\n";
|
||||
}
|
||||
}
|
||||
if (0 < pCallbackData->objectCount)
|
||||
{
|
||||
for (uint8_t i = 0; i < pCallbackData->objectCount; i++)
|
||||
{
|
||||
message += "\t"s + "Object " + std::to_string(i) + "\n";
|
||||
message += "\t\t"s + "objectType = " + vk::to_string(static_cast<vk::ObjectType>(pCallbackData->pObjects[i].objectType)) + "\n";
|
||||
message += "\t\t"s + "objectHandle = " + std::to_string(pCallbackData->pObjects[i].objectHandle) + "\n";
|
||||
message += std::string("\t") + "Object " + std::to_string(i) + "\n";
|
||||
message += std::string("\t\t") + "objectType = " + vk::to_string(static_cast<vk::ObjectType>(pCallbackData->pObjects[i].objectType)) + "\n";
|
||||
message += std::string("\t\t") + "objectHandle = " + std::to_string(pCallbackData->pObjects[i].objectHandle) + "\n";
|
||||
if (pCallbackData->pObjects[i].pObjectName)
|
||||
{
|
||||
message += "\t\t"s + "objectName = <" + pCallbackData->pObjects[i].pObjectName + ">\n";
|
||||
message += std::string("\t\t") + "objectName = <" + pCallbackData->pObjects[i].pObjectName + ">\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
|
||||
// To use PUSH_DESCRIPTOR, you must also specify GET_PHYSICAL_DEVICE_PROPERTIES_2
|
||||
std::vector<vk::ExtensionProperties> extensionProperties = vk::enumerateInstanceExtensionProperties();
|
||||
if (std::find_if(extensionProperties.begin(), extensionProperties.end(), [](auto ep) { return (strcmp(ep.extensionName,VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0); }) == extensionProperties.end())
|
||||
if (std::find_if(extensionProperties.begin(), extensionProperties.end(), [](vk::ExtensionProperties ep) { return (strcmp(ep.extensionName,VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME) == 0); }) == extensionProperties.end())
|
||||
{
|
||||
std::cout << "No GET_PHYSICAL_DEVICE_PROPERTIES_2 extension" << std::endl;
|
||||
return 0;
|
||||
@ -60,7 +60,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
|
||||
// Once instance is created, need to make sure the extension is available
|
||||
extensionProperties = physicalDevice.enumerateDeviceExtensionProperties();
|
||||
if (std::find_if(extensionProperties.begin(), extensionProperties.end(), [](auto ep) { return (strcmp(ep.extensionName,VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME) == 0); }) == extensionProperties.end())
|
||||
if (std::find_if(extensionProperties.begin(), extensionProperties.end(), [](vk::ExtensionProperties ep) { return (strcmp(ep.extensionName,VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME) == 0); }) == extensionProperties.end())
|
||||
{
|
||||
std::cout << "No extension for push descriptors" << std::endl;
|
||||
return 0;
|
||||
|
@ -83,8 +83,8 @@ AccelerationStructureData createAccelerationStructureData(vk::PhysicalDevice con
|
||||
vk::AccelerationStructureMemoryRequirementsInfoNV objectRequirements(vk::AccelerationStructureMemoryRequirementsTypeNV::eObject, *accelerationStructureData.acclerationStructure);
|
||||
vk::DeviceSize resultSizeInBytes = device->getAccelerationStructureMemoryRequirementsNV(objectRequirements).memoryRequirements.size;
|
||||
assert(0 < resultSizeInBytes);
|
||||
accelerationStructureData.resultBufferData = std::make_unique<vk::su::BufferData>(physicalDevice, device, resultSizeInBytes, vk::BufferUsageFlagBits::eRayTracingNV,
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal);
|
||||
accelerationStructureData.resultBufferData = std::unique_ptr<vk::su::BufferData>(new vk::su::BufferData(physicalDevice, device, resultSizeInBytes, vk::BufferUsageFlagBits::eRayTracingNV,
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal));
|
||||
|
||||
vk::AccelerationStructureMemoryRequirementsInfoNV buildScratchRequirements(vk::AccelerationStructureMemoryRequirementsTypeNV::eBuildScratch,
|
||||
*accelerationStructureData.acclerationStructure);
|
||||
@ -95,13 +95,13 @@ AccelerationStructureData createAccelerationStructureData(vk::PhysicalDevice con
|
||||
device->getAccelerationStructureMemoryRequirementsNV(updateScratchRequirements).memoryRequirements.size);
|
||||
assert(0 < scratchSizeInBytes);
|
||||
|
||||
accelerationStructureData.scratchBufferData = std::make_unique<vk::su::BufferData>(physicalDevice, device, scratchSizeInBytes, vk::BufferUsageFlagBits::eRayTracingNV,
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal);
|
||||
accelerationStructureData.scratchBufferData = std::unique_ptr<vk::su::BufferData>(new vk::su::BufferData(physicalDevice, device, scratchSizeInBytes, vk::BufferUsageFlagBits::eRayTracingNV,
|
||||
vk::MemoryPropertyFlagBits::eDeviceLocal));
|
||||
|
||||
if (!instances.empty())
|
||||
{
|
||||
accelerationStructureData.instanceBufferData = std::make_unique<vk::su::BufferData>(physicalDevice, device, instances.size() * sizeof(GeometryInstanceData),
|
||||
vk::BufferUsageFlagBits::eRayTracingNV);
|
||||
accelerationStructureData.instanceBufferData = std::unique_ptr<vk::su::BufferData>(new vk::su::BufferData(physicalDevice, device, instances.size() * sizeof(GeometryInstanceData),
|
||||
vk::BufferUsageFlagBits::eRayTracingNV));
|
||||
|
||||
std::vector<GeometryInstanceData> geometryInstanceData;
|
||||
for(size_t i = 0; i < instances.size(); i++)
|
||||
|
@ -41,4 +41,3 @@ target_link_libraries(utils PUBLIC glslang)
|
||||
target_link_libraries(utils PUBLIC glslang-default-resource-limits)
|
||||
target_link_libraries(utils PUBLIC SPIRV)
|
||||
target_compile_definitions(utils PUBLIC VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1)
|
||||
target_compile_features(utils PUBLIC cxx_std_14)
|
@ -448,7 +448,7 @@ namespace vk
|
||||
for (size_t i = 0; i < sizeof(requestedFormats) / sizeof(requestedFormats[0]); i++)
|
||||
{
|
||||
vk::Format requestedFormat = requestedFormats[i];
|
||||
auto it = std::find_if(formats.begin(), formats.end(), [requestedFormat, requestedColorSpace](auto const& f) { return (f.format == requestedFormat) && (f.colorSpace == requestedColorSpace); });
|
||||
auto it = std::find_if(formats.begin(), formats.end(), [requestedFormat, requestedColorSpace](vk::SurfaceFormatKHR const& f) { return (f.format == requestedFormat) && (f.colorSpace == requestedColorSpace); });
|
||||
if (it != formats.end())
|
||||
{
|
||||
pickedFormat = *it;
|
||||
@ -802,7 +802,7 @@ namespace vk
|
||||
if (needsStaging)
|
||||
{
|
||||
assert((formatProperties.optimalTilingFeatures & formatFeatureFlags) == formatFeatureFlags);
|
||||
stagingBufferData = std::make_unique<BufferData>(physicalDevice, device, extent.width * extent.height * 4, vk::BufferUsageFlagBits::eTransferSrc);
|
||||
stagingBufferData = std::unique_ptr<BufferData>(new BufferData(physicalDevice, device, extent.width * extent.height * 4, vk::BufferUsageFlagBits::eTransferSrc));
|
||||
imageTiling = vk::ImageTiling::eOptimal;
|
||||
usageFlags |= vk::ImageUsageFlagBits::eTransferDst;
|
||||
initialLayout = vk::ImageLayout::eUndefined;
|
||||
@ -813,8 +813,8 @@ namespace vk
|
||||
initialLayout = vk::ImageLayout::ePreinitialized;
|
||||
requirements = vk::MemoryPropertyFlagBits::eHostCoherent | vk::MemoryPropertyFlagBits::eHostVisible;
|
||||
}
|
||||
imageData = std::make_unique<ImageData>(physicalDevice, device, format, extent, imageTiling, usageFlags | vk::ImageUsageFlagBits::eSampled, initialLayout, requirements,
|
||||
vk::ImageAspectFlagBits::eColor);
|
||||
imageData = std::unique_ptr<ImageData>(new ImageData(physicalDevice, device, format, extent, imageTiling, usageFlags | vk::ImageUsageFlagBits::eSampled, initialLayout, requirements,
|
||||
vk::ImageAspectFlagBits::eColor));
|
||||
|
||||
textureSampler = device->createSamplerUnique(vk::SamplerCreateInfo(vk::SamplerCreateFlags(), vk::Filter::eLinear, vk::Filter::eLinear, vk::SamplerMipmapMode::eLinear,
|
||||
vk::SamplerAddressMode::eRepeat, vk::SamplerAddressMode::eRepeat, vk::SamplerAddressMode::eRepeat, 0.0f, anisotropyEnable,
|
||||
|
Loading…
Reference in New Issue
Block a user