mirror of
https://github.com/elima/gpu-playground.git
synced 2025-06-07 07:56:21 +00:00
vulkan-minimal: Links against a Vulkan loader (libvulkan.so) instead
Previously, the Intel Vulkan driver was used directly.
This commit is contained in:
parent
821e8f432c
commit
be8660abc4
@ -2,10 +2,7 @@ TARGET=vulkan-minimal
|
|||||||
|
|
||||||
GLSL_VALIDATOR=../glslangValidator
|
GLSL_VALIDATOR=../glslangValidator
|
||||||
|
|
||||||
VULKAN_SO_NAME=vulkan_intel
|
all: $(TARGET) vert.spv frag.spv
|
||||||
VULKAN_SO_PATH=~/devel/build/lib
|
|
||||||
|
|
||||||
all: Makefile $(TARGET) vert.spv frag.spv
|
|
||||||
|
|
||||||
vert.spv: shader.vert
|
vert.spv: shader.vert
|
||||||
$(GLSL_VALIDATOR) -V shader.vert
|
$(GLSL_VALIDATOR) -V shader.vert
|
||||||
@ -13,12 +10,11 @@ vert.spv: shader.vert
|
|||||||
frag.spv: shader.frag
|
frag.spv: shader.frag
|
||||||
$(GLSL_VALIDATOR) -V shader.frag
|
$(GLSL_VALIDATOR) -V shader.frag
|
||||||
|
|
||||||
$(TARGET): main.c vert.spv frag.spv
|
$(TARGET): Makefile main.c vert.spv frag.spv
|
||||||
gcc -ggdb -O0 -Wall -std=c99 \
|
gcc -ggdb -O0 -Wall -std=c99 \
|
||||||
-DCURRENT_DIR=\"`pwd`\" \
|
-DCURRENT_DIR=\"`pwd`\" \
|
||||||
`pkg-config --libs --cflags xcb` \
|
`pkg-config --libs --cflags xcb` \
|
||||||
-L $(VULKAN_SO_PATH) \
|
-lvulkan \
|
||||||
-l$(VULKAN_SO_NAME) \
|
|
||||||
-o $(TARGET) \
|
-o $(TARGET) \
|
||||||
main.c
|
main.c
|
||||||
|
|
||||||
|
@ -36,12 +36,15 @@
|
|||||||
#define WIDTH 640
|
#define WIDTH 640
|
||||||
#define HEIGHT 480
|
#define HEIGHT 480
|
||||||
|
|
||||||
|
/* This is only necessary if program is linked to a Vulkan vendor driver\
|
||||||
|
* directly
|
||||||
|
*/
|
||||||
PFN_vkVoidFunction vk_icdGetInstanceProcAddr (VkInstance instance,
|
PFN_vkVoidFunction vk_icdGetInstanceProcAddr (VkInstance instance,
|
||||||
const char* pName);
|
const char* pName);
|
||||||
|
|
||||||
#define GET_ICD_PROC_ADDR(api, symbol) \
|
#define GET_ICD_PROC_ADDR(api, symbol) \
|
||||||
api.symbol = (PFN_vk ##symbol) vk_icdGetInstanceProcAddr(NULL, "vk" #symbol);
|
api.symbol = (PFN_vk ##symbol) vk_icdGetInstanceProcAddr(NULL, "vk" #symbol);
|
||||||
|
|
||||||
|
|
||||||
#define GET_PROC_ADDR(api, symbol) \
|
#define GET_PROC_ADDR(api, symbol) \
|
||||||
api.symbol = (PFN_vk ##symbol) api.GetInstanceProcAddr(NULL, "vk" #symbol);
|
api.symbol = (PFN_vk ##symbol) api.GetInstanceProcAddr(NULL, "vk" #symbol);
|
||||||
|
|
||||||
@ -187,7 +190,12 @@ main (int32_t argc, char* argv[])
|
|||||||
/* ======================================================================= */
|
/* ======================================================================= */
|
||||||
|
|
||||||
/* load inital API entry points */
|
/* load inital API entry points */
|
||||||
GET_ICD_PROC_ADDR (vk, GetInstanceProcAddr);
|
|
||||||
|
/* if program is linked against a Vulkan loader */
|
||||||
|
vk.GetInstanceProcAddr = vkGetInstanceProcAddr;
|
||||||
|
/* otherwise, */
|
||||||
|
/* GET_ICD_PROC_ADDR (vk, GetInstanceProcAddr); */
|
||||||
|
|
||||||
GET_PROC_ADDR (vk, EnumerateInstanceLayerProperties);
|
GET_PROC_ADDR (vk, EnumerateInstanceLayerProperties);
|
||||||
GET_PROC_ADDR (vk, EnumerateInstanceExtensionProperties);
|
GET_PROC_ADDR (vk, EnumerateInstanceExtensionProperties);
|
||||||
GET_PROC_ADDR (vk, CreateInstance);
|
GET_PROC_ADDR (vk, CreateInstance);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user