mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Moved some implementation details into namespace detail. (#1840)
This commit is contained in:
parent
4e9c7ec4c3
commit
bb66ad3b04
@ -5669,17 +5669,15 @@ std::string VulkanHppGenerator::generateCppModuleUsings() const
|
|||||||
|
|
||||||
usings += exceptionsLeave + "\n";
|
usings += exceptionsLeave + "\n";
|
||||||
|
|
||||||
// ResultValue
|
// some hardcoded types
|
||||||
auto const hardCodedResultValueTypes = std::array{ "ignore", "ResultValue", "ResultValueType", "createResultValueType" };
|
auto const hardCodedResultValueTypes =
|
||||||
for ( auto const & className : hardCodedResultValueTypes )
|
std::array{ "ResultValue", "ResultValueType", "detail::createResultValueType", "detail::ignore", "detail::resultCheck" };
|
||||||
|
for ( auto const & valueType : hardCodedResultValueTypes )
|
||||||
{
|
{
|
||||||
usings += replaceWithMap( usingTemplate, { { "className", className } } );
|
usings += replaceWithMap( usingTemplate, { { "className", valueType } } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// resultCheck
|
usings += "\n" + generateConstexprUsings() + "\n";
|
||||||
usings += replaceWithMap( usingTemplate, { { "className", "resultCheck" } } ) + "\n";
|
|
||||||
|
|
||||||
usings += generateConstexprUsings() + "\n";
|
|
||||||
|
|
||||||
// structs, handles, UniqueHandles, etc
|
// structs, handles, UniqueHandles, etc
|
||||||
usings += generateCppModuleStructUsings();
|
usings += generateCppModuleStructUsings();
|
||||||
@ -9812,7 +9810,7 @@ std::string VulkanHppGenerator::generateResultCheck(
|
|||||||
std::string successCodeList = generateSuccessCodeList( commandData.successCodes, enumerating );
|
std::string successCodeList = generateSuccessCodeList( commandData.successCodes, enumerating );
|
||||||
|
|
||||||
std::string const resultCheckTemplate =
|
std::string const resultCheckTemplate =
|
||||||
R"(resultCheck( result, VULKAN_HPP_NAMESPACE_STRING "::${className}${classSeparator}${commandName}"${successCodeList} );)";
|
R"(VULKAN_HPP_NAMESPACE::detail::resultCheck( result, VULKAN_HPP_NAMESPACE_STRING "::${className}${classSeparator}${commandName}"${successCodeList} );)";
|
||||||
|
|
||||||
resultCheck = replaceWithMap(
|
resultCheck = replaceWithMap(
|
||||||
resultCheckTemplate,
|
resultCheckTemplate,
|
||||||
@ -9918,12 +9916,12 @@ std::string VulkanHppGenerator::generateReturnStatement( std::string const & com
|
|||||||
if ( returnVariable.empty() )
|
if ( returnVariable.empty() )
|
||||||
{
|
{
|
||||||
assert( !unique );
|
assert( !unique );
|
||||||
returnStatement = "return createResultValueType( result );";
|
returnStatement = "return VULKAN_HPP_NAMESPACE::detail::createResultValueType( result );";
|
||||||
}
|
}
|
||||||
else if ( unique )
|
else if ( unique )
|
||||||
{
|
{
|
||||||
assert( returnParam != INVALID_INDEX );
|
assert( returnParam != INVALID_INDEX );
|
||||||
returnStatement = "return createResultValueType( result, ";
|
returnStatement = "return VULKAN_HPP_NAMESPACE::detail::createResultValueType( result, ";
|
||||||
if ( dataType.starts_with( "std::" ) )
|
if ( dataType.starts_with( "std::" ) )
|
||||||
{
|
{
|
||||||
returnStatement += "std::move( unique" + startUpperCase( returnVariable ) + " )";
|
returnStatement += "std::move( unique" + startUpperCase( returnVariable ) + " )";
|
||||||
@ -9938,7 +9936,7 @@ std::string VulkanHppGenerator::generateReturnStatement( std::string const & com
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
returnStatement = "return createResultValueType( result, std::move( " + returnVariable + " ) );";
|
returnStatement = "return VULKAN_HPP_NAMESPACE::detail::createResultValueType( result, std::move( " + returnVariable + " ) );";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
template <typename T> void ignore(T const &) VULKAN_HPP_NOEXCEPT {}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct ResultValue
|
struct ResultValue
|
||||||
{
|
{
|
||||||
@ -107,33 +105,41 @@
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
void ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<T>::type createResultValueType( Result result, T & data )
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<T>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result, T & data )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return ResultValue<T>( result, data );
|
return ResultValue<T>( result, data );
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
return data;
|
return data;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<T>::type createResultValueType( Result result, T && data )
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<T>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result, T && data )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return ResultValue<T>( result, std::move( data ) );
|
return ResultValue<T>( result, std::move( data ) );
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
return std::move( data );
|
return std::move( data );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} // namespace detail
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message )
|
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
ignore( message );
|
VULKAN_HPP_NAMESPACE::detail::ignore( message );
|
||||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||||
#else
|
#else
|
||||||
if ( result != Result::eSuccess )
|
if ( result != Result::eSuccess )
|
||||||
{
|
{
|
||||||
detail::throwResultException( result, message );
|
VULKAN_HPP_NAMESPACE::detail::throwResultException( result, message );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -15,14 +18,15 @@
|
|||||||
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message, std::initializer_list<Result> successCodes )
|
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message, std::initializer_list<Result> successCodes )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
ignore( message );
|
VULKAN_HPP_NAMESPACE::detail::ignore( message );
|
||||||
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||||
#else
|
#else
|
||||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||||
{
|
{
|
||||||
detail::throwResultException( result, message );
|
VULKAN_HPP_NAMESPACE::detail::throwResultException( result, message );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} // namespace detail
|
||||||
|
@ -908,11 +908,11 @@ export namespace VULKAN_HPP_NAMESPACE
|
|||||||
using VULKAN_HPP_NAMESPACE::InvalidVideoStdParametersKHRError;
|
using VULKAN_HPP_NAMESPACE::InvalidVideoStdParametersKHRError;
|
||||||
#endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
#endif /*VULKAN_HPP_NO_EXCEPTIONS*/
|
||||||
|
|
||||||
using VULKAN_HPP_NAMESPACE::createResultValueType;
|
|
||||||
using VULKAN_HPP_NAMESPACE::ignore;
|
|
||||||
using VULKAN_HPP_NAMESPACE::resultCheck;
|
|
||||||
using VULKAN_HPP_NAMESPACE::ResultValue;
|
using VULKAN_HPP_NAMESPACE::ResultValue;
|
||||||
using VULKAN_HPP_NAMESPACE::ResultValueType;
|
using VULKAN_HPP_NAMESPACE::ResultValueType;
|
||||||
|
using VULKAN_HPP_NAMESPACE::detail::createResultValueType;
|
||||||
|
using VULKAN_HPP_NAMESPACE::detail::ignore;
|
||||||
|
using VULKAN_HPP_NAMESPACE::detail::resultCheck;
|
||||||
|
|
||||||
//===========================
|
//===========================
|
||||||
//=== CONSTEXPR CONSTANTs ===
|
//=== CONSTEXPR CONSTANTs ===
|
||||||
|
@ -6601,11 +6601,6 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct ResultValue
|
struct ResultValue
|
||||||
{
|
{
|
||||||
@ -6718,47 +6713,57 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<void>::type createResultValueType( Result result )
|
namespace detail
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
void ignore( T const & ) VULKAN_HPP_NOEXCEPT
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<void>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return result;
|
return result;
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<T>::type createResultValueType( Result result, T & data )
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<T>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result, T & data )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return ResultValue<T>( result, data );
|
return ResultValue<T>( result, data );
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
return data;
|
return data;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
VULKAN_HPP_INLINE typename ResultValueType<T>::type createResultValueType( Result result, T && data )
|
VULKAN_HPP_INLINE typename VULKAN_HPP_NAMESPACE::ResultValueType<T>::type createResultValueType( VULKAN_HPP_NAMESPACE::Result result, T && data )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
return ResultValue<T>( result, std::move( data ) );
|
return ResultValue<T>( result, std::move( data ) );
|
||||||
#else
|
#else
|
||||||
ignore( result );
|
VULKAN_HPP_NAMESPACE::detail::ignore( result );
|
||||||
return std::move( data );
|
return std::move( data );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message )
|
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
ignore( message );
|
VULKAN_HPP_NAMESPACE::detail::ignore( message );
|
||||||
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
|
||||||
#else
|
#else
|
||||||
if ( result != Result::eSuccess )
|
if ( result != Result::eSuccess )
|
||||||
{
|
{
|
||||||
detail::throwResultException( result, message );
|
VULKAN_HPP_NAMESPACE::detail::throwResultException( result, message );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -6766,17 +6771,18 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message, std::initializer_list<Result> successCodes )
|
VULKAN_HPP_INLINE void resultCheck( Result result, char const * message, std::initializer_list<Result> successCodes )
|
||||||
{
|
{
|
||||||
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
#ifdef VULKAN_HPP_NO_EXCEPTIONS
|
||||||
ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( result ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
ignore( message );
|
VULKAN_HPP_NAMESPACE::detail::ignore( message );
|
||||||
ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
VULKAN_HPP_NAMESPACE::detail::ignore( successCodes ); // just in case VULKAN_HPP_ASSERT_ON_RESULT is empty
|
||||||
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
|
||||||
#else
|
#else
|
||||||
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
|
||||||
{
|
{
|
||||||
detail::throwResultException( result, message );
|
VULKAN_HPP_NAMESPACE::detail::throwResultException( result, message );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
//===========================
|
//===========================
|
||||||
//=== CONSTEXPR CONSTANTs ===
|
//=== CONSTEXPR CONSTANTs ===
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user