From 3ecfd649524be513f989e585a9e0f1abd27242dc Mon Sep 17 00:00:00 2001 From: Chris Hellmuth Date: Mon, 9 Sep 2024 08:04:40 -0700 Subject: [PATCH] fix(gpu): Mock gpu pointcloud_search calls with empty custom attributes (#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 --- src/liboslexec/llvm_gen.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/liboslexec/llvm_gen.cpp b/src/liboslexec/llvm_gen.cpp index 948591046..ee850c7b1 100644 --- a/src/liboslexec/llvm_gen.cpp +++ b/src/liboslexec/llvm_gen.cpp @@ -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)); @@ -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.