mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 11:35:11 +00:00
Replace glad and the Vulkan SDK with glad2
This removes all dependencies from the GLFW test programs on the Vulkan SDK. It also removes support for linking the GLFW shared library (dynamic library, DLL) against the Vulkan loader static library.
This commit is contained in:
parent
3461d1c2a5
commit
d7e30b1c74
@ -1,41 +0,0 @@
|
||||
# Find Vulkan
|
||||
#
|
||||
# VULKAN_INCLUDE_DIR
|
||||
# VULKAN_LIBRARY
|
||||
# VULKAN_FOUND
|
||||
|
||||
if (WIN32)
|
||||
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
|
||||
"$ENV{VULKAN_SDK}/Include"
|
||||
"$ENV{VK_SDK_PATH}/Include")
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Lib"
|
||||
"$ENV{VULKAN_SDK}/Bin"
|
||||
"$ENV{VK_SDK_PATH}/Bin")
|
||||
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Lib"
|
||||
"$ENV{VULKAN_SDK}/Bin"
|
||||
"$ENV{VK_SDK_PATH}/Bin")
|
||||
else()
|
||||
find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Lib32"
|
||||
"$ENV{VULKAN_SDK}/Bin32"
|
||||
"$ENV{VK_SDK_PATH}/Bin32")
|
||||
find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
|
||||
"$ENV{VULKAN_SDK}/Lib32"
|
||||
"$ENV{VULKAN_SDK}/Bin32"
|
||||
"$ENV{VK_SDK_PATH}/Bin32")
|
||||
endif()
|
||||
else()
|
||||
find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
|
||||
"$ENV{VULKAN_SDK}/include")
|
||||
find_library(VULKAN_LIBRARY NAMES vulkan HINTS
|
||||
"$ENV{VULKAN_SDK}/lib")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY VULKAN_STATIC_LIBRARY)
|
||||
|
@ -22,7 +22,7 @@ option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON)
|
||||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON)
|
||||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
|
||||
option(GLFW_INSTALL "Generate installation target" ON)
|
||||
option(GLFW_VULKAN_STATIC "Use the Vulkan loader statically linked into application" OFF)
|
||||
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
@ -54,13 +54,17 @@ else()
|
||||
endif()
|
||||
|
||||
if (GLFW_VULKAN_STATIC)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# If you absolutely must do this, remove this line and add the Vulkan
|
||||
# loader static library via the CMAKE_SHARED_LINKER_FLAGS
|
||||
message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library")
|
||||
endif()
|
||||
set(_GLFW_VULKAN_STATIC 1)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Vulkan)
|
||||
|
||||
if (GLFW_BUILD_DOCS)
|
||||
set(DOXYGEN_SKIP_DOT TRUE)
|
||||
@ -157,24 +161,6 @@ else()
|
||||
message(FATAL_ERROR "No supported platform was detected")
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Add Vulkan static library if requested
|
||||
#--------------------------------------------------------------------
|
||||
if (GLFW_VULKAN_STATIC)
|
||||
if (VULKAN_FOUND AND VULKAN_STATIC_LIBRARY)
|
||||
list(APPEND glfw_LIBRARIES "${VULKAN_STATIC_LIBRARY}")
|
||||
if (BUILD_SHARED_LIBS)
|
||||
message(WARNING "Linking Vulkan loader static library into GLFW")
|
||||
endif()
|
||||
else()
|
||||
if (BUILD_SHARED_LIBS OR GLFW_BUILD_EXAMPLES OR GLFW_BUILD_TESTS)
|
||||
message(FATAL_ERROR "Vulkan loader static library not found")
|
||||
else()
|
||||
message(WARNING "Vulkan loader static library not found")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Find and add Unix math and time libraries
|
||||
#--------------------------------------------------------------------
|
||||
|
13
README.md
13
README.md
@ -97,17 +97,12 @@ located in the `deps/` directory.
|
||||
with command-line options
|
||||
- [TinyCThread](https://github.com/tinycthread/tinycthread) for threaded
|
||||
examples
|
||||
- An OpenGL 3.2 core loader generated by
|
||||
[glad](https://github.com/Dav1dde/glad) for examples using modern OpenGL
|
||||
- [glad2](https://github.com/Dav1dde/glad) for loading OpenGL and Vulkan
|
||||
functions
|
||||
- [linmath.h](https://github.com/datenwolf/linmath.h) for linear algebra in
|
||||
examples
|
||||
- [Nuklear](https://github.com/vurtun/nuklear) for test and example UI
|
||||
- [stb\_image\_write](https://github.com/nothings/stb) for writing images to disk
|
||||
- [Vulkan headers](https://www.khronos.org/registry/vulkan/) for Vulkan tests
|
||||
|
||||
The Vulkan example additionally requires the LunarG Vulkan SDK to be installed,
|
||||
or it will not be included in the build. On macOS you need to provide the path
|
||||
to the SDK manually as it has no standard installation location.
|
||||
|
||||
The documentation is generated with [Doxygen](http://doxygen.org/) if CMake can
|
||||
find that tool.
|
||||
@ -196,6 +191,7 @@ information on what to include when reporting a bug.
|
||||
- Removed `GLFW_USE_MENUBAR` compile-time option
|
||||
- Removed requirement of at least one window for `glfwWaitEvents` and
|
||||
`glfwPostEmptyEvent` (#1317)
|
||||
- Removed all dependencies on the Vulkan SDK
|
||||
- Bugfix: Calling `glfwMaximizeWindow` on a full screen window was not ignored
|
||||
- Bugfix: `GLFW_INCLUDE_VULKAN` could not be combined with the corresponding
|
||||
OpenGL and OpenGL ES header macros
|
||||
@ -210,14 +206,11 @@ information on what to include when reporting a bug.
|
||||
- [Win32] Removed XInput circular deadzone from joystick axis data (#1045)
|
||||
- [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861)
|
||||
- [Win32] Bugfix: Deadzone logic could underflow with some controllers (#910)
|
||||
- [Win32] Bugfix: Bitness test in `FindVulkan.cmake` was VS specific (#928)
|
||||
- [Win32] Bugfix: `glfwVulkanSupported` emitted an error on systems with
|
||||
a loader but no ICD (#916)
|
||||
- [Win32] Bugfix: Non-iconified full sreeen windows did not prevent screen
|
||||
blanking or password enabled screensavers (#851)
|
||||
- [Win32] Bugfix: Mouse capture logic lost secondary release messages (#954)
|
||||
- [Win32] Bugfix: The 32-bit Vulkan loader library static was not searched for
|
||||
- [Win32] Bugfix: Vulkan libraries have a new path as of SDK 1.0.42.0 (#956)
|
||||
- [Win32] Bugfix: Monitors with no display devices were not enumerated (#960)
|
||||
- [Win32] Bugfix: Monitor events were not emitted (#784)
|
||||
- [Win32] Bugfix: The DLL was installed to the wrong directory on Cygwin (#1035)
|
||||
|
1678
deps/glad.c
vendored
1678
deps/glad.c
vendored
File diff suppressed because it is too large
Load Diff
3840
deps/glad/gl.h
vendored
Normal file
3840
deps/glad/gl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3680
deps/glad/glad.h
vendored
3680
deps/glad/glad.h
vendored
File diff suppressed because it is too large
Load Diff
18
deps/KHR/khrplatform.h → deps/glad/khrplatform.h
vendored
18
deps/KHR/khrplatform.h → deps/glad/khrplatform.h
vendored
@ -2,7 +2,7 @@
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
** Copyright (c) 2008-2018 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
@ -26,18 +26,16 @@
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
|
||||
* The master copy of khrplatform.h is maintained in the Khronos EGL
|
||||
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
|
||||
* The last semantic modification to khrplatform.h was at commit ID:
|
||||
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
* Please submit changes by filing pull requests or issues on
|
||||
* the EGL Registry repository linked above.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
@ -101,6 +99,8 @@
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default")))
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
//
|
||||
// File: vk_platform.h
|
||||
//
|
||||
/* */
|
||||
/* File: vk_platform.h */
|
||||
/* */
|
||||
/*
|
||||
** Copyright (c) 2014-2017 The Khronos Group Inc.
|
||||
**
|
||||
@ -24,7 +24,7 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
***************************************************************************************************
|
||||
@ -47,22 +47,22 @@ extern "C"
|
||||
* Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
// On Windows, Vulkan commands use the stdcall convention
|
||||
/* 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 isn't 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.
|
||||
/* 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
|
||||
/* On other platforms, use the default calling convention */
|
||||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR
|
||||
@ -83,10 +83,10 @@ extern "C"
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // !defined(VK_NO_STDINT_H)
|
||||
#endif /* !defined(VK_NO_STDINT_H) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
3480
deps/glad/vulkan.h
vendored
Normal file
3480
deps/glad/vulkan.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1791
deps/glad_gl.c
vendored
Normal file
1791
deps/glad_gl.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
593
deps/glad_vulkan.c
vendored
Normal file
593
deps/glad_vulkan.c
vendored
Normal file
@ -0,0 +1,593 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glad/vulkan.h>
|
||||
|
||||
#ifndef GLAD_IMPL_UTIL_C_
|
||||
#define GLAD_IMPL_UTIL_C_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf_s
|
||||
#else
|
||||
#define GLAD_IMPL_UTIL_SSCANF sscanf
|
||||
#endif
|
||||
|
||||
#endif /* GLAD_IMPL_UTIL_C_ */
|
||||
|
||||
|
||||
int GLAD_VK_VERSION_1_0 = 0;
|
||||
int GLAD_VK_VERSION_1_1 = 0;
|
||||
int GLAD_VK_EXT_debug_report = 0;
|
||||
int GLAD_VK_KHR_surface = 0;
|
||||
int GLAD_VK_KHR_swapchain = 0;
|
||||
|
||||
|
||||
|
||||
PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR = NULL;
|
||||
PFN_vkAcquireNextImageKHR glad_vkAcquireNextImageKHR = NULL;
|
||||
PFN_vkAllocateCommandBuffers glad_vkAllocateCommandBuffers = NULL;
|
||||
PFN_vkAllocateDescriptorSets glad_vkAllocateDescriptorSets = NULL;
|
||||
PFN_vkAllocateMemory glad_vkAllocateMemory = NULL;
|
||||
PFN_vkBeginCommandBuffer glad_vkBeginCommandBuffer = NULL;
|
||||
PFN_vkBindBufferMemory glad_vkBindBufferMemory = NULL;
|
||||
PFN_vkBindBufferMemory2 glad_vkBindBufferMemory2 = NULL;
|
||||
PFN_vkBindImageMemory glad_vkBindImageMemory = NULL;
|
||||
PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL;
|
||||
PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL;
|
||||
PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL;
|
||||
PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL;
|
||||
PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL;
|
||||
PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL;
|
||||
PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL;
|
||||
PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL;
|
||||
PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL;
|
||||
PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL;
|
||||
PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL;
|
||||
PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL;
|
||||
PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL;
|
||||
PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL;
|
||||
PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL;
|
||||
PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL;
|
||||
PFN_vkCmdDispatch glad_vkCmdDispatch = NULL;
|
||||
PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL;
|
||||
PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL;
|
||||
PFN_vkCmdDraw glad_vkCmdDraw = NULL;
|
||||
PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL;
|
||||
PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL;
|
||||
PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL;
|
||||
PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL;
|
||||
PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL;
|
||||
PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL;
|
||||
PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL;
|
||||
PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL;
|
||||
PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL;
|
||||
PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL;
|
||||
PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL;
|
||||
PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL;
|
||||
PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL;
|
||||
PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL;
|
||||
PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL;
|
||||
PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL;
|
||||
PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL;
|
||||
PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL;
|
||||
PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL;
|
||||
PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL;
|
||||
PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL;
|
||||
PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL;
|
||||
PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL;
|
||||
PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL;
|
||||
PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL;
|
||||
PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL;
|
||||
PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL;
|
||||
PFN_vkCreateBuffer glad_vkCreateBuffer = NULL;
|
||||
PFN_vkCreateBufferView glad_vkCreateBufferView = NULL;
|
||||
PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL;
|
||||
PFN_vkCreateComputePipelines glad_vkCreateComputePipelines = NULL;
|
||||
PFN_vkCreateDebugReportCallbackEXT glad_vkCreateDebugReportCallbackEXT = NULL;
|
||||
PFN_vkCreateDescriptorPool glad_vkCreateDescriptorPool = NULL;
|
||||
PFN_vkCreateDescriptorSetLayout glad_vkCreateDescriptorSetLayout = NULL;
|
||||
PFN_vkCreateDescriptorUpdateTemplate glad_vkCreateDescriptorUpdateTemplate = NULL;
|
||||
PFN_vkCreateDevice glad_vkCreateDevice = NULL;
|
||||
PFN_vkCreateEvent glad_vkCreateEvent = NULL;
|
||||
PFN_vkCreateFence glad_vkCreateFence = NULL;
|
||||
PFN_vkCreateFramebuffer glad_vkCreateFramebuffer = NULL;
|
||||
PFN_vkCreateGraphicsPipelines glad_vkCreateGraphicsPipelines = NULL;
|
||||
PFN_vkCreateImage glad_vkCreateImage = NULL;
|
||||
PFN_vkCreateImageView glad_vkCreateImageView = NULL;
|
||||
PFN_vkCreateInstance glad_vkCreateInstance = NULL;
|
||||
PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL;
|
||||
PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL;
|
||||
PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL;
|
||||
PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL;
|
||||
PFN_vkCreateSampler glad_vkCreateSampler = NULL;
|
||||
PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL;
|
||||
PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL;
|
||||
PFN_vkCreateShaderModule glad_vkCreateShaderModule = NULL;
|
||||
PFN_vkCreateSwapchainKHR glad_vkCreateSwapchainKHR = NULL;
|
||||
PFN_vkDebugReportMessageEXT glad_vkDebugReportMessageEXT = NULL;
|
||||
PFN_vkDestroyBuffer glad_vkDestroyBuffer = NULL;
|
||||
PFN_vkDestroyBufferView glad_vkDestroyBufferView = NULL;
|
||||
PFN_vkDestroyCommandPool glad_vkDestroyCommandPool = NULL;
|
||||
PFN_vkDestroyDebugReportCallbackEXT glad_vkDestroyDebugReportCallbackEXT = NULL;
|
||||
PFN_vkDestroyDescriptorPool glad_vkDestroyDescriptorPool = NULL;
|
||||
PFN_vkDestroyDescriptorSetLayout glad_vkDestroyDescriptorSetLayout = NULL;
|
||||
PFN_vkDestroyDescriptorUpdateTemplate glad_vkDestroyDescriptorUpdateTemplate = NULL;
|
||||
PFN_vkDestroyDevice glad_vkDestroyDevice = NULL;
|
||||
PFN_vkDestroyEvent glad_vkDestroyEvent = NULL;
|
||||
PFN_vkDestroyFence glad_vkDestroyFence = NULL;
|
||||
PFN_vkDestroyFramebuffer glad_vkDestroyFramebuffer = NULL;
|
||||
PFN_vkDestroyImage glad_vkDestroyImage = NULL;
|
||||
PFN_vkDestroyImageView glad_vkDestroyImageView = NULL;
|
||||
PFN_vkDestroyInstance glad_vkDestroyInstance = NULL;
|
||||
PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL;
|
||||
PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL;
|
||||
PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL;
|
||||
PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL;
|
||||
PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL;
|
||||
PFN_vkDestroySampler glad_vkDestroySampler = NULL;
|
||||
PFN_vkDestroySamplerYcbcrConversion glad_vkDestroySamplerYcbcrConversion = NULL;
|
||||
PFN_vkDestroySemaphore glad_vkDestroySemaphore = NULL;
|
||||
PFN_vkDestroyShaderModule glad_vkDestroyShaderModule = NULL;
|
||||
PFN_vkDestroySurfaceKHR glad_vkDestroySurfaceKHR = NULL;
|
||||
PFN_vkDestroySwapchainKHR glad_vkDestroySwapchainKHR = NULL;
|
||||
PFN_vkDeviceWaitIdle glad_vkDeviceWaitIdle = NULL;
|
||||
PFN_vkEndCommandBuffer glad_vkEndCommandBuffer = NULL;
|
||||
PFN_vkEnumerateDeviceExtensionProperties glad_vkEnumerateDeviceExtensionProperties = NULL;
|
||||
PFN_vkEnumerateDeviceLayerProperties glad_vkEnumerateDeviceLayerProperties = NULL;
|
||||
PFN_vkEnumerateInstanceExtensionProperties glad_vkEnumerateInstanceExtensionProperties = NULL;
|
||||
PFN_vkEnumerateInstanceLayerProperties glad_vkEnumerateInstanceLayerProperties = NULL;
|
||||
PFN_vkEnumerateInstanceVersion glad_vkEnumerateInstanceVersion = NULL;
|
||||
PFN_vkEnumeratePhysicalDeviceGroups glad_vkEnumeratePhysicalDeviceGroups = NULL;
|
||||
PFN_vkEnumeratePhysicalDevices glad_vkEnumeratePhysicalDevices = NULL;
|
||||
PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL;
|
||||
PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL;
|
||||
PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL;
|
||||
PFN_vkFreeMemory glad_vkFreeMemory = NULL;
|
||||
PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL;
|
||||
PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL;
|
||||
PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL;
|
||||
PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL;
|
||||
PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL;
|
||||
PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL;
|
||||
PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL;
|
||||
PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL;
|
||||
PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL;
|
||||
PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL;
|
||||
PFN_vkGetEventStatus glad_vkGetEventStatus = NULL;
|
||||
PFN_vkGetFenceStatus glad_vkGetFenceStatus = NULL;
|
||||
PFN_vkGetImageMemoryRequirements glad_vkGetImageMemoryRequirements = NULL;
|
||||
PFN_vkGetImageMemoryRequirements2 glad_vkGetImageMemoryRequirements2 = NULL;
|
||||
PFN_vkGetImageSparseMemoryRequirements glad_vkGetImageSparseMemoryRequirements = NULL;
|
||||
PFN_vkGetImageSparseMemoryRequirements2 glad_vkGetImageSparseMemoryRequirements2 = NULL;
|
||||
PFN_vkGetImageSubresourceLayout glad_vkGetImageSubresourceLayout = NULL;
|
||||
PFN_vkGetInstanceProcAddr glad_vkGetInstanceProcAddr = NULL;
|
||||
PFN_vkGetPhysicalDeviceExternalBufferProperties glad_vkGetPhysicalDeviceExternalBufferProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceExternalFenceProperties glad_vkGetPhysicalDeviceExternalFenceProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceExternalSemaphoreProperties glad_vkGetPhysicalDeviceExternalSemaphoreProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceFeatures glad_vkGetPhysicalDeviceFeatures = NULL;
|
||||
PFN_vkGetPhysicalDeviceFeatures2 glad_vkGetPhysicalDeviceFeatures2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceFormatProperties glad_vkGetPhysicalDeviceFormatProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceFormatProperties2 glad_vkGetPhysicalDeviceFormatProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties glad_vkGetPhysicalDeviceImageFormatProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties2 glad_vkGetPhysicalDeviceImageFormatProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties glad_vkGetPhysicalDeviceMemoryProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties2 glad_vkGetPhysicalDeviceMemoryProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDevicePresentRectanglesKHR glad_vkGetPhysicalDevicePresentRectanglesKHR = NULL;
|
||||
PFN_vkGetPhysicalDeviceProperties glad_vkGetPhysicalDeviceProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceProperties2 glad_vkGetPhysicalDeviceProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties glad_vkGetPhysicalDeviceQueueFamilyProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 glad_vkGetPhysicalDeviceQueueFamilyProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties glad_vkGetPhysicalDeviceSparseImageFormatProperties = NULL;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = NULL;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = NULL;
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL;
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL;
|
||||
PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL;
|
||||
PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL;
|
||||
PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL;
|
||||
PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL;
|
||||
PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL;
|
||||
PFN_vkMapMemory glad_vkMapMemory = NULL;
|
||||
PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL;
|
||||
PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL;
|
||||
PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL;
|
||||
PFN_vkQueueSubmit glad_vkQueueSubmit = NULL;
|
||||
PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL;
|
||||
PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL;
|
||||
PFN_vkResetCommandPool glad_vkResetCommandPool = NULL;
|
||||
PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL;
|
||||
PFN_vkResetEvent glad_vkResetEvent = NULL;
|
||||
PFN_vkResetFences glad_vkResetFences = NULL;
|
||||
PFN_vkSetEvent glad_vkSetEvent = NULL;
|
||||
PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL;
|
||||
PFN_vkUnmapMemory glad_vkUnmapMemory = NULL;
|
||||
PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL;
|
||||
PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL;
|
||||
PFN_vkWaitForFences glad_vkWaitForFences = NULL;
|
||||
|
||||
|
||||
static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_VK_VERSION_1_0) return;
|
||||
vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load("vkAllocateCommandBuffers", userptr);
|
||||
vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load("vkAllocateDescriptorSets", userptr);
|
||||
vkAllocateMemory = (PFN_vkAllocateMemory) load("vkAllocateMemory", userptr);
|
||||
vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load("vkBeginCommandBuffer", userptr);
|
||||
vkBindBufferMemory = (PFN_vkBindBufferMemory) load("vkBindBufferMemory", userptr);
|
||||
vkBindImageMemory = (PFN_vkBindImageMemory) load("vkBindImageMemory", userptr);
|
||||
vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load("vkCmdBeginQuery", userptr);
|
||||
vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load("vkCmdBeginRenderPass", userptr);
|
||||
vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load("vkCmdBindDescriptorSets", userptr);
|
||||
vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load("vkCmdBindIndexBuffer", userptr);
|
||||
vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load("vkCmdBindPipeline", userptr);
|
||||
vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load("vkCmdBindVertexBuffers", userptr);
|
||||
vkCmdBlitImage = (PFN_vkCmdBlitImage) load("vkCmdBlitImage", userptr);
|
||||
vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load("vkCmdClearAttachments", userptr);
|
||||
vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load("vkCmdClearColorImage", userptr);
|
||||
vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load("vkCmdClearDepthStencilImage", userptr);
|
||||
vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load("vkCmdCopyBuffer", userptr);
|
||||
vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load("vkCmdCopyBufferToImage", userptr);
|
||||
vkCmdCopyImage = (PFN_vkCmdCopyImage) load("vkCmdCopyImage", userptr);
|
||||
vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load("vkCmdCopyImageToBuffer", userptr);
|
||||
vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load("vkCmdCopyQueryPoolResults", userptr);
|
||||
vkCmdDispatch = (PFN_vkCmdDispatch) load("vkCmdDispatch", userptr);
|
||||
vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load("vkCmdDispatchIndirect", userptr);
|
||||
vkCmdDraw = (PFN_vkCmdDraw) load("vkCmdDraw", userptr);
|
||||
vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load("vkCmdDrawIndexed", userptr);
|
||||
vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load("vkCmdDrawIndexedIndirect", userptr);
|
||||
vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load("vkCmdDrawIndirect", userptr);
|
||||
vkCmdEndQuery = (PFN_vkCmdEndQuery) load("vkCmdEndQuery", userptr);
|
||||
vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load("vkCmdEndRenderPass", userptr);
|
||||
vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load("vkCmdExecuteCommands", userptr);
|
||||
vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load("vkCmdFillBuffer", userptr);
|
||||
vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load("vkCmdNextSubpass", userptr);
|
||||
vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load("vkCmdPipelineBarrier", userptr);
|
||||
vkCmdPushConstants = (PFN_vkCmdPushConstants) load("vkCmdPushConstants", userptr);
|
||||
vkCmdResetEvent = (PFN_vkCmdResetEvent) load("vkCmdResetEvent", userptr);
|
||||
vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load("vkCmdResetQueryPool", userptr);
|
||||
vkCmdResolveImage = (PFN_vkCmdResolveImage) load("vkCmdResolveImage", userptr);
|
||||
vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load("vkCmdSetBlendConstants", userptr);
|
||||
vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load("vkCmdSetDepthBias", userptr);
|
||||
vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load("vkCmdSetDepthBounds", userptr);
|
||||
vkCmdSetEvent = (PFN_vkCmdSetEvent) load("vkCmdSetEvent", userptr);
|
||||
vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load("vkCmdSetLineWidth", userptr);
|
||||
vkCmdSetScissor = (PFN_vkCmdSetScissor) load("vkCmdSetScissor", userptr);
|
||||
vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load("vkCmdSetStencilCompareMask", userptr);
|
||||
vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load("vkCmdSetStencilReference", userptr);
|
||||
vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load("vkCmdSetStencilWriteMask", userptr);
|
||||
vkCmdSetViewport = (PFN_vkCmdSetViewport) load("vkCmdSetViewport", userptr);
|
||||
vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load("vkCmdUpdateBuffer", userptr);
|
||||
vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load("vkCmdWaitEvents", userptr);
|
||||
vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load("vkCmdWriteTimestamp", userptr);
|
||||
vkCreateBuffer = (PFN_vkCreateBuffer) load("vkCreateBuffer", userptr);
|
||||
vkCreateBufferView = (PFN_vkCreateBufferView) load("vkCreateBufferView", userptr);
|
||||
vkCreateCommandPool = (PFN_vkCreateCommandPool) load("vkCreateCommandPool", userptr);
|
||||
vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load("vkCreateComputePipelines", userptr);
|
||||
vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load("vkCreateDescriptorPool", userptr);
|
||||
vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load("vkCreateDescriptorSetLayout", userptr);
|
||||
vkCreateDevice = (PFN_vkCreateDevice) load("vkCreateDevice", userptr);
|
||||
vkCreateEvent = (PFN_vkCreateEvent) load("vkCreateEvent", userptr);
|
||||
vkCreateFence = (PFN_vkCreateFence) load("vkCreateFence", userptr);
|
||||
vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load("vkCreateFramebuffer", userptr);
|
||||
vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load("vkCreateGraphicsPipelines", userptr);
|
||||
vkCreateImage = (PFN_vkCreateImage) load("vkCreateImage", userptr);
|
||||
vkCreateImageView = (PFN_vkCreateImageView) load("vkCreateImageView", userptr);
|
||||
vkCreateInstance = (PFN_vkCreateInstance) load("vkCreateInstance", userptr);
|
||||
vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load("vkCreatePipelineCache", userptr);
|
||||
vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load("vkCreatePipelineLayout", userptr);
|
||||
vkCreateQueryPool = (PFN_vkCreateQueryPool) load("vkCreateQueryPool", userptr);
|
||||
vkCreateRenderPass = (PFN_vkCreateRenderPass) load("vkCreateRenderPass", userptr);
|
||||
vkCreateSampler = (PFN_vkCreateSampler) load("vkCreateSampler", userptr);
|
||||
vkCreateSemaphore = (PFN_vkCreateSemaphore) load("vkCreateSemaphore", userptr);
|
||||
vkCreateShaderModule = (PFN_vkCreateShaderModule) load("vkCreateShaderModule", userptr);
|
||||
vkDestroyBuffer = (PFN_vkDestroyBuffer) load("vkDestroyBuffer", userptr);
|
||||
vkDestroyBufferView = (PFN_vkDestroyBufferView) load("vkDestroyBufferView", userptr);
|
||||
vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load("vkDestroyCommandPool", userptr);
|
||||
vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load("vkDestroyDescriptorPool", userptr);
|
||||
vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load("vkDestroyDescriptorSetLayout", userptr);
|
||||
vkDestroyDevice = (PFN_vkDestroyDevice) load("vkDestroyDevice", userptr);
|
||||
vkDestroyEvent = (PFN_vkDestroyEvent) load("vkDestroyEvent", userptr);
|
||||
vkDestroyFence = (PFN_vkDestroyFence) load("vkDestroyFence", userptr);
|
||||
vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load("vkDestroyFramebuffer", userptr);
|
||||
vkDestroyImage = (PFN_vkDestroyImage) load("vkDestroyImage", userptr);
|
||||
vkDestroyImageView = (PFN_vkDestroyImageView) load("vkDestroyImageView", userptr);
|
||||
vkDestroyInstance = (PFN_vkDestroyInstance) load("vkDestroyInstance", userptr);
|
||||
vkDestroyPipeline = (PFN_vkDestroyPipeline) load("vkDestroyPipeline", userptr);
|
||||
vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load("vkDestroyPipelineCache", userptr);
|
||||
vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load("vkDestroyPipelineLayout", userptr);
|
||||
vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load("vkDestroyQueryPool", userptr);
|
||||
vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load("vkDestroyRenderPass", userptr);
|
||||
vkDestroySampler = (PFN_vkDestroySampler) load("vkDestroySampler", userptr);
|
||||
vkDestroySemaphore = (PFN_vkDestroySemaphore) load("vkDestroySemaphore", userptr);
|
||||
vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load("vkDestroyShaderModule", userptr);
|
||||
vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load("vkDeviceWaitIdle", userptr);
|
||||
vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load("vkEndCommandBuffer", userptr);
|
||||
vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load("vkEnumerateDeviceExtensionProperties", userptr);
|
||||
vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load("vkEnumerateDeviceLayerProperties", userptr);
|
||||
vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load("vkEnumerateInstanceExtensionProperties", userptr);
|
||||
vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load("vkEnumerateInstanceLayerProperties", userptr);
|
||||
vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load("vkEnumeratePhysicalDevices", userptr);
|
||||
vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load("vkFlushMappedMemoryRanges", userptr);
|
||||
vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load("vkFreeCommandBuffers", userptr);
|
||||
vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load("vkFreeDescriptorSets", userptr);
|
||||
vkFreeMemory = (PFN_vkFreeMemory) load("vkFreeMemory", userptr);
|
||||
vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load("vkGetBufferMemoryRequirements", userptr);
|
||||
vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load("vkGetDeviceMemoryCommitment", userptr);
|
||||
vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load("vkGetDeviceProcAddr", userptr);
|
||||
vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load("vkGetDeviceQueue", userptr);
|
||||
vkGetEventStatus = (PFN_vkGetEventStatus) load("vkGetEventStatus", userptr);
|
||||
vkGetFenceStatus = (PFN_vkGetFenceStatus) load("vkGetFenceStatus", userptr);
|
||||
vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load("vkGetImageMemoryRequirements", userptr);
|
||||
vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load("vkGetImageSparseMemoryRequirements", userptr);
|
||||
vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load("vkGetImageSubresourceLayout", userptr);
|
||||
vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load("vkGetInstanceProcAddr", userptr);
|
||||
vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load("vkGetPhysicalDeviceFeatures", userptr);
|
||||
vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load("vkGetPhysicalDeviceFormatProperties", userptr);
|
||||
vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load("vkGetPhysicalDeviceImageFormatProperties", userptr);
|
||||
vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load("vkGetPhysicalDeviceMemoryProperties", userptr);
|
||||
vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load("vkGetPhysicalDeviceProperties", userptr);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load("vkGetPhysicalDeviceQueueFamilyProperties", userptr);
|
||||
vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load("vkGetPhysicalDeviceSparseImageFormatProperties", userptr);
|
||||
vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load("vkGetPipelineCacheData", userptr);
|
||||
vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load("vkGetQueryPoolResults", userptr);
|
||||
vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load("vkGetRenderAreaGranularity", userptr);
|
||||
vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load("vkInvalidateMappedMemoryRanges", userptr);
|
||||
vkMapMemory = (PFN_vkMapMemory) load("vkMapMemory", userptr);
|
||||
vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load("vkMergePipelineCaches", userptr);
|
||||
vkQueueBindSparse = (PFN_vkQueueBindSparse) load("vkQueueBindSparse", userptr);
|
||||
vkQueueSubmit = (PFN_vkQueueSubmit) load("vkQueueSubmit", userptr);
|
||||
vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load("vkQueueWaitIdle", userptr);
|
||||
vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load("vkResetCommandBuffer", userptr);
|
||||
vkResetCommandPool = (PFN_vkResetCommandPool) load("vkResetCommandPool", userptr);
|
||||
vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load("vkResetDescriptorPool", userptr);
|
||||
vkResetEvent = (PFN_vkResetEvent) load("vkResetEvent", userptr);
|
||||
vkResetFences = (PFN_vkResetFences) load("vkResetFences", userptr);
|
||||
vkSetEvent = (PFN_vkSetEvent) load("vkSetEvent", userptr);
|
||||
vkUnmapMemory = (PFN_vkUnmapMemory) load("vkUnmapMemory", userptr);
|
||||
vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load("vkUpdateDescriptorSets", userptr);
|
||||
vkWaitForFences = (PFN_vkWaitForFences) load("vkWaitForFences", userptr);
|
||||
}
|
||||
static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_VK_VERSION_1_1) return;
|
||||
vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load("vkBindBufferMemory2", userptr);
|
||||
vkBindImageMemory2 = (PFN_vkBindImageMemory2) load("vkBindImageMemory2", userptr);
|
||||
vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load("vkCmdDispatchBase", userptr);
|
||||
vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load("vkCmdSetDeviceMask", userptr);
|
||||
vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load("vkCreateDescriptorUpdateTemplate", userptr);
|
||||
vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load("vkCreateSamplerYcbcrConversion", userptr);
|
||||
vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load("vkDestroyDescriptorUpdateTemplate", userptr);
|
||||
vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load("vkDestroySamplerYcbcrConversion", userptr);
|
||||
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
|
||||
vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load("vkEnumeratePhysicalDeviceGroups", userptr);
|
||||
vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load("vkGetBufferMemoryRequirements2", userptr);
|
||||
vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load("vkGetDescriptorSetLayoutSupport", userptr);
|
||||
vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load("vkGetDeviceGroupPeerMemoryFeatures", userptr);
|
||||
vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load("vkGetDeviceQueue2", userptr);
|
||||
vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load("vkGetImageMemoryRequirements2", userptr);
|
||||
vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load("vkGetImageSparseMemoryRequirements2", userptr);
|
||||
vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load("vkGetPhysicalDeviceExternalBufferProperties", userptr);
|
||||
vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load("vkGetPhysicalDeviceExternalFenceProperties", userptr);
|
||||
vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load("vkGetPhysicalDeviceExternalSemaphoreProperties", userptr);
|
||||
vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load("vkGetPhysicalDeviceFeatures2", userptr);
|
||||
vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load("vkGetPhysicalDeviceFormatProperties2", userptr);
|
||||
vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load("vkGetPhysicalDeviceImageFormatProperties2", userptr);
|
||||
vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load("vkGetPhysicalDeviceMemoryProperties2", userptr);
|
||||
vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load("vkGetPhysicalDeviceProperties2", userptr);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load("vkGetPhysicalDeviceQueueFamilyProperties2", userptr);
|
||||
vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load("vkGetPhysicalDeviceSparseImageFormatProperties2", userptr);
|
||||
vkTrimCommandPool = (PFN_vkTrimCommandPool) load("vkTrimCommandPool", userptr);
|
||||
vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load("vkUpdateDescriptorSetWithTemplate", userptr);
|
||||
}
|
||||
static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_VK_EXT_debug_report) return;
|
||||
vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load("vkCreateDebugReportCallbackEXT", userptr);
|
||||
vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load("vkDebugReportMessageEXT", userptr);
|
||||
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load("vkDestroyDebugReportCallbackEXT", userptr);
|
||||
}
|
||||
static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_VK_KHR_surface) return;
|
||||
vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load("vkDestroySurfaceKHR", userptr);
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", userptr);
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load("vkGetPhysicalDeviceSurfaceFormatsKHR", userptr);
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load("vkGetPhysicalDeviceSurfacePresentModesKHR", userptr);
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load("vkGetPhysicalDeviceSurfaceSupportKHR", userptr);
|
||||
}
|
||||
static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) {
|
||||
if(!GLAD_VK_KHR_swapchain) return;
|
||||
vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load("vkAcquireNextImage2KHR", userptr);
|
||||
vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load("vkAcquireNextImageKHR", userptr);
|
||||
vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load("vkCreateSwapchainKHR", userptr);
|
||||
vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load("vkDestroySwapchainKHR", userptr);
|
||||
vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load("vkGetDeviceGroupPresentCapabilitiesKHR", userptr);
|
||||
vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load("vkGetDeviceGroupSurfacePresentModesKHR", userptr);
|
||||
vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load("vkGetPhysicalDevicePresentRectanglesKHR", userptr);
|
||||
vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load("vkGetSwapchainImagesKHR", userptr);
|
||||
vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load("vkQueuePresentKHR", userptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *out_extension_count, char ***out_extensions) {
|
||||
uint32_t i;
|
||||
uint32_t instance_extension_count = 0;
|
||||
uint32_t device_extension_count = 0;
|
||||
uint32_t max_extension_count;
|
||||
uint32_t total_extension_count;
|
||||
char **extensions;
|
||||
VkExtensionProperties *ext_properties;
|
||||
VkResult result;
|
||||
|
||||
if (vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && vkEnumerateDeviceExtensionProperties == NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL);
|
||||
if (result != VK_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (physical_device != NULL) {
|
||||
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL);
|
||||
if (result != VK_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
total_extension_count = instance_extension_count + device_extension_count;
|
||||
max_extension_count = instance_extension_count > device_extension_count
|
||||
? instance_extension_count : device_extension_count;
|
||||
|
||||
ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties));
|
||||
if (ext_properties == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
result = vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties);
|
||||
if (result != VK_SUCCESS) {
|
||||
free((void*) ext_properties);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extensions = (char**) calloc(total_extension_count, sizeof(char*));
|
||||
if (extensions == NULL) {
|
||||
free((void*) ext_properties);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < instance_extension_count; ++i) {
|
||||
VkExtensionProperties ext = ext_properties[i];
|
||||
|
||||
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
||||
extensions[i] = (char*) malloc(extension_name_length * sizeof(char));
|
||||
memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char));
|
||||
}
|
||||
|
||||
if (physical_device != NULL) {
|
||||
result = vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties);
|
||||
if (result != VK_SUCCESS) {
|
||||
for (i = 0; i < instance_extension_count; ++i) {
|
||||
free((void*) extensions[i]);
|
||||
}
|
||||
free(extensions);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < device_extension_count; ++i) {
|
||||
VkExtensionProperties ext = ext_properties[i];
|
||||
|
||||
size_t extension_name_length = strlen(ext.extensionName) + 1;
|
||||
extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char));
|
||||
memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char));
|
||||
}
|
||||
}
|
||||
|
||||
free((void*) ext_properties);
|
||||
|
||||
*out_extension_count = total_extension_count;
|
||||
*out_extensions = extensions;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) {
|
||||
uint32_t i;
|
||||
|
||||
for(i = 0; i < extension_count ; ++i) {
|
||||
free((void*) (extensions[i]));
|
||||
}
|
||||
|
||||
free((void*) extensions);
|
||||
}
|
||||
|
||||
static int glad_vk_has_extension(const char *name, uint32_t extension_count, char **extensions) {
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < extension_count; ++i) {
|
||||
if(strcmp(name, extensions[i]) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GLADapiproc glad_vk_get_proc_from_userptr(const char* name, void *userptr) {
|
||||
return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name);
|
||||
}
|
||||
|
||||
static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) {
|
||||
uint32_t extension_count = 0;
|
||||
char **extensions = NULL;
|
||||
if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0;
|
||||
|
||||
GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions);
|
||||
GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions);
|
||||
GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions);
|
||||
|
||||
glad_vk_free_extensions(extension_count, extensions);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) {
|
||||
int major = 1;
|
||||
int minor = 0;
|
||||
|
||||
#ifdef VK_VERSION_1_1
|
||||
if (vkEnumerateInstanceVersion != NULL) {
|
||||
uint32_t version;
|
||||
VkResult result;
|
||||
|
||||
result = vkEnumerateInstanceVersion(&version);
|
||||
if (result == VK_SUCCESS) {
|
||||
major = (int) VK_VERSION_MAJOR(version);
|
||||
minor = (int) VK_VERSION_MINOR(version);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (physical_device != NULL && vkGetPhysicalDeviceProperties != NULL) {
|
||||
VkPhysicalDeviceProperties properties;
|
||||
vkGetPhysicalDeviceProperties(physical_device, &properties);
|
||||
|
||||
major = (int) VK_VERSION_MAJOR(properties.apiVersion);
|
||||
minor = (int) VK_VERSION_MINOR(properties.apiVersion);
|
||||
}
|
||||
|
||||
GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||
GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||
|
||||
return GLAD_MAKE_VERSION(major, minor);
|
||||
}
|
||||
|
||||
int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr) {
|
||||
int version;
|
||||
|
||||
#ifdef VK_VERSION_1_1
|
||||
vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load("vkEnumerateInstanceVersion", userptr);
|
||||
#endif
|
||||
version = glad_vk_find_core_vulkan( physical_device);
|
||||
if (!version) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
glad_vk_load_VK_VERSION_1_0(load, userptr);
|
||||
glad_vk_load_VK_VERSION_1_1(load, userptr);
|
||||
|
||||
if (!glad_vk_find_extensions_vulkan( physical_device)) return 0;
|
||||
glad_vk_load_VK_EXT_debug_report(load, userptr);
|
||||
glad_vk_load_VK_KHR_surface(load, userptr);
|
||||
glad_vk_load_VK_KHR_swapchain(load, userptr);
|
||||
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) {
|
||||
return gladLoadVulkanUserPtr( physical_device, glad_vk_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
73
deps/vulkan/vulkan.h
vendored
73
deps/vulkan/vulkan.h
vendored
@ -1,73 +0,0 @@
|
||||
#ifndef VULKAN_H_
|
||||
#define VULKAN_H_ 1
|
||||
|
||||
/*
|
||||
** Copyright (c) 2015-2018 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.
|
||||
*/
|
||||
|
||||
#include "vk_platform.h"
|
||||
#include "vulkan_core.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
#include "vulkan_android.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_VI_NN
|
||||
#include "vulkan_vi.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#include <wayland-client.h>
|
||||
#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_XLIB_XRANDR_EXT
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include "vulkan_xlib_xrandr.h"
|
||||
#endif
|
||||
|
||||
#endif // VULKAN_H_
|
7334
deps/vulkan/vulkan_core.h
vendored
7334
deps/vulkan/vulkan_core.h
vendored
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ If you are using an OpenGL extension loading library such as
|
||||
be included _before_ the GLFW one.
|
||||
|
||||
@code
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
|
||||
@ -62,7 +62,7 @@ prevent the GLFW header from including the OpenGL header.
|
||||
@code
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
@endcode
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ with the library.
|
||||
|
||||
@anchor GLFW_VULKAN_STATIC
|
||||
__GLFW_VULKAN_STATIC__ determines whether to use the Vulkan loader linked
|
||||
statically into the application.
|
||||
directly with the application.
|
||||
|
||||
|
||||
@subsubsection compile_options_win32 Windows specific CMake options
|
||||
@ -268,7 +268,7 @@ ramps and clipboard. The options are:
|
||||
If you are building GLFW as a shared library / dynamic library / DLL then you
|
||||
must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it.
|
||||
|
||||
If you are linking the Vulkan loader statically into your application then you
|
||||
If you are linking the Vulkan loader directly with your application then you
|
||||
must also define @b _GLFW_VULKAN_STATIC. Otherwise, GLFW will attempt to use the
|
||||
external version.
|
||||
|
||||
|
@ -341,6 +341,20 @@ during compilation of GLFW will still build but it will have no effect and the
|
||||
default behaviors will be used.
|
||||
|
||||
|
||||
@subsubsection vulkan_sdk_33 LunarG Vulkan SDK dependency
|
||||
|
||||
The GLFW test programs that previously depended on the LunarG Vulkan SDK now
|
||||
instead uses a Vulkan loader generated by
|
||||
[glad2](https://github.com/Dav1dde/glad). This means the GLFW CMake files no
|
||||
longer look for the Vulkan SDK.
|
||||
|
||||
Existing CMake projects that depended on the Vulkan SDK cache variables from
|
||||
GLFW will need to call `find_package(Vulkan)` themselves. CMake 3.7 and later
|
||||
already comes with a
|
||||
[Vulkan find module](https://cmake.org/cmake/help/latest/module/FindVulkan.html)
|
||||
similar to the one GLFW previously included.
|
||||
|
||||
|
||||
@subsubsection lib_suffix_33 CMake option LIB_SUFFIX
|
||||
|
||||
The `LIB_SUFFIX` CMake option has been removed. GLFW now uses the
|
||||
|
@ -47,11 +47,11 @@ exposes OpenGL 1.2. The easiest way to work around this is to use an
|
||||
If you are using such a library then you should include its header _before_ the
|
||||
GLFW header. This lets it replace the OpenGL header included by GLFW without
|
||||
conflicts. This example uses
|
||||
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
|
||||
[glad2](https://github.com/Dav1dde/glad), but the same rule applies to all such
|
||||
libraries.
|
||||
|
||||
@code
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
@endcode
|
||||
|
||||
@ -177,7 +177,7 @@ a current context to load from. This example uses
|
||||
libraries.
|
||||
|
||||
@code
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
@endcode
|
||||
|
||||
|
||||
|
@ -14,10 +14,6 @@ To develop for Vulkan you should download the [LunarG Vulkan
|
||||
SDK](https://vulkan.lunarg.com/) for your platform. Apart from headers and link
|
||||
libraries, they also provide the validation layers necessary for development.
|
||||
|
||||
The GLFW library does not need the Vulkan SDK to enable support for Vulkan.
|
||||
However, any Vulkan-specific test and example programs are built only if the
|
||||
CMake files find a Vulkan SDK.
|
||||
|
||||
For details on a specific function in this category, see the @ref vulkan. There
|
||||
are also guides for the other areas of the GLFW API.
|
||||
|
||||
@ -37,20 +33,14 @@ not need to be linked against the loader. However, it also means that if you
|
||||
are using the static library form of the Vulkan loader GLFW will either fail to
|
||||
find it or (worse) use the wrong one.
|
||||
|
||||
The @ref GLFW_VULKAN_STATIC CMake option makes GLFW link directly against the
|
||||
static library form. Not linking against the Vulkan loader will then be
|
||||
a compile-time error.
|
||||
The @ref GLFW_VULKAN_STATIC CMake option makes GLFW call the Vulkan loader
|
||||
directly instead of dynamically loading it at runtime. Not linking against the
|
||||
Vulkan loader will then be a compile-time error.
|
||||
|
||||
@macos Because the Vulkan loader and ICD are not installed globally on macOS,
|
||||
you need to set up the application bundle according to the LunarG SDK
|
||||
documentation. To help the GLFW CMake files find the SDK, you can set the
|
||||
`VULKAN_SDK` environment variable to the `macOS` subdirectory of the SDK.
|
||||
|
||||
@code{.sh}
|
||||
env VULKAN_SDK=/example/path/to/vulkansdk/macOS cmake .
|
||||
@endcode
|
||||
|
||||
This is explained in more detail in the LunarG Vulkan SDK release notes.
|
||||
documentation. This is explained in more detail in the
|
||||
[SDK documentation for macOS](https://vulkan.lunarg.com/doc/sdk/latest/mac/getting_started.html).
|
||||
|
||||
|
||||
@section vulkan_include Including the Vulkan and GLFW header files
|
||||
|
@ -23,22 +23,22 @@ elseif (APPLE)
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
endif()
|
||||
|
||||
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/glad.c")
|
||||
set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
||||
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/getopt.c")
|
||||
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
||||
|
||||
add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD})
|
||||
add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD})
|
||||
add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD})
|
||||
add_executable(offscreen offscreen.c ${ICON} ${GLAD})
|
||||
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD})
|
||||
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD})
|
||||
add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD})
|
||||
add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD})
|
||||
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD})
|
||||
add_executable(boing WIN32 MACOSX_BUNDLE boing.c ${ICON} ${GLAD_GL})
|
||||
add_executable(gears WIN32 MACOSX_BUNDLE gears.c ${ICON} ${GLAD_GL})
|
||||
add_executable(heightmap WIN32 MACOSX_BUNDLE heightmap.c ${ICON} ${GLAD_GL})
|
||||
add_executable(offscreen offscreen.c ${ICON} ${GLAD_GL})
|
||||
add_executable(particles WIN32 MACOSX_BUNDLE particles.c ${ICON} ${TINYCTHREAD} ${GETOPT} ${GLAD_GL})
|
||||
add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${ICON} ${GLAD_GL})
|
||||
add_executable(simple WIN32 MACOSX_BUNDLE simple.c ${ICON} ${GLAD_GL})
|
||||
add_executable(splitview WIN32 MACOSX_BUNDLE splitview.c ${ICON} ${GLAD_GL})
|
||||
add_executable(wave WIN32 MACOSX_BUNDLE wave.c ${ICON} ${GLAD_GL})
|
||||
|
||||
target_link_libraries(particles "${CMAKE_THREAD_LIBS_INIT}")
|
||||
if (RT_LIBRARY)
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <linmath.h>
|
||||
@ -642,7 +642,7 @@ int main( void )
|
||||
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval( 1 );
|
||||
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/**
|
||||
@ -327,7 +327,7 @@ int main(int argc, char *argv[])
|
||||
glfwSetKeyCallback(window, key);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval( 1 );
|
||||
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
/* Map height updates */
|
||||
@ -432,7 +432,7 @@ int main(int argc, char** argv)
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
/* Prepare opengl resources for rendering */
|
||||
shader_program = make_shader_program(vertex_shader_text, fragment_shader_text);
|
||||
|
@ -23,7 +23,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if USE_NATIVE_OSMESA
|
||||
@ -104,7 +104,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
// NOTE: OpenGL error checks have been omitted for brevity
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <getopt.h>
|
||||
#include <linmath.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
// Define tokens for GL_EXT_separate_specular_color if not already defined
|
||||
@ -994,7 +994,7 @@ int main(int argc, char** argv)
|
||||
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
glfwSetFramebufferSizeCallback(window, resize_callback);
|
||||
|
@ -23,7 +23,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -103,7 +103,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// The contexts are created with the same APIs so the function
|
||||
// pointers should be re-usable between them
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
// Create the OpenGL objects inside the first context, created above
|
||||
// All objects will be shared with the second context, created below
|
||||
|
@ -24,7 +24,7 @@
|
||||
//========================================================================
|
||||
//! [code]
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include "linmath.h"
|
||||
@ -98,7 +98,7 @@ int main(void)
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
// NOTE: OpenGL error checks have been omitted for brevity
|
||||
|
@ -10,7 +10,7 @@
|
||||
// because I am not a friend of orthogonal projections)
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@ -513,7 +513,7 @@ int main(void)
|
||||
|
||||
// Enable vsync
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
if (GLAD_GL_ARB_multisample || GLAD_GL_VERSION_1_3)
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <linmath.h>
|
||||
@ -412,7 +412,7 @@ int main(int argc, char* argv[])
|
||||
glfwSetScrollCallback(window, scroll_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
glfwGetFramebufferSize(window, &width, &height);
|
||||
|
@ -11,33 +11,36 @@ if (MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
set(GLAD "${GLFW_SOURCE_DIR}/deps/glad/glad.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/glad.c")
|
||||
set(GLAD_GL "${GLFW_SOURCE_DIR}/deps/glad/gl.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/glad_gl.c")
|
||||
set(GLAD_VULKAN "${GLFW_SOURCE_DIR}/deps/glad/vulkan.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/glad_vulkan.c")
|
||||
set(GETOPT "${GLFW_SOURCE_DIR}/deps/getopt.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/getopt.c")
|
||||
set(TINYCTHREAD "${GLFW_SOURCE_DIR}/deps/tinycthread.h"
|
||||
"${GLFW_SOURCE_DIR}/deps/tinycthread.c")
|
||||
|
||||
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD})
|
||||
add_executable(events events.c ${GETOPT} ${GLAD})
|
||||
add_executable(msaa msaa.c ${GETOPT} ${GLAD})
|
||||
add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD})
|
||||
add_executable(iconify iconify.c ${GETOPT} ${GLAD})
|
||||
add_executable(monitors monitors.c ${GETOPT} ${GLAD})
|
||||
add_executable(reopen reopen.c ${GLAD})
|
||||
add_executable(cursor cursor.c ${GLAD})
|
||||
add_executable(clipboard clipboard.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(events events.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(msaa msaa.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(glfwinfo glfwinfo.c ${GETOPT} ${GLAD_GL} ${GLAD_VULKAN})
|
||||
add_executable(iconify iconify.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(monitors monitors.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(reopen reopen.c ${GLAD_GL})
|
||||
add_executable(cursor cursor.c ${GLAD_GL})
|
||||
|
||||
add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD})
|
||||
add_executable(gamma WIN32 MACOSX_BUNDLE gamma.c ${GLAD})
|
||||
add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD})
|
||||
add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD})
|
||||
add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD})
|
||||
add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD})
|
||||
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD})
|
||||
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD})
|
||||
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD})
|
||||
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD})
|
||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD})
|
||||
add_executable(empty WIN32 MACOSX_BUNDLE empty.c ${TINYCTHREAD} ${GLAD_GL})
|
||||
add_executable(gamma WIN32 MACOSX_BUNDLE gamma.c ${GLAD_GL})
|
||||
add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD_GL})
|
||||
add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD_GL})
|
||||
add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD_GL})
|
||||
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL})
|
||||
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
|
||||
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD_GL})
|
||||
add_executable(vulkan WIN32 vulkan.c ${ICON} ${GLAD_VULKAN})
|
||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD_GL})
|
||||
|
||||
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}")
|
||||
target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}")
|
||||
@ -47,21 +50,10 @@ if (RT_LIBRARY)
|
||||
endif()
|
||||
|
||||
set(WINDOWS_BINARIES empty gamma icon inputlag joysticks opacity tearing
|
||||
threads timeout title windows)
|
||||
threads timeout title vulkan windows)
|
||||
set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen
|
||||
cursor)
|
||||
|
||||
if (VULKAN_FOUND)
|
||||
add_executable(vulkan WIN32 vulkan.c ${ICON})
|
||||
target_include_directories(vulkan PRIVATE "${VULKAN_INCLUDE_DIR}")
|
||||
if (GLFW_VULKAN_STATIC)
|
||||
target_link_libraries(vulkan "${VULKAN_STATIC_LIBRARY}")
|
||||
else()
|
||||
target_link_libraries(vulkan "${VULKAN_LIBRARY}")
|
||||
endif()
|
||||
list(APPEND WINDOWS_BINARIES vulkan)
|
||||
endif()
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
FOLDER "GLFW3/Tests")
|
||||
|
||||
@ -81,6 +73,7 @@ if (APPLE)
|
||||
set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
|
||||
set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout")
|
||||
set_target_properties(title PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Title")
|
||||
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Vulkan")
|
||||
set_target_properties(windows PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Windows")
|
||||
|
||||
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -123,7 +123,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
@ -30,7 +30,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@ -278,7 +278,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
glGenBuffers(1, &vertex_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer);
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "tinycthread.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <math.h>
|
||||
@ -91,7 +91,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
if (thrd_create(&thread, thread_main, NULL) != thrd_success)
|
||||
|
@ -31,7 +31,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -604,7 +604,7 @@ int main(int argc, char** argv)
|
||||
glfwSetDropCallback(slots[i].window, drop_callback);
|
||||
|
||||
glfwMakeContextCurrent(slots[i].window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
@ -121,7 +121,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
|
||||
|
@ -23,9 +23,8 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <glad/vulkan.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -214,9 +213,6 @@ static void list_vulkan_instance_extensions(void)
|
||||
{
|
||||
uint32_t i, ep_count = 0;
|
||||
VkExtensionProperties* ep;
|
||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties =
|
||||
(PFN_vkEnumerateInstanceExtensionProperties)
|
||||
glfwGetInstanceProcAddress(NULL, "vkEnumerateInstanceExtensionProperties");
|
||||
|
||||
printf("Vulkan instance extensions:\n");
|
||||
|
||||
@ -241,9 +237,6 @@ static void list_vulkan_instance_layers(void)
|
||||
{
|
||||
uint32_t i, lp_count = 0;
|
||||
VkLayerProperties* lp;
|
||||
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties =
|
||||
(PFN_vkEnumerateInstanceLayerProperties)
|
||||
glfwGetInstanceProcAddress(NULL, "vkEnumerateInstanceLayerProperties");
|
||||
|
||||
printf("Vulkan instance layers:\n");
|
||||
|
||||
@ -273,9 +266,6 @@ static void list_vulkan_device_extensions(VkInstance instance, VkPhysicalDevice
|
||||
{
|
||||
uint32_t i, ep_count;
|
||||
VkExtensionProperties* ep;
|
||||
PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties =
|
||||
(PFN_vkEnumerateDeviceExtensionProperties)
|
||||
glfwGetInstanceProcAddress(instance, "vkEnumerateDeviceExtensionProperties");
|
||||
|
||||
printf("Vulkan device extensions:\n");
|
||||
|
||||
@ -300,9 +290,6 @@ static void list_vulkan_device_layers(VkInstance instance, VkPhysicalDevice devi
|
||||
{
|
||||
uint32_t i, lp_count;
|
||||
VkLayerProperties* lp;
|
||||
PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties =
|
||||
(PFN_vkEnumerateDeviceLayerProperties)
|
||||
glfwGetInstanceProcAddress(instance, "vkEnumerateDeviceLayerProperties");
|
||||
|
||||
printf("Vulkan device layers:\n");
|
||||
|
||||
@ -358,6 +345,11 @@ static void print_version(void)
|
||||
printf("GLFW library version string: \"%s\"\n", glfwGetVersionString());
|
||||
}
|
||||
|
||||
static GLADapiproc glad_vulkan_callback(const char* name, void* user)
|
||||
{
|
||||
return glfwGetInstanceProcAddress((VkInstance) user, name);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ch, client, major, minor, revision, profile;
|
||||
@ -639,7 +631,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
@ -823,11 +815,8 @@ int main(int argc, char** argv)
|
||||
VkInstanceCreateInfo ici = {0};
|
||||
VkInstance instance;
|
||||
VkPhysicalDevice* pd;
|
||||
PFN_vkCreateInstance vkCreateInstance = (PFN_vkCreateInstance)
|
||||
glfwGetInstanceProcAddress(NULL, "vkCreateInstance");
|
||||
PFN_vkDestroyInstance vkDestroyInstance;
|
||||
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
|
||||
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
|
||||
|
||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
|
||||
|
||||
re = glfwGetRequiredInstanceExtensions(&re_count);
|
||||
|
||||
@ -865,12 +854,7 @@ int main(int argc, char** argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
vkDestroyInstance = (PFN_vkDestroyInstance)
|
||||
glfwGetInstanceProcAddress(instance, "vkDestroyInstance");
|
||||
vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)
|
||||
glfwGetInstanceProcAddress(instance, "vkEnumeratePhysicalDevices");
|
||||
vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)
|
||||
glfwGetInstanceProcAddress(instance, "vkGetPhysicalDeviceProperties");
|
||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, instance);
|
||||
|
||||
if (vkEnumeratePhysicalDevices(instance, &pd_count, NULL) != VK_SUCCESS)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -129,7 +129,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
set_icon(window, cur_icon_color);
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -191,7 +191,7 @@ static GLFWwindow* create_window(GLFWmonitor* monitor)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
@ -210,7 +210,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
update_vsync();
|
||||
|
||||
last_time = glfwGetTime();
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
@ -190,7 +190,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -166,7 +166,7 @@ static void test_modes(GLFWmonitor* monitor)
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
glfwSetTime(0.0);
|
||||
|
@ -29,7 +29,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@ -141,7 +141,7 @@ int main(int argc, char** argv)
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
glGetIntegerv(GL_SAMPLES, &samples);
|
||||
|
@ -23,7 +23,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
@ -67,7 +67,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
|
||||
|
@ -33,7 +33,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <time.h>
|
||||
@ -164,7 +164,7 @@ int main(int argc, char** argv)
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
vertex_shader = glCreateShader(GL_VERTEX_SHADER);
|
||||
|
@ -28,7 +28,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -222,7 +222,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
set_swap_interval(window, 0);
|
||||
|
||||
last_time = glfwGetTime();
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "tinycthread.h"
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -114,7 +114,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(threads[0].window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwMakeContextCurrent(NULL);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <time.h>
|
||||
@ -70,7 +70,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -55,7 +55,7 @@ int main(void)
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
|
113
tests/vulkan.c
113
tests/vulkan.c
@ -41,8 +41,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <glad/vulkan.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define DEMO_TEXTURE_COUNT 1
|
||||
@ -65,24 +65,9 @@
|
||||
exit(1); \
|
||||
} while (0)
|
||||
|
||||
#define GET_INSTANCE_PROC_ADDR(inst, entrypoint) \
|
||||
{ \
|
||||
demo->fp##entrypoint = \
|
||||
(PFN_vk##entrypoint)vkGetInstanceProcAddr(inst, "vk" #entrypoint); \
|
||||
if (demo->fp##entrypoint == NULL) { \
|
||||
ERR_EXIT("vkGetInstanceProcAddr failed to find vk" #entrypoint, \
|
||||
"vkGetInstanceProcAddr Failure"); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define GET_DEVICE_PROC_ADDR(dev, entrypoint) \
|
||||
{ \
|
||||
demo->fp##entrypoint = \
|
||||
(PFN_vk##entrypoint)vkGetDeviceProcAddr(dev, "vk" #entrypoint); \
|
||||
if (demo->fp##entrypoint == NULL) { \
|
||||
ERR_EXIT("vkGetDeviceProcAddr failed to find vk" #entrypoint, \
|
||||
"vkGetDeviceProcAddr Failure"); \
|
||||
} \
|
||||
static GLADapiproc glad_vulkan_callback(const char* name, void* user)
|
||||
{
|
||||
return glfwGetInstanceProcAddress((VkInstance) user, name);
|
||||
}
|
||||
|
||||
static const char fragShaderCode[] = {
|
||||
@ -287,19 +272,6 @@ struct demo {
|
||||
VkFormat format;
|
||||
VkColorSpaceKHR color_space;
|
||||
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR
|
||||
fpGetPhysicalDeviceSurfaceSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
|
||||
fpGetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR
|
||||
fpGetPhysicalDeviceSurfaceFormatsKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
|
||||
fpGetPhysicalDeviceSurfacePresentModesKHR;
|
||||
PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR;
|
||||
PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR;
|
||||
PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR;
|
||||
PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR;
|
||||
PFN_vkQueuePresentKHR fpQueuePresentKHR;
|
||||
uint32_t swapchainImageCount;
|
||||
VkSwapchainKHR swapchain;
|
||||
SwapchainBuffers *buffers;
|
||||
@ -347,10 +319,7 @@ struct demo {
|
||||
int32_t frameCount;
|
||||
bool validate;
|
||||
bool use_break;
|
||||
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallback;
|
||||
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallback;
|
||||
VkDebugReportCallbackEXT msg_callback;
|
||||
PFN_vkDebugReportMessageEXT DebugReportMessage;
|
||||
|
||||
float depthStencil;
|
||||
float depthIncrement;
|
||||
@ -631,7 +600,7 @@ static void demo_draw(struct demo *demo) {
|
||||
assert(!err);
|
||||
|
||||
// Get the index of the next available swapchain image:
|
||||
err = demo->fpAcquireNextImageKHR(demo->device, demo->swapchain, UINT64_MAX,
|
||||
err = vkAcquireNextImageKHR(demo->device, demo->swapchain, UINT64_MAX,
|
||||
imageAcquiredSemaphore,
|
||||
(VkFence)0, // TODO: Show use of fence
|
||||
&demo->current_buffer);
|
||||
@ -684,7 +653,7 @@ static void demo_draw(struct demo *demo) {
|
||||
.pImageIndices = &demo->current_buffer,
|
||||
};
|
||||
|
||||
err = demo->fpQueuePresentKHR(demo->queue, &present);
|
||||
err = vkQueuePresentKHR(demo->queue, &present);
|
||||
if (err == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
// demo->swapchain is out of date (e.g. the window was resized) and
|
||||
// must be recreated:
|
||||
@ -709,18 +678,18 @@ static void demo_prepare_buffers(struct demo *demo) {
|
||||
|
||||
// Check the surface capabilities and formats
|
||||
VkSurfaceCapabilitiesKHR surfCapabilities;
|
||||
err = demo->fpGetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
demo->gpu, demo->surface, &surfCapabilities);
|
||||
assert(!err);
|
||||
|
||||
uint32_t presentModeCount;
|
||||
err = demo->fpGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
err = vkGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
demo->gpu, demo->surface, &presentModeCount, NULL);
|
||||
assert(!err);
|
||||
VkPresentModeKHR *presentModes =
|
||||
(VkPresentModeKHR *)malloc(presentModeCount * sizeof(VkPresentModeKHR));
|
||||
assert(presentModes);
|
||||
err = demo->fpGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
err = vkGetPhysicalDeviceSurfacePresentModesKHR(
|
||||
demo->gpu, demo->surface, &presentModeCount, presentModes);
|
||||
assert(!err);
|
||||
|
||||
@ -797,8 +766,7 @@ static void demo_prepare_buffers(struct demo *demo) {
|
||||
};
|
||||
uint32_t i;
|
||||
|
||||
err = demo->fpCreateSwapchainKHR(demo->device, &swapchain, NULL,
|
||||
&demo->swapchain);
|
||||
err = vkCreateSwapchainKHR(demo->device, &swapchain, NULL, &demo->swapchain);
|
||||
assert(!err);
|
||||
|
||||
// If we just re-created an existing swapchain, we should destroy the old
|
||||
@ -806,17 +774,17 @@ static void demo_prepare_buffers(struct demo *demo) {
|
||||
// Note: destroying the swapchain also cleans up all its associated
|
||||
// presentable images once the platform is done with them.
|
||||
if (oldSwapchain != VK_NULL_HANDLE) {
|
||||
demo->fpDestroySwapchainKHR(demo->device, oldSwapchain, NULL);
|
||||
vkDestroySwapchainKHR(demo->device, oldSwapchain, NULL);
|
||||
}
|
||||
|
||||
err = demo->fpGetSwapchainImagesKHR(demo->device, demo->swapchain,
|
||||
err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain,
|
||||
&demo->swapchainImageCount, NULL);
|
||||
assert(!err);
|
||||
|
||||
VkImage *swapchainImages =
|
||||
(VkImage *)malloc(demo->swapchainImageCount * sizeof(VkImage));
|
||||
assert(swapchainImages);
|
||||
err = demo->fpGetSwapchainImagesKHR(demo->device, demo->swapchain,
|
||||
err = vkGetSwapchainImagesKHR(demo->device, demo->swapchain,
|
||||
&demo->swapchainImageCount,
|
||||
swapchainImages);
|
||||
assert(!err);
|
||||
@ -1843,6 +1811,8 @@ static void demo_init_vk(struct demo *demo) {
|
||||
"vkCreateInstance Failure");
|
||||
}
|
||||
|
||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, demo->inst);
|
||||
|
||||
/* Make initial call to query gpu_count, then second call for gpu info*/
|
||||
err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL);
|
||||
assert(!err && gpu_count > 0);
|
||||
@ -1864,6 +1834,8 @@ static void demo_init_vk(struct demo *demo) {
|
||||
"vkEnumeratePhysicalDevices Failure");
|
||||
}
|
||||
|
||||
gladLoadVulkanUserPtr(demo->gpu, glad_vulkan_callback, demo->inst);
|
||||
|
||||
/* Look for device extensions */
|
||||
uint32_t device_extension_count = 0;
|
||||
VkBool32 swapchainExtFound = 0;
|
||||
@ -1904,30 +1876,6 @@ static void demo_init_vk(struct demo *demo) {
|
||||
}
|
||||
|
||||
if (demo->validate) {
|
||||
demo->CreateDebugReportCallback =
|
||||
(PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(
|
||||
demo->inst, "vkCreateDebugReportCallbackEXT");
|
||||
demo->DestroyDebugReportCallback =
|
||||
(PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(
|
||||
demo->inst, "vkDestroyDebugReportCallbackEXT");
|
||||
if (!demo->CreateDebugReportCallback) {
|
||||
ERR_EXIT(
|
||||
"GetProcAddr: Unable to find vkCreateDebugReportCallbackEXT\n",
|
||||
"vkGetProcAddr Failure");
|
||||
}
|
||||
if (!demo->DestroyDebugReportCallback) {
|
||||
ERR_EXIT(
|
||||
"GetProcAddr: Unable to find vkDestroyDebugReportCallbackEXT\n",
|
||||
"vkGetProcAddr Failure");
|
||||
}
|
||||
demo->DebugReportMessage =
|
||||
(PFN_vkDebugReportMessageEXT)vkGetInstanceProcAddr(
|
||||
demo->inst, "vkDebugReportMessageEXT");
|
||||
if (!demo->DebugReportMessage) {
|
||||
ERR_EXIT("GetProcAddr: Unable to find vkDebugReportMessageEXT\n",
|
||||
"vkGetProcAddr Failure");
|
||||
}
|
||||
|
||||
VkDebugReportCallbackCreateInfoEXT dbgCreateInfo;
|
||||
dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT;
|
||||
dbgCreateInfo.flags =
|
||||
@ -1935,7 +1883,7 @@ static void demo_init_vk(struct demo *demo) {
|
||||
dbgCreateInfo.pfnCallback = demo->use_break ? BreakCallback : dbgFunc;
|
||||
dbgCreateInfo.pUserData = demo;
|
||||
dbgCreateInfo.pNext = NULL;
|
||||
err = demo->CreateDebugReportCallback(demo->inst, &dbgCreateInfo, NULL,
|
||||
err = vkCreateDebugReportCallbackEXT(demo->inst, &dbgCreateInfo, NULL,
|
||||
&demo->msg_callback);
|
||||
switch (err) {
|
||||
case VK_SUCCESS:
|
||||
@ -1951,13 +1899,6 @@ static void demo_init_vk(struct demo *demo) {
|
||||
}
|
||||
}
|
||||
|
||||
// Having these GIPA queries of device extension entry points both
|
||||
// BEFORE and AFTER vkCreateDevice is a good test for the loader
|
||||
GET_INSTANCE_PROC_ADDR(demo->inst, GetPhysicalDeviceSurfaceCapabilitiesKHR);
|
||||
GET_INSTANCE_PROC_ADDR(demo->inst, GetPhysicalDeviceSurfaceFormatsKHR);
|
||||
GET_INSTANCE_PROC_ADDR(demo->inst, GetPhysicalDeviceSurfacePresentModesKHR);
|
||||
GET_INSTANCE_PROC_ADDR(demo->inst, GetPhysicalDeviceSurfaceSupportKHR);
|
||||
|
||||
vkGetPhysicalDeviceProperties(demo->gpu, &demo->gpu_props);
|
||||
|
||||
// Query with NULL data to get count
|
||||
@ -2009,12 +1950,6 @@ static void demo_init_device(struct demo *demo) {
|
||||
|
||||
err = vkCreateDevice(demo->gpu, &device, NULL, &demo->device);
|
||||
assert(!err);
|
||||
|
||||
GET_DEVICE_PROC_ADDR(demo->device, CreateSwapchainKHR);
|
||||
GET_DEVICE_PROC_ADDR(demo->device, DestroySwapchainKHR);
|
||||
GET_DEVICE_PROC_ADDR(demo->device, GetSwapchainImagesKHR);
|
||||
GET_DEVICE_PROC_ADDR(demo->device, AcquireNextImageKHR);
|
||||
GET_DEVICE_PROC_ADDR(demo->device, QueuePresentKHR);
|
||||
}
|
||||
|
||||
static void demo_init_vk_swapchain(struct demo *demo) {
|
||||
@ -2028,7 +1963,7 @@ static void demo_init_vk_swapchain(struct demo *demo) {
|
||||
VkBool32 *supportsPresent =
|
||||
(VkBool32 *)malloc(demo->queue_count * sizeof(VkBool32));
|
||||
for (i = 0; i < demo->queue_count; i++) {
|
||||
demo->fpGetPhysicalDeviceSurfaceSupportKHR(demo->gpu, i, demo->surface,
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(demo->gpu, i, demo->surface,
|
||||
&supportsPresent[i]);
|
||||
}
|
||||
|
||||
@ -2087,12 +2022,12 @@ static void demo_init_vk_swapchain(struct demo *demo) {
|
||||
|
||||
// Get the list of VkFormat's that are supported:
|
||||
uint32_t formatCount;
|
||||
err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface,
|
||||
err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface,
|
||||
&formatCount, NULL);
|
||||
assert(!err);
|
||||
VkSurfaceFormatKHR *surfFormats =
|
||||
(VkSurfaceFormatKHR *)malloc(formatCount * sizeof(VkSurfaceFormatKHR));
|
||||
err = demo->fpGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface,
|
||||
err = vkGetPhysicalDeviceSurfaceFormatsKHR(demo->gpu, demo->surface,
|
||||
&formatCount, surfFormats);
|
||||
assert(!err);
|
||||
// If the format list includes just one entry of VK_FORMAT_UNDEFINED,
|
||||
@ -2126,6 +2061,8 @@ static void demo_init_connection(struct demo *demo) {
|
||||
fflush(stdout);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
|
||||
}
|
||||
|
||||
static void demo_init(struct demo *demo, const int argc, const char *argv[])
|
||||
@ -2208,12 +2145,12 @@ static void demo_cleanup(struct demo *demo) {
|
||||
vkDestroyImage(demo->device, demo->depth.image, NULL);
|
||||
vkFreeMemory(demo->device, demo->depth.mem, NULL);
|
||||
|
||||
demo->fpDestroySwapchainKHR(demo->device, demo->swapchain, NULL);
|
||||
vkDestroySwapchainKHR(demo->device, demo->swapchain, NULL);
|
||||
free(demo->buffers);
|
||||
|
||||
vkDestroyDevice(demo->device, NULL);
|
||||
if (demo->validate) {
|
||||
demo->DestroyDebugReportCallback(demo->inst, demo->msg_callback, NULL);
|
||||
vkDestroyDebugReportCallbackEXT(demo->inst, demo->msg_callback, NULL);
|
||||
}
|
||||
vkDestroySurfaceKHR(demo->inst, demo->surface, NULL);
|
||||
vkDestroyInstance(demo->inst, NULL);
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glad/gl.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <stdio.h>
|
||||
@ -140,7 +140,7 @@ int main(int argc, char** argv)
|
||||
glfwSetKeyCallback(windows[i], key_callback);
|
||||
|
||||
glfwMakeContextCurrent(windows[i]);
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glClearColor(colors[i].r, colors[i].g, colors[i].b, 1.f);
|
||||
|
||||
glfwGetWindowFrameSize(windows[i], &left, &top, &right, &bottom);
|
||||
|
Loading…
Reference in New Issue
Block a user