| // Raw-pointer launch interface for the pathtracer-diff kernels. Torch-free so | |
| // the .cu never sees libtorch headers (required for local MSVC builds). | |
| extern "C" { | |
| // All device pointers; ints/floats are host scalars. env*/med* may be | |
| // null/0 when absent. | |
| struct PtdSceneArgs { | |
| const float* tris; // [F, 9] | |
| const int* mat_ids; // [F] | |
| const float* uvs; // [F, 3, 2] | |
| int n_faces; | |
| const float* nodes_f; // [N, 6] | |
| const int* nodes_i; // [N, 3] | |
| int n_nodes; | |
| const int* light_faces; // [L] | |
| const float* light_cdf; // [L] | |
| int n_lights; | |
| float total_light_area; | |
| const float* tex; // [T, 3] albedo texels | |
| const int* tex_hdr; // [M, 3] | |
| int n_texels; | |
| const float* emi_tex; // [Te, 3] emission texels | |
| const int* emi_hdr; // [M, 3] | |
| int n_emi_texels; | |
| const int* mat_type; // [M] 0 diffuse | 1 conductor | 2 dielectric | | |
| // 3 plastic | 4 rough dielectric | |
| const float* mat_rough; // [M] | |
| const float* mat_ior; // [M] | |
| int n_mats; | |
| const float* med_sa; // [3] live absorption or null | |
| const float* med_ss; // [3] live scattering | |
| float med_sbar; // frozen sampling rate | |
| int has_med; | |
| const float* env; // [Eh*Ew, 3] or null | |
| int env_w, env_h; | |
| const float* env_cdf_m; // [Eh] | |
| const float* env_cdf_c; // [Eh*Ew] | |
| const float* env_pdf; // [Eh*Ew], sums to 1 | |
| }; | |
| void ptd_forward_launch(const PtdSceneArgs* args, const float* cam, int H, | |
| int W, int spp, int max_bounces, int mode, | |
| long long seed, float* image, cudaStream_t stream); | |
| void ptd_backward_launch(const PtdSceneArgs* args, const float* cam, int H, | |
| int W, int spp, int max_bounces, int mode, | |
| long long seed, const float* grad_image, | |
| float* grad_tex, float* grad_emi_tex, | |
| float* grad_env, float* grad_med, | |
| cudaStream_t stream); | |
| } // extern "C" | |