Remove implicit cast operators on ResultValue<T>

As it turned out to not provide a complete solution to the C++-API-change issue on logical-change of the C-API, we simply remove those implicit cast operators. That is, accessing the result and the value need to be explicit.
This commit is contained in:
asuessenbach
2020-07-20 13:48:03 +02:00
committed by Markus Tavenrath
parent 4cdc51ba0f
commit fba2516d9c
9 changed files with 206 additions and 134 deletions

View File

@@ -16299,21 +16299,29 @@ namespace VULKAN_HPP_NAMESPACE
}
#if !defined( VULKAN_HPP_DISABLE_IMPLICIT_RESULT_VALUE_CAST )
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator T const &() const & VULKAN_HPP_NOEXCEPT
{
return value;
}
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator T &() & VULKAN_HPP_NOEXCEPT
{
return value;
}
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator T const &&() const && VULKAN_HPP_NOEXCEPT
{
return std::move( value );
}
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator T &&() && VULKAN_HPP_NOEXCEPT
{
return std::move( value );
@@ -16343,17 +16351,42 @@ namespace VULKAN_HPP_NAMESPACE
}
# if !defined( VULKAN_HPP_DISABLE_IMPLICIT_RESULT_VALUE_CAST )
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator UniqueHandle<Type, Dispatch> &() & VULKAN_HPP_NOEXCEPT
{
return value;
}
VULKAN_HPP_DEPRECATED(
"Implicit-cast operators on vk::ResultValue are deprecated. Explicitly access the value as member of ResultValue." )
operator UniqueHandle<Type, Dispatch>() VULKAN_HPP_NOEXCEPT
{
return std::move( value );
}
# endif
};
template <typename Type, typename Dispatch>
struct ResultValue<std::vector<UniqueHandle<Type, Dispatch>>>
{
# ifdef VULKAN_HPP_HAS_NOEXCEPT
ResultValue( Result r, std::vector<UniqueHandle<Type, Dispatch>> && v ) VULKAN_HPP_NOEXCEPT
# else
ResultValue( Result r, std::vector<UniqueHandle<Type, Dispatch>> && v )
# endif
: result( r )
, value( std::move( v ) )
{}
Result result;
std::vector<UniqueHandle<Type, Dispatch>> value;
operator std::tuple<Result &, std::vector<UniqueHandle<Type, Dispatch>> &>() VULKAN_HPP_NOEXCEPT
{
return std::tuple<Result &, std::vector<UniqueHandle<Type, Dispatch>> &>( result, value );
}
};
#endif
template <typename T>
@@ -16467,14 +16500,49 @@ namespace VULKAN_HPP_NAMESPACE
# ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message );
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
# else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
{
throwResultException( result, message );
}
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
# endif
return ResultValue<UniqueHandle<T, D>>( result, UniqueHandle<T, D>( data, deleter ) );
}
template <typename T, typename D>
VULKAN_HPP_INLINE typename ResultValueType<std::vector<UniqueHandle<T, D>>>::type
createResultValue( Result result, std::vector<UniqueHandle<T, D>> && data, char const * message )
{
# ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message );
VULKAN_HPP_ASSERT_ON_RESULT( result == Result::eSuccess );
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
# else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
}
return std::move( data );
# endif
}
template <typename T, typename D>
VULKAN_HPP_INLINE ResultValue<std::vector<UniqueHandle<T, D>>>
createResultValue( Result result,
std::vector<UniqueHandle<T, D>> && data,
char const * message,
std::initializer_list<Result> successCodes )
{
# ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore( message );
VULKAN_HPP_ASSERT_ON_RESULT( std::find( successCodes.begin(), successCodes.end(), result ) != successCodes.end() );
# else
if ( std::find( successCodes.begin(), successCodes.end(), result ) == successCodes.end() )
{
throwResultException( result, message );
}
# endif
return ResultValue<std::vector<UniqueHandle<T, D>>>( result, std::move( data ) );
}
#endif
@@ -89785,7 +89853,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue(
result, uniqueCommandBuffers, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
result, std::move( uniqueCommandBuffers ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
}
template <typename Allocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
@@ -89811,7 +89879,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue(
result, uniqueCommandBuffers, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
result, std::move( uniqueCommandBuffers ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateCommandBuffersUnique" );
}
# endif /*VULKAN_HPP_NO_SMART_HANDLE*/
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@@ -89877,7 +89945,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue(
result, uniqueDescriptorSets, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
result, std::move( uniqueDescriptorSets ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
}
template <typename Allocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
@@ -89903,7 +89971,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue(
result, uniqueDescriptorSets, VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
result, std::move( uniqueDescriptorSets ), VULKAN_HPP_NAMESPACE_STRING "::Device::allocateDescriptorSetsUnique" );
}
# endif /*VULKAN_HPP_NO_SMART_HANDLE*/
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
@@ -90645,7 +90713,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createComputePipelinesUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -90680,7 +90748,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createComputePipelinesUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -91224,7 +91292,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createGraphicsPipelinesUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -91259,7 +91327,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createGraphicsPipelinesUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -91768,7 +91836,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue( result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createRayTracingPipelinesKHRUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess,
VULKAN_HPP_NAMESPACE::Result::eOperationDeferredKHR,
@@ -91807,7 +91875,7 @@ namespace VULKAN_HPP_NAMESPACE
}
return createResultValue( result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createRayTracingPipelinesKHRUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess,
VULKAN_HPP_NAMESPACE::Result::eOperationDeferredKHR,
@@ -91957,7 +92025,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createRayTracingPipelinesNVUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -91992,7 +92060,7 @@ namespace VULKAN_HPP_NAMESPACE
return createResultValue(
result,
uniquePipelines,
std::move( uniquePipelines ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createRayTracingPipelinesNVUnique",
{ VULKAN_HPP_NAMESPACE::Result::eSuccess, VULKAN_HPP_NAMESPACE::Result::ePipelineCompileRequiredEXT } );
}
@@ -92522,8 +92590,9 @@ namespace VULKAN_HPP_NAMESPACE
}
}
return createResultValue(
result, uniqueSwapchainKHRs, VULKAN_HPP_NAMESPACE_STRING "::Device::createSharedSwapchainsKHRUnique" );
return createResultValue( result,
std::move( uniqueSwapchainKHRs ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createSharedSwapchainsKHRUnique" );
}
template <typename Allocator, typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE
@@ -92552,8 +92621,9 @@ namespace VULKAN_HPP_NAMESPACE
}
}
return createResultValue(
result, uniqueSwapchainKHRs, VULKAN_HPP_NAMESPACE_STRING "::Device::createSharedSwapchainsKHRUnique" );
return createResultValue( result,
std::move( uniqueSwapchainKHRs ),
VULKAN_HPP_NAMESPACE_STRING "::Device::createSharedSwapchainsKHRUnique" );
}
template <typename Dispatch>
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE