File size: 2,118 Bytes
de4d6ae ddbb236 39a1f38 ddbb236 39a1f38 ddbb236 39a1f38 ddbb236 39a1f38 de4d6ae 39a1f38 ddbb236 de4d6ae | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | // Raw-pointer launch interface for the pathtracer-diff kernels. Torch-free so
// the .cu never sees libtorch headers (required for local MSVC builds).
#pragma once
#include <cuda_runtime_api.h>
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"
|