mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Introduce hard-coded default values for some structure members. (#1658)
This commit is contained in:
parent
39c8c02de0
commit
d60453f6ea
@ -10657,11 +10657,16 @@ std::string VulkanHppGenerator::generateStructConstructorArgument( bool listedAr
|
||||
{
|
||||
str += generateEnumInitializer( memberData.type, memberData.arraySizes, enumIt->second.values, enumIt->second.isBitmask );
|
||||
}
|
||||
else if ( memberData.defaultValue.empty() )
|
||||
{
|
||||
// if there's no default value, it can be initialized with just {}
|
||||
str += "{}";
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( memberData.value.empty() );
|
||||
// all the rest can be initialized with just {}
|
||||
str += "{}";
|
||||
assert( memberData.defaultValue.starts_with( "VK_" ) );
|
||||
std::string tag = findTag( memberData.defaultValue );
|
||||
str += "VULKAN_HPP_NAMESPACE::" + toCamelCase( stripPostfix( stripPrefix( memberData.defaultValue, "VK_" ), tag ) ) + tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -11129,8 +11134,7 @@ std::tuple<std::string, std::string, std::string, std::string>
|
||||
}
|
||||
else
|
||||
{
|
||||
// as we don't have any meaningful default initialization values, everything can be initialized by just '{}'
|
||||
// !
|
||||
// when we don't have any default initialization value, everything can be initialized by just '{}'
|
||||
assert( member.arraySizes.empty() || member.bitCount.empty() );
|
||||
if ( !member.bitCount.empty() )
|
||||
{
|
||||
@ -11145,10 +11149,16 @@ std::tuple<std::string, std::string, std::string, std::string>
|
||||
{
|
||||
members += generateEnumInitializer( member.type, member.arraySizes, enumIt->second.values, enumIt->second.isBitmask );
|
||||
}
|
||||
else
|
||||
else if ( member.defaultValue.empty() )
|
||||
{
|
||||
members += "{}";
|
||||
}
|
||||
else
|
||||
{
|
||||
assert( member.defaultValue.starts_with( "VK_" ) );
|
||||
std::string tag = findTag( member.defaultValue );
|
||||
members += "VULKAN_HPP_NAMESPACE::" + toCamelCase( stripPostfix( stripPrefix( member.defaultValue, "VK_" ), tag ) ) + tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
members += ";\n";
|
||||
@ -14703,6 +14713,20 @@ void VulkanHppGenerator::readTypeStruct( tinyxml2::XMLElement const * element, b
|
||||
}
|
||||
it->second.subStruct = determineSubStruct( *it );
|
||||
|
||||
// add some default values for some structures here!
|
||||
if ( ( it->first == "VkRayTracingShaderGroupCreateInfoNV" ) || ( it->first == "VkRayTracingShaderGroupCreateInfoKHR" ) )
|
||||
{
|
||||
assert( ( ( it->first != "VkRayTracingShaderGroupCreateInfoNV" ) || ( it->second.members.size() == 7 ) ) &&
|
||||
( ( it->first != "VkRayTracingShaderGroupCreateInfoKHR" ) || ( it->second.members.size() == 8 ) ) );
|
||||
assert( ( it->second.members[3].name == "generalShader" ) && ( it->second.members[4].name == "closestHitShader" ) &&
|
||||
( it->second.members[5].name == "anyHitShader" ) && ( it->second.members[6].name == "intersectionShader" ) );
|
||||
bool isKHR = ( it->first == "VkRayTracingShaderGroupCreateInfoKHR" );
|
||||
for ( size_t i : { 3, 4, 5, 6 } )
|
||||
{
|
||||
it->second.members[i].defaultValue = isKHR ? "VK_SHADER_UNUSED_KHR" : "VK_SHADER_UNUSED_NV";
|
||||
}
|
||||
}
|
||||
|
||||
// check if multiple structure members use the very same (not empty) len attribute
|
||||
// Note: even though the arrays are not marked as optional, they still might be mutually exclusive (like in
|
||||
// VkWriteDescriptorSet)! That is, there's not enough information available in vk.xml to decide on that, so we
|
||||
|
@ -312,6 +312,7 @@ private:
|
||||
|
||||
struct MemberData
|
||||
{
|
||||
std::string defaultValue = {};
|
||||
TypeInfo type = {};
|
||||
std::string name = {};
|
||||
std::vector<std::string> arraySizes = {};
|
||||
|
@ -93338,10 +93338,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
#if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
|
||||
VULKAN_HPP_CONSTEXPR RayTracingShaderGroupCreateInfoKHR(
|
||||
VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR type_ = VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR::eGeneral,
|
||||
uint32_t generalShader_ = {},
|
||||
uint32_t closestHitShader_ = {},
|
||||
uint32_t anyHitShader_ = {},
|
||||
uint32_t intersectionShader_ = {},
|
||||
uint32_t generalShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR,
|
||||
uint32_t closestHitShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR,
|
||||
uint32_t anyHitShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR,
|
||||
uint32_t intersectionShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR,
|
||||
const void * pShaderGroupCaptureReplayHandle_ = {},
|
||||
const void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT
|
||||
: pNext( pNext_ )
|
||||
@ -93468,10 +93468,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eRayTracingShaderGroupCreateInfoKHR;
|
||||
const void * pNext = {};
|
||||
VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR type = VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR::eGeneral;
|
||||
uint32_t generalShader = {};
|
||||
uint32_t closestHitShader = {};
|
||||
uint32_t anyHitShader = {};
|
||||
uint32_t intersectionShader = {};
|
||||
uint32_t generalShader = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR;
|
||||
uint32_t closestHitShader = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR;
|
||||
uint32_t anyHitShader = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR;
|
||||
uint32_t intersectionShader = VULKAN_HPP_NAMESPACE::ShaderUnusedKHR;
|
||||
const void * pShaderGroupCaptureReplayHandle = {};
|
||||
};
|
||||
|
||||
@ -93879,10 +93879,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
#if !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
|
||||
VULKAN_HPP_CONSTEXPR RayTracingShaderGroupCreateInfoNV(
|
||||
VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR type_ = VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR::eGeneral,
|
||||
uint32_t generalShader_ = {},
|
||||
uint32_t closestHitShader_ = {},
|
||||
uint32_t anyHitShader_ = {},
|
||||
uint32_t intersectionShader_ = {},
|
||||
uint32_t generalShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedNV,
|
||||
uint32_t closestHitShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedNV,
|
||||
uint32_t anyHitShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedNV,
|
||||
uint32_t intersectionShader_ = VULKAN_HPP_NAMESPACE::ShaderUnusedNV,
|
||||
const void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT
|
||||
: pNext( pNext_ )
|
||||
, type( type_ )
|
||||
@ -93998,10 +93998,10 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
VULKAN_HPP_NAMESPACE::StructureType sType = StructureType::eRayTracingShaderGroupCreateInfoNV;
|
||||
const void * pNext = {};
|
||||
VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR type = VULKAN_HPP_NAMESPACE::RayTracingShaderGroupTypeKHR::eGeneral;
|
||||
uint32_t generalShader = {};
|
||||
uint32_t closestHitShader = {};
|
||||
uint32_t anyHitShader = {};
|
||||
uint32_t intersectionShader = {};
|
||||
uint32_t generalShader = VULKAN_HPP_NAMESPACE::ShaderUnusedNV;
|
||||
uint32_t closestHitShader = VULKAN_HPP_NAMESPACE::ShaderUnusedNV;
|
||||
uint32_t anyHitShader = VULKAN_HPP_NAMESPACE::ShaderUnusedNV;
|
||||
uint32_t intersectionShader = VULKAN_HPP_NAMESPACE::ShaderUnusedNV;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
Loading…
Reference in New Issue
Block a user