Vulkan-Docs/tests/htest.c

65 lines
2.7 KiB
C
Raw Normal View History

Change log for April 7, 2019 Vulkan 1.1.106 spec update: * Update release number to 106. Public Issues: * Add searchbox and generate search index for the chunked HTML target. Note that doing this requires several new toolchain components to build the `chunked` target (public issue 578 / internal issue 1352). * Remove descriptions of flink:vkCreateSampler sampler constraints which were repeated in the valid usage statements (public pull request 648). * Fix sense of conditional around a valid usage statement in the <<copies>> chapter (public issue 942). Internal Issues: * Add missing pname:extent.width and pname:extent.height valid usage statements for flink:vkCmdClearAttachments (internal issue 1583). * Fix some inconsistencies in structures and corresponding pname:sType enumerant names by renaming sname:VkPhysicalDeviceShaderDrawParameterFeatures -> slink:slink:VkPhysicalDeviceShaderDrawParametersFeatures; sname:VkPhysicalDeviceVariablePointerFeatures -> slink:VkPhysicalDeviceVariablePointerFeatures; sname:VkPhysicalDeviceVariablePointerFeaturesKHR -> slink:VkPhysicalDeviceVariablePointerFeaturesKHR; sname:VkPhysicalDeviceBufferAddressFeaturesEXT -> slink:VkPhysicalDeviceBufferDeviceAddressFeaturesEXT; etext:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES -> ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES; etext:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES -> ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES; etext:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR -> ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR; and etext:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT -> ename:VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT. The old names are still available as aliases for backwards compatibility. This change required introducing valid XML markup which externally written XML processing scripts may need to be modified to accomodate, to support multiple aliases of a single command or token name (internal issue 1592). * Add slink:VkDevice as the first parameter to flink:vkSetLocalDimmingAMD (internal issue 1618). * Improve CI header compilation tests to test all Vulkan platform includes, using fake platform headers where needed, and change the `allchecks` Makefile target to use the more comprehensive `check_spec_links.py` script instead of the retired `checkinc` and `checklinks` targets. * Move descriptions of the ASTC compressed texture decode mode from the <<appendix-compressedtex-astc,appendix>> to the recently updated external Khronos Data Format Specification. * Fix minor markup and spelling issues in the `VK_NV_ray_tracing` extension.
2019-04-08 03:17:23 +00:00
//% gcc -c -Wall -I. -I../include htest.c
// Simple compilation test for Vulkan headers, including all platform
// headers.
// To allow compilation in environments without one or more platforms, fake
// headers for different platforms are supplied. They provide just the types
// Vulkan platforms require.
// When a new Vulkan platform is defined, the corresponding USE_PLATFORM
// header definition, and any supporting fake platform headers, should be
// defined here, along with a trivial compilation test using a Vulkan type
// or function specific to that platform.
// Enable each platform when vulkan.h is included
#define VK_USE_PLATFORM_ANDROID_KHR // No headers needed
#define VK_USE_PLATFORM_FUCHSIA // <zircon/types.h>
#define VK_USE_PLATFORM_GGP // <ggp_c/vulkan_types.h>
#define VK_USE_PLATFORM_IOS_MVK // No headers needed
#define VK_USE_PLATFORM_MACOS_MVK // No headers needed
#define VK_USE_PLATFORM_METAL_EXT // No headers needed
#define VK_USE_PLATFORM_VI_NN // No headers needed
#define VK_USE_PLATFORM_WAYLAND_KHR // <wayland-client.h>
#define VK_USE_PLATFORM_WIN32_KHR // <windows.h>
#define VK_USE_PLATFORM_XCB_KHR // <xcb/xcb.h>
#define VK_USE_PLATFORM_XLIB_KHR // <X11/Xlib.h>
#define VK_USE_PLATFORM_XLIB_XRANDR_EXT // <X11/extensions/Xrandr.h>
#include <vulkan/vulkan.h>
// Sanity check with a type or function from each platform header in turn
VkAndroidSurfaceCreateFlagsKHR android_flags;
VkImagePipeSurfaceCreateFlagsFUCHSIA fuchsia_flags;
VkStreamDescriptorSurfaceCreateFlagsGGP ggp_flags;
VkIOSSurfaceCreateFlagsMVK ios_flags;
VkMacOSSurfaceCreateFlagsMVK macos_flags;
VkMetalSurfaceCreateFlagsEXT metal_flags;
VkViSurfaceCreateFlagsNN vi_flags;
VkWaylandSurfaceCreateFlagsKHR wayland_flags;
VkWin32SurfaceCreateFlagsKHR win32_flags;
VkXcbSurfaceCreateFlagsKHR xcb_flags;
VkXlibSurfaceCreateFlagsKHR xlib_flags;
int main(void) {
const VkInstanceCreateInfo instance_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pNext = NULL,
.flags = 0,
.pApplicationInfo = NULL,
.enabledLayerCount = 0,
.ppEnabledLayerNames = NULL,
.enabledExtensionCount = 0,
.ppEnabledExtensionNames = NULL,
};
VkInstance instance;
vkCreateInstance(&instance_info, NULL, &instance);
vkDestroyInstance(instance, NULL);
// Test XLIB_XRANDR_EXT platform, which doesn't define a new type
VkResult xrandr_result = vkAcquireXlibDisplayEXT((VkPhysicalDevice)0, (Display *)NULL, (VkDisplayKHR)0);
(void)xrandr_result;
return 0;
}