Skip to content

Commit

Permalink
Add indirect decode buffer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Themaister committed Dec 31, 2023
1 parent a24d6fa commit 5b09604
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/meshopt_sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,14 @@ struct DecodedAttr
static void decode_mesh_gpu_bench(Vulkan::Device &dev, const MeshView &mesh)
{
Vulkan::BufferCreateInfo buf_info = {};
buf_info.domain = Vulkan::BufferDomain::Host;
buf_info.domain = Vulkan::BufferDomain::Device;
buf_info.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
buf_info.size = mesh.format_header->payload_size_b128 * sizeof(PayloadB128);
auto payload_buffer = dev.create_buffer(buf_info, mesh.payload);

buf_info.size = mesh.total_primitives * sizeof(u8vec3);
buf_info.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
buf_info.domain = Vulkan::BufferDomain::Device;

auto readback_decoded_index_buffer = dev.create_buffer(buf_info);

buf_info.size = mesh.total_vertices * sizeof(vec3);
Expand All @@ -358,11 +358,16 @@ static void decode_mesh_gpu_bench(Vulkan::Device &dev, const MeshView &mesh)
buf_info.domain = Vulkan::BufferDomain::Device;
auto readback_decoded_attr_buffer = dev.create_buffer(buf_info);

buf_info.size = mesh.format_header->meshlet_count * 20;
buf_info.domain = Vulkan::BufferDomain::Device;
auto readback_indirect_buffer = dev.create_buffer(buf_info);

DecodeInfo info = {};
info.ibo = readback_decoded_index_buffer.get();
info.streams[0] = readback_decoded_pos_buffer.get();
info.streams[1] = readback_decoded_attr_buffer.get();
info.target_style = mesh.format_header->style;
info.indirect = readback_indirect_buffer.get();
info.payload = payload_buffer.get();

constexpr unsigned ITER_PER_CONTEXT = 1000;
Expand Down Expand Up @@ -729,4 +734,4 @@ int main(int argc, char **argv)
decode_mesh_gpu_bench(dev, view);

return 0;
}
}

0 comments on commit 5b09604

Please sign in to comment.