Skip to content

Commit

Permalink
Add explicit conversions <-> C types
Browse files Browse the repository at this point in the history
  • Loading branch information
shg8 committed Feb 15, 2024
1 parent 810eaa5 commit dbfd6c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 3dgs/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void Renderer::initializeVulkan() {
configuration.enableVulkanValidationLayers);

context->createInstance();
auto surface = vk::SurfaceKHR{window->createSurface(context)};
auto surface = static_cast<vk::SurfaceKHR>(window->createSurface(context));
context->selectPhysicalDevice(configuration.physicalDeviceId, surface);

vk::PhysicalDeviceFeatures pdf{};
Expand Down
8 changes: 4 additions & 4 deletions vulkan/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Utils.h"

Buffer::Buffer(const std::shared_ptr<VulkanContext>& _context, uint32_t size, vk::BufferUsageFlags usage,
VmaMemoryUsage vmaUsage, VmaAllocationCreateFlags flags, bool shared, VkDeviceSize alignment)
VmaMemoryUsage vmaUsage, VmaAllocationCreateFlags flags, bool shared, vk::DeviceSize alignment)
: context(_context),
size(size),
usage(usage),
Expand All @@ -23,7 +23,7 @@ Buffer::Buffer(const std::shared_ptr<VulkanContext>& _context, uint32_t size, vk
bufferInfo.setQueueFamilyIndexCount(2).setPQueueFamilyIndices(queueFamilyIndices);
}

VkBufferCreateInfo vkBufferInfo = bufferInfo;
auto vkBufferInfo = static_cast<VkBufferCreateInfo>(bufferInfo);

VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = vmaUsage;
Expand All @@ -40,7 +40,7 @@ Buffer::Buffer(const std::shared_ptr<VulkanContext>& _context, uint32_t size, vk
if (res != VK_SUCCESS) {
throw std::runtime_error("Failed to create buffer");
}
buffer = vkBuffer;
buffer = static_cast<vk::Buffer>(vkBuffer);
}

Buffer Buffer::createStagingBuffer(uint32_t size) {
Expand Down Expand Up @@ -119,7 +119,7 @@ std::shared_ptr<Buffer> Buffer::staging(std::shared_ptr<VulkanContext> context,
false);
}

std::shared_ptr<Buffer> Buffer::storage(std::shared_ptr<VulkanContext> context, uint64_t size, bool concurrentSharing, VkDeviceSize alignment) {
std::shared_ptr<Buffer> Buffer::storage(std::shared_ptr<VulkanContext> context, uint64_t size, bool concurrentSharing, vk::DeviceSize alignment) {
return std::make_shared<Buffer>(context, size, vk::BufferUsageFlagBits::eStorageBuffer | vk::BufferUsageFlagBits::eTransferDst | vk::BufferUsageFlagBits::eTransferSrc,
VMA_MEMORY_USAGE_GPU_ONLY, VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT,
concurrentSharing, alignment);
Expand Down
2 changes: 1 addition & 1 deletion vulkan/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Buffer : public std::enable_shared_from_this<Buffer> {

static std::shared_ptr<Buffer> staging(std::shared_ptr<VulkanContext> context, unsigned long size);

static std::shared_ptr<Buffer> storage(std::shared_ptr<VulkanContext> context, uint64_t size, bool concurrentSharing = false, VkDeviceSize alignment = 0);
static std::shared_ptr<Buffer> storage(std::shared_ptr<VulkanContext> context, uint64_t size, bool concurrentSharing = false, vk::DeviceSize alignment = 0);

void upload(const void *data, uint32_t size, uint32_t offset = 0);

Expand Down

0 comments on commit dbfd6c3

Please sign in to comment.