mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-09 14:10:07 +00:00
Add support of hex numbers for enum values (#1671)
This commit is contained in:
parent
7b70ce4831
commit
eccf541cd4
@ -145,7 +145,7 @@ void VideoHppGenerator::checkCorrectness() const
|
||||
// check that all array sizes are a known constant
|
||||
for ( auto const & arraySize : member.arraySizes )
|
||||
{
|
||||
if ( arraySize.find_first_not_of( "0123456789" ) != std::string::npos )
|
||||
if ( !isNumber( arraySize ) )
|
||||
{
|
||||
bool found = extIt->requireData.constants.contains( arraySize );
|
||||
if ( !found )
|
||||
@ -457,6 +457,7 @@ void VideoHppGenerator::readEnumsEnum( tinyxml2::XMLElement const * element, std
|
||||
|
||||
std::string prefix = toUpperCase( enumIt->first ) + "_";
|
||||
checkForError( name.starts_with( prefix ), line, "encountered enum value <" + name + "> that does not begin with expected prefix <" + prefix + ">" );
|
||||
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
|
||||
|
||||
checkForError( std::none_of( enumIt->second.values.begin(), enumIt->second.values.end(), [&name]( EnumValueData const & evd ) { return evd.name == name; } ),
|
||||
line,
|
||||
@ -596,7 +597,7 @@ void VideoHppGenerator::readRequireEnum( tinyxml2::XMLElement const * element, s
|
||||
|
||||
if ( !name.ends_with( "_SPEC_VERSION" ) && !name.ends_with( "_EXTENSION_NAME" ) )
|
||||
{
|
||||
checkForError( value.find_first_not_of( "0123456789" ) == std::string::npos, line, "enum value uses unknown constant <" + value + ">" );
|
||||
checkForError( isNumber( value ) || isHexNumber( value ), line, "enum value uses unknown constant <" + value + ">" );
|
||||
checkForError( constants.insert( { name, { value, line } } ).second, line, "required enum <" + name + "> already specified" );
|
||||
}
|
||||
}
|
||||
|
@ -13871,7 +13871,7 @@ void VulkanHppGenerator::readRequireEnum(
|
||||
{
|
||||
protect = attribute.second;
|
||||
}
|
||||
else if (attribute.first == "type")
|
||||
else if ( attribute.first == "type" )
|
||||
{
|
||||
type = attribute.second;
|
||||
}
|
||||
@ -13897,7 +13897,7 @@ void VulkanHppGenerator::readRequireEnum(
|
||||
checkForError( m_types.insert( { name, TypeData{ TypeCategory::Constant, { requiredBy }, line } } ).second,
|
||||
line,
|
||||
"required enum <" + name + "> specified by value <" + value + "> is already specified" );
|
||||
if (type == "uint32_t")
|
||||
if ( type == "uint32_t" )
|
||||
{
|
||||
assert( !m_constants.contains( name ) );
|
||||
m_constants[name] = { type, value, line };
|
||||
@ -15368,11 +15368,6 @@ bool isAllUpper( std::string const & name )
|
||||
return std::none_of( name.begin(), name.end(), []( auto const & c ) { return c != toupper( c ); } );
|
||||
}
|
||||
|
||||
bool isNumber( std::string const & name )
|
||||
{
|
||||
return name.find_first_not_of( "0123456789" ) == std::string::npos;
|
||||
}
|
||||
|
||||
std::string readSnippet( std::string const & snippetFile )
|
||||
{
|
||||
std::ifstream ifs( std::string( BASE_PATH ) + "/snippets/" + snippetFile );
|
||||
|
@ -274,6 +274,16 @@ inline std::vector<tinyxml2::XMLElement const *> getChildElements( ElementContai
|
||||
return childElements;
|
||||
}
|
||||
|
||||
inline bool isHexNumber(std::string const& name)
|
||||
{
|
||||
return name.starts_with( "0x" ) && ( name.find_first_not_of( "0123456789ABCDEF", 2 ) == std::string::npos );
|
||||
}
|
||||
|
||||
inline bool isNumber( std::string const & name )
|
||||
{
|
||||
return name.find_first_not_of( "0123456789" ) == std::string::npos;
|
||||
}
|
||||
|
||||
inline std::string readComment( tinyxml2::XMLElement const * element )
|
||||
{
|
||||
int line = element->GetLineNum();
|
||||
|
@ -1028,9 +1028,9 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
|
||||
bool operator==( EncodeH264RefPicMarkingEntry const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return ( operation == rhs.operation ) && ( difference_of_pic_nums_minus1 == rhs.difference_of_pic_nums_minus1 ) &&
|
||||
( long_term_pic_num == rhs.long_term_pic_num ) && ( long_term_frame_idx == rhs.long_term_frame_idx ) &&
|
||||
( max_long_term_frame_idx_plus1 == rhs.max_long_term_frame_idx_plus1 );
|
||||
return ( memory_management_control_operation == rhs.memory_management_control_operation ) &&
|
||||
( difference_of_pic_nums_minus1 == rhs.difference_of_pic_nums_minus1 ) && ( long_term_pic_num == rhs.long_term_pic_num ) &&
|
||||
( long_term_frame_idx == rhs.long_term_frame_idx ) && ( max_long_term_frame_idx_plus1 == rhs.max_long_term_frame_idx_plus1 );
|
||||
}
|
||||
|
||||
bool operator!=( EncodeH264RefPicMarkingEntry const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
@ -1039,7 +1039,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
}
|
||||
|
||||
public:
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264MemMgmtControlOp operation =
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264MemMgmtControlOp memory_management_control_operation =
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264MemMgmtControlOp::eEnd;
|
||||
uint16_t difference_of_pic_nums_minus1 = {};
|
||||
uint16_t long_term_pic_num = {};
|
||||
@ -1185,7 +1185,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
{
|
||||
return ( flags == rhs.flags ) && ( first_mb_in_slice == rhs.first_mb_in_slice ) && ( slice_type == rhs.slice_type ) &&
|
||||
( slice_alpha_c0_offset_div2 == rhs.slice_alpha_c0_offset_div2 ) && ( slice_beta_offset_div2 == rhs.slice_beta_offset_div2 ) &&
|
||||
( reserved1 == rhs.reserved1 ) && ( cabac_init_idc == rhs.cabac_init_idc ) &&
|
||||
( slice_qp_delta == rhs.slice_qp_delta ) && ( reserved1 == rhs.reserved1 ) && ( cabac_init_idc == rhs.cabac_init_idc ) &&
|
||||
( disable_deblocking_filter_idc == rhs.disable_deblocking_filter_idc ) && ( pWeightTable == rhs.pWeightTable );
|
||||
}
|
||||
|
||||
@ -1200,7 +1200,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264SliceType slice_type = VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264SliceType::eP;
|
||||
int8_t slice_alpha_c0_offset_div2 = {};
|
||||
int8_t slice_beta_offset_div2 = {};
|
||||
uint16_t reserved1 = {};
|
||||
int8_t slice_qp_delta = {};
|
||||
uint8_t reserved1 = {};
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264CabacInitIdc cabac_init_idc =
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264CabacInitIdc::e0;
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H264DisableDeblockingFilterIdc disable_deblocking_filter_idc =
|
||||
@ -2416,7 +2417,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
( slice_cb_qp_offset == rhs.slice_cb_qp_offset ) && ( slice_cr_qp_offset == rhs.slice_cr_qp_offset ) &&
|
||||
( slice_beta_offset_div2 == rhs.slice_beta_offset_div2 ) && ( slice_tc_offset_div2 == rhs.slice_tc_offset_div2 ) &&
|
||||
( slice_act_y_qp_offset == rhs.slice_act_y_qp_offset ) && ( slice_act_cb_qp_offset == rhs.slice_act_cb_qp_offset ) &&
|
||||
( slice_act_cr_qp_offset == rhs.slice_act_cr_qp_offset ) && ( reserved1 == rhs.reserved1 ) && ( pWeightTable == rhs.pWeightTable );
|
||||
( slice_act_cr_qp_offset == rhs.slice_act_cr_qp_offset ) && ( slice_qp_delta == rhs.slice_qp_delta ) && ( reserved1 == rhs.reserved1 ) &&
|
||||
( pWeightTable == rhs.pWeightTable );
|
||||
}
|
||||
|
||||
bool operator!=( EncodeH265SliceSegmentHeader const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
@ -2437,7 +2439,8 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
int8_t slice_act_y_qp_offset = {};
|
||||
int8_t slice_act_cb_qp_offset = {};
|
||||
int8_t slice_act_cr_qp_offset = {};
|
||||
VULKAN_HPP_NAMESPACE::ArrayWrapper1D<uint8_t, 3> reserved1 = {};
|
||||
int8_t slice_qp_delta = {};
|
||||
uint16_t reserved1 = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265WeightTable * pWeightTable = {};
|
||||
};
|
||||
|
||||
@ -2550,28 +2553,28 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
uint32_t reserved : 23;
|
||||
};
|
||||
|
||||
struct EncodeH265SliceSegmentLongTermRefPics
|
||||
struct EncodeH265LongTermRefPics
|
||||
{
|
||||
using NativeType = StdVideoEncodeH265SliceSegmentLongTermRefPics;
|
||||
using NativeType = StdVideoEncodeH265LongTermRefPics;
|
||||
|
||||
operator StdVideoEncodeH265SliceSegmentLongTermRefPics const &() const VULKAN_HPP_NOEXCEPT
|
||||
operator StdVideoEncodeH265LongTermRefPics const &() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *reinterpret_cast<const StdVideoEncodeH265SliceSegmentLongTermRefPics *>( this );
|
||||
return *reinterpret_cast<const StdVideoEncodeH265LongTermRefPics *>( this );
|
||||
}
|
||||
|
||||
operator StdVideoEncodeH265SliceSegmentLongTermRefPics &() VULKAN_HPP_NOEXCEPT
|
||||
operator StdVideoEncodeH265LongTermRefPics &() VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return *reinterpret_cast<StdVideoEncodeH265SliceSegmentLongTermRefPics *>( this );
|
||||
return *reinterpret_cast<StdVideoEncodeH265LongTermRefPics *>( this );
|
||||
}
|
||||
|
||||
bool operator==( EncodeH265SliceSegmentLongTermRefPics const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
bool operator==( EncodeH265LongTermRefPics const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return ( num_long_term_sps == rhs.num_long_term_sps ) && ( num_long_term_pics == rhs.num_long_term_pics ) && ( lt_idx_sps == rhs.lt_idx_sps ) &&
|
||||
( poc_lsb_lt == rhs.poc_lsb_lt ) && ( used_by_curr_pic_lt_flag == rhs.used_by_curr_pic_lt_flag ) &&
|
||||
( delta_poc_msb_present_flag == rhs.delta_poc_msb_present_flag ) && ( delta_poc_msb_cycle_lt == rhs.delta_poc_msb_cycle_lt );
|
||||
}
|
||||
|
||||
bool operator!=( EncodeH265SliceSegmentLongTermRefPics const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
bool operator!=( EncodeH265LongTermRefPics const & rhs ) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !operator==( rhs );
|
||||
}
|
||||
@ -2617,16 +2620,16 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
public:
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265PictureInfoFlags flags = {};
|
||||
VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H265PictureType pic_type = VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H265PictureType::eP;
|
||||
uint8_t sps_video_parameter_set_id = {};
|
||||
uint8_t pps_seq_parameter_set_id = {};
|
||||
uint8_t pps_pic_parameter_set_id = {};
|
||||
uint8_t short_term_ref_pic_set_idx = {};
|
||||
int32_t PicOrderCntVal = {};
|
||||
uint8_t TemporalId = {};
|
||||
VULKAN_HPP_NAMESPACE::ArrayWrapper1D<uint8_t, 7> reserved1 = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265ReferenceListsInfo * pRefLists = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H265ShortTermRefPicSet * pShortTermRefPicSet = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265SliceSegmentLongTermRefPics * pLongTermRefPics = {};
|
||||
uint8_t sps_video_parameter_set_id = {};
|
||||
uint8_t pps_seq_parameter_set_id = {};
|
||||
uint8_t pps_pic_parameter_set_id = {};
|
||||
uint8_t short_term_ref_pic_set_idx = {};
|
||||
int32_t PicOrderCntVal = {};
|
||||
uint8_t TemporalId = {};
|
||||
VULKAN_HPP_NAMESPACE::ArrayWrapper1D<uint8_t, 7> reserved1 = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265ReferenceListsInfo * pRefLists = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::H265ShortTermRefPicSet * pShortTermRefPicSet = {};
|
||||
const VULKAN_HPP_NAMESPACE::VULKAN_HPP_VIDEO_NAMESPACE::EncodeH265LongTermRefPics * pLongTermRefPics = {};
|
||||
};
|
||||
|
||||
struct EncodeH265ReferenceInfoFlags
|
||||
|
Loading…
Reference in New Issue
Block a user