Skip to content

Commit

Permalink
Allow external VkSurfaceKHR (proper fix for #27)
Browse files Browse the repository at this point in the history
  • Loading branch information
corporateshark committed Apr 9, 2024
1 parent 10d9418 commit e5233d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lvk/vulkan/VulkanClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2800,7 +2800,8 @@ void lvk::VulkanStagingDevice::waitAndReset() {
regions_.push_front({0, stagingBufferSize_, SubmitHandle()});
}

lvk::VulkanContext::VulkanContext(const lvk::ContextConfig& config, void* window, void* display) : config_(config) {
lvk::VulkanContext::VulkanContext(const lvk::ContextConfig& config, void* window, void* display, VkSurfaceKHR surface) :
config_(config), vkSurface_(surface) {
LVK_PROFILER_THREAD("MainThread");

pimpl_ = std::make_unique<VulkanContextImpl>();
Expand All @@ -2814,7 +2815,7 @@ lvk::VulkanContext::VulkanContext(const lvk::ContextConfig& config, void* window

createInstance();

if (window) {
if (window && !surface) {
createSurface(window, display);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lvk/vulkan/VulkanClasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class VulkanStagingDevice final {

class VulkanContext final : public IContext {
public:
VulkanContext(const lvk::ContextConfig& config, void* window, void* display = nullptr);
VulkanContext(const lvk::ContextConfig& config, void* window, void* display = nullptr, VkSurfaceKHR surface = VK_NULL_HANDLE);
~VulkanContext();

ICommandBuffer& acquireCommandBuffer() override;
Expand Down

0 comments on commit e5233d4

Please sign in to comment.