-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
798 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const std = @import ("std"); | ||
const c = @import ("c"); | ||
|
||
const vk = @import ("vk"); | ||
const raw = @import ("raw"); | ||
|
||
pub const Attachment = extern struct | ||
{ | ||
pub const Description = extern struct | ||
{ | ||
flags: vk.Attachment.Description.Flags = 0, | ||
format: vk.Format, | ||
samples: vk.SampleCount.Flags, | ||
load_op: vk.Attachment.LoadOp, | ||
store_op: vk.Attachment.StoreOp, | ||
stencil_load_op: vk.Attachment.LoadOp, | ||
stencil_store_op: vk.Attachment.StoreOp, | ||
initial_layout: vk.Image.Layout, | ||
final_layout: vk.Image.Layout, | ||
|
||
pub const Flags = u32; | ||
}; | ||
|
||
pub const LoadOp = enum (i32) | ||
{ | ||
CLEAR = c.VK_ATTACHMENT_LOAD_OP_CLEAR, | ||
DONT_CARE = c.VK_ATTACHMENT_LOAD_OP_DONT_CARE, | ||
}; | ||
|
||
pub const Reference = extern struct | ||
{ | ||
attachment: u32, | ||
layout: vk.Image.Layout, | ||
}; | ||
|
||
pub const StoreOp = enum (i32) | ||
{ | ||
STORE = c.VK_ATTACHMENT_STORE_OP_STORE, | ||
DONT_CARE = c.VK_ATTACHMENT_STORE_OP_DONT_CARE, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const std = @import ("std"); | ||
const c = @import ("c"); | ||
|
||
const vk = @import ("vk"); | ||
const raw = @import ("raw"); | ||
|
||
pub const Descriptor = extern struct | ||
{ | ||
pub const Pool = enum (u64) { NULL_HANDLE = vk.NULL_HANDLE, _, }; | ||
|
||
pub const Set = enum (u64) | ||
{ | ||
NULL_HANDLE = vk.NULL_HANDLE, _, | ||
|
||
pub const Layout = enum (u64) | ||
{ | ||
NULL_HANDLE = vk.NULL_HANDLE, _, | ||
|
||
pub const Binding = extern struct | ||
{ | ||
binding: u32, | ||
descriptor_type: vk.Descriptor.Type, | ||
descriptor_count: u32 = 0, | ||
stage_flags: vk.ShaderStage.Flags, | ||
p_immutable_samplers: ?[*] const vk.Sampler = null, | ||
}; | ||
|
||
pub const Create = extern struct | ||
{ | ||
pub const Flags = u32; | ||
|
||
pub const Info = extern struct | ||
{ | ||
s_type: vk.StructureType = .DESCRIPTOR_SET_LAYOUT_CREATE_INFO, | ||
p_next: ?*const anyopaque = null, | ||
flags: vk.Descriptor.Set.Layout.Create.Flags = 0, | ||
binding_count: u32 = 0, | ||
p_bindings: ?[*] const vk.Descriptor.Set.Layout.Binding = null, | ||
}; | ||
}; | ||
pub fn create (device: vk.Device, p_create_info: *const vk.Descriptor.Set.Layout.Create.Info, p_allocator: ?*const vk.AllocationCallbacks) !vk.Descriptor.Set.Layout | ||
{ | ||
var set_layout: vk.Descriptor.Set.Layout = undefined; | ||
const result = raw.prototypes.device.vkCreateDescriptorSetLayout (device, p_create_info, p_allocator, &set_layout); | ||
if (result > 0) | ||
{ | ||
std.debug.print ("{s} failed with {} status code\n", .{ @typeName (@This ()) ++ "." ++ @src ().fn_name, result, }); | ||
return error.UnexpectedResult; | ||
} | ||
return set_layout; | ||
} | ||
|
||
pub fn destroy (device: vk.Device, descriptor_set_layout: vk.Descriptor.Set.Layout, p_allocator: ?*const vk.AllocationCallbacks) void | ||
{ | ||
raw.prototypes.device.vkDestroyDescriptorSetLayout(device, descriptor_set_layout, p_allocator); | ||
} | ||
}; | ||
}; | ||
|
||
pub const Type = enum (i32) | ||
{ | ||
UNIFORM_BUFFER = c.VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, | ||
COMBINED_IMAGE_SAMPLER = c.VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const std = @import ("std"); | ||
const c = @import ("c"); | ||
|
||
const vk = @import ("vk"); | ||
const raw = @import ("raw"); | ||
|
||
pub const Format = enum (u32) | ||
{ | ||
A8B8G8R8_UNORM_PACK32 = c.VK_FORMAT_A8B8G8R8_UNORM_PACK32, | ||
B8G8R8A8_SRGB = c.VK_FORMAT_B8G8R8A8_SRGB, | ||
B8G8R8A8_UNORM = c.VK_FORMAT_B8G8R8A8_UNORM, | ||
R8G8B8_UNORM = c.VK_FORMAT_R8G8B8_UNORM, | ||
R8G8B8A8_UNORM = c.VK_FORMAT_R8G8B8A8_UNORM, | ||
_, | ||
|
||
pub const Feature = extern struct | ||
{ | ||
pub const Flags = u32; | ||
|
||
pub const Bit = enum (vk.Format.Feature.Flags) | ||
{ | ||
BLIT_SRC = c.VK_FORMAT_FEATURE_BLIT_SRC_BIT, | ||
BLIT_DST = c.VK_FORMAT_FEATURE_BLIT_DST_BIT, | ||
|
||
pub fn contains (self: @This (), flags: vk.Format.Feature.Flags) bool | ||
{ | ||
return (flags & @intFromEnum (self)) == @intFromEnum (self); | ||
} | ||
}; | ||
}; | ||
|
||
pub const Properties = extern struct | ||
{ | ||
linear_tiling_features: vk.Format.Feature.Flags = 0, | ||
optimal_tiling_features: vk.Format.Feature.Flags = 0, | ||
buffer_features: vk.Format.Feature.Flags = 0, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const std = @import ("std"); | ||
const c = @import ("c"); | ||
|
||
const vk = @import ("vk"); | ||
const raw = @import ("raw"); | ||
|
||
pub const Framebuffer = enum (u64) | ||
{ | ||
NULL_HANDLE = vk.NULL_HANDLE, _, | ||
|
||
pub const Create = extern struct | ||
{ | ||
pub const Flags = u32; | ||
|
||
pub const Info = extern struct | ||
{ | ||
s_type: vk.StructureType = .FRAMEBUFFER_CREATE_INFO, | ||
p_next: ?*const anyopaque = null, | ||
flags: vk.Framebuffer.Create.Flags = 0, | ||
render_pass: vk.RenderPass, | ||
attachment_count: u32 = 0, | ||
p_attachments: ?[*] const vk.Image.View = null, | ||
width: u32, | ||
height: u32, | ||
layers: u32, | ||
}; | ||
}; | ||
|
||
pub fn create (device: vk.Device, p_create_info: *const vk.Framebuffer.Create.Info, p_allocator: ?*const vk.AllocationCallbacks) !vk.Framebuffer | ||
{ | ||
var framebuffer: vk.Framebuffer = undefined; | ||
const result = raw.prototypes.device.vkCreateFramebuffer (device, p_create_info, p_allocator, &framebuffer); | ||
if (result > 0) | ||
{ | ||
std.debug.print ("{s} failed with {} status code\n", .{ @typeName (@This ()) ++ "." ++ @src ().fn_name, result, }); | ||
return error.UnexpectedResult; | ||
} | ||
return framebuffer; | ||
} | ||
|
||
pub fn destroy (device: vk.Device, framebuffer: vk.Framebuffer, p_allocator: ?*const vk.AllocationCallbacks) void | ||
{ | ||
raw.prototypes.device.vkDestroyFramebuffer (device, framebuffer, p_allocator); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.