diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 14:49:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:49:26 +0800 |
| commit | f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch) | |
| tree | ea1d61342cd29368e19135000ec2948813096205 /tools/gfx/vulkan/vk-api.cpp | |
| parent | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff) | |
format
* format
* Minor test fixes
* enable checking cpp format in ci
Diffstat (limited to 'tools/gfx/vulkan/vk-api.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-api.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/gfx/vulkan/vk-api.cpp b/tools/gfx/vulkan/vk-api.cpp index 8f5e4235b..3d2042a8d 100644 --- a/tools/gfx/vulkan/vk-api.cpp +++ b/tools/gfx/vulkan/vk-api.cpp @@ -3,22 +3,23 @@ #include "core/slang-list.h" -namespace gfx { +namespace gfx +{ using namespace Slang; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! VulkanApi !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#define VK_API_CHECK_FUNCTION(x) && (x != nullptr) -#define VK_API_CHECK_FUNCTIONS(FUNCTION_LIST) true FUNCTION_LIST(VK_API_CHECK_FUNCTION) +#define VK_API_CHECK_FUNCTION(x) &&(x != nullptr) +#define VK_API_CHECK_FUNCTIONS(FUNCTION_LIST) true FUNCTION_LIST(VK_API_CHECK_FUNCTION) bool VulkanApi::areDefined(ProcType type) const { switch (type) { - case ProcType::Global: return VK_API_CHECK_FUNCTIONS(VK_API_ALL_GLOBAL_PROCS); - case ProcType::Instance: return VK_API_CHECK_FUNCTIONS(VK_API_ALL_INSTANCE_PROCS); - case ProcType::Device: return VK_API_CHECK_FUNCTIONS(VK_API_DEVICE_PROCS); - default: + case ProcType::Global: return VK_API_CHECK_FUNCTIONS(VK_API_ALL_GLOBAL_PROCS); + case ProcType::Instance: return VK_API_CHECK_FUNCTIONS(VK_API_ALL_INSTANCE_PROCS); + case ProcType::Device: return VK_API_CHECK_FUNCTIONS(VK_API_DEVICE_PROCS); + default: { assert(!"Unhandled type"); return false; @@ -49,7 +50,7 @@ Slang::Result VulkanApi::initInstanceProcs(VkInstance instance) VK_API_ALL_INSTANCE_PROCS(VK_API_GET_INSTANCE_PROC) - // Get optional + // Get optional VK_API_INSTANCE_PROCS_OPT(VK_API_GET_INSTANCE_PROC) if (!areDefined(ProcType::Instance)) @@ -108,7 +109,7 @@ int VulkanApi::findMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags prop // bit holds current test bit against typeBits. Ie bit == 1 << typeBits uint32_t bit = 1; - for (int i = 0; i < numMemoryTypes; ++i, bit += bit) + for (int i = 0; i < numMemoryTypes; ++i, bit += bit) { auto const& memoryType = m_deviceMemoryProperties.memoryTypes[i]; if ((typeBits & bit) && (memoryType.propertyFlags & properties) == properties) @@ -117,7 +118,7 @@ int VulkanApi::findMemoryTypeIndex(uint32_t typeBits, VkMemoryPropertyFlags prop } } - //assert(!"failed to find a usable memory type"); + // assert(!"failed to find a usable memory type"); return -1; } @@ -130,10 +131,13 @@ int VulkanApi::findQueue(VkQueueFlags reqFlags) const Slang::List<VkQueueFamilyProperties> queueFamilies; queueFamilies.setCount(numQueueFamilies); - vkGetPhysicalDeviceQueueFamilyProperties(m_physicalDevice, &numQueueFamilies, queueFamilies.getBuffer()); + vkGetPhysicalDeviceQueueFamilyProperties( + m_physicalDevice, + &numQueueFamilies, + queueFamilies.getBuffer()); // Find a queue that can service our needs - //VkQueueFlags reqQueueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT; + // VkQueueFlags reqQueueFlags = VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT; int queueFamilyIndex = -1; for (int i = 0; i < int(numQueueFamilies); ++i) @@ -147,4 +151,4 @@ int VulkanApi::findQueue(VkQueueFlags reqFlags) const return -1; } -} // renderer_test +} // namespace gfx |
