mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-21 03:11:57 +00:00
Don't link against the Vulkan loader, load it at runtime.
This commit is contained in:
parent
d936bad256
commit
85b9f84b3d
9 changed files with 3177 additions and 12 deletions
|
@ -595,6 +595,7 @@ set(VK-Source
|
|||
${REF_SRC_DIR}/vk/vk_validation.c
|
||||
${REF_SRC_DIR}/vk/vk_warp.c
|
||||
${REF_SRC_DIR}/vk/vk_util.c
|
||||
${REF_SRC_DIR}/vk/volk/volk.c
|
||||
${REF_SRC_DIR}/files/pcx.c
|
||||
${REF_SRC_DIR}/files/stb.c
|
||||
${REF_SRC_DIR}/files/wal.c
|
||||
|
|
5
Makefile
5
Makefile
|
@ -649,14 +649,14 @@ ref_vk:
|
|||
@echo "===> Building ref_vk.dll"
|
||||
$(MAKE) release/ref_vk.dll
|
||||
|
||||
release/ref_vk.dll : LDFLAGS += -shared -lvulkan
|
||||
release/ref_vk.dll : LDFLAGS += -shared
|
||||
else
|
||||
ref_vk:
|
||||
@echo "===> Building ref_vk.so"
|
||||
$(MAKE) release/ref_vk.so
|
||||
|
||||
release/ref_vk.so : CFLAGS += -fPIC
|
||||
release/ref_vk.so : LDFLAGS += -shared -lvulkan
|
||||
release/ref_vk.so : LDFLAGS += -shared
|
||||
endif
|
||||
|
||||
build/ref_vk/%.o: %.c
|
||||
|
@ -969,6 +969,7 @@ REFVK_OBJS_ := \
|
|||
src/client/refresh/vk/vk_validation.o \
|
||||
src/client/refresh/vk/vk_warp.o \
|
||||
src/client/refresh/vk/vk_util.o \
|
||||
src/client/refresh/vk/volk/volk.o \
|
||||
src/client/refresh/files/pcx.o \
|
||||
src/client/refresh/files/stb.o \
|
||||
src/client/refresh/files/wal.o \
|
||||
|
|
|
@ -21,16 +21,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifndef __VK_LOCAL_H__
|
||||
#define __VK_LOCAL_H__
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL2/SDL_vulkan.h>
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "../../ref_shared.h"
|
||||
|
||||
#include "../volk/volk.h"
|
||||
#include "qvk.h"
|
||||
|
||||
// verify if VkResult is VK_SUCCESS
|
||||
|
|
|
@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "local.h"
|
||||
#include "util.h"
|
||||
#include "shaders.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#ifndef __VK_UTIL_H__
|
||||
#define __VK_UTIL_H__
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include "../volk/volk.h"
|
||||
|
||||
#define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1))
|
||||
|
||||
|
|
|
@ -1701,6 +1701,8 @@ qboolean QVk_Init(SDL_Window *window)
|
|||
VkResult res = vkCreateInstance(&createInfo, NULL, &vk_instance);
|
||||
free(wantedExtensions);
|
||||
|
||||
volkLoadInstance(vk_instance);
|
||||
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
R_Printf(PRINT_ALL, "%s(): Could not create Vulkan instance: %s\n", __func__, QVk_GetError(res));
|
||||
|
|
|
@ -1601,13 +1601,13 @@ R_IsVsyncActive(void)
|
|||
|
||||
static int R_PrepareForWindow(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if (SDL_Vulkan_LoadLibrary("libvulkan-1.dll"))
|
||||
if (SDL_Vulkan_LoadLibrary(NULL))
|
||||
{
|
||||
R_Printf(PRINT_ALL, "%s() Loader import failed: %s",
|
||||
__func__, SDL_GetError());
|
||||
R_Printf(PRINT_ALL, "%s() Loader import failed: %s", __func__, SDL_GetError());
|
||||
}
|
||||
#endif
|
||||
|
||||
volkInitializeCustom(SDL_Vulkan_GetVkGetInstanceProcAddr());
|
||||
|
||||
return SDL_WINDOW_VULKAN;
|
||||
}
|
||||
|
||||
|
|
1905
src/client/refresh/vk/volk/volk.c
Normal file
1905
src/client/refresh/vk/volk/volk.c
Normal file
File diff suppressed because it is too large
Load diff
1257
src/client/refresh/vk/volk/volk.h
Normal file
1257
src/client/refresh/vk/volk/volk.h
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue