Skip to content

Commit

Permalink
fix(optix): fix userdata derivatives for interpolated params on GPU (#…
Browse files Browse the repository at this point in the history
…1685)

Following #1657, it turns out we forgot to zero initialize the userdata derivatives for the optix path.
This leads to some rendering glitches caused by the memory garbage left in those derivatives.

Signed-off-by: Pascal Lecocq <[email protected]>
Co-authored-by: Pascal Lecocq <[email protected]>
  • Loading branch information
lecocqp and Pascal Lecocq committed May 20, 2023
1 parent abdc966 commit 5c49a7c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/liboslexec/llvm_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ BackendLLVM::llvm_assign_initial_value(const Symbol& sym, bool force)
llvm::Value* dst = llvm_void_ptr(sym);
TypeDesc t = sym.typespec().simpletype();
ll.op_memcpy(dst, src, t.size(), t.basesize());
if (sym.has_derivs())
llvm_zero_derivs(sym);
#endif
} else if (!sym.lockgeom() && !sym.typespec().is_closure()) {
// geometrically-varying param; memcpy its default value
Expand Down

0 comments on commit 5c49a7c

Please sign in to comment.