Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VulkanWindow: add methods to retrieve id & ref #49

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/fwk/vulkan/vulkan_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace fwk {

class VulkanDevice {
public:
VDeviceRef ref() const { return VDeviceRef(m_id); }
VDeviceRef ref() { return VDeviceRef(m_id); }
VDeviceId id() const { return m_id; }
VPhysicalDeviceId physId() const { return m_phys_id; }
VkDevice handle() const { return m_handle; }
Expand Down
1 change: 1 addition & 0 deletions include/fwk/vulkan/vulkan_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class VWindowRef {
VWindowId id() const { return m_id; }

private:
friend class VulkanWindow;
friend class VulkanStorage;
VWindowRef(VWindowId, VulkanWindow *);

Expand Down
2 changes: 2 additions & 0 deletions include/fwk/vulkan/vulkan_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DECLARE_ENUM(WindowEvent);
class VulkanWindow {
public:
using Flag = VWindowFlag;
VWindowRef ref();
VWindowId id() const;

static Ex<VWindowRef> create(VInstanceRef, ZStr title, IRect rect, VWindowFlags);

Expand Down
3 changes: 3 additions & 0 deletions src/vulkan/vulkan_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ struct VulkanWindow::Impl {
bool is_closing = false;
};

VWindowRef VulkanWindow::ref() { return VWindowRef(m_impl->id, this); }
VWindowId VulkanWindow::id() const { return m_impl->id; }

VulkanWindow::VulkanWindow(VWindowId id, VInstanceRef instance_ref) {
m_impl.emplace(id, instance_ref);
}
Expand Down