[test] Add missing test cases for ResultValueRValue.cpp

This commit is contained in:
mocabe 2020-05-26 17:17:05 +09:00 committed by Markus Tavenrath
parent b36fe941f4
commit 63f3412b03

View File

@ -20,19 +20,25 @@
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
template <typename T> #if defined(VULKAN_DISABLE_IMPLICIT_RESULT_VALUE_CAST)
struct Wrapper static_assert(false, "Conversions not enabled");
{ #endif
Wrapper( T && raw ) : raw{ raw } {}
T raw; template <class T> void as_value(T) {}
}; template <class T> void as_cref(const T&) {}
template <class T> void as_rvref(T&&) {}
void test() void test()
{ {
auto device = vk::Device{}; auto device = vk::Device{};
// We should be able to move created vk objects, regardless of the
// result type they were returned in. // just example: non-result values (vk::Image)
Wrapper<vk::Image>{ device.createImage( {} ) }; as_value<vk::Image>(device.createImage({}));
Wrapper<vk::Pipeline>{ device.createGraphicsPipeline( {}, {} ) }; as_cref<vk::Image>(device.createImage({}));
as_rvref<vk::Image>(device.createImage({}));
// vk::ResultValue<vk::Pipeline> should also work
as_value<vk::Pipeline>(device.createGraphicsPipeline(nullptr, {}));
as_cref<vk::Pipeline>(device.createGraphicsPipeline(nullptr, {}));
as_rvref<vk::Pipeline>(device.createGraphicsPipeline(nullptr,{}));
} }