mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-09 14:10:07 +00:00
Extend support of video format properties (no code generated) (#1937)
This commit is contained in:
parent
dd0785dbc1
commit
6a11b182e1
@ -5863,8 +5863,7 @@ std::string VulkanHppGenerator::generateCppModuleUsings() const
|
||||
usings += exceptionsLeave + "\n";
|
||||
|
||||
// some hardcoded types
|
||||
auto const hardCodedResultValueTypes =
|
||||
std::array{ "ResultValue", "ResultValueType" };
|
||||
auto const hardCodedResultValueTypes = std::array{ "ResultValue", "ResultValueType" };
|
||||
for ( auto const & valueType : hardCodedResultValueTypes )
|
||||
{
|
||||
usings += replaceWithMap( usingTemplate, { { "className", valueType } } );
|
||||
@ -9991,8 +9990,7 @@ std::tuple<std::string, std::string, std::string, std::string, std::string, std:
|
||||
clearMembers += "\n m_constructorSuccessCode = VULKAN_HPP_NAMESPACE::Result::eErrorUnknown;";
|
||||
memberVariables += "\n VULKAN_HPP_NAMESPACE::Result m_constructorSuccessCode = VULKAN_HPP_NAMESPACE::Result::eErrorUnknown;";
|
||||
swapMembers += "\n std::swap( m_constructorSuccessCode, rhs.m_constructorSuccessCode );";
|
||||
moveConstructorInitializerList +=
|
||||
"m_constructorSuccessCode( VULKAN_HPP_NAMESPACE::exchange( rhs.m_constructorSuccessCode, {} ) ), ";
|
||||
moveConstructorInitializerList += "m_constructorSuccessCode( VULKAN_HPP_NAMESPACE::exchange( rhs.m_constructorSuccessCode, {} ) ), ";
|
||||
moveAssignmentInstructions += "\n std::swap( m_constructorSuccessCode, rhs.m_constructorSuccessCode );";
|
||||
releaseMembers += "\n m_constructorSuccessCode = VULKAN_HPP_NAMESPACE::Result::eErrorUnknown;";
|
||||
}
|
||||
@ -15719,10 +15717,12 @@ void VulkanHppGenerator::readVideoCapabilities( tinyxml2::XMLElement const * ele
|
||||
checkAttributes( line, attributes, { { "struct", {} } }, {} );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
videoCodec.capabilities = attributes.find( "struct" )->second;
|
||||
checkForError( m_structs.contains( videoCodec.capabilities ),
|
||||
std::string capabilities = attributes.find( "struct" )->second;
|
||||
checkForError( std::find( videoCodec.capabilities.begin(), videoCodec.capabilities.end(), capabilities ) == videoCodec.capabilities.end(),
|
||||
line,
|
||||
"videocodec <" + videoCodec.name + "> lists unknown capabilities struct <" + videoCodec.capabilities + ">" );
|
||||
"videocapabilities struct <" + capabilities + "> already listed for videoCodec <" + videoCodec.name + ">" );
|
||||
checkForError( m_structs.contains( capabilities ), line, "videocodec <" + videoCodec.name + "> lists unknown capabilities struct <" + capabilities + ">" );
|
||||
videoCodec.capabilities.push_back( capabilities );
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::readVideoCodec( tinyxml2::XMLElement const * element )
|
||||
@ -15732,7 +15732,7 @@ void VulkanHppGenerator::readVideoCodec( tinyxml2::XMLElement const * element )
|
||||
checkAttributes( line, attributes, { { "name", {} } }, { { "extend", {} }, { "value", {} } } );
|
||||
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
checkElements( line, children, { { "videocapabilities", true } }, { "videoformat", "videoprofiles" } );
|
||||
checkElements( line, children, { { "videocapabilities", false } }, { "videoformat", "videoprofiles" } );
|
||||
|
||||
VideoCodec videoCodec;
|
||||
videoCodec.xmlLine = line;
|
||||
@ -15804,10 +15804,43 @@ void VulkanHppGenerator::readVideoFormat( tinyxml2::XMLElement const * element,
|
||||
{
|
||||
const int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
|
||||
if ( attributes.contains( "extend" ) )
|
||||
{
|
||||
checkAttributes( line, attributes, { { "extend", {} } }, {} );
|
||||
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
checkElements( line, children, { { "videoformatproperties", true } } );
|
||||
|
||||
std::string extend = attributes.find( "extend" )->second;
|
||||
|
||||
std::vector<VideoFormat>::iterator videoFormatIt;
|
||||
|
||||
auto videoCodecIt = std::find_if( m_videoCodecs.begin(),
|
||||
m_videoCodecs.end(),
|
||||
[&extend, &videoFormatIt]( auto & vc )
|
||||
{
|
||||
videoFormatIt =
|
||||
std::find_if( vc.formats.begin(), vc.formats.end(), [&extend]( auto & vf ) { return vf.name == extend; } );
|
||||
return videoFormatIt != vc.formats.end();
|
||||
} );
|
||||
checkForError( videoCodecIt != m_videoCodecs.end(), line, "videocodec <" + videoCodec.name + "> extends unknown videoformat <" + extend + ">" );
|
||||
|
||||
for ( auto child : children )
|
||||
{
|
||||
std::string value = child->Value();
|
||||
if ( value == "videoformatproperties" )
|
||||
{
|
||||
readVideoFormatProperties( child, videoCodecIt->name, *videoFormatIt );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
checkAttributes( line, attributes, { { "name", {} }, { "usage", {} } }, {} );
|
||||
|
||||
std::vector<tinyxml2::XMLElement const *> children = getChildElements( element );
|
||||
checkElements( line, children, {}, { "videorequirecapabilities" } );
|
||||
checkElements( line, children, {}, { "videoformatproperties", "videorequirecapabilities" } );
|
||||
|
||||
auto flagBitsIt = m_enums.find( "VkImageUsageFlagBits" );
|
||||
assert( flagBitsIt != m_enums.end() );
|
||||
@ -15839,10 +15872,17 @@ void VulkanHppGenerator::readVideoFormat( tinyxml2::XMLElement const * element,
|
||||
for ( auto child : children )
|
||||
{
|
||||
std::string value = child->Value();
|
||||
assert( value == "videorequirecapabilities" );
|
||||
if ( value == "videoformatproperties" )
|
||||
{
|
||||
readVideoFormatProperties( child, videoCodec.name, videoCodec.formats.back() );
|
||||
}
|
||||
else if ( value == "videorequirecapabilities" )
|
||||
{
|
||||
readVideoRequireCapabilities( child, videoCodec );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::readVideoProfileMember( tinyxml2::XMLElement const * element, VideoCodec & videoCodec )
|
||||
{
|
||||
@ -15932,6 +15972,26 @@ void VulkanHppGenerator::readVideoProfiles( tinyxml2::XMLElement const * element
|
||||
}
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::readVideoFormatProperties( tinyxml2::XMLElement const * element, std::string const & videoCodec, VideoFormat & videoFormat )
|
||||
{
|
||||
const int line = element->GetLineNum();
|
||||
std::map<std::string, std::string> attributes = getAttributes( element );
|
||||
checkAttributes( line, attributes, { { "struct", {} } }, {} );
|
||||
checkElements( line, getChildElements( element ), {} );
|
||||
|
||||
std::string formatProperties = attributes.find( "struct" )->second;
|
||||
|
||||
checkForError( m_structs.find( formatProperties ) != m_structs.end(),
|
||||
line,
|
||||
"videoCodec <" + videoCodec + "> lists unknown struct <" + formatProperties + "> as videoformatproperties" );
|
||||
checkForError( std::find( videoFormat.formatProperties.begin(), videoFormat.formatProperties.end(), formatProperties ) == videoFormat.formatProperties.end(),
|
||||
line,
|
||||
"videoformatproperties <" + formatProperties + "> listed in videocodec <" + videoCodec + "> already listed for videoformat <" +
|
||||
videoFormat.name + ">" );
|
||||
|
||||
videoFormat.formatProperties.push_back( formatProperties );
|
||||
}
|
||||
|
||||
void VulkanHppGenerator::readVideoRequireCapabilities( tinyxml2::XMLElement const * element, VideoCodec & videoCodec )
|
||||
{
|
||||
const int line = element->GetLineNum();
|
||||
|
@ -398,6 +398,7 @@ private:
|
||||
struct VideoFormat
|
||||
{
|
||||
int xmlLine = {};
|
||||
std::vector<std::string> formatProperties;
|
||||
std::string name;
|
||||
std::vector<std::string> usage;
|
||||
std::vector<VideoRequireCapabilities> requireCapabilities;
|
||||
@ -428,7 +429,7 @@ private:
|
||||
{
|
||||
int xmlLine = {};
|
||||
std::string name;
|
||||
std::string capabilities;
|
||||
std::vector<std::string> capabilities;
|
||||
std::string extend;
|
||||
std::string value;
|
||||
std::vector<VideoFormat> formats;
|
||||
@ -1090,6 +1091,7 @@ private:
|
||||
void readVideoProfileMember( tinyxml2::XMLElement const * element, VideoCodec & videoCodec );
|
||||
void readVideoProfile( tinyxml2::XMLElement const * element, VideoCodec & videoCodec );
|
||||
void readVideoProfiles( tinyxml2::XMLElement const * element, VideoCodec & videoCodec );
|
||||
void readVideoFormatProperties( tinyxml2::XMLElement const * element, std::string const & videoCodec, VideoFormat & videoFormat );
|
||||
void readVideoRequireCapabilities( tinyxml2::XMLElement const * element, VideoCodec & videoCodec );
|
||||
void registerDeleter( std::string const & commandName, CommandData const & commandData );
|
||||
void rescheduleRAIIHandle( std::string & str,
|
||||
|
Loading…
Reference in New Issue
Block a user