Skip to content
Snippets Groups Projects
Verified Commit f6e670ec authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Changed copy-by-value to copy-by-reference and made getters const

parent a8dbbb3a
No related branches found
No related tags found
No related merge requests found
......@@ -8,9 +8,9 @@ int main(int argc, const char** argv) {
VK_MAKE_VERSION(0, 0, 1)
);
const vk::Instance instance = context.getInstance();
const vk::PhysicalDevice physicalDevice = context.getPhysicalDevice();
const vk::Device device = context.getDevice();
const vk::Instance& instance = context.getInstance();
const vk::PhysicalDevice& physicalDevice = context.getPhysicalDevice();
const vk::Device& device = context.getDevice();
std::cout << "Physical device: " << physicalDevice.getProperties().deviceName << std::endl;
......
......@@ -53,15 +53,15 @@ namespace vkcv {
return Context(instance, physicalDevice, device);
}
vk::Instance Context::getInstance() {
const vk::Instance& Context::getInstance() const {
return m_instance;
}
vk::PhysicalDevice Context::getPhysicalDevice() {
const vk::PhysicalDevice& Context::getPhysicalDevice() const {
return m_physicalDevice;
}
vk::Device Context::getDevice() {
const vk::Device& Context::getDevice() const {
return m_device;
}
}
......@@ -16,9 +16,14 @@ namespace vkcv {
Context(const Context &other) = delete;
Context(Context &&other) = default;
vk::Instance getInstance();
vk::PhysicalDevice getPhysicalDevice();
vk::Device getDevice();
[[nodiscard]]
const vk::Instance& getInstance() const;
[[nodiscard]]
const vk::PhysicalDevice& getPhysicalDevice() const;
[[nodiscard]]
const vk::Device& getDevice() const;
virtual ~Context();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment