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:
Camilla Löwy
2019-04-14 17:34:38 +02:00
parent 3461d1c2a5
commit d7e30b1c74
49 changed files with 9978 additions and 13183 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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