forked from mirror/vulkan-zig
Author suffix last for alloc functions
This commit is contained in:
@@ -247,7 +247,7 @@ const SwapImage = struct {
|
||||
};
|
||||
|
||||
fn initSwapchainImages(gc: *const GraphicsContext, swapchain: vk.SwapchainKHR, format: vk.Format, allocator: Allocator) ![]SwapImage {
|
||||
const images = try gc.dev.getSwapchainImagesKhrAlloc(swapchain, allocator);
|
||||
const images = try gc.dev.getSwapchainImagesAllocKHR(swapchain, allocator);
|
||||
defer allocator.free(images);
|
||||
|
||||
const swap_images = try allocator.alloc(SwapImage, images.len);
|
||||
@@ -270,7 +270,7 @@ fn findSurfaceFormat(gc: *const GraphicsContext, allocator: Allocator) !vk.Surfa
|
||||
.color_space = .srgb_nonlinear_khr,
|
||||
};
|
||||
|
||||
const surface_formats = try gc.instance.getPhysicalDeviceSurfaceFormatsKhrAlloc(gc.pdev, gc.surface, allocator);
|
||||
const surface_formats = try gc.instance.getPhysicalDeviceSurfaceFormatsAllocKHR(gc.pdev, gc.surface, allocator);
|
||||
defer allocator.free(surface_formats);
|
||||
|
||||
for (surface_formats) |sfmt| {
|
||||
@@ -283,7 +283,7 @@ fn findSurfaceFormat(gc: *const GraphicsContext, allocator: Allocator) !vk.Surfa
|
||||
}
|
||||
|
||||
fn findPresentMode(gc: *const GraphicsContext, allocator: Allocator) !vk.PresentModeKHR {
|
||||
const present_modes = try gc.instance.getPhysicalDeviceSurfacePresentModesKhrAlloc(gc.pdev, gc.surface, allocator);
|
||||
const present_modes = try gc.instance.getPhysicalDeviceSurfacePresentModesAllocKHR(gc.pdev, gc.surface, allocator);
|
||||
defer allocator.free(present_modes);
|
||||
|
||||
const preferred = [_]vk.PresentModeKHR{
|
||||
|
||||
@@ -1624,10 +1624,17 @@ fn Renderer(comptime WriterType: type) type {
|
||||
);
|
||||
}
|
||||
|
||||
// vkFooKHR => vkFooAllocKHR
|
||||
fn makeAllocWrapperName(self: *Self, wrapped_name: []const u8) ![]const u8 {
|
||||
const tag = self.id_renderer.getAuthorTag(wrapped_name) orelse "";
|
||||
const base_len = wrapped_name.len - tag.len;
|
||||
return std.mem.concat(self.allocator, u8, &.{ wrapped_name[0..base_len], "Alloc", tag });
|
||||
}
|
||||
|
||||
fn renderProxyCommandAlloc(self: *Self, wrapped_name: []const u8, command: reg.Command, dispatch_handle: []const u8) !void {
|
||||
const returns_vk_result = command.return_type.* == .name and mem.eql(u8, command.return_type.name, "VkResult");
|
||||
|
||||
const name = try std.mem.concat(self.allocator, u8, &.{ wrapped_name, "Alloc" });
|
||||
const name = try self.makeAllocWrapperName(wrapped_name);
|
||||
defer self.allocator.free(name);
|
||||
|
||||
if (command.params.len < 2) {
|
||||
@@ -1973,7 +1980,7 @@ fn Renderer(comptime WriterType: type) type {
|
||||
fn renderWrapperAlloc(self: *Self, wrapped_name: []const u8, command: reg.Command) !void {
|
||||
const returns_vk_result = command.return_type.* == .name and mem.eql(u8, command.return_type.name, "VkResult");
|
||||
|
||||
const name = try std.mem.concat(self.allocator, u8, &.{ wrapped_name, "Alloc" });
|
||||
const name = try self.makeAllocWrapperName(wrapped_name);
|
||||
defer self.allocator.free(name);
|
||||
|
||||
if (command.params.len < 2) {
|
||||
|
||||
Reference in New Issue
Block a user