skyline/app/libraries/VulkanHpp/vulkan/internal/exceptions.hpp
◱ PixelyIon 500b49d329 Add Vulkan-Hpp to libraries
This commit adds Vulkan-Hpp as a library to the project. The headers are from a modified version of `VulkanHppGenerator`. They are broken into multiple files to avoid exceeding the Intellisense file size limit of Android Studio.
2020-04-23 22:26:27 +05:30

498 lines
19 KiB
C++

// Copyright (c) 2015-2019 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ---- Exceptions to the Apache 2.0 License: ----
//
// As an exception, if you use this Software to generate code and portions of
// this Software are embedded into the generated code as a result, you may
// redistribute such product without providing attribution as would otherwise
// be required by Sections 4(a), 4(b) and 4(d) of the License.
//
// In addition, if you combine or link code generated by this Software with
// software that is licensed under the GPLv2 or the LGPL v2.0 or 2.1
// ("`Combined Software`") and if a court of competent jurisdiction determines
// that the patent provision (Section 3), the indemnity provision (Section 9)
// or other Section of the License conflicts with the conditions of the
// applicable GPL or LGPL license, you may retroactively and prospectively
// choose to deem waived or otherwise exclude such Section(s) of the License,
// but only in their entirety and only with respect to the Combined Software.
//
// This header is generated from the Khronos Vulkan XML API Registry.
#pragma once
#include "bitmasks.hpp"
#ifndef VULKAN_HPP_NO_EXCEPTIONS
namespace std
{
template <>
struct is_error_code_enum<VULKAN_HPP_NAMESPACE::Result> : public true_type
{};
}
#endif
namespace VULKAN_HPP_NAMESPACE
{
#ifndef VULKAN_HPP_NO_EXCEPTIONS
class ErrorCategoryImpl : public std::error_category
{
public:
virtual const char* name() const VULKAN_HPP_NOEXCEPT override { return VULKAN_HPP_NAMESPACE_STRING"::Result"; }
virtual std::string message(int ev) const override { return to_string(static_cast<Result>(ev)); }
};
class Error
{
public:
Error() VULKAN_HPP_NOEXCEPT = default;
Error(const Error&) VULKAN_HPP_NOEXCEPT = default;
virtual ~Error() VULKAN_HPP_NOEXCEPT = default;
virtual const char* what() const VULKAN_HPP_NOEXCEPT = 0;
};
class LogicError : public Error, public std::logic_error
{
public:
explicit LogicError( const std::string& what )
: Error(), std::logic_error(what) {}
explicit LogicError( char const * what )
: Error(), std::logic_error(what) {}
virtual const char* what() const VULKAN_HPP_NOEXCEPT { return std::logic_error::what(); }
};
class SystemError : public Error, public std::system_error
{
public:
SystemError( std::error_code ec )
: Error(), std::system_error(ec) {}
SystemError( std::error_code ec, std::string const& what )
: Error(), std::system_error(ec, what) {}
SystemError( std::error_code ec, char const * what )
: Error(), std::system_error(ec, what) {}
SystemError( int ev, std::error_category const& ecat )
: Error(), std::system_error(ev, ecat) {}
SystemError( int ev, std::error_category const& ecat, std::string const& what)
: Error(), std::system_error(ev, ecat, what) {}
SystemError( int ev, std::error_category const& ecat, char const * what)
: Error(), std::system_error(ev, ecat, what) {}
virtual const char* what() const VULKAN_HPP_NOEXCEPT { return std::system_error::what(); }
};
VULKAN_HPP_INLINE const std::error_category& errorCategory() VULKAN_HPP_NOEXCEPT
{
static ErrorCategoryImpl instance;
return instance;
}
VULKAN_HPP_INLINE std::error_code make_error_code(Result e) VULKAN_HPP_NOEXCEPT
{
return std::error_code(static_cast<int>(e), errorCategory());
}
VULKAN_HPP_INLINE std::error_condition make_error_condition(Result e) VULKAN_HPP_NOEXCEPT
{
return std::error_condition(static_cast<int>(e), errorCategory());
}
class OutOfHostMemoryError : public SystemError
{
public:
OutOfHostMemoryError( std::string const& message )
: SystemError( make_error_code( Result::eErrorOutOfHostMemory ), message ) {}
OutOfHostMemoryError( char const * message )
: SystemError( make_error_code( Result::eErrorOutOfHostMemory ), message ) {}
};
class OutOfDeviceMemoryError : public SystemError
{
public:
OutOfDeviceMemoryError( std::string const& message )
: SystemError( make_error_code( Result::eErrorOutOfDeviceMemory ), message ) {}
OutOfDeviceMemoryError( char const * message )
: SystemError( make_error_code( Result::eErrorOutOfDeviceMemory ), message ) {}
};
class InitializationFailedError : public SystemError
{
public:
InitializationFailedError( std::string const& message )
: SystemError( make_error_code( Result::eErrorInitializationFailed ), message ) {}
InitializationFailedError( char const * message )
: SystemError( make_error_code( Result::eErrorInitializationFailed ), message ) {}
};
class DeviceLostError : public SystemError
{
public:
DeviceLostError( std::string const& message )
: SystemError( make_error_code( Result::eErrorDeviceLost ), message ) {}
DeviceLostError( char const * message )
: SystemError( make_error_code( Result::eErrorDeviceLost ), message ) {}
};
class MemoryMapFailedError : public SystemError
{
public:
MemoryMapFailedError( std::string const& message )
: SystemError( make_error_code( Result::eErrorMemoryMapFailed ), message ) {}
MemoryMapFailedError( char const * message )
: SystemError( make_error_code( Result::eErrorMemoryMapFailed ), message ) {}
};
class LayerNotPresentError : public SystemError
{
public:
LayerNotPresentError( std::string const& message )
: SystemError( make_error_code( Result::eErrorLayerNotPresent ), message ) {}
LayerNotPresentError( char const * message )
: SystemError( make_error_code( Result::eErrorLayerNotPresent ), message ) {}
};
class ExtensionNotPresentError : public SystemError
{
public:
ExtensionNotPresentError( std::string const& message )
: SystemError( make_error_code( Result::eErrorExtensionNotPresent ), message ) {}
ExtensionNotPresentError( char const * message )
: SystemError( make_error_code( Result::eErrorExtensionNotPresent ), message ) {}
};
class FeatureNotPresentError : public SystemError
{
public:
FeatureNotPresentError( std::string const& message )
: SystemError( make_error_code( Result::eErrorFeatureNotPresent ), message ) {}
FeatureNotPresentError( char const * message )
: SystemError( make_error_code( Result::eErrorFeatureNotPresent ), message ) {}
};
class IncompatibleDriverError : public SystemError
{
public:
IncompatibleDriverError( std::string const& message )
: SystemError( make_error_code( Result::eErrorIncompatibleDriver ), message ) {}
IncompatibleDriverError( char const * message )
: SystemError( make_error_code( Result::eErrorIncompatibleDriver ), message ) {}
};
class TooManyObjectsError : public SystemError
{
public:
TooManyObjectsError( std::string const& message )
: SystemError( make_error_code( Result::eErrorTooManyObjects ), message ) {}
TooManyObjectsError( char const * message )
: SystemError( make_error_code( Result::eErrorTooManyObjects ), message ) {}
};
class FormatNotSupportedError : public SystemError
{
public:
FormatNotSupportedError( std::string const& message )
: SystemError( make_error_code( Result::eErrorFormatNotSupported ), message ) {}
FormatNotSupportedError( char const * message )
: SystemError( make_error_code( Result::eErrorFormatNotSupported ), message ) {}
};
class FragmentedPoolError : public SystemError
{
public:
FragmentedPoolError( std::string const& message )
: SystemError( make_error_code( Result::eErrorFragmentedPool ), message ) {}
FragmentedPoolError( char const * message )
: SystemError( make_error_code( Result::eErrorFragmentedPool ), message ) {}
};
class OutOfPoolMemoryError : public SystemError
{
public:
OutOfPoolMemoryError( std::string const& message )
: SystemError( make_error_code( Result::eErrorOutOfPoolMemory ), message ) {}
OutOfPoolMemoryError( char const * message )
: SystemError( make_error_code( Result::eErrorOutOfPoolMemory ), message ) {}
};
class InvalidExternalHandleError : public SystemError
{
public:
InvalidExternalHandleError( std::string const& message )
: SystemError( make_error_code( Result::eErrorInvalidExternalHandle ), message ) {}
InvalidExternalHandleError( char const * message )
: SystemError( make_error_code( Result::eErrorInvalidExternalHandle ), message ) {}
};
class SurfaceLostKHRError : public SystemError
{
public:
SurfaceLostKHRError( std::string const& message )
: SystemError( make_error_code( Result::eErrorSurfaceLostKHR ), message ) {}
SurfaceLostKHRError( char const * message )
: SystemError( make_error_code( Result::eErrorSurfaceLostKHR ), message ) {}
};
class NativeWindowInUseKHRError : public SystemError
{
public:
NativeWindowInUseKHRError( std::string const& message )
: SystemError( make_error_code( Result::eErrorNativeWindowInUseKHR ), message ) {}
NativeWindowInUseKHRError( char const * message )
: SystemError( make_error_code( Result::eErrorNativeWindowInUseKHR ), message ) {}
};
class OutOfDateKHRError : public SystemError
{
public:
OutOfDateKHRError( std::string const& message )
: SystemError( make_error_code( Result::eErrorOutOfDateKHR ), message ) {}
OutOfDateKHRError( char const * message )
: SystemError( make_error_code( Result::eErrorOutOfDateKHR ), message ) {}
};
class IncompatibleDisplayKHRError : public SystemError
{
public:
IncompatibleDisplayKHRError( std::string const& message )
: SystemError( make_error_code( Result::eErrorIncompatibleDisplayKHR ), message ) {}
IncompatibleDisplayKHRError( char const * message )
: SystemError( make_error_code( Result::eErrorIncompatibleDisplayKHR ), message ) {}
};
class ValidationFailedEXTError : public SystemError
{
public:
ValidationFailedEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorValidationFailedEXT ), message ) {}
ValidationFailedEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorValidationFailedEXT ), message ) {}
};
class InvalidShaderNVError : public SystemError
{
public:
InvalidShaderNVError( std::string const& message )
: SystemError( make_error_code( Result::eErrorInvalidShaderNV ), message ) {}
InvalidShaderNVError( char const * message )
: SystemError( make_error_code( Result::eErrorInvalidShaderNV ), message ) {}
};
class InvalidDrmFormatModifierPlaneLayoutEXTError : public SystemError
{
public:
InvalidDrmFormatModifierPlaneLayoutEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT ), message ) {}
InvalidDrmFormatModifierPlaneLayoutEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT ), message ) {}
};
class FragmentationEXTError : public SystemError
{
public:
FragmentationEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorFragmentationEXT ), message ) {}
FragmentationEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorFragmentationEXT ), message ) {}
};
class NotPermittedEXTError : public SystemError
{
public:
NotPermittedEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorNotPermittedEXT ), message ) {}
NotPermittedEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorNotPermittedEXT ), message ) {}
};
class InvalidDeviceAddressEXTError : public SystemError
{
public:
InvalidDeviceAddressEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorInvalidDeviceAddressEXT ), message ) {}
InvalidDeviceAddressEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorInvalidDeviceAddressEXT ), message ) {}
};
class FullScreenExclusiveModeLostEXTError : public SystemError
{
public:
FullScreenExclusiveModeLostEXTError( std::string const& message )
: SystemError( make_error_code( Result::eErrorFullScreenExclusiveModeLostEXT ), message ) {}
FullScreenExclusiveModeLostEXTError( char const * message )
: SystemError( make_error_code( Result::eErrorFullScreenExclusiveModeLostEXT ), message ) {}
};
[[noreturn]] static void throwResultException( Result result, char const * message )
{
switch ( result )
{
case Result::eErrorOutOfHostMemory: throw OutOfHostMemoryError( message );
case Result::eErrorOutOfDeviceMemory: throw OutOfDeviceMemoryError( message );
case Result::eErrorInitializationFailed: throw InitializationFailedError( message );
case Result::eErrorDeviceLost: throw DeviceLostError( message );
case Result::eErrorMemoryMapFailed: throw MemoryMapFailedError( message );
case Result::eErrorLayerNotPresent: throw LayerNotPresentError( message );
case Result::eErrorExtensionNotPresent: throw ExtensionNotPresentError( message );
case Result::eErrorFeatureNotPresent: throw FeatureNotPresentError( message );
case Result::eErrorIncompatibleDriver: throw IncompatibleDriverError( message );
case Result::eErrorTooManyObjects: throw TooManyObjectsError( message );
case Result::eErrorFormatNotSupported: throw FormatNotSupportedError( message );
case Result::eErrorFragmentedPool: throw FragmentedPoolError( message );
case Result::eErrorOutOfPoolMemory: throw OutOfPoolMemoryError( message );
case Result::eErrorInvalidExternalHandle: throw InvalidExternalHandleError( message );
case Result::eErrorSurfaceLostKHR: throw SurfaceLostKHRError( message );
case Result::eErrorNativeWindowInUseKHR: throw NativeWindowInUseKHRError( message );
case Result::eErrorOutOfDateKHR: throw OutOfDateKHRError( message );
case Result::eErrorIncompatibleDisplayKHR: throw IncompatibleDisplayKHRError( message );
case Result::eErrorValidationFailedEXT: throw ValidationFailedEXTError( message );
case Result::eErrorInvalidShaderNV: throw InvalidShaderNVError( message );
case Result::eErrorInvalidDrmFormatModifierPlaneLayoutEXT: throw InvalidDrmFormatModifierPlaneLayoutEXTError( message );
case Result::eErrorFragmentationEXT: throw FragmentationEXTError( message );
case Result::eErrorNotPermittedEXT: throw NotPermittedEXTError( message );
case Result::eErrorInvalidDeviceAddressEXT: throw InvalidDeviceAddressEXTError( message );
case Result::eErrorFullScreenExclusiveModeLostEXT: throw FullScreenExclusiveModeLostEXTError( message );
default: throw SystemError( make_error_code( result ) );
}
}
#endif
template <typename T> void ignore(T const&) VULKAN_HPP_NOEXCEPT {}
template <typename T>
struct ResultValue
{
#ifdef VULKAN_HPP_HAS_NOEXCEPT
ResultValue( Result r, T & v ) VULKAN_HPP_NOEXCEPT(VULKAN_HPP_NOEXCEPT(T(v)))
#else
ResultValue( Result r, T & v )
#endif
: result( r )
, value( v )
{}
#ifdef VULKAN_HPP_HAS_NOEXCEPT
ResultValue( Result r, T && v ) VULKAN_HPP_NOEXCEPT(VULKAN_HPP_NOEXCEPT(T(std::move(v))))
#else
ResultValue( Result r, T && v )
#endif
: result( r )
, value( std::move( v ) )
{}
Result result;
T value;
operator std::tuple<Result&, T&>() VULKAN_HPP_NOEXCEPT { return std::tuple<Result&, T&>(result, value); }
};
template <typename T>
struct ResultValueType
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
typedef ResultValue<T> type;
#else
typedef T type;
#endif
};
template <>
struct ResultValueType<void>
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
typedef Result type;
#else
typedef void type;
#endif
};
VULKAN_HPP_INLINE ResultValueType<void>::type createResultValue( Result result, char const * message )
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message);
VULKAN_HPP_ASSERT( result == Result::eSuccess );
return result;
#else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
}
#endif
}
template <typename T>
VULKAN_HPP_INLINE typename ResultValueType<T>::type createResultValue( Result result, T & data, char const * message )
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message);
VULKAN_HPP_ASSERT( result == Result::eSuccess );
return ResultValue<T>( result, std::move( data ) );
#else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
}
return std::move( data );
#endif
}
VULKAN_HPP_INLINE Result createResultValue( Result result, char const * message, std::initializer_list<Result> successCodes )
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message);
VULKAN_HPP_ASSERT( 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 result;
}
template <typename T>
VULKAN_HPP_INLINE ResultValue<T> createResultValue( Result result, T & data, char const * message, std::initializer_list<Result> successCodes )
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message);
VULKAN_HPP_ASSERT( 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<T>( result, data );
}
#ifndef VULKAN_HPP_NO_SMART_HANDLE
template <typename T, typename D>
VULKAN_HPP_INLINE typename ResultValueType<UniqueHandle<T,D>>::type createResultValue( Result result, T & data, char const * message, typename UniqueHandleTraits<T,D>::deleter const& deleter )
{
#ifdef VULKAN_HPP_NO_EXCEPTIONS
ignore(message);
VULKAN_HPP_ASSERT( result == Result::eSuccess );
return ResultValue<UniqueHandle<T,D>>( result, UniqueHandle<T,D>(data, deleter) );
#else
if ( result != Result::eSuccess )
{
throwResultException( result, message );
}
return UniqueHandle<T,D>(data, deleter);
#endif
}
#endif
} // namespace VULKAN_HPP_NAMESPACE