adding vkGetBufferDeviceAddress
This commit is contained in:
@@ -52,3 +52,9 @@ pub inline fn getMemoryRequirements(self: *Self, requirements: *vk.MemoryRequire
|
||||
requirements.memory_type_bits = self.allowed_memory_types.mask;
|
||||
self.vtable.getMemoryRequirements(self, requirements);
|
||||
}
|
||||
|
||||
pub inline fn getDeviceAddress(self: *Self) VkError!vk.DeviceAddress {
|
||||
const memory = self.memory orelse return 0;
|
||||
const map = try memory.map(self.offset, self.size);
|
||||
return @intCast(@intFromPtr(map.ptr));
|
||||
}
|
||||
|
||||
@@ -239,6 +239,9 @@ const device_pfn_map = block: {
|
||||
functionMapEntryPoint("vkFreeDescriptorSets"),
|
||||
functionMapEntryPoint("vkFreeMemory"),
|
||||
functionMapEntryPoint("vkGetBufferMemoryRequirements"),
|
||||
functionMapEntryPoint("vkGetBufferDeviceAddress"),
|
||||
functionMapEntryPoint("vkGetBufferDeviceAddressEXT"),
|
||||
functionMapEntryPoint("vkGetBufferDeviceAddressKHR"),
|
||||
functionMapEntryPoint("vkGetDeviceMemoryCommitment"),
|
||||
functionMapEntryPoint("vkGetDeviceGroupPeerMemoryFeatures"),
|
||||
functionMapEntryPoint("vkGetDeviceGroupPeerMemoryFeaturesKHR"),
|
||||
@@ -1398,6 +1401,34 @@ pub export fn apeGetBufferMemoryRequirements(p_device: vk.Device, p_buffer: vk.B
|
||||
buffer.getMemoryRequirements(requirements);
|
||||
}
|
||||
|
||||
pub export fn apeGetBufferDeviceAddress(p_device: vk.Device, info: *const vk.BufferDeviceAddressInfo) callconv(vk.vulkan_call_conv) vk.DeviceAddress {
|
||||
entryPointBeginLogTrace(.vkGetBufferDeviceAddress);
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
Dispatchable(Device).checkHandleValidity(p_device) catch |err| {
|
||||
errorLogger(err);
|
||||
return 0;
|
||||
};
|
||||
|
||||
const buffer = NonDispatchable(Buffer).fromHandleObject(info.buffer) catch |err| {
|
||||
errorLogger(err);
|
||||
return 0;
|
||||
};
|
||||
|
||||
return buffer.getDeviceAddress() catch |err| {
|
||||
errorLogger(err);
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
pub export fn apeGetBufferDeviceAddressEXT(p_device: vk.Device, info: *const vk.BufferDeviceAddressInfo) callconv(vk.vulkan_call_conv) vk.DeviceAddress {
|
||||
return @call(.always_inline, apeGetBufferDeviceAddress, .{ p_device, info });
|
||||
}
|
||||
|
||||
pub export fn apeGetBufferDeviceAddressKHR(p_device: vk.Device, info: *const vk.BufferDeviceAddressInfo) callconv(vk.vulkan_call_conv) vk.DeviceAddress {
|
||||
return @call(.always_inline, apeGetBufferDeviceAddress, .{ p_device, info });
|
||||
}
|
||||
|
||||
pub export fn apeGetDeviceMemoryCommitment(p_device: vk.Device, p_memory: vk.DeviceMemory, committed_memory: *vk.DeviceSize) callconv(vk.vulkan_call_conv) void {
|
||||
entryPointBeginLogTrace(.vkGetDeviceMemoryCommitment);
|
||||
defer entryPointEndLogTrace();
|
||||
|
||||
Reference in New Issue
Block a user