aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bindings/cxx/include/pugl/vulkan.hpp4
-rw-r--r--examples/pugl_vulkan_cxx_demo.cpp7
-rw-r--r--examples/pugl_vulkan_demo.c7
-rw-r--r--include/pugl/vulkan.h4
-rw-r--r--src/mac_vulkan.m6
-rw-r--r--src/win_vulkan.c6
-rw-r--r--src/x11_vulkan.c6
-rw-r--r--wscript1
8 files changed, 24 insertions, 17 deletions
diff --git a/bindings/cxx/include/pugl/vulkan.hpp b/bindings/cxx/include/pugl/vulkan.hpp
index 5ce8acd..aaa221f 100644
--- a/bindings/cxx/include/pugl/vulkan.hpp
+++ b/bindings/cxx/include/pugl/vulkan.hpp
@@ -142,14 +142,14 @@ getInstanceExtensions() noexcept
/// @copydoc puglCreateSurface
inline VkResult
-createSurface(const VulkanLoader& loader,
+createSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
View& view,
VkInstance instance,
const VkAllocationCallbacks* const allocator,
VkSurfaceKHR* const surface) noexcept
{
const VkResult r = puglCreateSurface(
- loader.cobj(), view.cobj(), instance, allocator, surface);
+ vkGetInstanceProcAddr, view.cobj(), instance, allocator, surface);
return (!r && !surface) ? VK_ERROR_INITIALIZATION_FAILED : r;
}
diff --git a/examples/pugl_vulkan_cxx_demo.cpp b/examples/pugl_vulkan_cxx_demo.cpp
index 7a4e5cb..6da5e5a 100644
--- a/examples/pugl_vulkan_cxx_demo.cpp
+++ b/examples/pugl_vulkan_cxx_demo.cpp
@@ -417,8 +417,11 @@ GraphicsDevice::init(const pugl::VulkanLoader& loader,
// Create a Vulkan surface for the window using the Pugl API
VkSurfaceKHR surfaceHandle = {};
- if ((r = pugl::createSurface(
- loader, view, context.instance, nullptr, &surfaceHandle))) {
+ if ((r = pugl::createSurface(loader.getInstanceProcAddrFunc(),
+ view,
+ context.instance,
+ nullptr,
+ &surfaceHandle))) {
return r;
}
diff --git a/examples/pugl_vulkan_demo.c b/examples/pugl_vulkan_demo.c
index a65731b..3f684fe 100644
--- a/examples/pugl_vulkan_demo.c
+++ b/examples/pugl_vulkan_demo.c
@@ -1100,8 +1100,11 @@ main(int argc, char** argv)
// Create Vulkan surface for Window
PuglVulkanLoader* loader = puglNewVulkanLoader(app.world);
- if (puglCreateSurface(
- loader, app.view, vk->instance, ALLOC_VK, &vk->surface)) {
+ if (puglCreateSurface(puglGetInstanceProcAddrFunc(loader),
+ app.view,
+ vk->instance,
+ ALLOC_VK,
+ &vk->surface)) {
return logError("Failed to create surface\n");
}
diff --git a/include/pugl/vulkan.h b/include/pugl/vulkan.h
index 487ecda..05e13e2 100644
--- a/include/pugl/vulkan.h
+++ b/include/pugl/vulkan.h
@@ -117,7 +117,7 @@ puglGetInstanceExtensions(uint32_t* count);
/**
Create a Vulkan surface for a Pugl view.
- @param loader The loader for Vulkan functions.
+ @param vkGetInstanceProcAddr Accessor for Vulkan functions.
@param view The view the surface is to be displayed on.
@param instance The Vulkan instance.
@param allocator Vulkan allocation callbacks, may be NULL.
@@ -125,7 +125,7 @@ puglGetInstanceExtensions(uint32_t* count);
@return `VK_SUCCESS` on success, or a Vulkan error code.
*/
PUGL_API VkResult
-puglCreateSurface(const PuglVulkanLoader* loader,
+puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
PuglView* view,
VkInstance instance,
const VkAllocationCallbacks* allocator,
diff --git a/src/mac_vulkan.m b/src/mac_vulkan.m
index 39c7f29..2d01fd4 100644
--- a/src/mac_vulkan.m
+++ b/src/mac_vulkan.m
@@ -194,7 +194,7 @@ puglGetInstanceExtensions(uint32_t* const count)
}
VkResult
-puglCreateSurface(const PuglVulkanLoader* const loader,
+puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
PuglView* const view,
VkInstance instance,
const VkAllocationCallbacks* const allocator,
@@ -203,8 +203,8 @@ puglCreateSurface(const PuglVulkanLoader* const loader,
PuglInternals* const impl = view->impl;
PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK =
- (PFN_vkCreateMacOSSurfaceMVK)puglGetInstanceProcAddrFunc(
- loader)(instance, "vkCreateMacOSSurfaceMVK");
+ (PFN_vkCreateMacOSSurfaceMVK)
+ vkGetInstanceProcAddr(instance, "vkCreateMacOSSurfaceMVK");
const VkMacOSSurfaceCreateInfoMVK info = {
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK,
diff --git a/src/win_vulkan.c b/src/win_vulkan.c
index eb20698..3d6934a 100644
--- a/src/win_vulkan.c
+++ b/src/win_vulkan.c
@@ -107,7 +107,7 @@ puglGetInstanceExtensions(uint32_t* const count)
}
VkResult
-puglCreateSurface(const PuglVulkanLoader* const loader,
+puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
PuglView* const view,
VkInstance instance,
const VkAllocationCallbacks* const pAllocator,
@@ -116,8 +116,8 @@ puglCreateSurface(const PuglVulkanLoader* const loader,
PuglInternals* const impl = view->impl;
PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR =
- (PFN_vkCreateWin32SurfaceKHR)puglGetInstanceProcAddrFunc(loader)(
- instance, "vkCreateWin32SurfaceKHR");
+ (PFN_vkCreateWin32SurfaceKHR)
+ vkGetInstanceProcAddr(instance, "vkCreateWin32SurfaceKHR");
const VkWin32SurfaceCreateInfoKHR createInfo = {
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR,
diff --git a/src/x11_vulkan.c b/src/x11_vulkan.c
index 7004fd8..c7ae1b0 100644
--- a/src/x11_vulkan.c
+++ b/src/x11_vulkan.c
@@ -110,7 +110,7 @@ puglGetInstanceExtensions(uint32_t* const count)
}
VkResult
-puglCreateSurface(const PuglVulkanLoader* const loader,
+puglCreateSurface(PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr,
PuglView* const view,
VkInstance instance,
const VkAllocationCallbacks* const allocator,
@@ -120,8 +120,8 @@ puglCreateSurface(const PuglVulkanLoader* const loader,
PuglWorldInternals* world_impl = view->world->impl;
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
- (PFN_vkCreateXlibSurfaceKHR)puglGetInstanceProcAddrFunc(loader)(
- instance, "vkCreateXlibSurfaceKHR");
+ (PFN_vkCreateXlibSurfaceKHR)
+ vkGetInstanceProcAddr(instance, "vkCreateXlibSurfaceKHR");
const VkXlibSurfaceCreateInfoKHR info = {
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
diff --git a/wscript b/wscript
index bd4d19a..e500d38 100644
--- a/wscript
+++ b/wscript
@@ -134,6 +134,7 @@ def configure(conf):
'/wd4868', # may not enforce left-to-right evaluation order
'/wd5026', # move constructor implicitly deleted
'/wd5027', # move assignment operator implicitly deleted
+ '/wd5039', # pointer to throwing function passed to C function
],
})