mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-21 20:00:11 +00:00
Use existing tests for appveyor. (#426)
This commit is contained in:
parent
8f3b1d6f01
commit
10aa543b7e
@ -9,11 +9,18 @@ configuration:
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
- GENERATOR: Visual Studio 14 2015
|
||||
GENERATOR_ARCH: Win32
|
||||
RAW_PLATFORM: x86
|
||||
- GENERATOR: Visual Studio 15 2017 Win64
|
||||
- GENERATOR: Visual Studio 14 2015
|
||||
GENERATOR_ARCH: x64
|
||||
RAW_PLATFORM: amd64
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
GENERATOR_ARCH: Win32
|
||||
RAW_PLATFORM: x86
|
||||
- GENERATOR: Visual Studio 15 2017
|
||||
GENERATOR_ARCH: x64
|
||||
RAW_PLATFORM: amd64
|
||||
|
||||
|
||||
install:
|
||||
- git submodule update --init --recursive
|
||||
@ -27,17 +34,7 @@ before_build:
|
||||
build_script:
|
||||
- mkdir appveyor-build
|
||||
- cd appveyor-build
|
||||
- cmake .. "-G%GENERATOR%"
|
||||
- cmake --build . --config %CONFIGURATION%
|
||||
- cmake ..\tests -G "%GENERATOR%" -A %GENERATOR_ARCH% -DTESTS_BUILD_WITH_LOCAL_VULKAN_HPP=1 -DTESTS_BUILD_ONLY_DYNAMIC=1
|
||||
|
||||
test_script:
|
||||
- "%CONFIGURATION%\\VulkanHppGenerator"
|
||||
- ps: Write-Output "#include ""vulkan.hpp""" | Out-File -FilePath test.cpp
|
||||
- ps: Write-Output "int myCreateInstance()" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output "{" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output " vk::Instance inst;" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output " auto const inst_info = vk::InstanceCreateInfo();" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output " vk::Result result = vk::createInstance(&inst_info, nullptr, &inst);" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output " return static_cast<int> (result);" | Out-File -FilePath test.cpp -Append
|
||||
- ps: Write-Output "}" | Out-File -FilePath test.cpp -Append
|
||||
- cl.exe -I../vulkan -I../Vulkan-Headers/include /EHsc -c test.cpp
|
||||
- cmake --build . --config %CONFIGURATION%
|
||||
|
@ -14,11 +14,15 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
find_package(Vulkan REQUIRED)
|
||||
|
||||
project(Vulkan-Hpp_Tests)
|
||||
|
||||
|
||||
option (TESTS_BUILD_WITH_LOCAL_VULKAN_HPP OFF)
|
||||
option (TESTS_BUILD_ONLY_DYNAMIC OFF)
|
||||
|
||||
if (NOT (TESTS_BUILD_ONLY_DYNAMIC AND TESTS_BUILD_WITH_LOCAL_VULKAN_HPP))
|
||||
find_package(Vulkan REQUIRED)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
add_definitions(-DNOMINMAX -DVK_USE_PLATFORM_WIN32_KHR)
|
||||
|
@ -14,22 +14,24 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(DeviceFunctions)
|
||||
if (NOT TESTS_BUILD_ONLY_DYNAMIC)
|
||||
project(DeviceFunctions)
|
||||
|
||||
set(HEADERS
|
||||
)
|
||||
set(HEADERS
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
DeviceFunctions.cpp
|
||||
)
|
||||
set(SOURCES
|
||||
DeviceFunctions.cpp
|
||||
)
|
||||
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
source_group(headers FILES ${HEADERS})
|
||||
source_group(sources FILES ${SOURCES})
|
||||
|
||||
add_executable(DeviceFunctions
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
add_executable(DeviceFunctions
|
||||
${HEADERS}
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
set_target_properties(DeviceFunctions PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(DeviceFunctions "${Vulkan_LIBRARIES}")
|
||||
set_target_properties(DeviceFunctions PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(DeviceFunctions "${Vulkan_LIBRARIES}")
|
||||
endif()
|
@ -31,5 +31,8 @@ add_executable(NoExceptions
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(NoExceptions "-ldl")
|
||||
endif()
|
||||
|
||||
set_target_properties(NoExceptions PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(NoExceptions "${Vulkan_LIBRARIES}")
|
||||
|
@ -17,6 +17,7 @@
|
||||
// Note: this is _no_ functional test!! Don't ever code this way!!
|
||||
|
||||
#define VULKAN_HPP_NO_EXCEPTIONS
|
||||
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include <iostream>
|
||||
@ -24,6 +25,8 @@
|
||||
static char const* AppName = "DeviceFunctions";
|
||||
static char const* EngineName = "Vulkan.hpp";
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE;
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
{
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
|
@ -31,5 +31,8 @@ add_executable(StructureChain
|
||||
${SOURCES}
|
||||
)
|
||||
|
||||
if (UNIX)
|
||||
target_link_libraries(StructureChain "-ldl")
|
||||
endif()
|
||||
|
||||
set_target_properties(StructureChain PROPERTIES FOLDER "Tests")
|
||||
target_link_libraries(StructureChain "${Vulkan_LIBRARIES}")
|
||||
|
@ -15,6 +15,8 @@
|
||||
// VulkanHpp Tests : StructureChain
|
||||
// Compile-test for StructureChains
|
||||
|
||||
#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
|
||||
|
||||
#include "vulkan/vulkan.hpp"
|
||||
#include <iostream>
|
||||
|
||||
@ -29,10 +31,16 @@ static char const* EngineName = "Vulkan.hpp";
|
||||
// unknow compiler... just ignore the warnings for yourselves ;)
|
||||
#endif
|
||||
|
||||
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE;
|
||||
|
||||
int main(int /*argc*/, char ** /*argv*/)
|
||||
{
|
||||
try
|
||||
{
|
||||
vk::DynamicLoader dl;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = dl.getProcAddress<PFN_vkGetInstanceProcAddr>("vkGetInstanceProcAddr");
|
||||
VULKAN_HPP_DEFAULT_DISPATCHER.init(vkGetInstanceProcAddr);
|
||||
|
||||
vk::ApplicationInfo appInfo(AppName, 1, EngineName, 1, VK_API_VERSION_1_1);
|
||||
vk::UniqueInstance instance = vk::createInstanceUnique(vk::InstanceCreateInfo({}, &appInfo));
|
||||
vk::PhysicalDevice physicalDevice = instance->enumeratePhysicalDevices().front();
|
||||
@ -46,7 +54,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDevicePushDescriptorPropertiesKHR> sc6;
|
||||
vk::StructureChain<vk::PhysicalDeviceProperties2, vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties, vk::PhysicalDevicePushDescriptorPropertiesKHR> sc7;
|
||||
|
||||
// some not valid StructureChains
|
||||
// some invalid StructureChains
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDeviceMaintenance3Properties, vk::PhysicalDevicePushDescriptorPropertiesKHR> x;
|
||||
//vk::StructureChain<vk::PhysicalDeviceIDProperties, vk::PhysicalDevicePushDescriptorPropertiesKHR, vk::PhysicalDeviceMaintenance3Properties> x;
|
||||
@ -59,16 +67,14 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
|
||||
// simple calls, getting structure back
|
||||
vk::PhysicalDeviceFeatures2 a = physicalDevice.getFeatures2();
|
||||
vk::PhysicalDeviceFeatures2 b = physicalDevice.getFeatures2(vk::DispatchLoaderStatic());
|
||||
|
||||
// complex calls, getting StructureChain back
|
||||
auto c = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & c0 = c.get<vk::PhysicalDeviceFeatures2>();
|
||||
vk::PhysicalDeviceVariablePointerFeatures & c1 = c.get<vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
|
||||
auto t0 = c.get<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
|
||||
auto d = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>(vk::DispatchLoaderStatic());
|
||||
auto d = physicalDevice.getFeatures2<vk::PhysicalDeviceFeatures2, vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
vk::PhysicalDeviceFeatures2 & d0 = d.get<vk::PhysicalDeviceFeatures2>();
|
||||
vk::PhysicalDeviceVariablePointerFeatures & d1 = d.get<vk::PhysicalDeviceVariablePointerFeatures>();
|
||||
|
||||
@ -76,7 +82,7 @@ int main(int /*argc*/, char ** /*argv*/)
|
||||
|
||||
using StructureChain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
|
||||
using AllocatorType = std::vector<StructureChain>::allocator_type;
|
||||
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>(vk::DispatchLoaderStatic());
|
||||
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>(VULKAN_HPP_DEFAULT_DISPATCHER);
|
||||
}
|
||||
catch (vk::SystemError err)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user