Skip to content

Commit

Permalink
vulkan: Move addPointerToChain to utils.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Wunkolo committed Jan 6, 2025
1 parent fa9d10a commit 92ed26e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 17 additions & 0 deletions core/rend/vulkan/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ static inline u32 findMemoryType(vk::PhysicalDeviceMemoryProperties const& memor
return typeIndex;
}

static inline void addPointerToChain(void* head, const void* ptr)
{
vk::BaseInStructure* prevInStructure = static_cast<vk::BaseInStructure*>(head);
while (prevInStructure->pNext)
{
// Structure already in chain
if (prevInStructure->pNext == ptr)
{
return;
}
prevInStructure = const_cast<vk::BaseInStructure*>(prevInStructure->pNext);
}

// Add structure to end
prevInStructure->pNext = static_cast<const vk::BaseInStructure*>(ptr);
}

static const char GouraudSource[] = R"(
#if pp_Gouraud == 0
#define INTERPOLATION flat
Expand Down
17 changes: 0 additions & 17 deletions core/rend/vulkan/vulkan_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,23 +471,6 @@ bool VulkanContext::InitDevice()
}

// Get device features
const auto addPointerToChain = [](void* head, const void* ptr) -> void
{
vk::BaseInStructure* prevInStructure = static_cast<vk::BaseInStructure*>(head);
while (prevInStructure->pNext)
{
// Structure already in chain
if (prevInStructure->pNext == ptr)
{
return;
}
prevInStructure = const_cast<vk::BaseInStructure*>(prevInStructure->pNext);
}

// Add structure to end
prevInStructure->pNext = static_cast<const vk::BaseInStructure*>(ptr);
};

vk::PhysicalDeviceFeatures2 featuresChain{};
vk::PhysicalDeviceFeatures& features = featuresChain.features;

Expand Down

0 comments on commit 92ed26e

Please sign in to comment.