diff --git a/include/nvrhi/vulkan.h b/include/nvrhi/vulkan.h index 6f2b764..eb6b17a 100644 --- a/include/nvrhi/vulkan.h +++ b/include/nvrhi/vulkan.h @@ -23,10 +23,6 @@ #pragma once #include - -#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1 -#include - #include namespace nvrhi @@ -43,12 +39,12 @@ namespace nvrhi::vulkan { public: // Additional Vulkan-specific public methods - virtual vk::Semaphore getQueueSemaphore(CommandQueue queue) = 0; - virtual void queueWaitForSemaphore(CommandQueue waitQueue, vk::Semaphore semaphore, uint64_t value) = 0; - virtual void queueSignalSemaphore(CommandQueue executionQueue, vk::Semaphore semaphore, uint64_t value) = 0; + virtual VkSemaphore getQueueSemaphore(CommandQueue queue) = 0; + virtual void queueWaitForSemaphore(CommandQueue waitQueue, VkSemaphore semaphore, uint64_t value) = 0; + virtual void queueSignalSemaphore(CommandQueue executionQueue, VkSemaphore semaphore, uint64_t value) = 0; virtual uint64_t queueGetCompletedInstance(CommandQueue queue) = 0; - virtual FramebufferHandle createHandleForNativeFramebuffer(vk::RenderPass renderPass, - vk::Framebuffer framebuffer, const FramebufferDesc& desc, bool transferOwnership) = 0; + virtual FramebufferHandle createHandleForNativeFramebuffer(VkRenderPass renderPass, + VkFramebuffer framebuffer, const FramebufferDesc& desc, bool transferOwnership) = 0; }; typedef RefCountPtr DeviceHandle; @@ -57,19 +53,19 @@ namespace nvrhi::vulkan { IMessageCallback* errorCB = nullptr; - vk::Instance instance; - vk::PhysicalDevice physicalDevice; - vk::Device device; + VkInstance instance; + VkPhysicalDevice physicalDevice; + VkDevice device; // any of the queues can be null if this context doesn't intend to use them - vk::Queue graphicsQueue; + VkQueue graphicsQueue; int graphicsQueueIndex = -1; - vk::Queue transferQueue; + VkQueue transferQueue; int transferQueueIndex = -1; - vk::Queue computeQueue; + VkQueue computeQueue; int computeQueueIndex = -1; - vk::AllocationCallbacks *allocationCallbacks = nullptr; + VkAllocationCallbacks *allocationCallbacks = nullptr; const char **instanceExtensions = nullptr; size_t numInstanceExtensions = 0; @@ -85,8 +81,7 @@ namespace nvrhi::vulkan NVRHI_API DeviceHandle createDevice(const DeviceDesc& desc); - NVRHI_API vk::Format convertFormat(nvrhi::Format format); + NVRHI_API VkFormat convertFormat(nvrhi::Format format); NVRHI_API const char* resultToString(VkResult result); - NVRHI_API const char* resultToString(vk::Result result); } \ No newline at end of file diff --git a/src/vulkan/vulkan-backend.h b/src/vulkan/vulkan-backend.h index 73b143a..93bc06b 100644 --- a/src/vulkan/vulkan-backend.h +++ b/src/vulkan/vulkan-backend.h @@ -29,6 +29,9 @@ #include #include +#define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1 +#include + #ifdef NVRHI_WITH_RTXMU #include #endif @@ -1118,11 +1121,11 @@ namespace nvrhi::vulkan IMessageCallback* getMessageCallback() override { return m_Context.messageCallback; } // vulkan::IDevice implementation - vk::Semaphore getQueueSemaphore(CommandQueue queue) override; - void queueWaitForSemaphore(CommandQueue waitQueue, vk::Semaphore semaphore, uint64_t value) override; - void queueSignalSemaphore(CommandQueue executionQueue, vk::Semaphore semaphore, uint64_t value) override; + VkSemaphore getQueueSemaphore(CommandQueue queue) override; + void queueWaitForSemaphore(CommandQueue waitQueue, VkSemaphore semaphore, uint64_t value) override; + void queueSignalSemaphore(CommandQueue executionQueue, VkSemaphore semaphore, uint64_t value) override; uint64_t queueGetCompletedInstance(CommandQueue queue) override; - FramebufferHandle createHandleForNativeFramebuffer(vk::RenderPass renderPass, vk::Framebuffer framebuffer, + FramebufferHandle createHandleForNativeFramebuffer(VkRenderPass renderPass, VkFramebuffer framebuffer, const FramebufferDesc& desc, bool transferOwnership) override; private: diff --git a/src/vulkan/vulkan-constants.cpp b/src/vulkan/vulkan-constants.cpp index 7ec5561..2e1c0da 100644 --- a/src/vulkan/vulkan-constants.cpp +++ b/src/vulkan/vulkan-constants.cpp @@ -33,82 +33,82 @@ namespace nvrhi::vulkan struct FormatMapping { nvrhi::Format rhiFormat; - vk::Format vkFormat; + VkFormat vkFormat; }; static const std::array c_FormatMap = { { - { Format::UNKNOWN, vk::Format(VK_FORMAT_UNDEFINED) }, - { Format::R8_UINT, vk::Format(VK_FORMAT_R8_UINT) }, - { Format::R8_SINT, vk::Format(VK_FORMAT_R8_SINT) }, - { Format::R8_UNORM, vk::Format(VK_FORMAT_R8_UNORM) }, - { Format::R8_SNORM, vk::Format(VK_FORMAT_R8_SNORM) }, - { Format::RG8_UINT, vk::Format(VK_FORMAT_R8G8_UINT) }, - { Format::RG8_SINT, vk::Format(VK_FORMAT_R8G8_SINT) }, - { Format::RG8_UNORM, vk::Format(VK_FORMAT_R8G8_UNORM) }, - { Format::RG8_SNORM, vk::Format(VK_FORMAT_R8G8_SNORM) }, - { Format::R16_UINT, vk::Format(VK_FORMAT_R16_UINT) }, - { Format::R16_SINT, vk::Format(VK_FORMAT_R16_SINT) }, - { Format::R16_UNORM, vk::Format(VK_FORMAT_R16_UNORM) }, - { Format::R16_SNORM, vk::Format(VK_FORMAT_R16_SNORM) }, - { Format::R16_FLOAT, vk::Format(VK_FORMAT_R16_SFLOAT) }, - { Format::BGRA4_UNORM, vk::Format(VK_FORMAT_B4G4R4A4_UNORM_PACK16) }, - { Format::B5G6R5_UNORM, vk::Format(VK_FORMAT_B5G6R5_UNORM_PACK16) }, - { Format::B5G5R5A1_UNORM, vk::Format(VK_FORMAT_B5G5R5A1_UNORM_PACK16) }, - { Format::RGBA8_UINT, vk::Format(VK_FORMAT_R8G8B8A8_UINT) }, - { Format::RGBA8_SINT, vk::Format(VK_FORMAT_R8G8B8A8_SINT) }, - { Format::RGBA8_UNORM, vk::Format(VK_FORMAT_R8G8B8A8_UNORM) }, - { Format::RGBA8_SNORM, vk::Format(VK_FORMAT_R8G8B8A8_SNORM) }, - { Format::BGRA8_UNORM, vk::Format(VK_FORMAT_B8G8R8A8_UNORM) }, - { Format::SRGBA8_UNORM, vk::Format(VK_FORMAT_R8G8B8A8_SRGB) }, - { Format::SBGRA8_UNORM, vk::Format(VK_FORMAT_B8G8R8A8_SRGB) }, - { Format::R10G10B10A2_UNORM, vk::Format(VK_FORMAT_A2B10G10R10_UNORM_PACK32) }, - { Format::R11G11B10_FLOAT, vk::Format(VK_FORMAT_B10G11R11_UFLOAT_PACK32) }, - { Format::RG16_UINT, vk::Format(VK_FORMAT_R16G16_UINT) }, - { Format::RG16_SINT, vk::Format(VK_FORMAT_R16G16_SINT) }, - { Format::RG16_UNORM, vk::Format(VK_FORMAT_R16G16_UNORM) }, - { Format::RG16_SNORM, vk::Format(VK_FORMAT_R16G16_SNORM) }, - { Format::RG16_FLOAT, vk::Format(VK_FORMAT_R16G16_SFLOAT) }, - { Format::R32_UINT, vk::Format(VK_FORMAT_R32_UINT) }, - { Format::R32_SINT, vk::Format(VK_FORMAT_R32_SINT) }, - { Format::R32_FLOAT, vk::Format(VK_FORMAT_R32_SFLOAT) }, - { Format::RGBA16_UINT, vk::Format(VK_FORMAT_R16G16B16A16_UINT) }, - { Format::RGBA16_SINT, vk::Format(VK_FORMAT_R16G16B16A16_SINT) }, - { Format::RGBA16_FLOAT, vk::Format(VK_FORMAT_R16G16B16A16_SFLOAT) }, - { Format::RGBA16_UNORM, vk::Format(VK_FORMAT_R16G16B16A16_UNORM) }, - { Format::RGBA16_SNORM, vk::Format(VK_FORMAT_R16G16B16A16_SNORM) }, - { Format::RG32_UINT, vk::Format(VK_FORMAT_R32G32_UINT) }, - { Format::RG32_SINT, vk::Format(VK_FORMAT_R32G32_SINT) }, - { Format::RG32_FLOAT, vk::Format(VK_FORMAT_R32G32_SFLOAT) }, - { Format::RGB32_UINT, vk::Format(VK_FORMAT_R32G32B32_UINT) }, - { Format::RGB32_SINT, vk::Format(VK_FORMAT_R32G32B32_SINT) }, - { Format::RGB32_FLOAT, vk::Format(VK_FORMAT_R32G32B32_SFLOAT) }, - { Format::RGBA32_UINT, vk::Format(VK_FORMAT_R32G32B32A32_UINT) }, - { Format::RGBA32_SINT, vk::Format(VK_FORMAT_R32G32B32A32_SINT) }, - { Format::RGBA32_FLOAT, vk::Format(VK_FORMAT_R32G32B32A32_SFLOAT) }, - { Format::D16, vk::Format(VK_FORMAT_D16_UNORM) }, - { Format::D24S8, vk::Format(VK_FORMAT_D24_UNORM_S8_UINT) }, - { Format::X24G8_UINT, vk::Format(VK_FORMAT_D24_UNORM_S8_UINT) }, - { Format::D32, vk::Format(VK_FORMAT_D32_SFLOAT) }, - { Format::D32S8, vk::Format(VK_FORMAT_D32_SFLOAT_S8_UINT) }, - { Format::X32G8_UINT, vk::Format(VK_FORMAT_D32_SFLOAT_S8_UINT) }, - { Format::BC1_UNORM, vk::Format(VK_FORMAT_BC1_RGB_UNORM_BLOCK) }, - { Format::BC1_UNORM_SRGB, vk::Format(VK_FORMAT_BC1_RGB_SRGB_BLOCK) }, - { Format::BC2_UNORM, vk::Format(VK_FORMAT_BC2_UNORM_BLOCK) }, - { Format::BC2_UNORM_SRGB, vk::Format(VK_FORMAT_BC2_SRGB_BLOCK) }, - { Format::BC3_UNORM, vk::Format(VK_FORMAT_BC3_UNORM_BLOCK) }, - { Format::BC3_UNORM_SRGB, vk::Format(VK_FORMAT_BC3_SRGB_BLOCK) }, - { Format::BC4_UNORM, vk::Format(VK_FORMAT_BC4_UNORM_BLOCK) }, - { Format::BC4_SNORM, vk::Format(VK_FORMAT_BC4_SNORM_BLOCK) }, - { Format::BC5_UNORM, vk::Format(VK_FORMAT_BC5_UNORM_BLOCK) }, - { Format::BC5_SNORM, vk::Format(VK_FORMAT_BC5_SNORM_BLOCK) }, - { Format::BC6H_UFLOAT, vk::Format(VK_FORMAT_BC6H_UFLOAT_BLOCK) }, - { Format::BC6H_SFLOAT, vk::Format(VK_FORMAT_BC6H_SFLOAT_BLOCK) }, - { Format::BC7_UNORM, vk::Format(VK_FORMAT_BC7_UNORM_BLOCK) }, - { Format::BC7_UNORM_SRGB, vk::Format(VK_FORMAT_BC7_SRGB_BLOCK) }, + { Format::UNKNOWN, VK_FORMAT_UNDEFINED }, + { Format::R8_UINT, VK_FORMAT_R8_UINT }, + { Format::R8_SINT, VK_FORMAT_R8_SINT }, + { Format::R8_UNORM, VK_FORMAT_R8_UNORM }, + { Format::R8_SNORM, VK_FORMAT_R8_SNORM }, + { Format::RG8_UINT, VK_FORMAT_R8G8_UINT }, + { Format::RG8_SINT, VK_FORMAT_R8G8_SINT }, + { Format::RG8_UNORM, VK_FORMAT_R8G8_UNORM }, + { Format::RG8_SNORM, VK_FORMAT_R8G8_SNORM }, + { Format::R16_UINT, VK_FORMAT_R16_UINT }, + { Format::R16_SINT, VK_FORMAT_R16_SINT }, + { Format::R16_UNORM, VK_FORMAT_R16_UNORM }, + { Format::R16_SNORM, VK_FORMAT_R16_SNORM }, + { Format::R16_FLOAT, VK_FORMAT_R16_SFLOAT }, + { Format::BGRA4_UNORM, VK_FORMAT_B4G4R4A4_UNORM_PACK16 }, + { Format::B5G6R5_UNORM, VK_FORMAT_B5G6R5_UNORM_PACK16 }, + { Format::B5G5R5A1_UNORM, VK_FORMAT_B5G5R5A1_UNORM_PACK16 }, + { Format::RGBA8_UINT, VK_FORMAT_R8G8B8A8_UINT }, + { Format::RGBA8_SINT, VK_FORMAT_R8G8B8A8_SINT }, + { Format::RGBA8_UNORM, VK_FORMAT_R8G8B8A8_UNORM }, + { Format::RGBA8_SNORM, VK_FORMAT_R8G8B8A8_SNORM }, + { Format::BGRA8_UNORM, VK_FORMAT_B8G8R8A8_UNORM }, + { Format::SRGBA8_UNORM, VK_FORMAT_R8G8B8A8_SRGB }, + { Format::SBGRA8_UNORM, VK_FORMAT_B8G8R8A8_SRGB }, + { Format::R10G10B10A2_UNORM, VK_FORMAT_A2B10G10R10_UNORM_PACK32 }, + { Format::R11G11B10_FLOAT, VK_FORMAT_B10G11R11_UFLOAT_PACK32 }, + { Format::RG16_UINT, VK_FORMAT_R16G16_UINT }, + { Format::RG16_SINT, VK_FORMAT_R16G16_SINT }, + { Format::RG16_UNORM, VK_FORMAT_R16G16_UNORM }, + { Format::RG16_SNORM, VK_FORMAT_R16G16_SNORM }, + { Format::RG16_FLOAT, VK_FORMAT_R16G16_SFLOAT }, + { Format::R32_UINT, VK_FORMAT_R32_UINT }, + { Format::R32_SINT, VK_FORMAT_R32_SINT }, + { Format::R32_FLOAT, VK_FORMAT_R32_SFLOAT }, + { Format::RGBA16_UINT, VK_FORMAT_R16G16B16A16_UINT }, + { Format::RGBA16_SINT, VK_FORMAT_R16G16B16A16_SINT }, + { Format::RGBA16_FLOAT, VK_FORMAT_R16G16B16A16_SFLOAT }, + { Format::RGBA16_UNORM, VK_FORMAT_R16G16B16A16_UNORM }, + { Format::RGBA16_SNORM, VK_FORMAT_R16G16B16A16_SNORM }, + { Format::RG32_UINT, VK_FORMAT_R32G32_UINT }, + { Format::RG32_SINT, VK_FORMAT_R32G32_SINT }, + { Format::RG32_FLOAT, VK_FORMAT_R32G32_SFLOAT }, + { Format::RGB32_UINT, VK_FORMAT_R32G32B32_UINT }, + { Format::RGB32_SINT, VK_FORMAT_R32G32B32_SINT }, + { Format::RGB32_FLOAT, VK_FORMAT_R32G32B32_SFLOAT }, + { Format::RGBA32_UINT, VK_FORMAT_R32G32B32A32_UINT }, + { Format::RGBA32_SINT, VK_FORMAT_R32G32B32A32_SINT }, + { Format::RGBA32_FLOAT, VK_FORMAT_R32G32B32A32_SFLOAT }, + { Format::D16, VK_FORMAT_D16_UNORM }, + { Format::D24S8, VK_FORMAT_D24_UNORM_S8_UINT }, + { Format::X24G8_UINT, VK_FORMAT_D24_UNORM_S8_UINT }, + { Format::D32, VK_FORMAT_D32_SFLOAT }, + { Format::D32S8, VK_FORMAT_D32_SFLOAT_S8_UINT }, + { Format::X32G8_UINT, VK_FORMAT_D32_SFLOAT_S8_UINT }, + { Format::BC1_UNORM, VK_FORMAT_BC1_RGB_UNORM_BLOCK }, + { Format::BC1_UNORM_SRGB, VK_FORMAT_BC1_RGB_SRGB_BLOCK }, + { Format::BC2_UNORM, VK_FORMAT_BC2_UNORM_BLOCK }, + { Format::BC2_UNORM_SRGB, VK_FORMAT_BC2_SRGB_BLOCK }, + { Format::BC3_UNORM, VK_FORMAT_BC3_UNORM_BLOCK }, + { Format::BC3_UNORM_SRGB, VK_FORMAT_BC3_SRGB_BLOCK }, + { Format::BC4_UNORM, VK_FORMAT_BC4_UNORM_BLOCK }, + { Format::BC4_SNORM, VK_FORMAT_BC4_SNORM_BLOCK }, + { Format::BC5_UNORM, VK_FORMAT_BC5_UNORM_BLOCK }, + { Format::BC5_SNORM, VK_FORMAT_BC5_SNORM_BLOCK }, + { Format::BC6H_UFLOAT, VK_FORMAT_BC6H_UFLOAT_BLOCK }, + { Format::BC6H_SFLOAT, VK_FORMAT_BC6H_SFLOAT_BLOCK }, + { Format::BC7_UNORM, VK_FORMAT_BC7_UNORM_BLOCK }, + { Format::BC7_UNORM_SRGB, VK_FORMAT_BC7_SRGB_BLOCK }, } }; - vk::Format convertFormat(nvrhi::Format format) + VkFormat convertFormat(nvrhi::Format format) { assert(format < nvrhi::Format::COUNT); assert(c_FormatMap[uint32_t(format)].rhiFormat == format); @@ -469,12 +469,7 @@ namespace nvrhi::vulkan } } } - - const char* resultToString(vk::Result result) - { - return resultToString((VkResult)result); - } - + vk::PrimitiveTopology convertPrimitiveTopology(PrimitiveType topology) { switch(topology) diff --git a/src/vulkan/vulkan-device.cpp b/src/vulkan/vulkan-device.cpp index 7808f9d..5f0d4e0 100644 --- a/src/vulkan/vulkan-device.cpp +++ b/src/vulkan/vulkan-device.cpp @@ -48,7 +48,7 @@ namespace nvrhi::vulkan } Device::Device(const DeviceDesc& desc) - : m_Context(desc.instance, desc.physicalDevice, desc.device, desc.allocationCallbacks) + : m_Context(desc.instance, desc.physicalDevice, desc.device, reinterpret_cast(desc.allocationCallbacks)) , m_Allocator(m_Context) , m_TimerQueryAllocator(desc.maxTimerQueries, true) { @@ -323,10 +323,10 @@ namespace nvrhi::vulkan FormatSupport Device::queryFormatSupport(Format format) { - vk::Format vulkanFormat = convertFormat(format); + VkFormat vulkanFormat = convertFormat(format); vk::FormatProperties props; - m_Context.physicalDevice.getFormatProperties(vulkanFormat, &props); + m_Context.physicalDevice.getFormatProperties(vk::Format(vulkanFormat), &props); FormatSupport result = FormatSupport::None; @@ -450,7 +450,7 @@ namespace nvrhi::vulkan { std::stringstream ss; ss << "Failed to allocate memory for Heap " << utils::DebugNameToString(d.debugName) - << ", VkResult = " << resultToString(res); + << ", VkResult = " << resultToString(VkResult(res)); m_Context.error(ss.str()); diff --git a/src/vulkan/vulkan-graphics.cpp b/src/vulkan/vulkan-graphics.cpp index a61d3b4..bb49fda 100644 --- a/src/vulkan/vulkan-graphics.cpp +++ b/src/vulkan/vulkan-graphics.cpp @@ -80,7 +80,7 @@ namespace nvrhi::vulkan assert(fb->framebufferInfo.width == std::max(t->desc.width >> rt.subresources.baseMipLevel, 1u)); assert(fb->framebufferInfo.height == std::max(t->desc.height >> rt.subresources.baseMipLevel, 1u)); - const vk::Format attachmentFormat = (rt.format == Format::UNKNOWN ? t->imageInfo.format : convertFormat(rt.format)); + const vk::Format attachmentFormat = (rt.format == Format::UNKNOWN ? t->imageInfo.format : vk::Format(convertFormat(rt.format))); attachmentDescs[i] = vk::AttachmentDescription2() .setFormat(attachmentFormat) @@ -235,7 +235,7 @@ namespace nvrhi::vulkan return FramebufferHandle::Create(fb); } - FramebufferHandle Device::createHandleForNativeFramebuffer(vk::RenderPass renderPass, vk::Framebuffer framebuffer, + FramebufferHandle Device::createHandleForNativeFramebuffer(VkRenderPass renderPass, VkFramebuffer framebuffer, const FramebufferDesc& desc, bool transferOwnership) { Framebuffer* fb = new Framebuffer(m_Context); diff --git a/src/vulkan/vulkan-queue.cpp b/src/vulkan/vulkan-queue.cpp index 618bc3e..f77355f 100644 --- a/src/vulkan/vulkan-queue.cpp +++ b/src/vulkan/vulkan-queue.cpp @@ -234,21 +234,21 @@ namespace nvrhi::vulkan return nullptr; } - vk::Semaphore Device::getQueueSemaphore(CommandQueue queueID) + VkSemaphore Device::getQueueSemaphore(CommandQueue queueID) { Queue& queue = *m_Queues[uint32_t(queueID)]; return queue.trackingSemaphore; } - void Device::queueWaitForSemaphore(CommandQueue waitQueueID, vk::Semaphore semaphore, uint64_t value) + void Device::queueWaitForSemaphore(CommandQueue waitQueueID, VkSemaphore semaphore, uint64_t value) { Queue& waitQueue = *m_Queues[uint32_t(waitQueueID)]; waitQueue.addWaitSemaphore(semaphore, value); } - void Device::queueSignalSemaphore(CommandQueue executionQueueID, vk::Semaphore semaphore, uint64_t value) + void Device::queueSignalSemaphore(CommandQueue executionQueueID, VkSemaphore semaphore, uint64_t value) { Queue& executionQueue = *m_Queues[uint32_t(executionQueueID)]; diff --git a/src/vulkan/vulkan-raytracing.cpp b/src/vulkan/vulkan-raytracing.cpp index bbebdb8..5179182 100644 --- a/src/vulkan/vulkan-raytracing.cpp +++ b/src/vulkan/vulkan-raytracing.cpp @@ -98,7 +98,7 @@ namespace nvrhi::vulkan break; } - dstt.setVertexFormat(convertFormat(srct.vertexFormat)); + dstt.setVertexFormat(vk::Format(convertFormat(srct.vertexFormat))); dstt.setVertexData(getBufferAddress(srct.vertexBuffer, srct.vertexOffset)); dstt.setVertexStride(srct.vertexStride); dstt.setMaxVertex(std::max(srct.vertexCount, 1u) - 1u); diff --git a/src/vulkan/vulkan-resource-bindings.cpp b/src/vulkan/vulkan-resource-bindings.cpp index 0f1ef04..6e88f1a 100644 --- a/src/vulkan/vulkan-resource-bindings.cpp +++ b/src/vulkan/vulkan-resource-bindings.cpp @@ -467,7 +467,7 @@ namespace nvrhi::vulkan .setBuffer(buffer->buffer) .setOffset(range.byteOffset) .setRange(range.byteSize) - .setFormat(vkformat); + .setFormat(vk::Format(vkformat)); res = m_Context.device.createBufferView(&bufferViewInfo, m_Context.allocationCallbacks, &bufferViewRef); ASSERT_VK_OK(res); @@ -786,7 +786,7 @@ namespace nvrhi::vulkan .setBuffer(buffer->buffer) .setOffset(range.byteOffset) .setRange(range.byteSize) - .setFormat(vkformat); + .setFormat(vk::Format(vkformat)); res = m_Context.device.createBufferView(&bufferViewInfo, m_Context.allocationCallbacks, &bufferViewRef); ASSERT_VK_OK(res); diff --git a/src/vulkan/vulkan-shader.cpp b/src/vulkan/vulkan-shader.cpp index fa243b1..c288626 100644 --- a/src/vulkan/vulkan-shader.cpp +++ b/src/vulkan/vulkan-shader.cpp @@ -189,7 +189,7 @@ namespace nvrhi::vulkan outAttrib.location = attributeLocation; outAttrib.binding = in.bufferIndex; - outAttrib.format = vulkan::convertFormat(in.format); + outAttrib.format = vk::Format(vulkan::convertFormat(in.format)); outAttrib.offset = bufferOffset + in.offset; bufferOffset += element_size_bytes; diff --git a/src/vulkan/vulkan-texture.cpp b/src/vulkan/vulkan-texture.cpp index 1a1678e..c800291 100644 --- a/src/vulkan/vulkan-texture.cpp +++ b/src/vulkan/vulkan-texture.cpp @@ -280,7 +280,7 @@ namespace nvrhi::vulkan auto vkformat = nvrhi::vulkan::convertFormat(format); - vk::ImageAspectFlags aspectflags = guessSubresourceImageAspectFlags(vkformat, viewtype); + vk::ImageAspectFlags aspectflags = guessSubresourceImageAspectFlags(vk::Format(vkformat), viewtype); view.subresourceRange = vk::ImageSubresourceRange() .setAspectMask(aspectflags) .setBaseMipLevel(subresource.baseMipLevel) @@ -293,7 +293,7 @@ namespace nvrhi::vulkan auto viewInfo = vk::ImageViewCreateInfo() .setImage(image) .setViewType(imageViewType) - .setFormat(vkformat) + .setFormat(vk::Format(vkformat)) .setSubresourceRange(view.subresourceRange); if (viewtype == TextureSubresourceViewType::StencilOnly)