Skip to content

Commit

Permalink
create pipe on first reload
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNumbat committed Mar 12, 2024
1 parent 39dc162 commit f4ab6b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
9 changes: 3 additions & 6 deletions rvk/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,11 @@ Opt<Binding_Table> Binding_Table::make(Arc<Device, Alloc> device, Commands& cmds

u64 Pipeline::shader_group_handles_size() {
u64 handle_size = device->sbt_handle_size();
u64 handle_aligned = Math::align(handle_size, device->sbt_handle_alignment());
u64 total_size = n_shaders * handle_aligned;
return total_size;
return n_shaders * handle_size;
}

void Pipeline::shader_group_handles_write(Slice<u8> data) {
RVK_CHECK(vkGetRayTracingShaderGroupHandlesKHR(*device, pipeline, 0, n_shaders, data.length(),
const_cast<u8*>(data.data())));
void Pipeline::shader_group_handles_write(u8* data, u64 length) {
RVK_CHECK(vkGetRayTracingShaderGroupHandlesKHR(*device, pipeline, 0, n_shaders, length, data));
}

Pipeline::Pipeline(Arc<Device, Alloc> D, Info info) : device(move(D)) {
Expand Down
4 changes: 2 additions & 2 deletions rvk/pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ struct Pipeline {
template<Region R>
Vec<u8, Mregion<R>> shader_group_handles() {
auto data = Vec<u8, Mregion<R>>::make(shader_group_handles_size());
shader_group_handles_write(data.slice());
shader_group_handles_write(data.data(), data.length());
return data;
}

Expand All @@ -158,7 +158,7 @@ struct Pipeline {
friend struct Vk;

u64 shader_group_handles_size();
void shader_group_handles_write(Slice<u8> data);
void shader_group_handles_write(u8* data, u64 length);

Arc<Device, Alloc> device;

Expand Down
2 changes: 2 additions & 0 deletions rvk/shader_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ void Shader_Loader::on_reload(Slice<Shader_Loader::Token> tokens,
FunctionN<16, void(Shader_Loader&)> callback) {
assert(device.ok());

callback(*this);

Thread::Lock lock{mutex};

Reload_Token reload_token = next_reload_token++;
Expand Down

0 comments on commit f4ab6b4

Please sign in to comment.