forked from mirror/vulkan-zig
Made vulkan-zig conform to new multi for syntax
This commit is contained in:
@@ -147,7 +147,7 @@ pub const GraphicsContext = struct {
|
||||
}
|
||||
|
||||
pub fn findMemoryTypeIndex(self: GraphicsContext, memory_type_bits: u32, flags: vk.MemoryPropertyFlags) !u32 {
|
||||
for (self.mem_props.memory_types[0..self.mem_props.memory_type_count]) |mem_type, i| {
|
||||
for (self.mem_props.memory_types[0..self.mem_props.memory_type_count], 0..) |mem_type, i| {
|
||||
if (memory_type_bits & (@as(u32, 1) << @truncate(u5, i)) != 0 and mem_type.property_flags.contains(flags)) {
|
||||
return @truncate(u32, i);
|
||||
}
|
||||
@@ -285,7 +285,7 @@ fn allocateQueues(vki: InstanceDispatch, pdev: vk.PhysicalDevice, allocator: All
|
||||
var graphics_family: ?u32 = null;
|
||||
var present_family: ?u32 = null;
|
||||
|
||||
for (families) |properties, i| {
|
||||
for (families, 0..) |properties, i| {
|
||||
const family = @intCast(u32, i);
|
||||
|
||||
if (graphics_family == null and properties.queue_flags.graphics_bit) {
|
||||
|
||||
@@ -177,7 +177,7 @@ fn uploadVertices(gc: *const GraphicsContext, pool: vk.CommandPool, buffer: vk.B
|
||||
defer gc.vkd.unmapMemory(gc.dev, staging_memory);
|
||||
|
||||
const gpu_vertices = @ptrCast([*]Vertex, @alignCast(@alignOf(Vertex), data));
|
||||
for (vertices) |vertex, i| {
|
||||
for (vertices, 0..) |vertex, i| {
|
||||
gpu_vertices[i] = vertex;
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ fn createCommandBuffers(
|
||||
.extent = extent,
|
||||
};
|
||||
|
||||
for (cmdbufs) |cmdbuf, i| {
|
||||
for (cmdbufs, framebuffers) |cmdbuf, framebuffer| {
|
||||
try gc.vkd.beginCommandBuffer(cmdbuf, &.{});
|
||||
|
||||
gc.vkd.cmdSetViewport(cmdbuf, 0, 1, @ptrCast([*]const vk.Viewport, &viewport));
|
||||
@@ -268,7 +268,7 @@ fn createCommandBuffers(
|
||||
|
||||
gc.vkd.cmdBeginRenderPass(cmdbuf, &.{
|
||||
.render_pass = render_pass,
|
||||
.framebuffer = framebuffers[i],
|
||||
.framebuffer = framebuffer,
|
||||
.render_area = render_area,
|
||||
.clear_value_count = 1,
|
||||
.p_clear_values = @ptrCast([*]const vk.ClearValue, &clear),
|
||||
|
||||
Reference in New Issue
Block a user