diff --git a/VkCppGenerator.cpp b/VkCppGenerator.cpp index 3716f34..2ac294f 100644 --- a/VkCppGenerator.cpp +++ b/VkCppGenerator.cpp @@ -385,16 +385,16 @@ void readTypeUnionMember( tinyxml2::XMLElement * element, std::vector & tags); void readTypes(tinyxml2::XMLElement * element, VkData & vkData); void sortDependencies( std::list & dependencies ); -std::string reduceName(std::string const& name); +std::string reduceName(std::string const& name, bool stripTrailingS = false); std::string strip(std::string const& value, std::string const& prefix, std::string const& tag = std::string()); std::string stripCommand(std::string const& value); std::string toCamelCase(std::string const& value); std::string toUpperCase(std::string const& name); -void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall); +void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular); void writeEnumsToString(std::ofstream & ofs, VkData const& vkData); void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::vector const& successCodes); -void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters); -void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters); +void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular); +void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular); void writeMemberData(std::ofstream & ofs, MemberData const& memberData, std::set const& vkTypes); void writeStructConstructor( std::ofstream & ofs, std::string const& name, std::string const& memberName, StructData const& structData, std::set const& vkTypes, std::map const& defaultValues ); void writeStructGetter( std::ofstream & ofs, MemberData const& memberData, std::string const& memberName, std::set const& vkTypes, bool constVersion ); @@ -1464,16 +1464,26 @@ void sortDependencies( std::list & dependencies ) dependencies.swap(sortedDependencies); } -std::string reduceName(std::string const& name) +std::string reduceName(std::string const& name, bool stripTrailingS) { assert(1 < name.length()); + std::string reducedName; if ((name[0] == 'p') && (isupper(name[1]) || name[1] == 'p')) { - std::string reducedName = strip(name, "p"); + reducedName = strip(name, "p"); reducedName[0] = tolower(reducedName[0]); - return reducedName; } - return name; + else + { + reducedName = name; + } + + if (stripTrailingS && (reducedName.back() == 's')) + { + reducedName.pop_back(); + } + + return reducedName; } std::string strip(std::string const& value, std::string const& prefix, std::string const& postfix) @@ -1539,7 +1549,7 @@ std::string toUpperCase(std::string const& name) return convertedName; } -void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall) +void writeCall(std::ofstream & ofs, std::string const& name, size_t templateIndex, CommandData const& commandData, std::set const& vkTypes, std::map const& vectorParameters, size_t returnIndex, bool firstCall, bool singular) { std::map countIndices; for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) @@ -1576,12 +1586,26 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde } else { - ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( " << reduceName(commandData.arguments[it->second].name) << ".size() "; - if (templateIndex == it->second) + if (singular) { - ofs << "* sizeof( T ) "; + if (templateIndex == it->second) + { + ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( sizeof( T ) )"; + } + else + { + ofs << "1"; + } + } + else + { + ofs << "static_cast<" << commandData.arguments[it->first].pureType << ">( " << reduceName(commandData.arguments[it->second].name) << ".size() "; + if (templateIndex == it->second) + { + ofs << "* sizeof( T ) "; + } + ofs << ")"; } - ofs << ")"; } } else @@ -1608,7 +1632,17 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde { ofs << "Vk"; } - ofs << commandData.arguments[it->first].pureType << "*>( " << reduceName(commandData.arguments[it->first].name) << ".data() )"; + ofs << commandData.arguments[it->first].pureType << "*>( "; + if (singular) + { + ofs << "&"; + } + ofs << reduceName(commandData.arguments[it->first].name, singular); + if (!singular) + { + ofs << ".data()"; + } + ofs << " )"; } else if (commandData.arguments[it->first].pureType == "char") { @@ -1624,7 +1658,15 @@ void writeCall(std::ofstream & ofs, std::string const& name, size_t templateInde } else { - ofs << reduceName(commandData.arguments[it->first].name) << ".data()"; + if (singular) + { + ofs << "&"; + } + ofs << reduceName(commandData.arguments[it->first].name, singular); + if (!singular) + { + ofs << ".data()"; + } } } } @@ -1711,7 +1753,7 @@ void writeExceptionCheck(std::ofstream & ofs, std::string const& indentation, st << indentation << " }" << std::endl; } -void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters) +void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, std::string const& returnType, size_t templateIndex, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes, size_t returnIndex, std::map const& vectorParameters, bool singular) { ofs << indentation << "{" << std::endl; @@ -1722,7 +1764,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: } // add some error checks if multiple vectors need to have the same size - if (1 < vectorParameters.size()) + if (!singular && (1 < vectorParameters.size())) { for (std::map::const_iterator it0 = vectorParameters.begin(); it0 != vectorParameters.end(); ++it0) { @@ -1745,33 +1787,36 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: // write the local variable to hold a returned value if ((returnIndex != ~0) && (commandData.returnType != returnType)) { - ofs << indentation << " " << returnType << " " << reduceName(commandData.arguments[returnIndex].name); + ofs << indentation << " " << (singular ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(commandData.arguments[returnIndex].name, singular); - std::map::const_iterator it = vectorParameters.find(returnIndex); - if (it != vectorParameters.end() && !commandData.twoStep) + if (!singular) { - std::string size; - if ((it->second == ~0) && !commandData.arguments[returnIndex].len.empty()) + std::map::const_iterator it = vectorParameters.find(returnIndex); + if (it != vectorParameters.end() && !commandData.twoStep) { - size = reduceName(commandData.arguments[returnIndex].len); - size_t pos = size.find("->"); - assert(pos != std::string::npos); - size.replace(pos, 2, "."); - size += "()"; - } - else - { - for (std::map::const_iterator sit = vectorParameters.begin(); sit != vectorParameters.end(); ++sit) + std::string size; + if ((it->second == ~0) && !commandData.arguments[returnIndex].len.empty()) { - if ((sit->first != returnIndex) && (sit->second == it->second)) + size = reduceName(commandData.arguments[returnIndex].len); + size_t pos = size.find("->"); + assert(pos != std::string::npos); + size.replace(pos, 2, "."); + size += "()"; + } + else + { + for (std::map::const_iterator sit = vectorParameters.begin(); sit != vectorParameters.end(); ++sit) { - size = reduceName(commandData.arguments[sit->first].name) + ".size()"; - break; + if ((sit->first != returnIndex) && (sit->second == it->second)) + { + size = reduceName(commandData.arguments[sit->first].name) + ".size()"; + break; + } } } + assert(!size.empty()); + ofs << "( " << size << " )"; } - assert(!size.empty()); - ofs << "( " << size << " )"; } ofs << ";" << std::endl; } @@ -1809,7 +1854,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: assert(!commandData.twoStep); ofs << "return "; } - writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true); + writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, true, singular); if (commandData.returnType == "Result") { ofs << " )"; @@ -1843,7 +1888,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: { ofs << indentation << " "; } - writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false); + writeCall(ofs, dependencyData.name, templateIndex, commandData, vkTypes, vectorParameters, returnIndex, false, singular); if (commandData.returnType == "Result") { ofs << " )"; @@ -1867,7 +1912,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: // return the returned value if ((returnIndex != ~0) && (commandData.returnType != returnType)) { - ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name) << ";" << std::endl; + ofs << indentation << " return " << reduceName(commandData.arguments[returnIndex].name, singular) << ";" << std::endl; } else if (returnType == "Result") { @@ -1877,7 +1922,7 @@ void writeFunctionBody(std::ofstream & ofs, std::string const& indentation, std: ofs << indentation << "}" << std::endl; } -void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters) +void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, std::string const& returnType, std::string const& name, CommandData const& commandData, size_t returnIndex, size_t templateIndex, std::map const& vectorParameters, bool singular) { std::set skippedArguments; for (std::map::const_iterator it = vectorParameters.begin(); it != vectorParameters.end(); ++it) @@ -1908,7 +1953,7 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st { ofs << "inline "; } - ofs << returnType << " " << name << "("; + ofs << ((singular && (returnIndex != ~0)) ? commandData.arguments[returnIndex].pureType : returnType) << " " << reduceName(name, singular) << "("; if (skippedArguments.size() + (commandData.handleCommand ? 1 : 0) < commandData.arguments.size()) { size_t lastArgument = ~0; @@ -1966,7 +2011,7 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st { if (templateIndex == i) { - ofs << "std::vector"; + ofs << (singular ? "T" : "std::vector"); } else if (commandData.arguments[i].pureType == "char") { @@ -1976,6 +2021,10 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st { ofs << "std::vector"; } + else if (singular) + { + ofs << commandData.arguments[i].pureType; + } else { ofs << "std::vector<" << commandData.arguments[i].pureType << ">"; @@ -1989,7 +2038,7 @@ void writeFunctionHeader(std::ofstream & ofs, std::string const& indentation, st { ofs << "> const"; } - ofs << " & " << reduceName(commandData.arguments[i].name); + ofs << " & " << reduceName(commandData.arguments[i].name, singular); if (optional && (i == lastArgument)) { ofs << " = nullptr"; @@ -2269,6 +2318,18 @@ void writeTypeCommand( std::ofstream & ofs, DependencyData const& dependencyData } } +bool hasSizedVectorParameter(std::map const& vectorParameters, size_t returnIndex) +{ + for (auto it = vectorParameters.begin(); it != vectorParameters.end(); ++it) + { + if ((it->first != returnIndex) && (it->second != ~0)) + { + return true; + } + } + return false; +} + void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentation, std::string const& className, std::string const& functionName, DependencyData const& dependencyData, CommandData const& commandData, std::set const& vkTypes) { enterProtect(ofs, commandData.protect); @@ -2278,8 +2339,14 @@ void writeTypeCommandEnhanced(std::ofstream & ofs, std::string const& indentatio std::map::const_iterator returnVector = vectorParameters.find(returnIndex); std::string returnType = determineReturnType(commandData, returnIndex, returnVector != vectorParameters.end()); - writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters); - writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters); + writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, false); + writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, false); + if (hasSizedVectorParameter(vectorParameters, returnIndex)) + { + ofs << std::endl; + writeFunctionHeader(ofs, indentation, returnType, functionName, commandData, returnIndex, templateIndex, vectorParameters, true); + writeFunctionBody(ofs, indentation, className, functionName, returnType, templateIndex, dependencyData, commandData, vkTypes, returnIndex, vectorParameters, true); + } leaveProtect(ofs, commandData.protect); } diff --git a/vulkan/vk_cpp.h b/vulkan/vk_cpp.h index 89bbbbc..bdae130 100644 --- a/vulkan/vk_cpp.h +++ b/vulkan/vk_cpp.h @@ -17654,6 +17654,11 @@ namespace vk { vkCmdSetViewport( m_commandBuffer, firstViewport, static_cast( viewports.size() ), reinterpret_cast( viewports.data() ) ); } + + void setViewport( uint32_t firstViewport, Viewport const & viewport ) const + { + vkCmdSetViewport( m_commandBuffer, firstViewport, 1, reinterpret_cast( &viewport ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void setScissor( uint32_t firstScissor, uint32_t scissorCount, const Rect2D* pScissors ) const @@ -17666,6 +17671,11 @@ namespace vk { vkCmdSetScissor( m_commandBuffer, firstScissor, static_cast( scissors.size() ), reinterpret_cast( scissors.data() ) ); } + + void setScissor( uint32_t firstScissor, Rect2D const & scissor ) const + { + vkCmdSetScissor( m_commandBuffer, firstScissor, 1, reinterpret_cast( &scissor ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -17776,6 +17786,11 @@ namespace vk { vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, static_cast( descriptorSets.size() ), reinterpret_cast( descriptorSets.data() ), static_cast( dynamicOffsets.size() ), dynamicOffsets.data() ); } + + void bindDescriptorSet( PipelineBindPoint pipelineBindPoint, PipelineLayout layout, uint32_t firstSet, DescriptorSet const & descriptorSet, uint32_t const & dynamicOffset ) const + { + vkCmdBindDescriptorSets( m_commandBuffer, static_cast( pipelineBindPoint ), static_cast( layout ), firstSet, 1, reinterpret_cast( &descriptorSet ), 1, &dynamicOffset ); + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -17806,6 +17821,11 @@ namespace vk } vkCmdBindVertexBuffers( m_commandBuffer, firstBinding, static_cast( buffers.size() ), reinterpret_cast( buffers.data() ), offsets.data() ); } + + void bindVertexBuffer( uint32_t firstBinding, Buffer const & buffer, DeviceSize const & offset ) const + { + vkCmdBindVertexBuffers( m_commandBuffer, firstBinding, 1, reinterpret_cast( &buffer ), &offset ); + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -17902,6 +17922,11 @@ namespace vk { vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } + + void copyBuffer( Buffer srcBuffer, Buffer dstBuffer, BufferCopy const & region ) const + { + vkCmdCopyBuffer( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstBuffer ), 1, reinterpret_cast( ®ion ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageCopy* pRegions ) const @@ -17914,6 +17939,11 @@ namespace vk { vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } + + void copyImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, ImageCopy const & region ) const + { + vkCmdCopyImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageBlit* pRegions, Filter filter ) const @@ -17926,6 +17956,11 @@ namespace vk { 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 ) ); } + + void blitImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, ImageBlit const & region, Filter filter ) const + { + vkCmdBlitImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ), static_cast( filter ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const BufferImageCopy* pRegions ) const @@ -17938,6 +17973,11 @@ namespace vk { vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } + + void copyBufferToImage( Buffer srcBuffer, Image dstImage, ImageLayout dstImageLayout, BufferImageCopy const & region ) const + { + vkCmdCopyBufferToImage( m_commandBuffer, static_cast( srcBuffer ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, uint32_t regionCount, const BufferImageCopy* pRegions ) const @@ -17950,6 +17990,11 @@ namespace vk { vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } + + void copyImageToBuffer( Image srcImage, ImageLayout srcImageLayout, Buffer dstBuffer, BufferImageCopy const & region ) const + { + vkCmdCopyImageToBuffer( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstBuffer ), 1, reinterpret_cast( ®ion ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void updateBuffer( Buffer dstBuffer, DeviceSize dstOffset, DeviceSize dataSize, const uint32_t* pData ) const @@ -17990,6 +18035,11 @@ namespace vk { vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &color ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); } + + void clearColorImage( Image image, ImageLayout imageLayout, const ClearColorValue & color, ImageSubresourceRange const & range ) const + { + vkCmdClearColorImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &color ), 1, reinterpret_cast( &range ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const ImageSubresourceRange* pRanges ) const @@ -18002,6 +18052,11 @@ namespace vk { vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &depthStencil ), static_cast( ranges.size() ), reinterpret_cast( ranges.data() ) ); } + + void clearDepthStencilImage( Image image, ImageLayout imageLayout, const ClearDepthStencilValue & depthStencil, ImageSubresourceRange const & range ) const + { + vkCmdClearDepthStencilImage( m_commandBuffer, static_cast( image ), static_cast( imageLayout ), reinterpret_cast( &depthStencil ), 1, reinterpret_cast( &range ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void clearAttachments( uint32_t attachmentCount, const ClearAttachment* pAttachments, uint32_t rectCount, const ClearRect* pRects ) const @@ -18014,6 +18069,11 @@ namespace vk { vkCmdClearAttachments( m_commandBuffer, static_cast( attachments.size() ), reinterpret_cast( attachments.data() ), static_cast( rects.size() ), reinterpret_cast( rects.data() ) ); } + + void clearAttachment( ClearAttachment const & attachment, ClearRect const & rect ) const + { + vkCmdClearAttachments( m_commandBuffer, 1, reinterpret_cast( &attachment ), 1, reinterpret_cast( &rect ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, uint32_t regionCount, const ImageResolve* pRegions ) const @@ -18026,6 +18086,11 @@ namespace vk { vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), static_cast( regions.size() ), reinterpret_cast( regions.data() ) ); } + + void resolveImage( Image srcImage, ImageLayout srcImageLayout, Image dstImage, ImageLayout dstImageLayout, ImageResolve const & region ) const + { + vkCmdResolveImage( m_commandBuffer, static_cast( srcImage ), static_cast( srcImageLayout ), static_cast( dstImage ), static_cast( dstImageLayout ), 1, reinterpret_cast( ®ion ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -18066,6 +18131,11 @@ namespace vk { 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() ) ); } + + void waitEvent( Event const & event, PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, MemoryBarrier const & memoryBarrier, BufferMemoryBarrier const & bufferMemoryBarrier, ImageMemoryBarrier const & imageMemoryBarrier ) const + { + vkCmdWaitEvents( m_commandBuffer, 1, reinterpret_cast( &event ), static_cast( srcStageMask ), static_cast( dstStageMask ), 1, reinterpret_cast( &memoryBarrier ), 1, reinterpret_cast( &bufferMemoryBarrier ), 1, reinterpret_cast( &imageMemoryBarrier ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const MemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const BufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const ImageMemoryBarrier* pImageMemoryBarriers ) const @@ -18078,6 +18148,11 @@ namespace vk { 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() ) ); } + + void pipelineBarrier( PipelineStageFlags srcStageMask, PipelineStageFlags dstStageMask, DependencyFlags dependencyFlags, MemoryBarrier const & memoryBarrier, BufferMemoryBarrier const & bufferMemoryBarrier, ImageMemoryBarrier const & imageMemoryBarrier ) const + { + vkCmdPipelineBarrier( m_commandBuffer, static_cast( srcStageMask ), static_cast( dstStageMask ), static_cast( dependencyFlags ), 1, reinterpret_cast( &memoryBarrier ), 1, reinterpret_cast( &bufferMemoryBarrier ), 1, reinterpret_cast( &imageMemoryBarrier ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -18160,6 +18235,11 @@ namespace vk { vkCmdPushConstants( m_commandBuffer, static_cast( layout ), static_cast( stageFlags ), offset, static_cast( values.size() ), values.data() ); } + + void pushConstant( PipelineLayout layout, ShaderStageFlags stageFlags, uint32_t offset, std::vector const & value ) const + { + vkCmdPushConstants( m_commandBuffer, static_cast( layout ), static_cast( stageFlags ), offset, 1, &value ); + } #endif /*VKCPP_ENHANCED_MODE*/ void beginRenderPass( const RenderPassBeginInfo* pRenderPassBegin, SubpassContents contents ) const @@ -18212,6 +18292,11 @@ namespace vk { vkCmdExecuteCommands( m_commandBuffer, static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); } + + void executeCommand( CommandBuffer const & commandBuffer ) const + { + vkCmdExecuteCommands( m_commandBuffer, 1, reinterpret_cast( &commandBuffer ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ #if !defined(VK_CPP_TYPESAFE_CONVERSION) @@ -18791,6 +18876,15 @@ namespace vk throw std::system_error( result, "vk::Queue::submit" ); } } + + void submit( SubmitInfo const & submit, Fence fence ) const + { + Result result = static_cast( vkQueueSubmit( m_queue, 1, reinterpret_cast( &submit ), static_cast( fence ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Queue::submit" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -18825,6 +18919,15 @@ namespace vk throw std::system_error( result, "vk::Queue::bindSparse" ); } } + + void bindSparse( BindSparseInfo const & bindInfo, Fence fence ) const + { + Result result = static_cast( vkQueueBindSparse( m_queue, 1, reinterpret_cast( &bindInfo ), static_cast( fence ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Queue::bindSparse" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ Result presentKHR( const PresentInfoKHR* pPresentInfo ) const @@ -20227,6 +20330,15 @@ namespace vk throw std::system_error( result, "vk::Device::flushMappedMemoryRanges" ); } } + + void flushMappedMemoryRange( MappedMemoryRange const & memoryRange ) const + { + Result result = static_cast( vkFlushMappedMemoryRanges( m_device, 1, reinterpret_cast( &memoryRange ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::flushMappedMemoryRanges" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ Result invalidateMappedMemoryRanges( uint32_t memoryRangeCount, const MappedMemoryRange* pMemoryRanges ) const @@ -20243,6 +20355,15 @@ namespace vk throw std::system_error( result, "vk::Device::invalidateMappedMemoryRanges" ); } } + + void invalidateMappedMemoryRange( MappedMemoryRange const & memoryRange ) const + { + Result result = static_cast( vkInvalidateMappedMemoryRanges( m_device, 1, reinterpret_cast( &memoryRange ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::invalidateMappedMemoryRanges" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ void getMemoryCommitment( DeviceMemory memory, DeviceSize* pCommittedMemoryInBytes ) const @@ -20384,6 +20505,15 @@ namespace vk throw std::system_error( result, "vk::Device::resetFences" ); } } + + void resetFence( Fence const & fence ) const + { + Result result = static_cast( vkResetFences( m_device, 1, reinterpret_cast( &fence ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::resetFences" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ #ifndef VKCPP_ENHANCED_MODE @@ -20420,6 +20550,16 @@ namespace vk } return result; } + + Result waitForFence( Fence const & fence, Bool32 waitAll, uint64_t timeout ) const + { + Result result = static_cast( vkWaitForFences( m_device, 1, reinterpret_cast( &fence ), waitAll, timeout ) ); + if ( ( result != Result::eSuccess ) && ( result != Result::eTimeout ) ) + { + throw std::system_error( result, "vk::Device::waitForFences" ); + } + return result; + } #endif /*VKCPP_ENHANCED_MODE*/ Result createSemaphore( const SemaphoreCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Semaphore* pSemaphore ) const @@ -20817,6 +20957,15 @@ namespace vk throw std::system_error( result, "vk::Device::mergePipelineCaches" ); } } + + void mergePipelineCache( PipelineCache dstCache, PipelineCache const & srcCache ) const + { + Result result = static_cast( vkMergePipelineCaches( m_device, static_cast( dstCache ), 1, reinterpret_cast( &srcCache ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::mergePipelineCaches" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ Result createGraphicsPipelines( PipelineCache pipelineCache, uint32_t createInfoCount, const GraphicsPipelineCreateInfo* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines ) const @@ -20835,6 +20984,17 @@ namespace vk } return pipelines; } + + Pipeline createGraphicsPipeline( PipelineCache pipelineCache, GraphicsPipelineCreateInfo const & createInfo, Optional const & allocator = nullptr ) const + { + Pipeline pipeline; + Result result = static_cast( vkCreateGraphicsPipelines( m_device, static_cast( pipelineCache ), 1, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &pipeline ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::createGraphicsPipelines" ); + } + return pipeline; + } #endif /*VKCPP_ENHANCED_MODE*/ Result createComputePipelines( PipelineCache pipelineCache, uint32_t createInfoCount, const ComputePipelineCreateInfo* pCreateInfos, const AllocationCallbacks* pAllocator, Pipeline* pPipelines ) const @@ -20853,6 +21013,17 @@ namespace vk } return pipelines; } + + Pipeline createComputePipeline( PipelineCache pipelineCache, ComputePipelineCreateInfo const & createInfo, Optional const & allocator = nullptr ) const + { + Pipeline pipeline; + Result result = static_cast( vkCreateComputePipelines( m_device, static_cast( pipelineCache ), 1, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &pipeline ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::createComputePipelines" ); + } + return pipeline; + } #endif /*VKCPP_ENHANCED_MODE*/ void destroyPipeline( Pipeline pipeline, const AllocationCallbacks* pAllocator ) const @@ -21037,6 +21208,15 @@ namespace vk throw std::system_error( result, "vk::Device::freeDescriptorSets" ); } } + + void freeDescriptorSet( DescriptorPool descriptorPool, DescriptorSet const & descriptorSet ) const + { + Result result = static_cast( vkFreeDescriptorSets( m_device, static_cast( descriptorPool ), 1, reinterpret_cast( &descriptorSet ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::freeDescriptorSets" ); + } + } #endif /*VKCPP_ENHANCED_MODE*/ void updateDescriptorSets( uint32_t descriptorWriteCount, const WriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const CopyDescriptorSet* pDescriptorCopies ) const @@ -21049,6 +21229,11 @@ namespace vk { vkUpdateDescriptorSets( m_device, static_cast( descriptorWrites.size() ), reinterpret_cast( descriptorWrites.data() ), static_cast( descriptorCopies.size() ), reinterpret_cast( descriptorCopies.data() ) ); } + + void updateDescriptorSet( WriteDescriptorSet const & descriptorWrite, CopyDescriptorSet const & descriptorCopie ) const + { + vkUpdateDescriptorSets( m_device, 1, reinterpret_cast( &descriptorWrite ), 1, reinterpret_cast( &descriptorCopie ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ Result createFramebuffer( const FramebufferCreateInfo* pCreateInfo, const AllocationCallbacks* pAllocator, Framebuffer* pFramebuffer ) const @@ -21201,6 +21386,11 @@ namespace vk { vkFreeCommandBuffers( m_device, static_cast( commandPool ), static_cast( commandBuffers.size() ), reinterpret_cast( commandBuffers.data() ) ); } + + void freeCommandBuffer( CommandPool commandPool, CommandBuffer const & commandBuffer ) const + { + vkFreeCommandBuffers( m_device, static_cast( commandPool ), 1, reinterpret_cast( &commandBuffer ) ); + } #endif /*VKCPP_ENHANCED_MODE*/ Result createSharedSwapchainsKHR( uint32_t swapchainCount, const SwapchainCreateInfoKHR* pCreateInfos, const AllocationCallbacks* pAllocator, SwapchainKHR* pSwapchains ) const @@ -21219,6 +21409,17 @@ namespace vk } return swapchains; } + + SwapchainKHR createSharedSwapchainsKHR( SwapchainCreateInfoKHR const & createInfo, Optional const & allocator = nullptr ) const + { + SwapchainKHR swapchain; + Result result = static_cast( vkCreateSharedSwapchainsKHR( m_device, 1, reinterpret_cast( &createInfo ), reinterpret_cast( static_cast( allocator)), reinterpret_cast( &swapchain ) ) ); + if ( result != Result::eSuccess ) + { + throw std::system_error( result, "vk::Device::createSharedSwapchainsKHR" ); + } + return swapchain; + } #endif /*VKCPP_ENHANCED_MODE*/ Result createSwapchainKHR( const SwapchainCreateInfoKHR* pCreateInfo, const AllocationCallbacks* pAllocator, SwapchainKHR* pSwapchain ) const