From 54fced9dd3dec947710ed97a97e133c5e4a344db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Wed, 23 Mar 2016 15:45:46 +0100 Subject: [PATCH] changed functions with optional std::string parameters from "std::string const &" to "vk::Optional const &"; moved vk::Optional constructor on std::nullptr_t from private to public; introduced vk::Optional::operator->() and explicit operator bool(); removed static operator null() on all struct-wrapper classes --- README.md | 412 +++++++++++------------ VkCppGenerator.cpp | 146 +++++---- vulkan/vk_cpp.h | 789 +++++---------------------------------------- 3 files changed, 370 insertions(+), 977 deletions(-) diff --git a/README.md b/README.md index 2500b5b..c704334 100644 --- a/README.md +++ b/README.md @@ -1,207 +1,207 @@ -# Open-Source Vulkan C++ API - -Vulkan is a C API and as such inherits all common pitfalls of using a general C programming library. The motivation of a low-level Vulkan C++ API is to avoid these common pitfalls by applying commonly known C++ features while keeping the overall structure of a Vulkan program and preserving the full freedom it provides as low-level graphics API. An additional guideline we followed was not to introduce additional runtime overhead by providing a header-only library with inline functions. - -Have a look at the following piece of code which creates a VkImage: - -```c++ - VkImageCreateInfo ci; - ci.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; - ci.pNext = nullptr; - ci.flags = ...some flags...; - ci.imageType = VK_IMAGE_TYPE_2D; - ci.format = VK_FORMAT_R8G8B8A8_UNORM; - ci.extent = VkExtent3D { width, height, 1 }; - ci.mipLevels = 1; - ci.arrayLayers = 1; - ci.samples = VK_SAMPLE_COUNT_1_BIT; - ci.tiling = VK_IMAGE_TILING_OPTIMAL; - ci.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; - ci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; - ci.queueFamilyIndexCount = 0; - ci.pQueueFamilyIndices = 0; - ci.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - vkCreateImage(device, &ci, allocator, &image)); -``` - -There may be some issues that can happen when filling the structure which cannot be caught at compile time: - -* initialization of ```ci.sType``` using wrong enum values -* uninitialized data fields (e.g. missing initialization of ```ci.mipLevels```) -* use of invalid bits for ```ci.flags``` (no type-safety for bits) -* use of incorrect enums for fields (no type-safety for enums) - -These initializations will most likely show up as random runtime errors, which usually are nasty and time-consuming to debug. -Our auto-generated, C++ 11-conform layer uses commonly known C++ features like implicit initialization through constructors -to avoid incorrect or missing initializations and introduces type-safety with scoped enums to turn explicit initialization -errors into compile errors. Following is a list of features and conventions introduced by our Vulkan C++ layer: - -* works along the official C version of the API -* defines all symbols within the 'vk' namespace and to avoid redundancy the vk/Vk/VK_ prefixes have been removed from all symbols, i.e. ```vk::ImageCreateInfo``` for VkImageCreateInfo. -* camel case syntax with an 'e' prefix has been introduced for all enums, i.e. ```vk::ImageType::e2D``` (the prefix was a compromise, more about that later) removes the 'BIT' suffix from all flag related enums, i.e. ```vk::ImageUsage::eColorAttachment```. -* introduces constructors for all structs, which by default set the appropriate ```sType``` and all other values to zero. -* encapsulates member variables of the structs with getter and setter functions, i.e. ```ci.imageType()``` to get a value and ```ci.imageType(vk::ImageType::e2D)``` to set a value. -* introduces wrapper classes around the vulkan handles, i.e. ```vk::CommandBuffer``` for VkCommandBuffer -* introduces member functions of those wrapper classes, that map to vulkan functions getting the corresponding vulkan handle as its first argument. The type of that handle is stripped from the function name, i.e. ```vk::Device::getProcAddr``` for vkGetDeviceProcAddr. Note the special handling for the class CommandBuffer, where most of the vulkan functions would just include "Cmd", instead of "CommandBuffer", i.e. ```vk::CommandBuffer::bindPipeline``` for vkCmdBindPipeline. -With those changes applied, the updated code snippet looks like this: - - -```c++ -vk::ImageCreateInfo ci; -ci.flags(...some flags...); -ci.imageType(vk::ImageType::e2D); -ci.format(vk::Format::eR8G8B8A8Unorm); -ci.extent(vk::Extent3D { width, height, 1 }); -ci.mipLevels(1); -ci.arrayLayers(1); -ci.samples(1); -ci.tiling(vk::ImageTiling::eOptimal); -ci.usage(vk::ImageUsage::eColorAttachment); -ci.sharingMode(vk::SharingMode::eExclusive); - // ci.queueFamilyIndexCount(0) // no need to set, already initialized - // ci.pQueueFamilyIndices(0) // no need to set, already initialized -ci.initialLayout(vk::ImageLayout::eUndefined); -device.createImage(&ci, allocator, &image); -``` - -Which is a total of 13 lines of code, versus 17 lines for the C version. In addition, this code is more robust as described above. - -# Type-safe Enums - -Splitting up the C enums into a namespace and scoped enums resulted in two compilation issues. -First some enums started with a digit like ```vk::ImageType::1D``` which resulted in a compilation error. -Second, there's the risk that upper symbols like ```vk::CompositeAlphaFlagBitsKHR::OPAQUE``` do clash with preprocessor defines. -In the given example ```OPAQUE``` has been defined in ```win32gdi.h``` resulting a compilation error. - -To overcome those two issues the symbols have been converted to camel case and the prefix 'e' has been added so that each enum starts with a letter. - -# Improvements to Bit Flags - -After those changes the code might look more familiar to C++ developers, but there is still no gain with regards to safety. - With C++ features available we replaced all Vulkan enums with scoped enums to achieve type safety which already uncovered -a few small issues in our code. The good thing with scoped enums is that there is no implicit casts to integer types anymore. -The downside is that OR'ing the bits for the flags does not work anymore without an explicit cast. As a solution to this problem -we have introduced a new ```vk::Flags``` template which is used for all flags. This class supports the standard -operations one usually needs on bitmasks like &=, |=, & and |. Except for the initialization with 0, which is being replaced by -the default constructor, the ```vk::Flags``` class works exactly like a normal bitmask with the improvement that -it is impossible to set bits not specified by the corresponding enum. To generate a bit mask with two bits set write: - -```c++ -ci.usage = vk::ImageUsage::eColorAttachment | vk::ImageUsage::eStorage; -``` - -By adding the scoped enums and ```vk::Flags``` the C++ API provides type safety for all enums and flags which is a -big improvement. This leaves the remaining issue that the compiler might not detect uninitialized fields in structs. As a solution -we have added constructors to all structs which accept all values defined by the corresponding struct. - -```c++ -vk::ImageCreateInfo ci( - ...some flags..., vk::ImageType::e2D, vk::Format::eR8G8B8A8Unorm, - vk::Extent3D { width, height, 1 }, 1, 1, - vk::SampleCount::e1, vk::ImageTiling::eOptimal, - vk::ImageUsage::eColorAttachment, vk::SharingMode::eExclusive, - 0, 0, vk::ImageLayout::eUndefined); -``` - -# String conversions - -At development time it can be quite handy to have a utility function that can convert an enum or flags to a string for debugging purposes. To achieve this, -we have implemented ```getString(type)``` functions for all enums and flags. Calling ```getString(vk::SharingMode::eExclusive)``` will return 'Exclusive' and calling -```getString(vk::QueueFlagBits::eGraphics | vk::QueueFlagBits::eCompute)``` will return the concatenated string 'Graphics | Compute'. - -# Alternative Initialization of Structs - -Another nice feature of those constructors is that sType is being initialized internally and thus is always correct. - -Finally, we have added a default constructor to each struct which initializes all values to 0 to allow setting the values with the named parameter idiom which is similar to the designated initializer list of C99. - -```c++ -vk::ImageCreateInfo ci = vk::ImageCreateInfo() - .flags(...some flags...) - .imageType(vk::ImageType::e2D) - .format(vk::Format::eR8G8B8A8Unorm) - .extent(vk::Extent3D { width, height, 1 }) - .mipLevels(1) - .arrayLayers(1) - .samples(1) - .tiling(vk::ImageTiling::eOptimal) - .usage(vk::ImageUsage::eColorAttachment) - .sharingMode(vk::SharingMode::eExclusive) - // .queueFamilyIndexCount(0) // no need to set, already initialized - // .pQueueFamilyIndices(0) // no need to set, already initialized - .initialLayout(vk::ImageLayout::eUndefined); -device.createImage(&ci, allocator, &image); -``` - -# Enhancements beyond native Vulkan -To provide a more object oriented feeling we're providing classes for each handle which include all Vulkan functions where the first -parameter matches the handle. In addition to this we made a few changes to the signatures of the member functions -* To enable the enhanced mode put ```#define VKCPP_ENHANCED_MODE``` before including ```vk_cpp.h``` -* ```(count, T*)``` has been replaced by ```std::vector``` -* ```const char *``` has been replaced by ```std::string ``` -* ```T const*``` has been replaced by ```T const &``` to allow temporary objects. This is useful to pass small structures like ```vk::ClearColorValue``` or ```vk::Extent*``` -```commandBuffer.clearColorImage(image, layout, std::array{1.0f, 1.0f, 1.0f, 1.0f}, {...});``` -Optional parameters are being replaced by ```Optional const &``` which accept a type of ```T const&```. To tell the wrapper that a nullptr should be passed use ```T::null()```. -* The wrapper will throw a ```std::system_error``` if a ```vk::Result``` return value is not an success code. If there's only a single success code it's not returned at all. In this case functions with a single output value do return this output value instead. - -Here are a few code examples: -```c++ - try { - VkInstance nativeInstance = nullptr; // Fetch the instance from a favorite toolkit - - // create a vkcpp handle from a native handle - vk::Instance i(nativeInstance); - - // operator=(VkInstance const &) is also supported - i = nativeInstance; - - // Get VkInstance from vk::Instance - nativeInstance = i; - - // Get a std::vector as result of an enumeration call. - std::vector physicalDevices = i.enumeratePhysicalDevices(); - vk::FormatProperties formatProperties = physicalDevices[0].getFormatProperties(vk::Format::eR8G8B8A8Unorm); - - vk::CommandBuffer commandBuffer = ...; - vk::Buffer buffer = ...; - - // Accept std::vector as source for updateBuffer - commandBuffer.updateBuffer(buffer, 0, {some values}); // update buffer with std::vector - - // Sometimes it's necessary to pass a nullptr to a struct. For this case we've added Optional T::null() to all structs T as replacement for the nullptr. - device.allocateMemory(allocateInfo, vk::AllocationCallbacks::null()); - - } - catch (std::system_error e) - { - std::cerr << "Vulkan failure: " << e.what() << std::endl; - } -``` - -# Usage -To start with the C++ version of the Vulkan API download header from GIT, put it in a vulkan subdirectory and add -```#include ``` to your source code. - -To build the header for a given vk.xml specification continue with the following steps: - -* Build VkCppGenerator -* Grab your favourite version vk.xml from Khronos -* Excute ```VkCppGenerator ``` to generate ```vk_cpp.h``` in the current working directory. - -# Build instructions for VkCppGenerator - -* Clone the repository: ```git clone https://github.com/nvpro-pipeline/vkcpp.git``` -* Update submodules: ```git submodule update --init --recursive``` -* Use CMake to generate a solution or makefile for your favourite build environment -* Launch the build - -# Providing Pull Requests - -NVIDIA is happy to review and consider pull requests for merging into the main tree of vkcpp for bug fixes and features. Before providing a pull request to NVIDIA, please note the following: - -* A pull request provided to this repo by a developer constitutes permission from the developer for NVIDIA to merge the provided - changes or any NVIDIA modified version of these changes to the repo. NVIDIA may remove or change the code at any time and in any - way deemed appropriate. Due to the required paperwork please refrain from providing pull requests for simple changes and file an issue - describing a bug or the desired change instead. -* Not all pull requests can be or will be accepted. NVIDIA will close pull requests that it does not intend to merge. +# Open-Source Vulkan C++ API + +Vulkan is a C API and as such inherits all common pitfalls of using a general C programming library. The motivation of a low-level Vulkan C++ API is to avoid these common pitfalls by applying commonly known C++ features while keeping the overall structure of a Vulkan program and preserving the full freedom it provides as low-level graphics API. An additional guideline we followed was not to introduce additional runtime overhead by providing a header-only library with inline functions. + +Have a look at the following piece of code which creates a VkImage: + +```c++ + VkImageCreateInfo ci; + ci.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + ci.pNext = nullptr; + ci.flags = ...some flags...; + ci.imageType = VK_IMAGE_TYPE_2D; + ci.format = VK_FORMAT_R8G8B8A8_UNORM; + ci.extent = VkExtent3D { width, height, 1 }; + ci.mipLevels = 1; + ci.arrayLayers = 1; + ci.samples = VK_SAMPLE_COUNT_1_BIT; + ci.tiling = VK_IMAGE_TILING_OPTIMAL; + ci.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + ci.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + ci.queueFamilyIndexCount = 0; + ci.pQueueFamilyIndices = 0; + ci.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + vkCreateImage(device, &ci, allocator, &image)); +``` + +There may be some issues that can happen when filling the structure which cannot be caught at compile time: + +* initialization of ```ci.sType``` using wrong enum values +* uninitialized data fields (e.g. missing initialization of ```ci.mipLevels```) +* use of invalid bits for ```ci.flags``` (no type-safety for bits) +* use of incorrect enums for fields (no type-safety for enums) + +These initializations will most likely show up as random runtime errors, which usually are nasty and time-consuming to debug. +Our auto-generated, C++ 11-conform layer uses commonly known C++ features like implicit initialization through constructors +to avoid incorrect or missing initializations and introduces type-safety with scoped enums to turn explicit initialization +errors into compile errors. Following is a list of features and conventions introduced by our Vulkan C++ layer: + +* works along the official C version of the API +* defines all symbols within the 'vk' namespace and to avoid redundancy the vk/Vk/VK_ prefixes have been removed from all symbols, i.e. ```vk::ImageCreateInfo``` for VkImageCreateInfo. +* camel case syntax with an 'e' prefix has been introduced for all enums, i.e. ```vk::ImageType::e2D``` (the prefix was a compromise, more about that later) removes the 'BIT' suffix from all flag related enums, i.e. ```vk::ImageUsage::eColorAttachment```. +* introduces constructors for all structs, which by default set the appropriate ```sType``` and all other values to zero. +* encapsulates member variables of the structs with getter and setter functions, i.e. ```ci.imageType()``` to get a value and ```ci.imageType(vk::ImageType::e2D)``` to set a value. +* introduces wrapper classes around the vulkan handles, i.e. ```vk::CommandBuffer``` for VkCommandBuffer +* introduces member functions of those wrapper classes, that map to vulkan functions getting the corresponding vulkan handle as its first argument. The type of that handle is stripped from the function name, i.e. ```vk::Device::getProcAddr``` for vkGetDeviceProcAddr. Note the special handling for the class CommandBuffer, where most of the vulkan functions would just include "Cmd", instead of "CommandBuffer", i.e. ```vk::CommandBuffer::bindPipeline``` for vkCmdBindPipeline. +With those changes applied, the updated code snippet looks like this: + + +```c++ +vk::ImageCreateInfo ci; +ci.flags(...some flags...); +ci.imageType(vk::ImageType::e2D); +ci.format(vk::Format::eR8G8B8A8Unorm); +ci.extent(vk::Extent3D { width, height, 1 }); +ci.mipLevels(1); +ci.arrayLayers(1); +ci.samples(1); +ci.tiling(vk::ImageTiling::eOptimal); +ci.usage(vk::ImageUsage::eColorAttachment); +ci.sharingMode(vk::SharingMode::eExclusive); + // ci.queueFamilyIndexCount(0) // no need to set, already initialized + // ci.pQueueFamilyIndices(0) // no need to set, already initialized +ci.initialLayout(vk::ImageLayout::eUndefined); +device.createImage(&ci, allocator, &image); +``` + +Which is a total of 13 lines of code, versus 17 lines for the C version. In addition, this code is more robust as described above. + +# Type-safe Enums + +Splitting up the C enums into a namespace and scoped enums resulted in two compilation issues. +First some enums started with a digit like ```vk::ImageType::1D``` which resulted in a compilation error. +Second, there's the risk that upper symbols like ```vk::CompositeAlphaFlagBitsKHR::OPAQUE``` do clash with preprocessor defines. +In the given example ```OPAQUE``` has been defined in ```win32gdi.h``` resulting a compilation error. + +To overcome those two issues the symbols have been converted to camel case and the prefix 'e' has been added so that each enum starts with a letter. + +# Improvements to Bit Flags + +After those changes the code might look more familiar to C++ developers, but there is still no gain with regards to safety. + With C++ features available we replaced all Vulkan enums with scoped enums to achieve type safety which already uncovered +a few small issues in our code. The good thing with scoped enums is that there is no implicit casts to integer types anymore. +The downside is that OR'ing the bits for the flags does not work anymore without an explicit cast. As a solution to this problem +we have introduced a new ```vk::Flags``` template which is used for all flags. This class supports the standard +operations one usually needs on bitmasks like &=, |=, & and |. Except for the initialization with 0, which is being replaced by +the default constructor, the ```vk::Flags``` class works exactly like a normal bitmask with the improvement that +it is impossible to set bits not specified by the corresponding enum. To generate a bit mask with two bits set write: + +```c++ +ci.usage = vk::ImageUsage::eColorAttachment | vk::ImageUsage::eStorage; +``` + +By adding the scoped enums and ```vk::Flags``` the C++ API provides type safety for all enums and flags which is a +big improvement. This leaves the remaining issue that the compiler might not detect uninitialized fields in structs. As a solution +we have added constructors to all structs which accept all values defined by the corresponding struct. + +```c++ +vk::ImageCreateInfo ci( + ...some flags..., vk::ImageType::e2D, vk::Format::eR8G8B8A8Unorm, + vk::Extent3D { width, height, 1 }, 1, 1, + vk::SampleCount::e1, vk::ImageTiling::eOptimal, + vk::ImageUsage::eColorAttachment, vk::SharingMode::eExclusive, + 0, 0, vk::ImageLayout::eUndefined); +``` + +# String conversions + +At development time it can be quite handy to have a utility function that can convert an enum or flags to a string for debugging purposes. To achieve this, +we have implemented ```to_string(type)``` functions for all enums and flags. Calling ```to_string(vk::SharingMode::eExclusive)``` will return 'Exclusive' and calling +```to_string(vk::QueueFlagBits::eGraphics | vk::QueueFlagBits::eCompute)``` will return the concatenated string 'Graphics | Compute'. + +# Alternative Initialization of Structs + +Another nice feature of those constructors is that sType is being initialized internally and thus is always correct. + +Finally, we have added a default constructor to each struct which initializes all values to 0 to allow setting the values with the named parameter idiom which is similar to the designated initializer list of C99. + +```c++ +vk::ImageCreateInfo ci = vk::ImageCreateInfo() + .flags(...some flags...) + .imageType(vk::ImageType::e2D) + .format(vk::Format::eR8G8B8A8Unorm) + .extent(vk::Extent3D { width, height, 1 }) + .mipLevels(1) + .arrayLayers(1) + .samples(1) + .tiling(vk::ImageTiling::eOptimal) + .usage(vk::ImageUsage::eColorAttachment) + .sharingMode(vk::SharingMode::eExclusive) + // .queueFamilyIndexCount(0) // no need to set, already initialized + // .pQueueFamilyIndices(0) // no need to set, already initialized + .initialLayout(vk::ImageLayout::eUndefined); +device.createImage(&ci, allocator, &image); +``` + +# Enhancements beyond native Vulkan +To provide a more object oriented feeling we're providing classes for each handle which include all Vulkan functions where the first +parameter matches the handle. In addition to this we made a few changes to the signatures of the member functions +* To enable the enhanced mode put ```#define VKCPP_ENHANCED_MODE``` before including ```vk_cpp.h``` +* ```(count, T*)``` has been replaced by ```std::vector``` +* ```const char *``` has been replaced by ```std::string ``` +* ```T const*``` has been replaced by ```T const &``` to allow temporary objects. This is useful to pass small structures like ```vk::ClearColorValue``` or ```vk::Extent*``` +```commandBuffer.clearColorImage(image, layout, std::array{1.0f, 1.0f, 1.0f, 1.0f}, {...});``` +Optional parameters are being replaced by ```Optional const &``` which accept a type of ```T const&```. ```nullptr``` can be used to initialize an empty ```Optional```. +* The wrapper will throw a ```std::system_error``` if a ```vk::Result``` return value is not an success code. If there's only a single success code it's not returned at all. In this case functions with a single output value do return this output value instead. + +Here are a few code examples: +```c++ + try { + VkInstance nativeInstance = nullptr; // Fetch the instance from a favorite toolkit + + // create a vkcpp handle from a native handle + vk::Instance i(nativeInstance); + + // operator=(VkInstance const &) is also supported + i = nativeInstance; + + // Get VkInstance from vk::Instance + nativeInstance = i; + + // Get a std::vector as result of an enumeration call. + std::vector physicalDevices = i.enumeratePhysicalDevices(); + vk::FormatProperties formatProperties = physicalDevices[0].getFormatProperties(vk::Format::eR8G8B8A8Unorm); + + vk::CommandBuffer commandBuffer = ...; + vk::Buffer buffer = ...; + + // Accept std::vector as source for updateBuffer + commandBuffer.updateBuffer(buffer, 0, {some values}); // update buffer with std::vector + + // Sometimes it's necessary to pass a nullptr to a struct. For this case we've added Optional(std::nullptr_t). + device.allocateMemory(allocateInfo, nullptr); + + } + catch (std::system_error e) + { + std::cerr << "Vulkan failure: " << e.what() << std::endl; + } +``` + +# Usage +To start with the C++ version of the Vulkan API download header from GIT, put it in a vulkan subdirectory and add +```#include ``` to your source code. + +To build the header for a given vk.xml specification continue with the following steps: + +* Build VkCppGenerator +* Grab your favourite version vk.xml from Khronos +* Excute ```VkCppGenerator ``` to generate ```vk_cpp.h``` in the current working directory. + +# Build instructions for VkCppGenerator + +* Clone the repository: ```git clone https://github.com/nvpro-pipeline/vkcpp.git``` +* Update submodules: ```git submodule update --init --recursive``` +* Use CMake to generate a solution or makefile for your favourite build environment +* Launch the build + +# Providing Pull Requests + +NVIDIA is happy to review and consider pull requests for merging into the main tree of vkcpp for bug fixes and features. Before providing a pull request to NVIDIA, please note the following: + +* A pull request provided to this repo by a developer constitutes permission from the developer for NVIDIA to merge the provided + changes or any NVIDIA modified version of these changes to the repo. NVIDIA may remove or change the code at any time and in any + way deemed appropriate. Due to the required paperwork please refrain from providing pull requests for simple changes and file an issue + describing a bug or the desired change instead. +* Not all pull requests can be or will be accepted. NVIDIA will close pull requests that it does not intend to merge. * The modified files and any new files must include the unmodified NVIDIA copyright header seen at the top of all shipping files. \ No newline at end of file diff --git a/VkCppGenerator.cpp b/VkCppGenerator.cpp index 4ca2f13..7acb72c 100644 --- a/VkCppGenerator.cpp +++ b/VkCppGenerator.cpp @@ -215,20 +215,21 @@ const std::string flagsHeader( ); std::string const optionalClassHeader = ( -" template \n" -" class Optional\n" -" {\n" -" public:\n" -" Optional(RefType & reference) { m_ptr = &reference; }\n" -"\n" -" operator RefType*() const { return m_ptr; }\n" -"\n" -" private:\n" -" Optional(std::nullptr_t) { m_ptr = nullptr; }\n" -" friend RefType;\n" -" RefType *m_ptr;\n" -" };\n" -"\n" + " template \n" + " class Optional\n" + " {\n" + " public:\n" + " Optional(RefType & reference) { m_ptr = &reference; }\n" + " Optional(std::nullptr_t) { m_ptr = nullptr; }\n" + "\n" + " operator RefType*() const { return m_ptr; }\n" + " RefType const* operator->() const { return m_ptr; }\n" + " explicit operator bool() const { return !m_ptr; }\n" + "\n" + " private:\n" + " RefType *m_ptr;\n" + " };\n" + "\n" ); // trim from end @@ -1603,7 +1604,15 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde } else if (commandData.arguments[it->first].pureType == "char") { - ofs << reduceName(commandData.arguments[it->first].name) << ".c_str()"; + ofs << reduceName(commandData.arguments[it->first].name); + if (commandData.arguments[it->first].optional) + { + ofs << " ? " << reduceName(commandData.arguments[it->first].name) << "->c_str() : nullptr"; + } + else + { + ofs << ".c_str()"; + } } else { @@ -1626,11 +1635,11 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde { ofs << "&"; } - ofs << reduceName(commandData.arguments[i].name) - << (commandData.arguments[i].optional ? "))" : " )"); + ofs << reduceName(commandData.arguments[i].name) << (commandData.arguments[i].optional ? "))" : " )"); } else { + assert(!commandData.arguments[i].optional); ofs << "reinterpret_cast( &" << reduceName(commandData.arguments[i].name) << " )"; } } @@ -1646,7 +1655,15 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde if (commandData.arguments[i].type.find("const") != std::string::npos) { assert(commandData.arguments[i].type.find("char") != std::string::npos); - ofs << reduceName(commandData.arguments[i].name) << ".c_str()"; + ofs << reduceName(commandData.arguments[i].name); + if (commandData.arguments[i].optional) + { + ofs << " ? " << reduceName(commandData.arguments[i].name) << "->c_str() : nullptr"; + } + else + { + ofs << ".c_str()"; + } } else { @@ -1864,63 +1881,65 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st { ofs << ", "; } - if (vectorParameters.find(i) == vectorParameters.end()) + + std::map::const_iterator it = vectorParameters.find(i); + size_t pos = commandData.arguments[i].type.find('*'); + if ((it == vectorParameters.end()) && (pos == std::string::npos)) { - size_t pos = commandData.arguments[i].type.find('*'); - if (pos == std::string::npos) + ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name; + if (!commandData.arguments[i].arraySize.empty()) { - ofs << commandData.arguments[i].type << " " << commandData.arguments[i].name; - if (!commandData.arguments[i].arraySize.empty()) - { - ofs << "[" << commandData.arguments[i].arraySize << "]"; - } - } - else - { - std::string type = commandData.arguments[i].type; - if (type.find("char") != std::string::npos) - { - type = "std::string const&"; - } - else - { - assert(type[pos] == '*'); - if (commandData.arguments[i].optional) - { - type[pos] = ' '; - type = "vk::Optional<" + trimEnd(type) + "> const &"; - } - else - { - type[pos] = '&'; - } - } - ofs << type << " " << reduceName(commandData.arguments[i].name); + ofs << "[" << commandData.arguments[i].arraySize << "]"; } } else { - if (templateIndex == i) + bool optional = commandData.arguments[i].optional && ((it == vectorParameters.end()) || (it->second == ~0)); + if (optional) { - ofs << "std::vector "; + ofs << "vk::Optional<"; } - else if (commandData.arguments[i].pureType == "char") + if (vectorParameters.find(i) == vectorParameters.end()) { - ofs << "std::string "; - } - else if (commandData.arguments[i].pureType == "void") - { - ofs << "std::vector "; + assert(pos != std::string::npos); + if (commandData.arguments[i].type.find("char") != std::string::npos) + { + ofs << "std::string const"; + } + else + { + assert(commandData.arguments[i].type[pos] == '*'); + ofs << trimEnd(commandData.arguments[i].type.substr(0, pos)); + } } else { - ofs << "std::vector<" << commandData.arguments[i].pureType << "> "; + if (templateIndex == i) + { + ofs << "std::vector"; + } + else if (commandData.arguments[i].pureType == "char") + { + ofs << "std::string"; + } + else if (commandData.arguments[i].pureType == "void") + { + ofs << "std::vector"; + } + else + { + ofs << "std::vector<" << commandData.arguments[i].pureType << ">"; + } + if (commandData.arguments[i].type.find("const") != std::string::npos) + { + ofs << " const"; + } } - if (commandData.arguments[i].type.find("const") != std::string::npos) + if (optional) { - ofs << "const"; + ofs << "> const"; } - ofs << "& " << reduceName(commandData.arguments[i].name); + ofs << " & " << reduceName(commandData.arguments[i].name); } argEncountered = true; } @@ -2506,13 +2525,6 @@ void writeTypeStruct( std::ofstream & ofs, VkData const& vkData, DependencyData } } - // null handle - ofs << " static Optional null()" << std::endl - << " {" << std::endl - << " return Optional(nullptr);" << std::endl - << " }" << std::endl - << std::endl; - // the cast-operator to the wrapped struct, and the struct itself as a private member variable ofs << " operator const Vk" << dependencyData.name << "&() const" << std::endl << " {" << std::endl diff --git a/vulkan/vk_cpp.h b/vulkan/vk_cpp.h index f752cc5..fb437f3 100644 --- a/vulkan/vk_cpp.h +++ b/vulkan/vk_cpp.h @@ -189,12 +189,13 @@ namespace vk { public: Optional(RefType & reference) { m_ptr = &reference; } + Optional(std::nullptr_t) { m_ptr = nullptr; } operator RefType*() const { return m_ptr; } + RefType const* operator->() const { return m_ptr; } + explicit operator bool() const { return !m_ptr; } private: - Optional(std::nullptr_t) { m_ptr = nullptr; } - friend RefType; RefType *m_ptr; }; @@ -1840,11 +1841,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkOffset2D&() const { return m_offset2D; @@ -1928,11 +1924,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkOffset3D&() const { return m_offset3D; @@ -1999,11 +1990,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkExtent2D&() const { return m_extent2D; @@ -2087,11 +2073,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkExtent3D&() const { return m_extent3D; @@ -2226,11 +2207,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkViewport&() const { return m_viewport; @@ -2297,11 +2273,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkRect2D&() const { return m_rect2D; @@ -2385,11 +2356,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkClearRect&() const { return m_clearRect; @@ -2413,11 +2379,6 @@ namespace vk return m_extensionProperties.specVersion; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkExtensionProperties&() const { return m_extensionProperties; @@ -2451,11 +2412,6 @@ namespace vk return reinterpret_cast( m_layerProperties.description ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkLayerProperties&() const { return m_layerProperties; @@ -2586,11 +2542,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkAllocationCallbacks&() const { return m_allocationCallbacks; @@ -2619,11 +2570,6 @@ namespace vk return m_memoryRequirements.memoryTypeBits; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMemoryRequirements&() const { return m_memoryRequirements; @@ -2707,11 +2653,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorBufferInfo&() const { return m_descriptorBufferInfo; @@ -2750,11 +2691,6 @@ namespace vk return m_subresourceLayout.depthPitch; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSubresourceLayout&() const { return m_subresourceLayout; @@ -2838,11 +2774,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBufferCopy&() const { return m_bufferCopy; @@ -2926,11 +2857,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSpecializationMapEntry&() const { return m_specializationMapEntry; @@ -3031,11 +2957,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSpecializationInfo&() const { return m_specializationInfo; @@ -3177,11 +3098,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkClearDepthStencilValue&() const { return m_clearDepthStencilValue; @@ -4203,11 +4119,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPhysicalDeviceFeatures&() const { return m_physicalDeviceFeatures; @@ -4246,11 +4157,6 @@ namespace vk return m_physicalDeviceSparseProperties.residencyNonResidentStrict; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPhysicalDeviceSparseProperties&() const { return m_physicalDeviceSparseProperties; @@ -4351,11 +4257,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDrawIndirectCommand&() const { return m_drawIndirectCommand; @@ -4473,11 +4374,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDrawIndexedIndirectCommand&() const { return m_drawIndexedIndirectCommand; @@ -4561,11 +4457,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDispatchIndirectCommand&() const { return m_dispatchIndirectCommand; @@ -4632,11 +4523,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayPlanePropertiesKHR&() const { return m_displayPlanePropertiesKHR; @@ -4703,11 +4589,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayModeParametersKHR&() const { return m_displayModeParametersKHR; @@ -4774,11 +4655,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayModePropertiesKHR&() const { return m_displayModePropertiesKHR; @@ -4876,11 +4752,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorImageInfo&() const { return m_descriptorImageInfo; @@ -4947,11 +4818,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkAttachmentReference&() const { return m_attachmentReference; @@ -5106,11 +4972,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkComponentMapping&() const { return m_componentMapping; @@ -5192,11 +5053,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorPoolSize&() const { return m_descriptorPoolSize; @@ -5422,11 +5278,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSubpassDescription&() const { return m_subpassDescription; @@ -5715,11 +5566,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkStencilOpState&() const { return m_stencilOpState; @@ -5852,11 +5698,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkVertexInputBindingDescription&() const { return m_vertexInputBindingDescription; @@ -6146,11 +5987,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkVertexInputAttributeDescription&() const { return m_vertexInputAttributeDescription; @@ -6367,11 +6203,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkApplicationInfo&() const { return m_applicationInfo; @@ -6506,11 +6337,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDeviceQueueCreateInfo&() const { return m_deviceQueueCreateInfo; @@ -6713,11 +6539,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDeviceCreateInfo&() const { return m_deviceCreateInfo; @@ -6886,11 +6707,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkInstanceCreateInfo&() const { return m_instanceCreateInfo; @@ -6991,11 +6807,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMemoryAllocateInfo&() const { return m_memoryAllocateInfo; @@ -7113,11 +6924,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMappedMemoryRange&() const { return m_mappedMemoryRange; @@ -7320,11 +7126,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkWriteDescriptorSet&() const { return m_writeDescriptorSet; @@ -7510,11 +7311,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkCopyDescriptorSet&() const { return m_copyDescriptorSet; @@ -7666,11 +7462,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBufferViewCreateInfo&() const { return m_bufferViewCreateInfo; @@ -7788,11 +7579,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkShaderModuleCreateInfo&() const { return m_shaderModuleCreateInfo; @@ -7910,11 +7696,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorSetAllocateInfo&() const { return m_descriptorSetAllocateInfo; @@ -8066,11 +7847,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineVertexInputStateCreateInfo&() const { return m_pipelineVertexInputStateCreateInfo; @@ -8188,11 +7964,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineInputAssemblyStateCreateInfo&() const { return m_pipelineInputAssemblyStateCreateInfo; @@ -8293,11 +8064,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineTessellationStateCreateInfo&() const { return m_pipelineTessellationStateCreateInfo; @@ -8449,11 +8215,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineViewportStateCreateInfo&() const { return m_pipelineViewportStateCreateInfo; @@ -8707,11 +8468,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineRasterizationStateCreateInfo&() const { return m_pipelineRasterizationStateCreateInfo; @@ -8948,11 +8704,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineDepthStencilStateCreateInfo&() const { return m_pipelineDepthStencilStateCreateInfo; @@ -9070,11 +8821,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineCacheCreateInfo&() const { return m_pipelineCacheCreateInfo; @@ -9413,11 +9159,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSamplerCreateInfo&() const { return m_samplerCreateInfo; @@ -9535,11 +9276,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkCommandBufferAllocateInfo&() const { return m_commandBufferAllocateInfo; @@ -9691,11 +9427,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkRenderPassBeginInfo&() const { return m_renderPassBeginInfo; @@ -9779,11 +9510,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkEventCreateInfo&() const { return m_eventCreateInfo; @@ -9867,11 +9593,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSemaphoreCreateInfo&() const { return m_semaphoreCreateInfo; @@ -10057,11 +9778,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkFramebufferCreateInfo&() const { return m_framebufferCreateInfo; @@ -10162,11 +9878,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayModeCreateInfoKHR&() const { return m_displayModeCreateInfoKHR; @@ -10284,11 +9995,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayPresentInfoKHR&() const { return m_displayPresentInfoKHR; @@ -10390,11 +10096,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkAndroidSurfaceCreateInfoKHR&() const { return m_androidSurfaceCreateInfoKHR; @@ -10514,11 +10215,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMirSurfaceCreateInfoKHR&() const { return m_mirSurfaceCreateInfoKHR; @@ -10638,11 +10334,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkWaylandSurfaceCreateInfoKHR&() const { return m_waylandSurfaceCreateInfoKHR; @@ -10762,11 +10453,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkWin32SurfaceCreateInfoKHR&() const { return m_win32SurfaceCreateInfoKHR; @@ -10886,11 +10572,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkXlibSurfaceCreateInfoKHR&() const { return m_xlibSurfaceCreateInfoKHR; @@ -11010,11 +10691,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkXcbSurfaceCreateInfoKHR&() const { return m_xcbSurfaceCreateInfoKHR; @@ -11190,11 +10866,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPresentInfoKHR&() const { return m_presentInfoKHR; @@ -11325,11 +10996,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineDynamicStateCreateInfo&() const { return m_pipelineDynamicStateCreateInfo; @@ -11378,11 +11044,6 @@ namespace vk return reinterpret_cast( m_queueFamilyProperties.minImageTransferGranularity ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkQueueFamilyProperties&() const { return m_queueFamilyProperties; @@ -11422,11 +11083,6 @@ namespace vk return m_memoryType.heapIndex; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMemoryType&() const { return m_memoryType; @@ -11462,11 +11118,6 @@ namespace vk return reinterpret_cast( m_memoryHeap.flags ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMemoryHeap&() const { return m_memoryHeap; @@ -11500,11 +11151,6 @@ namespace vk return reinterpret_cast( m_physicalDeviceMemoryProperties.memoryHeaps ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPhysicalDeviceMemoryProperties&() const { return m_physicalDeviceMemoryProperties; @@ -11633,11 +11279,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkMemoryBarrier&() const { return m_memoryBarrier; @@ -11823,11 +11464,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBufferMemoryBarrier&() const { return m_bufferMemoryBarrier; @@ -12030,11 +11666,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBufferCreateInfo&() const { return m_bufferCreateInfo; @@ -12171,11 +11802,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorSetLayoutBinding&() const { return m_descriptorSetLayoutBinding; @@ -12293,11 +11919,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorSetLayoutCreateInfo&() const { return m_descriptorSetLayoutCreateInfo; @@ -12449,11 +12070,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineShaderStageCreateInfo&() const { return m_pipelineShaderStageCreateInfo; @@ -12537,11 +12153,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPushConstantRange&() const { return m_pushConstantRange; @@ -12693,11 +12304,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineLayoutCreateInfo&() const { return m_pipelineLayoutCreateInfo; @@ -12898,11 +12504,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkComputePipelineCreateInfo&() const { return m_computePipelineCreateInfo; @@ -13086,11 +12687,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineColorBlendAttachmentState&() const { return m_pipelineColorBlendAttachmentState; @@ -13259,11 +12855,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineColorBlendStateCreateInfo&() const { return m_pipelineColorBlendStateCreateInfo; @@ -13359,11 +12950,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkFenceCreateInfo&() const { return m_fenceCreateInfo; @@ -13416,11 +13002,6 @@ namespace vk return reinterpret_cast( m_formatProperties.bufferFeatures ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkFormatProperties&() const { return m_formatProperties; @@ -13652,11 +13233,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkCommandBufferInheritanceInfo&() const { return m_commandBufferInheritanceInfo; @@ -13757,11 +13333,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkCommandBufferBeginInfo&() const { return m_commandBufferBeginInfo; @@ -13896,11 +13467,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkQueryPoolCreateInfo&() const { return m_queryPoolCreateInfo; @@ -13999,11 +13565,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageSubresource&() const { return m_imageSubresource; @@ -14104,11 +13665,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageSubresourceLayers&() const { return m_imageSubresourceLayers; @@ -14226,11 +13782,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageSubresourceRange&() const { return m_imageSubresourceRange; @@ -14433,11 +13984,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageMemoryBarrier&() const { return m_imageMemoryBarrier; @@ -14606,11 +14152,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageViewCreateInfo&() const { return m_imageViewCreateInfo; @@ -14728,11 +14269,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageCopy&() const { return m_imageCopy; @@ -14833,11 +14369,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageBlit&() const { return m_imageBlit; @@ -14972,11 +14503,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBufferImageCopy&() const { return m_bufferImageCopy; @@ -15094,11 +14620,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageResolve&() const { return m_imageResolve; @@ -15182,11 +14703,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkClearAttachment&() const { return m_clearAttachment; @@ -15229,11 +14745,6 @@ namespace vk return reinterpret_cast( m_sparseImageFormatProperties.flags ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseImageFormatProperties&() const { return m_sparseImageFormatProperties; @@ -15272,11 +14783,6 @@ namespace vk return m_sparseImageMemoryRequirements.imageMipTailStride; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseImageMemoryRequirements&() const { return m_sparseImageMemoryRequirements; @@ -15406,11 +14912,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseMemoryBind&() const { return m_sparseMemoryBind; @@ -15545,11 +15046,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseImageMemoryBind&() const { return m_sparseImageMemoryBind; @@ -15633,11 +15129,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseBufferMemoryBindInfo&() const { return m_sparseBufferMemoryBindInfo; @@ -15721,11 +15212,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseImageOpaqueMemoryBindInfo&() const { return m_sparseImageOpaqueMemoryBindInfo; @@ -15809,11 +15295,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSparseImageMemoryBindInfo&() const { return m_sparseImageMemoryBindInfo; @@ -16050,11 +15531,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkBindSparseInfo&() const { return m_bindSparseInfo; @@ -16196,11 +15672,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkCommandPoolCreateInfo&() const { return m_commandPoolCreateInfo; @@ -16281,11 +15752,6 @@ namespace vk return m_imageFormatProperties.maxResourceSize; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageFormatProperties&() const { return m_imageFormatProperties; @@ -16573,11 +16039,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkImageCreateInfo&() const { return m_imageCreateInfo; @@ -16763,11 +16224,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPipelineMultisampleStateCreateInfo&() const { return m_pipelineMultisampleStateCreateInfo; @@ -17123,11 +16579,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkGraphicsPipelineCreateInfo&() const { return m_graphicsPipelineCreateInfo; @@ -17671,11 +17122,6 @@ namespace vk return m_physicalDeviceLimits.nonCoherentAtomSize; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPhysicalDeviceLimits&() const { return m_physicalDeviceLimits; @@ -17734,11 +17180,6 @@ namespace vk return reinterpret_cast( m_physicalDeviceProperties.sparseProperties ); } - static Optional null() - { - return Optional(nullptr); - } - operator const VkPhysicalDeviceProperties&() const { return m_physicalDeviceProperties; @@ -17936,11 +17377,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkAttachmentDescription&() const { return m_attachmentDescription; @@ -18101,11 +17537,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDescriptorPoolCreateInfo&() const { return m_descriptorPoolCreateInfo; @@ -18153,7 +17584,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void begin( const CommandBufferBeginInfo& beginInfo ) const + void begin( const CommandBufferBeginInfo & beginInfo ) const { Result result = static_cast( vkBeginCommandBuffer( m_commandBuffer, reinterpret_cast( &beginInfo ) ) ); if ( result != Result::eSuccess ) @@ -18219,7 +17650,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void setViewport( uint32_t firstViewport, std::vector const& viewports ) const + void setViewport( uint32_t firstViewport, std::vector const & viewports ) const { vkCmdSetViewport( m_commandBuffer, firstViewport, static_cast( viewports.size() ), reinterpret_cast( viewports.data() ) ); } @@ -18231,7 +17662,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void setScissor( uint32_t firstScissor, std::vector const& scissors ) const + void setScissor( uint32_t firstScissor, std::vector const & scissors ) const { vkCmdSetScissor( m_commandBuffer, firstScissor, static_cast( scissors.size() ), reinterpret_cast( scissors.data() ) ); } @@ -18341,7 +17772,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void bindDescriptorSets( PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint32_t firstSet, std::vector const& descriptorSets, std::vector const& dynamicOffsets ) const + void bindDescriptorSets( PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint32_t firstSet, std::vector const & descriptorSets, std::vector const & dynamicOffsets ) const { vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, static_cast( descriptorSets.size() ), reinterpret_cast( descriptorSets.data() ), static_cast( dynamicOffsets.size() ), dynamicOffsets.data() ); } @@ -18367,7 +17798,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void bindVertexBuffers( uint32_t firstBinding, std::vector const& buffers, std::vector const& offsets ) const + void bindVertexBuffers( uint32_t firstBinding, std::vector const & buffers, std::vector const & offsets ) const { if ( buffers.size() != offsets.size() ) { @@ -18467,7 +17898,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void copyBuffer( Buffer srcBuffer, Buffer dstBuffer, std::vector const& regions ) const + void copyBuffer( Buffer srcBuffer, Buffer dstBuffer, std::vector const & regions ) const { vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } @@ -18479,7 +17910,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const& regions ) const + void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } @@ -18491,7 +17922,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const& regions, Filter filter ) const + void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions, Filter filter ) const { vkCmdBlitImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ), static_cast( filter ) ); } @@ -18503,7 +17934,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, std::vector const& regions ) const + void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } @@ -18515,7 +17946,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, std::vector const& regions ) const + void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, std::vector const & regions ) const { vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } @@ -18528,7 +17959,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE template - void updateBuffer( Buffer dstBuffer, DeviceSize dstOffset, std::vector const& data ) const + void updateBuffer( Buffer dstBuffer, DeviceSize dstOffset, std::vector const & data ) const { static_assert( sizeof( T ) % sizeof( uint32_t ) == 0, "wrong size of template type T" ); vkCmdUpdateBuffer( m_commandBuffer, static_cast( dstBuffer ), dstOffset, static_cast( data.size() * sizeof( T ) ), reinterpret_cast( data.data() ) ); @@ -18555,7 +17986,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void clearColorImage( Image image, ImageLayout imageLayout, const ClearColorValue& color, std::vector const& ranges ) const + void clearColorImage( Image image, ImageLayout imageLayout, const ClearColorValue & color, std::vector const & ranges ) const { vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &color ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); } @@ -18567,7 +17998,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue& depthStencil, std::vector const& ranges ) const + void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue & depthStencil, std::vector const & ranges ) const { vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &depthStencil ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); } @@ -18579,7 +18010,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void clearAttachments( std::vector const& attachments, std::vector const& rects ) const + void clearAttachments( std::vector const & attachments, std::vector const & rects ) const { vkCmdClearAttachments( m_commandBuffer, static_cast( attachments.size() ), reinterpret_cast( attachments.data() ), static_cast( rects.size() ), reinterpret_cast( rects.data() ) ); } @@ -18591,7 +18022,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const& regions ) const + void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, std::vector const & regions ) const { vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } @@ -18631,7 +18062,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void waitEvents( std::vector const& events, PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, std::vector const& memoryBarriers, std::vector const& bufferMemoryBarriers, std::vector const& imageMemoryBarriers ) const + void waitEvents( std::vector const & events, PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, std::vector const & memoryBarriers, std::vector const & bufferMemoryBarriers, std::vector const & imageMemoryBarriers ) const { vkCmdWaitEvents( m_commandBuffer, static_cast( events.size() ), reinterpret_cast( events.data() ), static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( memoryBarriers.size() ), reinterpret_cast( memoryBarriers.data() ), static_cast( bufferMemoryBarriers.size() ), reinterpret_cast( bufferMemoryBarriers.data() ), static_cast( imageMemoryBarriers.size() ), reinterpret_cast( imageMemoryBarriers.data() ) ); } @@ -18643,7 +18074,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, std::vector const& memoryBarriers, std::vector const& bufferMemoryBarriers, std::vector const& imageMemoryBarriers ) const + void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, std::vector const & memoryBarriers, std::vector const & bufferMemoryBarriers, std::vector const & imageMemoryBarriers ) const { vkCmdPipelineBarrier( m_commandBuffer, static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( dependencyFlags ), static_cast( memoryBarriers.size() ), reinterpret_cast( memoryBarriers.data() ), static_cast( bufferMemoryBarriers.size() ), reinterpret_cast( bufferMemoryBarriers.data() ), static_cast( imageMemoryBarriers.size() ), reinterpret_cast( imageMemoryBarriers.data() ) ); } @@ -18725,7 +18156,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector const& values ) const + void pushConstants( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector const & values ) const { vkCmdPushConstants( m_commandBuffer, static_cast( layout ), static_cast( stageFlags ), offset, static_cast( values.size() ), values.data() ); } @@ -18737,7 +18168,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void beginRenderPass( const RenderPassBeginInfo& renderPassBegin, SubpassContents contents ) const + void beginRenderPass( const RenderPassBeginInfo & renderPassBegin, SubpassContents contents ) const { vkCmdBeginRenderPass( m_commandBuffer, reinterpret_cast( &renderPassBegin ), static_cast( contents ) ); } @@ -18777,7 +18208,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void executeCommands( std::vector const& commandBuffers ) const + void executeCommands( std::vector const & commandBuffers ) const { vkCmdExecuteCommands( m_commandBuffer, static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); } @@ -18947,11 +18378,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSubpassDependency&() const { return m_subpassDependency; @@ -19137,11 +18563,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkRenderPassCreateInfo&() const { return m_renderPassCreateInfo; @@ -19327,11 +18748,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSubmitInfo&() const { return m_submitInfo; @@ -19367,7 +18783,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void submit( std::vector const& submits, Fence fence ) const + void submit( std::vector const & submits, Fence fence ) const { Result result = static_cast( vkQueueSubmit( m_queue, static_cast( submits.size() ), reinterpret_cast( submits.data() ), static_cast( fence ) ) ); if ( result != Result::eSuccess ) @@ -19401,7 +18817,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void bindSparse( std::vector const& bindInfo, Fence fence ) const + void bindSparse( std::vector const & bindInfo, Fence fence ) const { Result result = static_cast( vkQueueBindSparse( m_queue, static_cast( bindInfo.size() ), reinterpret_cast( bindInfo.data() ), static_cast( fence ) ) ); if ( result != Result::eSuccess ) @@ -19417,7 +18833,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Result presentKHR( const PresentInfoKHR& presentInfo ) const + Result presentKHR( const PresentInfoKHR & presentInfo ) const { Result result = static_cast( vkQueuePresentKHR( m_queue, reinterpret_cast( &presentInfo ) ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eSuboptimalKHR ) ) @@ -19520,11 +18936,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSurfaceFormatKHR&() const { return m_surfaceFormatKHR; @@ -19725,11 +19136,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayPlaneCapabilitiesKHR&() const { return m_displayPlaneCapabilitiesKHR; @@ -19916,11 +19322,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplayPropertiesKHR&() const { return m_displayPropertiesKHR; @@ -20123,11 +19524,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDisplaySurfaceCreateInfoKHR&() const { return m_displaySurfaceCreateInfoKHR; @@ -20330,11 +19726,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSurfaceCapabilitiesKHR&() const { return m_surfaceCapabilitiesKHR; @@ -20673,11 +20064,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkSwapchainCreateInfoKHR&() const { return m_swapchainCreateInfoKHR; @@ -20713,7 +20099,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - PFN_vkVoidFunction getProcAddr( std::string const& name ) const + PFN_vkVoidFunction getProcAddr( std::string const & name ) const { return vkGetDeviceProcAddr( m_device, name.c_str() ); } @@ -20769,7 +20155,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - DeviceMemory allocateMemory( const MemoryAllocateInfo& allocateInfo, vk::Optional const & allocator ) const + DeviceMemory allocateMemory( const MemoryAllocateInfo & allocateInfo, vk::Optional const & allocator ) const { DeviceMemory memory; Result result = static_cast( vkAllocateMemory( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &memory ) ) ); @@ -20833,7 +20219,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void flushMappedMemoryRanges( std::vector const& memoryRanges ) const + void flushMappedMemoryRanges( std::vector const & memoryRanges ) const { Result result = static_cast( vkFlushMappedMemoryRanges( m_device, static_cast( memoryRanges.size() ), reinterpret_cast( memoryRanges.data() ) ) ); if ( result != Result::eSuccess ) @@ -20849,7 +20235,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void invalidateMappedMemoryRanges( std::vector const& memoryRanges ) const + void invalidateMappedMemoryRanges( std::vector const & memoryRanges ) const { Result result = static_cast( vkInvalidateMappedMemoryRanges( m_device, static_cast( memoryRanges.size() ), reinterpret_cast( memoryRanges.data() ) ) ); if ( result != Result::eSuccess ) @@ -20960,7 +20346,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Fence createFence( const FenceCreateInfo& createInfo, vk::Optional const & allocator ) const + Fence createFence( const FenceCreateInfo & createInfo, vk::Optional const & allocator ) const { Fence fence; Result result = static_cast( vkCreateFence( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &fence ) ) ); @@ -20990,7 +20376,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void resetFences( std::vector const& fences ) const + void resetFences( std::vector const & fences ) const { Result result = static_cast( vkResetFences( m_device, static_cast( fences.size() ), reinterpret_cast( fences.data() ) ) ); if ( result != Result::eSuccess ) @@ -21025,7 +20411,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Result waitForFences( std::vector const& fences, Bool32 waitAll, uint64_t timeout ) const + Result waitForFences( std::vector const & fences, Bool32 waitAll, uint64_t timeout ) const { Result result = static_cast( vkWaitForFences( m_device, static_cast( fences.size() ), reinterpret_cast( fences.data() ), waitAll, timeout ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eTimeout ) ) @@ -21042,7 +20428,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Semaphore createSemaphore( const SemaphoreCreateInfo& createInfo, vk::Optional const & allocator ) const + Semaphore createSemaphore( const SemaphoreCreateInfo & createInfo, vk::Optional const & allocator ) const { Semaphore semaphore; Result result = static_cast( vkCreateSemaphore( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &semaphore ) ) ); @@ -21072,7 +20458,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Event createEvent( const EventCreateInfo& createInfo, vk::Optional const & allocator ) const + Event createEvent( const EventCreateInfo & createInfo, vk::Optional const & allocator ) const { Event event; Result result = static_cast( vkCreateEvent( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &event ) ) ); @@ -21157,7 +20543,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - QueryPool createQueryPool( const QueryPoolCreateInfo& createInfo, vk::Optional const & allocator ) const + QueryPool createQueryPool( const QueryPoolCreateInfo & createInfo, vk::Optional const & allocator ) const { QueryPool queryPool; Result result = static_cast( vkCreateQueryPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &queryPool ) ) ); @@ -21205,7 +20591,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Buffer createBuffer( const BufferCreateInfo& createInfo, vk::Optional const & allocator ) const + Buffer createBuffer( const BufferCreateInfo & createInfo, vk::Optional const & allocator ) const { Buffer buffer; Result result = static_cast( vkCreateBuffer( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &buffer ) ) ); @@ -21235,7 +20621,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - BufferView createBufferView( const BufferViewCreateInfo& createInfo, vk::Optional const & allocator ) const + BufferView createBufferView( const BufferViewCreateInfo & createInfo, vk::Optional const & allocator ) const { BufferView view; Result result = static_cast( vkCreateBufferView( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &view ) ) ); @@ -21265,7 +20651,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Image createImage( const ImageCreateInfo& createInfo, vk::Optional const & allocator ) const + Image createImage( const ImageCreateInfo & createInfo, vk::Optional const & allocator ) const { Image image; Result result = static_cast( vkCreateImage( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &image ) ) ); @@ -21295,7 +20681,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - SubresourceLayout getImageSubresourceLayout( Image image, const ImageSubresource& subresource ) const + SubresourceLayout getImageSubresourceLayout( Image image, const ImageSubresource & subresource ) const { SubresourceLayout layout; vkGetImageSubresourceLayout( m_device, static_cast( image ), reinterpret_cast( &subresource ), reinterpret_cast( &layout ) ); @@ -21309,7 +20695,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - ImageView createImageView( const ImageViewCreateInfo& createInfo, vk::Optional const & allocator ) const + ImageView createImageView( const ImageViewCreateInfo & createInfo, vk::Optional const & allocator ) const { ImageView view; Result result = static_cast( vkCreateImageView( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &view ) ) ); @@ -21339,7 +20725,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - ShaderModule createShaderModule( const ShaderModuleCreateInfo& createInfo, vk::Optional const & allocator ) const + ShaderModule createShaderModule( const ShaderModuleCreateInfo & createInfo, vk::Optional const & allocator ) const { ShaderModule shaderModule; Result result = static_cast( vkCreateShaderModule( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &shaderModule ) ) ); @@ -21369,7 +20755,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - PipelineCache createPipelineCache( const PipelineCacheCreateInfo& createInfo, vk::Optional const & allocator ) const + PipelineCache createPipelineCache( const PipelineCacheCreateInfo & createInfo, vk::Optional const & allocator ) const { PipelineCache pipelineCache; Result result = static_cast( vkCreatePipelineCache( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &pipelineCache ) ) ); @@ -21424,7 +20810,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void mergePipelineCaches( PipelineCache dstCache, std::vector const& srcCaches ) const + void mergePipelineCaches( PipelineCache dstCache, std::vector const & srcCaches ) const { Result result = static_cast( vkMergePipelineCaches( m_device, static_cast( dstCache ), static_cast( srcCaches.size() ), reinterpret_cast( srcCaches.data() ) ) ); if ( result != Result::eSuccess ) @@ -21440,7 +20826,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - std::vector createGraphicsPipelines( PipelineCache pipelineCache, std::vector const& createInfos, vk::Optional const & allocator ) const + std::vector createGraphicsPipelines( PipelineCache pipelineCache, std::vector const & createInfos, vk::Optional const & allocator ) const { std::vector pipelines( createInfos.size() ); Result result = static_cast( vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), static_cast( createInfos.size() ), reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( pipelines.data() ) ) ); @@ -21458,7 +20844,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - std::vector createComputePipelines( PipelineCache pipelineCache, std::vector const& createInfos, vk::Optional const & allocator ) const + std::vector createComputePipelines( PipelineCache pipelineCache, std::vector const & createInfos, vk::Optional const & allocator ) const { std::vector pipelines( createInfos.size() ); Result result = static_cast( vkCreateComputePipelines( m_device, static_cast( pipelineCache ), static_cast( createInfos.size() ), reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( pipelines.data() ) ) ); @@ -21488,7 +20874,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - PipelineLayout createPipelineLayout( const PipelineLayoutCreateInfo& createInfo, vk::Optional const & allocator ) const + PipelineLayout createPipelineLayout( const PipelineLayoutCreateInfo & createInfo, vk::Optional const & allocator ) const { PipelineLayout pipelineLayout; Result result = static_cast( vkCreatePipelineLayout( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &pipelineLayout ) ) ); @@ -21518,7 +20904,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Sampler createSampler( const SamplerCreateInfo& createInfo, vk::Optional const & allocator ) const + Sampler createSampler( const SamplerCreateInfo & createInfo, vk::Optional const & allocator ) const { Sampler sampler; Result result = static_cast( vkCreateSampler( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &sampler ) ) ); @@ -21548,7 +20934,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - DescriptorSetLayout createDescriptorSetLayout( const DescriptorSetLayoutCreateInfo& createInfo, vk::Optional const & allocator ) const + DescriptorSetLayout createDescriptorSetLayout( const DescriptorSetLayoutCreateInfo & createInfo, vk::Optional const & allocator ) const { DescriptorSetLayout setLayout; Result result = static_cast( vkCreateDescriptorSetLayout( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &setLayout ) ) ); @@ -21578,7 +20964,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - DescriptorPool createDescriptorPool( const DescriptorPoolCreateInfo& createInfo, vk::Optional const & allocator ) const + DescriptorPool createDescriptorPool( const DescriptorPoolCreateInfo & createInfo, vk::Optional const & allocator ) const { DescriptorPool descriptorPool; Result result = static_cast( vkCreateDescriptorPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &descriptorPool ) ) ); @@ -21626,7 +21012,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - std::vector allocateDescriptorSets( const DescriptorSetAllocateInfo& allocateInfo ) const + std::vector allocateDescriptorSets( const DescriptorSetAllocateInfo & allocateInfo ) const { std::vector descriptorSets( allocateInfo.descriptorSetCount() ); Result result = static_cast( vkAllocateDescriptorSets( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( descriptorSets.data() ) ) ); @@ -21644,7 +21030,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void freeDescriptorSets( DescriptorPool descriptorPool, std::vector const& descriptorSets ) const + void freeDescriptorSets( DescriptorPool descriptorPool, std::vector const & descriptorSets ) const { Result result = static_cast( vkFreeDescriptorSets( m_device, static_cast( descriptorPool ), static_cast( descriptorSets.size() ), reinterpret_cast( descriptorSets.data() ) ) ); if ( result != Result::eSuccess ) @@ -21660,7 +21046,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void updateDescriptorSets( std::vector const& descriptorWrites, std::vector const& descriptorCopies ) const + void updateDescriptorSets( std::vector const & descriptorWrites, std::vector const & descriptorCopies ) const { vkUpdateDescriptorSets( m_device, static_cast( descriptorWrites.size() ), reinterpret_cast( descriptorWrites.data() ), static_cast( descriptorCopies.size() ), reinterpret_cast( descriptorCopies.data() ) ); } @@ -21672,7 +21058,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Framebuffer createFramebuffer( const FramebufferCreateInfo& createInfo, vk::Optional const & allocator ) const + Framebuffer createFramebuffer( const FramebufferCreateInfo & createInfo, vk::Optional const & allocator ) const { Framebuffer framebuffer; Result result = static_cast( vkCreateFramebuffer( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &framebuffer ) ) ); @@ -21702,7 +21088,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - RenderPass createRenderPass( const RenderPassCreateInfo& createInfo, vk::Optional const & allocator ) const + RenderPass createRenderPass( const RenderPassCreateInfo & createInfo, vk::Optional const & allocator ) const { RenderPass renderPass; Result result = static_cast( vkCreateRenderPass( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &renderPass ) ) ); @@ -21746,7 +21132,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - CommandPool createCommandPool( const CommandPoolCreateInfo& createInfo, vk::Optional const & allocator ) const + CommandPool createCommandPool( const CommandPoolCreateInfo & createInfo, vk::Optional const & allocator ) const { CommandPool commandPool; Result result = static_cast( vkCreateCommandPool( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &commandPool ) ) ); @@ -21794,7 +21180,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - std::vector allocateCommandBuffers( const CommandBufferAllocateInfo& allocateInfo ) const + std::vector allocateCommandBuffers( const CommandBufferAllocateInfo & allocateInfo ) const { std::vector commandBuffers( allocateInfo.commandBufferCount() ); Result result = static_cast( vkAllocateCommandBuffers( m_device, reinterpret_cast( &allocateInfo ), reinterpret_cast( commandBuffers.data() ) ) ); @@ -21812,7 +21198,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void freeCommandBuffers( CommandPool commandPool, std::vector const& commandBuffers ) const + void freeCommandBuffers( CommandPool commandPool, std::vector const & commandBuffers ) const { vkFreeCommandBuffers( m_device, static_cast( commandPool ), static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); } @@ -21824,7 +21210,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - std::vector createSharedSwapchainsKHR( std::vector const& createInfos, vk::Optional const & allocator ) const + std::vector createSharedSwapchainsKHR( std::vector const & createInfos, vk::Optional const & allocator ) const { std::vector swapchains( createInfos.size() ); Result result = static_cast( vkCreateSharedSwapchainsKHR( m_device, static_cast( createInfos.size() ), reinterpret_cast( createInfos.data() ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( swapchains.data() ) ) ); @@ -21842,7 +21228,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - SwapchainKHR createSwapchainKHR( const SwapchainCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SwapchainKHR createSwapchainKHR( const SwapchainCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SwapchainKHR swapchain; Result result = static_cast( vkCreateSwapchainKHR( m_device, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &swapchain ) ) ); @@ -21896,7 +21282,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t& imageIndex ) const + Result acquireNextImageKHR( SwapchainKHR swapchain, uint64_t timeout, Semaphore semaphore, Fence fence, uint32_t & imageIndex ) const { Result result = static_cast( vkAcquireNextImageKHR( m_device, static_cast( swapchain ), timeout, static_cast( semaphore ), static_cast( fence ), &imageIndex ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eSuboptimalKHR ) ) @@ -22046,7 +21432,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Device createDevice( const DeviceCreateInfo& createInfo, vk::Optional const & allocator ) const + Device createDevice( const DeviceCreateInfo & createInfo, vk::Optional const & allocator ) const { Device device; Result result = static_cast( vkCreateDevice( m_physicalDevice, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &device ) ) ); @@ -22088,16 +21474,16 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Result enumerateDeviceExtensionProperties( std::string const& layerName, std::vector & properties ) const + Result enumerateDeviceExtensionProperties( vk::Optional const & layerName, std::vector & properties ) const { uint32_t propertyCount; - Result result = static_cast( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName.c_str(), &propertyCount, nullptr ) ); + Result result = static_cast( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) { throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" ); } properties.resize( propertyCount ); - result = static_cast( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName.c_str(), &propertyCount, reinterpret_cast( properties.data() ) ) ); + result = static_cast( vkEnumerateDeviceExtensionProperties( m_physicalDevice, layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast( properties.data() ) ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) { throw std::system_error( result, "vk::PhysicalDevice::enumerateDeviceExtensionProperties" ); @@ -22225,7 +21611,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - DisplayModeKHR createDisplayModeKHR( DisplayKHR display, const DisplayModeCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + DisplayModeKHR createDisplayModeKHR( DisplayKHR display, const DisplayModeCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { DisplayModeKHR mode; Result result = static_cast( vkCreateDisplayModeKHR( m_physicalDevice, static_cast( display ), reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &mode ) ) ); @@ -22264,7 +21650,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_MIR_KHR - Bool32 getMirPresentationSupportKHR( uint32_t queueFamilyIndex, MirConnection& connection ) const + Bool32 getMirPresentationSupportKHR( uint32_t queueFamilyIndex, MirConnection & connection ) const { return vkGetPhysicalDeviceMirPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &connection ); } @@ -22295,7 +21681,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - Result getSurfaceCapabilitiesKHR( SurfaceKHR surface, SurfaceCapabilitiesKHR& surfaceCapabilities ) const + Result getSurfaceCapabilitiesKHR( SurfaceKHR surface, SurfaceCapabilitiesKHR & surfaceCapabilities ) const { Result result = static_cast( vkGetPhysicalDeviceSurfaceCapabilitiesKHR( m_physicalDevice, static_cast( surface ), reinterpret_cast( &surfaceCapabilities ) ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) @@ -22363,7 +21749,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WAYLAND_KHR - Bool32 getWaylandPresentationSupportKHR( uint32_t queueFamilyIndex, struct wl_display& display ) const + Bool32 getWaylandPresentationSupportKHR( uint32_t queueFamilyIndex, struct wl_display & display ) const { return vkGetPhysicalDeviceWaylandPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &display ); } @@ -22397,7 +21783,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XLIB_KHR - Bool32 getXlibPresentationSupportKHR( uint32_t queueFamilyIndex, Display& dpy, VisualID visualID ) const + Bool32 getXlibPresentationSupportKHR( uint32_t queueFamilyIndex, Display & dpy, VisualID visualID ) const { return vkGetPhysicalDeviceXlibPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &dpy, visualID ); } @@ -22413,7 +21799,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XCB_KHR - Bool32 getXcbPresentationSupportKHR( uint32_t queueFamilyIndex, xcb_connection_t& connection, xcb_visualid_t visual_id ) const + Bool32 getXcbPresentationSupportKHR( uint32_t queueFamilyIndex, xcb_connection_t & connection, xcb_visualid_t visual_id ) const { return vkGetPhysicalDeviceXcbPresentationSupportKHR( m_physicalDevice, queueFamilyIndex, &connection, visual_id ); } @@ -22562,11 +21948,6 @@ namespace vk return *this; } - static Optional null() - { - return Optional(nullptr); - } - operator const VkDebugReportCallbackCreateInfoEXT&() const { return m_debugReportCallbackCreateInfoEXT; @@ -22671,7 +22052,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - PFN_vkVoidFunction getProcAddr( std::string const& name ) const + PFN_vkVoidFunction getProcAddr( std::string const & name ) const { return vkGetInstanceProcAddr( m_instance, name.c_str() ); } @@ -22686,7 +22067,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_ANDROID_KHR - SurfaceKHR createAndroidSurfaceKHR( const AndroidSurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createAndroidSurfaceKHR( const AndroidSurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateAndroidSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22705,7 +22086,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - SurfaceKHR createDisplayPlaneSurfaceKHR( const DisplaySurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createDisplayPlaneSurfaceKHR( const DisplaySurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateDisplayPlaneSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22726,7 +22107,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_MIR_KHR - SurfaceKHR createMirSurfaceKHR( const MirSurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createMirSurfaceKHR( const MirSurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateMirSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22760,7 +22141,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WAYLAND_KHR - SurfaceKHR createWaylandSurfaceKHR( const WaylandSurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createWaylandSurfaceKHR( const WaylandSurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateWaylandSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22782,7 +22163,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_WIN32_KHR - SurfaceKHR createWin32SurfaceKHR( const Win32SurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createWin32SurfaceKHR( const Win32SurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateWin32SurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22804,7 +22185,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XLIB_KHR - SurfaceKHR createXlibSurfaceKHR( const XlibSurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createXlibSurfaceKHR( const XlibSurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateXlibSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22826,7 +22207,7 @@ namespace vk #ifdef VKCPP_ENHANCED_MODE #ifdef VK_USE_PLATFORM_XCB_KHR - SurfaceKHR createXcbSurfaceKHR( const XcbSurfaceCreateInfoKHR& createInfo, vk::Optional const & allocator ) const + SurfaceKHR createXcbSurfaceKHR( const XcbSurfaceCreateInfoKHR & createInfo, vk::Optional const & allocator ) const { SurfaceKHR surface; Result result = static_cast( vkCreateXcbSurfaceKHR( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &surface ) ) ); @@ -22845,7 +22226,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - DebugReportCallbackEXT createDebugReportCallbackEXT( const DebugReportCallbackCreateInfoEXT& createInfo, vk::Optional const & allocator ) const + DebugReportCallbackEXT createDebugReportCallbackEXT( const DebugReportCallbackCreateInfoEXT & createInfo, vk::Optional const & allocator ) const { DebugReportCallbackEXT callback; Result result = static_cast( vkCreateDebugReportCallbackEXT( m_instance, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &callback ) ) ); @@ -22875,7 +22256,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - void debugReportMessageEXT( DebugReportFlagsEXT flags, DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, std::string const& layerPrefix, std::string const& message ) const + void debugReportMessageEXT( DebugReportFlagsEXT flags, DebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, std::string const & layerPrefix, std::string const & message ) const { vkDebugReportMessageEXT( m_instance, static_cast( flags ), static_cast( objectType ), object, location, messageCode, layerPrefix.c_str(), message.c_str() ); } @@ -22916,7 +22297,7 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - inline Instance createInstance( const InstanceCreateInfo& createInfo, vk::Optional const & allocator ) + inline Instance createInstance( const InstanceCreateInfo & createInfo, vk::Optional const & allocator ) { Instance instance; Result result = static_cast( vkCreateInstance( reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &instance ) ) ); @@ -22958,16 +22339,16 @@ namespace vk } #ifdef VKCPP_ENHANCED_MODE - inline Result enumerateInstanceExtensionProperties( std::string const& layerName, std::vector & properties ) + inline Result enumerateInstanceExtensionProperties( vk::Optional const & layerName, std::vector & properties ) { uint32_t propertyCount; - Result result = static_cast( vkEnumerateInstanceExtensionProperties( layerName.c_str(), &propertyCount, nullptr ) ); + Result result = static_cast( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, nullptr ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) { throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" ); } properties.resize( propertyCount ); - result = static_cast( vkEnumerateInstanceExtensionProperties( layerName.c_str(), &propertyCount, reinterpret_cast( properties.data() ) ) ); + result = static_cast( vkEnumerateInstanceExtensionProperties( layerName ? layerName->c_str() : nullptr, &propertyCount, reinterpret_cast( properties.data() ) ) ); if ( ( result != Result::eSuccess ) && ( result != Result::eIncomplete ) ) { throw std::system_error( result, "vk::enumerateInstanceExtensionProperties" );