Add Vulkan 1.3 headers

This commit is contained in:
2025-01-21 00:04:32 +01:00
parent b438dd7bf4
commit a106e1cf85
7 changed files with 8380 additions and 0 deletions

View File

@ -6,5 +6,6 @@ cc_binary(
deps = [
"@asl//asl",
"@sdl3_windows//:sdl3",
"//vendor/vulkan",
],
)

View File

@ -1,7 +1,14 @@
#include <asl/print.hpp>
#include <asl/buffer.hpp>
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_vulkan.h>
#define VK_NO_STDDEF_H
#define VK_NO_STDINT_H
#define VK_NO_PROTOTYPES
#include <vulkan.h>
int SDL_main(int /* argc */, char* /* argv */[])
{
@ -10,6 +17,26 @@ int SDL_main(int /* argc */, char* /* argv */[])
SDL_ShowWindow(window);
asl::buffer<const char*> instance_extensions;
asl::buffer<const char*> device_extensions;
asl::buffer<const char*> layers;
{
uint32_t count = 0;
const char* const* extensions = SDL_Vulkan_GetInstanceExtensions(&count);
for (uint32_t i = 0; i < count; ++i)
{
instance_extensions.push(extensions[i]); // NOLINT(*-pointer-arithmetic)
}
}
layers.push("VK_LAYER_KHRONOS_validation");
layers.push("VK_LAYER_LUNARG_monitor");
instance_extensions.push(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
device_extensions.push(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
bool running = true;
while (running)
{

12
vendor/vulkan/BUILD.bazel vendored Normal file
View File

@ -0,0 +1,12 @@
cc_library(
name = "vulkan",
hdrs = [
"vk_platform.h",
"vulkan.h",
"vulkan_core.h",
],
includes = [
".",
],
visibility = ["//:__subpackages__"],
)

3
vendor/vulkan/notes.txt vendored Normal file
View File

@ -0,0 +1,3 @@
https://github.com/KhronosGroup/Vulkan-Docs
python scripts/genvk.py -registry xml/vk.xml -o gen -emitExtensions VK_KHR_surface -emitExtension VK_KHR_swapchain -emitExtension VK_EXT_debug_utils -feature VK_VERSION_1_0 -feature VK_VERSION_1_1 -feature VK_VERSION_1_2 -feature VK_VERSION_1_3 vulkan_core.h

84
vendor/vulkan/vk_platform.h vendored Normal file
View File

@ -0,0 +1,84 @@
//
// File: vk_platform.h
//
/*
** Copyright 2014-2025 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#ifndef VK_PLATFORM_H_
#define VK_PLATFORM_H_
#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus
/*
***************************************************************************************************
* Platform-specific directives and type declarations
***************************************************************************************************
*/
/* Platform-specific calling convention macros.
*
* Platforms should define these so that Vulkan clients call Vulkan commands
* with the same calling conventions that the Vulkan implementation expects.
*
* VKAPI_ATTR - Placed before the return type in function declarations.
* Useful for C++11 and GCC/Clang-style function attribute syntax.
* VKAPI_CALL - Placed after the return type in function declarations.
* Useful for MSVC-style calling convention syntax.
* VKAPI_PTR - Placed between the '(' and '*' in function pointer types.
*
* Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void);
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
*/
#if defined(_WIN32)
// On Windows, Vulkan commands use the stdcall convention
#define VKAPI_ATTR
#define VKAPI_CALL __stdcall
#define VKAPI_PTR VKAPI_CALL
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
#error "Vulkan is not supported for the 'armeabi' NDK ABI"
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
// calling convention, i.e. float parameters are passed in registers. This
// is true even if the rest of the application passes floats on the stack,
// as it does by default when compiling for the armeabi-v7a NDK ABI.
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
#define VKAPI_CALL
#define VKAPI_PTR VKAPI_ATTR
#else
// On other platforms, use the default calling convention
#define VKAPI_ATTR
#define VKAPI_CALL
#define VKAPI_PTR
#endif
#if !defined(VK_NO_STDDEF_H)
#include <stddef.h>
#endif // !defined(VK_NO_STDDEF_H)
#if !defined(VK_NO_STDINT_H)
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
#endif // !defined(VK_NO_STDINT_H)
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif

99
vendor/vulkan/vulkan.h vendored Normal file
View File

@ -0,0 +1,99 @@
#ifndef VULKAN_H_
#define VULKAN_H_ 1
/*
** Copyright 2015-2025 The Khronos Group Inc.
**
** SPDX-License-Identifier: Apache-2.0
*/
#include "vk_platform.h"
#include "vulkan_core.h"
#ifdef VK_USE_PLATFORM_ANDROID_KHR
#include "vulkan_android.h"
#endif
#ifdef VK_USE_PLATFORM_FUCHSIA
#include <zircon/types.h>
#include "vulkan_fuchsia.h"
#endif
#ifdef VK_USE_PLATFORM_IOS_MVK
#include "vulkan_ios.h"
#endif
#ifdef VK_USE_PLATFORM_MACOS_MVK
#include "vulkan_macos.h"
#endif
#ifdef VK_USE_PLATFORM_METAL_EXT
#include "vulkan_metal.h"
#endif
#ifdef VK_USE_PLATFORM_VI_NN
#include "vulkan_vi.h"
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
#include "vulkan_wayland.h"
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
#include <windows.h>
#include "vulkan_win32.h"
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
#include <xcb/xcb.h>
#include "vulkan_xcb.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
#include <X11/Xlib.h>
#include "vulkan_xlib.h"
#endif
#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
#include <directfb.h>
#include "vulkan_directfb.h"
#endif
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#include "vulkan_xlib_xrandr.h"
#endif
#ifdef VK_USE_PLATFORM_GGP
#include <ggp_c/vulkan_types.h>
#include "vulkan_ggp.h"
#endif
#ifdef VK_USE_PLATFORM_SCREEN_QNX
#include <screen/screen.h>
#include "vulkan_screen.h"
#endif
#ifdef VK_USE_PLATFORM_SCI
#include <nvscisync.h>
#include <nvscibuf.h>
#include "vulkan_sci.h"
#endif
#ifdef VK_ENABLE_BETA_EXTENSIONS
#include "vulkan_beta.h"
#endif
#endif // VULKAN_H_

8154
vendor/vulkan/vulkan_core.h vendored Normal file

File diff suppressed because it is too large Load Diff