Skip to content

Commit

Permalink
fix(gpu): Mock gpu pointcloud_search calls with empty custom attribut…
Browse files Browse the repository at this point in the history
…es (#1859)

The GPU calling convention for variadic shadeops is to pass a pointer to the extra parameters as the op's final argument. Currently calls to osl_pointcloud_search don't follow this convention, so their ptx fails to compile due to argument count mismatches.

This PR doesn't implement the full correct behavior, it just adds a nullptr to the end of OptiX calls to osl_pointcloud_search. This makes everything at least compile, so scenes that have pointcloud operations can fail more gracefully on GPU (for now).

Signed-off-by: Chris Hellmuth <[email protected]>
  • Loading branch information
chellmuth committed Sep 9, 2024
1 parent b472adc commit 3ecfd64
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/liboslexec/llvm_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3963,7 +3963,9 @@ LLVMGEN(llvm_gen_pointcloud_search)
else
clear_derivs_of.push_back(&Value);
}
} else {
} else if (!rop.use_optix()) {
//TODO: Implement custom attribute arguments for OptiX

// It is a regular attribute, push it to the arg list
args.push_back(rop.llvm_load_value(Name));
args.push_back(rop.ll.constant(simpletype));
Expand All @@ -3977,7 +3979,14 @@ LLVMGEN(llvm_gen_pointcloud_search)
capacity);
}

args[9] = rop.ll.constant(extra_attrs);
if (rop.use_optix()) {
// TODO: Implement proper variadic arguments for OptiX.
// In the meantime, dropping the custom attributes lets shader ptx compile properly.
args[9] = rop.ll.constant(0);
args.push_back(rop.ll.void_ptr_null());
} else {
args[9] = rop.ll.constant(extra_attrs);
}

if (Max_points.is_constant()) {
// Compare capacity to the requested number of points.
Expand Down

0 comments on commit 3ecfd64

Please sign in to comment.