Skip to content

Commit

Permalink
[vulkan] Fix bug in empty root buffer (#2807)
Browse files Browse the repository at this point in the history
* [vulkan] Fix bug in empty root buffer

* Auto Format

* typo

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
g1n0st and taichi-gardener authored Aug 26, 2021
1 parent 746129b commit d85729c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions taichi/backends/vulkan/spirv_snode_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ class SpirvSNodeCompiler {
CompiledSpirvSNode run(IRBuilder *builder,
const CompiledSNodeStructs *compiled_structs) {
CompiledSpirvSNode result;
result.root_stype = compute_snode_stype(
builder, compiled_structs,
compiled_structs->snode_descriptors.find(compiled_structs->root->id)
->second,
&result.snode_id_struct_stype_tbl, &result.snode_id_array_stype_tbl);
if (compiled_structs->root_size != 0) {
result.root_stype = compute_snode_stype(
builder, compiled_structs,
compiled_structs->snode_descriptors.find(compiled_structs->root->id)
->second,
&result.snode_id_struct_stype_tbl, &result.snode_id_array_stype_tbl);
} else { // Use an arbitary default type to skip empty root buffer
result.root_stype = builder->i32_type();
}
return result;
}

Expand Down

0 comments on commit d85729c

Please sign in to comment.