beautiful nothing
This commit is contained in:
parent
03162f6f0b
commit
7e026b8041
|
@ -163,7 +163,13 @@ test "vec" {
|
||||||
pub const Float4x4 = packed struct {
|
pub const Float4x4 = packed struct {
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
|
|
||||||
const zero = Self{};
|
pub const zero = Self{};
|
||||||
|
pub const id = Self{
|
||||||
|
.c0 = .{ .x = 1, .y = 0, .z = 0, .w = 0 },
|
||||||
|
.c1 = .{ .x = 0, .y = 1, .z = 0, .w = 0 },
|
||||||
|
.c2 = .{ .x = 0, .y = 0, .z = 1, .w = 0 },
|
||||||
|
.c3 = .{ .x = 0, .y = 0, .z = 0, .w = 1 },
|
||||||
|
};
|
||||||
|
|
||||||
c0: Vec4f = .{},
|
c0: Vec4f = .{},
|
||||||
c1: Vec4f = .{},
|
c1: Vec4f = .{},
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub fn execute(device: *const Device, swapchain: *Swapchain) !void {
|
||||||
|
|
||||||
// todo: pt_trace convar check
|
// todo: pt_trace convar check
|
||||||
try DepthPass.execute(device, swapchain);
|
try DepthPass.execute(device, swapchain);
|
||||||
OpaquePass.execute();
|
try OpaquePass.execute(device, swapchain);
|
||||||
|
|
||||||
// Exposure.execute();
|
// Exposure.execute();
|
||||||
// UIPass.execute();
|
// UIPass.execute();
|
||||||
|
@ -85,11 +85,18 @@ const DepthPass = struct {
|
||||||
const depth_buffer = Targets.getDepthBuffer(swapchain);
|
const depth_buffer = Targets.getDepthBuffer(swapchain);
|
||||||
|
|
||||||
var info = RenderPass.Description{
|
var info = RenderPass.Description{
|
||||||
.src_stage_mask = .{ .early_fragment_tests_bit = true },
|
.src_stage_mask = .{ .fragment_shader_bit = true },
|
||||||
.src_access_mask = .{ .depth_stencil_attachment_read_bit = true },
|
.src_access_mask = .{ .shader_read_bit = true },
|
||||||
.dst_stage_mask = .{ .late_fragment_tests_bit = true },
|
.dst_stage_mask = .{ .color_attachment_output_bit = true },
|
||||||
.dst_access_mask = .{ .depth_stencil_attachment_write_bit = true },
|
.dst_access_mask = .{ .color_attachment_write_bit = true },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//var info = RenderPass.Description{
|
||||||
|
// .src_stage_mask = .{ .early_fragment_tests_bit = true },
|
||||||
|
// .src_access_mask = .{ .depth_stencil_attachment_read_bit = true },
|
||||||
|
// .dst_stage_mask = .{ .late_fragment_tests_bit = true },
|
||||||
|
// .dst_access_mask = .{ .depth_stencil_attachment_write_bit = true },
|
||||||
|
//};
|
||||||
info.attachments[0] = .{
|
info.attachments[0] = .{
|
||||||
.format = depth_buffer.format,
|
.format = depth_buffer.format,
|
||||||
.layout = .depth_stencil_attachment_optimal,
|
.layout = .depth_stencil_attachment_optimal,
|
||||||
|
@ -224,13 +231,21 @@ const OpaquePass = struct {
|
||||||
|
|
||||||
const scene_buffer = Targets.getSceneBuffer(swapchain);
|
const scene_buffer = Targets.getSceneBuffer(swapchain);
|
||||||
const depth_buffer = Targets.getDepthBuffer(swapchain);
|
const depth_buffer = Targets.getDepthBuffer(swapchain);
|
||||||
|
|
||||||
var info = RenderPass.Description{
|
var info = RenderPass.Description{
|
||||||
.src_stage_mask = .{ .late_fragment_tests_bit = true },
|
.src_stage_mask = .{ .fragment_shader_bit = true },
|
||||||
.dst_stage_mask = .{ .early_fragment_tests_bit = true, .color_attachment_output_bit = true },
|
.dst_stage_mask = .{ .color_attachment_output_bit = true },
|
||||||
.src_access_mask = .{ .depth_stencil_attachment_write_bit = true },
|
.src_access_mask = .{ .shader_read_bit = true },
|
||||||
.dst_access_mask = .{ .depth_stencil_attachment_read_bit = true, .depth_stencil_attachment_write_bit = true },
|
.dst_access_mask = .{ .color_attachment_write_bit = true },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//var info = RenderPass.Description{
|
||||||
|
// .src_stage_mask = .{ .late_fragment_tests_bit = true },
|
||||||
|
// .dst_stage_mask = .{ .early_fragment_tests_bit = true, .color_attachment_output_bit = true },
|
||||||
|
// .src_access_mask = .{ .depth_stencil_attachment_write_bit = true },
|
||||||
|
// .dst_access_mask = .{ .depth_stencil_attachment_read_bit = true, .color_attachment_write_bit = true },
|
||||||
|
//};
|
||||||
|
|
||||||
info.attachments[0] = .{
|
info.attachments[0] = .{
|
||||||
.format = depth_buffer.format,
|
.format = depth_buffer.format,
|
||||||
.layout = .depth_stencil_attachment_optimal,
|
.layout = .depth_stencil_attachment_optimal,
|
||||||
|
@ -384,5 +399,53 @@ const OpaquePass = struct {
|
||||||
Bindings.bindBuffer(settings.Bid.Globals.id, .uniform_buffer, s_per_camera_buffer.current(swapchain));
|
Bindings.bindBuffer(settings.Bid.Globals.id, .uniform_buffer, s_per_camera_buffer.current(swapchain));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn execute() void {}
|
const pm_opaque_execute = ProfileMark.init("OpaquePass.execute");
|
||||||
|
pub fn execute(device: *const Device, swapchain: *Swapchain) !void {
|
||||||
|
pm_opaque_execute.begin();
|
||||||
|
defer pm_opaque_execute.end();
|
||||||
|
|
||||||
|
var attachments = [_]*Image{
|
||||||
|
Targets.getDepthBuffer(swapchain),
|
||||||
|
Targets.getSceneBuffer(swapchain),
|
||||||
|
};
|
||||||
|
const rect = vk.Rect2D{
|
||||||
|
.extent = .{
|
||||||
|
.width = attachments[0].width,
|
||||||
|
.height = attachments[0].height,
|
||||||
|
},
|
||||||
|
.offset = std.mem.zeroes(vk.Offset2D),
|
||||||
|
};
|
||||||
|
const fbuf = try framebuffer.getOrAdd(device, &attachments, rect.extent.width, rect.extent.height);
|
||||||
|
const cmdbuf = try Command.Buffer.get(.graphics, device);
|
||||||
|
|
||||||
|
_ = try Image.State.depthAttachWrite(device, cmdbuf, attachments[0]);
|
||||||
|
_ = try Image.State.colorAttachWrite(device, cmdbuf, attachments[1]);
|
||||||
|
// textable fragsampleall
|
||||||
|
|
||||||
|
cmdbuf.defaultViewport(device, swapchain);
|
||||||
|
cmdbuf.bindPass(device, swapchain, &s_pass);
|
||||||
|
const clear_values = [_]vk.ClearValue{
|
||||||
|
.{
|
||||||
|
.depth_stencil = .{ .depth = 1, .stencil = 0 },
|
||||||
|
},
|
||||||
|
.{
|
||||||
|
.color = .{ .float_32 = .{ 0, 0, 0, 1 } },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
cmdbuf.beginRenderPass(device, s_render_pass, fbuf, rect, &clear_values);
|
||||||
|
defer cmdbuf.endRenderPass(device);
|
||||||
|
|
||||||
|
// ITERATE THROUGH ENTITIES AND DRAW THEM FINALLY OMG
|
||||||
|
|
||||||
|
const pc = PushConstants{
|
||||||
|
.kLocalToWorld = Float4x4.id,
|
||||||
|
.kIMc0 = Vec4f{ .x = 1, .y = 0, .z = 0, .w = 0 },
|
||||||
|
.kIMc1 = Vec4f{ .x = 0, .y = 1, .z = 0, .w = 0 },
|
||||||
|
.kIMc2 = Vec4f{ .x = 0, .y = 0, .z = 1, .w = 0 },
|
||||||
|
.kTexInds = Vec4u{},
|
||||||
|
};
|
||||||
|
|
||||||
|
cmdbuf.pushConstants(device, &s_pass, &pc);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,7 @@ pub fn getOrAdd(device: *const Device, attachments: []*const Image, width: u32,
|
||||||
.height = @intCast(u16, height),
|
.height = @intCast(u16, height),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std.debug.print("# attachments: {}\n\n", .{attachments.len});
|
||||||
for (attachments) |attachment, i| {
|
for (attachments) |attachment, i| {
|
||||||
assert(attachment.view != .null_handle);
|
assert(attachment.view != .null_handle);
|
||||||
key.attachments[i] = attachment.view;
|
key.attachments[i] = attachment.view;
|
||||||
|
@ -57,6 +58,7 @@ pub fn getOrAdd(device: *const Device, attachments: []*const Image, width: u32,
|
||||||
|
|
||||||
const result = s_fbufs.getOrPutAssumeCapacity(key);
|
const result = s_fbufs.getOrPutAssumeCapacity(key);
|
||||||
if (!result.found_existing) {
|
if (!result.found_existing) {
|
||||||
|
std.debug.print("new fbuf: att {any} \n\n format {any}\n\n", .{ key.attachments[0..attachments.len], key.formats[0..attachments.len] });
|
||||||
const value = Value{
|
const value = Value{
|
||||||
.handle = try Framebuffer.init(device, key.attachments[0..attachments.len], key.formats[0..attachments.len], key.width, key.height),
|
.handle = try Framebuffer.init(device, key.attachments[0..attachments.len], key.formats[0..attachments.len], key.width, key.height),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue