Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda interop vk13 #637

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open

Cuda interop vk13 #637

wants to merge 64 commits into from

Conversation

devshgraphicsprogramming
Copy link
Member

Description

Testing

TODO list:

@devshgraphicsprogramming devshgraphicsprogramming changed the base branch from master to vulkan_1_3 January 4, 2024 20:18
Comment on lines -78 to +126
inline bool isDedicated() const {return m_dedicated;}
inline bool isDedicated() const {return m_params.dedicated;}

//! Returns the size of the memory allocation
inline size_t getAllocationSize() const {return m_allocationSize;}
inline size_t getAllocationSize() const {return m_params.allocationSize;}

//!
inline core::bitflag<E_MEMORY_ALLOCATE_FLAGS> getAllocateFlags() const { return m_allocateFlags; }
inline core::bitflag<E_MEMORY_ALLOCATE_FLAGS> getAllocateFlags() const { return m_params.allocateFlags; }

//!
inline core::bitflag<E_MEMORY_PROPERTY_FLAGS> getMemoryPropertyFlags() const { return m_memoryPropertyFlags; }
inline core::bitflag<E_MEMORY_PROPERTY_FLAGS> getMemoryPropertyFlags() const { return m_params.memoryPropertyFlags; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self I'll probably remove all these getters later since we have a struct that we cache

@@ -111,6 +127,7 @@ class IDeviceMemoryBacked : public IBackendObject
//! members
SCachedCreationParams m_cachedCreationParams;
SDeviceMemoryRequirements m_cachedMemoryReqs;
void* m_cachedExternalHandle = nullptr;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what even sets this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #637 (comment), no need for extra member

Comment on lines +741 to +745
uint32_t exportableTypes : 7 = ~0u;
uint32_t compatibleTypes : 7 = ~0u;
uint32_t dedicatedOnly : 1 = 0u;
uint32_t exportable : 1 = ~0u;
uint32_t importable : 1 = ~0u;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++20, you can slap enums in bitfields now

case IQueue::FamilyExternal:
case IQueue::FamilyIgnored:
case IQueue::FamilyForeign:
idx |= 1u << 31;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda flaky, cause it relies on my encoding I have that I only use 1 bit for something else, I'd rather do a real switch-case-return (the VK enum)

@@ -9,7 +9,6 @@ namespace nbl::video
CVulkanImage::~CVulkanImage()
{
preDestroyStep();
// don't destroy imported handles
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new text

// e.g. don't destroy imported handles from the same VkInstance (e.g. if hooking into external Vulkan codebase)
// truly EXTERNAL_MEMORY imported handles, do need to be destroyed + CloseHandled (separate thing)

Comment on lines +170 to +173
VkExportMemoryWin32HandleInfoKHR handleInfo = {
.sType = VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR,
.dwAccess = GENERIC_ALL,
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ifdef win32 around

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else if (stageMask.hasFlags(asset::ACCESS_FLAGS::SHADER_WRITE_BITS) && shaderCapableFamily)
stageMask ^= asset::ACCESS_FLAGS::SHADER_WRITE_BITS;
return getSupportedAccessMask(queueFamilyIndex).hasFlags(stageMask);
VK_ACCESS_SHADER_WRITE_BIT;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one stale line leftover?

Comment on lines -95 to +100
inline bool valid() const
enum Validity
{
INVALID,
VALID,
WORK_WITHOUT_SYNC,
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, you have a logger for a reason.

Base automatically changed from vulkan_1_3 to master March 11, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants