We would like to allow overriding the soname of libvulkan, in which case the tests and demos should respect that override.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 2 +- demos/demo_xcb.h | 15 +++++++++++++++ tests/vulkan_procs.h | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am index ed881ffa1..6a4cba449 100644 --- a/Makefile.am +++ b/Makefile.am @@ -325,7 +325,7 @@ endif EXTRA_DIST += $(vkd3d_shader_tests)
if BUILD_DEMOS -DEMOS_LDADD = $(LDADD) libvkd3d-shader.la @DEMO_LIBS@ @VULKAN_LIBS@ +DEMOS_LDADD = $(LDADD) libvkd3d-shader.la @DL_LIBS@ @DEMO_LIBS@ DEMOS_CFLAGS = $(AM_CFLAGS) @DEMO_CFLAGS@ bin_PROGRAMS += $(vkd3d_demos)
diff --git a/demos/demo_xcb.h b/demos/demo_xcb.h index d8be00f03..e8c6553d8 100644 --- a/demos/demo_xcb.h +++ b/demos/demo_xcb.h @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#define VK_NO_PROTOTYPES #define VK_USE_PLATFORM_XCB_KHR #define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_3 #include <vkd3d.h> @@ -29,6 +30,13 @@ #include <unistd.h> #include <fcntl.h> #include <stdbool.h> +#include "vkd3d_common.h" + +#define DECLARE_VK_PFN(name) PFN_##name name; +DECLARE_VK_PFN(vkCreateInstance); +#define VK_INSTANCE_PFN DECLARE_VK_PFN +#define VK_DEVICE_PFN DECLARE_VK_PFN +#include "../tests/vulkan_procs.h"
struct demo { @@ -329,6 +337,13 @@ static inline struct demo_swapchain *demo_swapchain_create(ID3D12CommandQueue *c VkDevice vk_device; VkImage *vk_images; VkFormat format; + void *libvulkan; + + if (!(libvulkan = vkd3d_dlopen(SONAME_LIBVULKAN))) + { + fprintf(stderr, "Failed to load %s: %s.\n", SONAME_LIBVULKAN, vkd3d_dlerror()); + exit(1); + }
if ((format = vkd3d_get_vk_format(desc->format)) == VK_FORMAT_UNDEFINED) return NULL; diff --git a/tests/vulkan_procs.h b/tests/vulkan_procs.h index 8e205c1be..984cd5fa1 100644 --- a/tests/vulkan_procs.h +++ b/tests/vulkan_procs.h @@ -42,9 +42,13 @@ VK_INSTANCE_PFN(vkGetPhysicalDeviceFeatures) VK_INSTANCE_PFN(vkGetPhysicalDeviceFormatProperties) VK_INSTANCE_PFN(vkGetPhysicalDeviceMemoryProperties) VK_INSTANCE_PFN(vkGetPhysicalDeviceQueueFamilyProperties) +VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) +VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceFormatsKHR) +VK_INSTANCE_PFN(vkGetPhysicalDeviceSurfaceSupportKHR)
/* Device functions (obtained by vkGetDeviceProcAddr). */ VK_DEVICE_PFN(vkDestroyDevice) /* Load vkDestroyDevice() first. */ +VK_DEVICE_PFN(vkAcquireNextImageKHR) VK_DEVICE_PFN(vkAllocateCommandBuffers) VK_DEVICE_PFN(vkAllocateDescriptorSets) VK_DEVICE_PFN(vkAllocateMemory) @@ -67,6 +71,7 @@ VK_DEVICE_PFN(vkCreateBuffer) VK_DEVICE_PFN(vkCreateCommandPool) VK_DEVICE_PFN(vkCreateDescriptorPool) VK_DEVICE_PFN(vkCreateDescriptorSetLayout) +VK_DEVICE_PFN(vkCreateFence) VK_DEVICE_PFN(vkCreateFramebuffer) VK_DEVICE_PFN(vkCreateGraphicsPipelines) VK_DEVICE_PFN(vkCreateImage) @@ -75,10 +80,12 @@ VK_DEVICE_PFN(vkCreatePipelineLayout) VK_DEVICE_PFN(vkCreateRenderPass) VK_DEVICE_PFN(vkCreateSampler) VK_DEVICE_PFN(vkCreateShaderModule) +VK_DEVICE_PFN(vkCreateSwapchainKHR) VK_DEVICE_PFN(vkDestroyBuffer) VK_DEVICE_PFN(vkDestroyCommandPool) VK_DEVICE_PFN(vkDestroyDescriptorPool) VK_DEVICE_PFN(vkDestroyDescriptorSetLayout) +VK_DEVICE_PFN(vkDestroyFence) VK_DEVICE_PFN(vkDestroyFramebuffer) VK_DEVICE_PFN(vkDestroyImage) VK_DEVICE_PFN(vkDestroyImageView) @@ -87,18 +94,28 @@ VK_DEVICE_PFN(vkDestroyPipelineLayout) VK_DEVICE_PFN(vkDestroyRenderPass) VK_DEVICE_PFN(vkDestroySampler) VK_DEVICE_PFN(vkDestroyShaderModule) +VK_DEVICE_PFN(vkDestroySurfaceKHR) +VK_DEVICE_PFN(vkDestroySwapchainKHR) VK_DEVICE_PFN(vkEndCommandBuffer) VK_DEVICE_PFN(vkFreeCommandBuffers) VK_DEVICE_PFN(vkFreeMemory) VK_DEVICE_PFN(vkGetBufferMemoryRequirements) VK_DEVICE_PFN(vkGetDeviceQueue) VK_DEVICE_PFN(vkGetImageMemoryRequirements) +VK_DEVICE_PFN(vkGetSwapchainImagesKHR) VK_DEVICE_PFN(vkMapMemory) +VK_DEVICE_PFN(vkQueuePresentKHR) VK_DEVICE_PFN(vkQueueSubmit) VK_DEVICE_PFN(vkQueueWaitIdle) VK_DEVICE_PFN(vkResetDescriptorPool) +VK_DEVICE_PFN(vkResetFences) VK_DEVICE_PFN(vkUnmapMemory) VK_DEVICE_PFN(vkUpdateDescriptorSets) +VK_DEVICE_PFN(vkWaitForFences) + +#ifdef VK_USE_PLATFORM_XCB_KHR +VK_INSTANCE_PFN(vkCreateXcbSurfaceKHR) +#endif
#undef VK_INSTANCE_PFN #undef VK_INSTANCE_EXT_PFN