Skip to content

Commit

Permalink
single sets
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNumbat committed Apr 30, 2024
1 parent 66080d5 commit 20698dd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rvk/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,10 @@ void Pipeline::bind_set(Commands& cmds, Descriptor_Set& set, u32 set_index) {
vkCmdBindDescriptorSets(cmds, bind_point(kind), layout, set_index, 1, &s, 0, null);
}

void Pipeline::bind_set(Commands& cmds, Descriptor_Set& set, u32 set_index, u32 frame_slot) {
assert(pipeline);
VkDescriptorSet s = set.get(frame_slot);
vkCmdBindDescriptorSets(cmds, bind_point(kind), layout, set_index, 1, &s, 0, null);
}

} // namespace rvk::impl
3 changes: 2 additions & 1 deletion rvk/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ struct Pipeline {
Pipeline& operator=(Pipeline&& src);

void bind(Commands& cmds);
void bind_set(Commands& cmds, Descriptor_Set& set, u32 set_index = 0);
void bind_set(Commands& cmds, Descriptor_Set& set, u32 set_index);
void bind_set(Commands& cmds, Descriptor_Set& set, u32 set_index, u32 frame_slot);

template<Push_Constant P>
void push(Commands& cmds, const typename P::T& data) {
Expand Down
4 changes: 4 additions & 0 deletions rvk/rvk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,10 @@ Descriptor_Set make_set(Descriptor_Set_Layout& layout, u32 variable_count) {
variable_count);
}

Descriptor_Set make_single_set(Descriptor_Set_Layout& layout, u32 variable_count) {
return impl::singleton->descriptor_pool->make(layout, 1, variable_count);
}

Box<Shader_Loader, Alloc> make_shader_loader() {
return Box<Shader_Loader, Alloc>::make(impl::singleton->device.dup());
}
Expand Down
1 change: 1 addition & 0 deletions rvk/rvk.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ template<Type_List L>
Descriptor_Set_Layout make_layout(Slice<const u32> counts = Slice<const u32>{});

Descriptor_Set make_set(Descriptor_Set_Layout& layout, u32 variable_count = 0);
Descriptor_Set make_single_set(Descriptor_Set_Layout& layout, u32 variable_count = 0);

template<Type_List L, Binding... Binds>
requires(Same<L, List<Binds...>>)
Expand Down
2 changes: 1 addition & 1 deletion rvk/swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void Compositor::render(Commands& cmds, u64 frame_index, u64 slot_index, bool ha
};

pipeline.bind(cmds);
pipeline.bind_set(cmds, ds);
pipeline.bind_set(cmds, ds, 0);

vkCmdBeginRendering(cmds, &info);
vkCmdDraw(cmds, 4, 1, 0, 0);
Expand Down

0 comments on commit 20698dd

Please sign in to comment.