Update glad2 and switch to header-only version

This updates to a newer version of glad2 and switches to the header-only
variant.

This also (finally) switches to the newer glad2 loader signature that
allows us to pass in glfwGetInstanceProcAddress directly.
This commit is contained in:
Camilla Löwy
2021-08-25 01:18:03 +02:00
parent 518e26e16e
commit 62074f3dea
38 changed files with 4297 additions and 3749 deletions

View File

@@ -41,6 +41,7 @@
#include <windows.h>
#endif
#define GLAD_VULKAN_IMPLEMENTATION
#include <glad/vulkan.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
@@ -65,11 +66,6 @@
exit(1); \
} while (0)
static GLADapiproc glad_vulkan_callback(const char* name, void* user)
{
return glfwGetInstanceProcAddress((VkInstance) user, name);
}
static const uint32_t fragShaderCode[] = {
0x07230203,0x00010000,0x00080007,0x00000014,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
@@ -1251,7 +1247,7 @@ static void demo_prepare_pipeline(struct demo *demo) {
VkPipelineDepthStencilStateCreateInfo ds;
VkPipelineViewportStateCreateInfo vp;
VkPipelineMultisampleStateCreateInfo ms;
VkDynamicState dynamicStateEnables[VK_DYNAMIC_STATE_RANGE_SIZE];
VkDynamicState dynamicStateEnables[(VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1)];
VkPipelineDynamicStateCreateInfo dynamicState;
VkResult U_ASSERT_ONLY err;
@@ -1715,7 +1711,7 @@ static void demo_init_vk(struct demo *demo) {
"vkCreateInstance Failure");
}
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, demo->inst);
gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, demo->inst);
/* Make initial call to query gpu_count, then second call for gpu info*/
err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, NULL);
@@ -1738,7 +1734,7 @@ static void demo_init_vk(struct demo *demo) {
"vkEnumeratePhysicalDevices Failure");
}
gladLoadVulkanUserPtr(demo->gpu, glad_vulkan_callback, demo->inst);
gladLoadVulkanUserPtr(demo->gpu, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, demo->inst);
/* Look for device extensions */
uint32_t device_extension_count = 0;
@@ -1966,7 +1962,7 @@ static void demo_init_connection(struct demo *demo) {
exit(1);
}
gladLoadVulkanUserPtr(NULL, glad_vulkan_callback, NULL);
gladLoadVulkanUserPtr(NULL, (GLADuserptrloadfunc) glfwGetInstanceProcAddress, NULL);
}
static void demo_init(struct demo *demo, const int argc, const char *argv[])