-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrasterizer.h
199 lines (184 loc) · 4.35 KB
/
rasterizer.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/*
* Copyright (C) 2023, Inria
* GRAPHDECO research group, https://team.inria.fr/graphdeco
* All rights reserved.
*
* This software is free for non-commercial, research and evaluation use
* under the terms of the LICENSE.md file.
*
* For inquiries contact george.drettakis@inria.fr
*/
#ifndef CUDA_RASTERIZER_H_INCLUDED
#define CUDA_RASTERIZER_H_INCLUDED
#include <vector>
#include <functional>
#include "cuda_fp16.h"
namespace CudaRasterizer
{
class Rasterizer
{
public:
static void fusedPreprocess4D(
const int P,
const int deg,
const int deg_t,
const int M,
const float* means3D,
const float* cov,
const float* ms,
const float* cov_t,
const float* opacities,
const float* t1,
const float* sh,
const float* t,
const float* viewmatrix,
const float* projmatrix,
const float* cam_pos,
const float duration,
bool* mask,
float* occ1,
float* xyz3,
float* rgb3);
static void fusedPreprocess4DSparse(
const int P,
const int deg,
const int deg_t,
const int M,
const float* means3D,
const float* cov,
const float* ms,
const float* cov_t,
const float* opacities,
const float* t1,
const float* base,
const float* sh,
const float* t,
const int* inverse,
const float* viewmatrix,
const float* projmatrix,
const float* cam_pos,
const float duration,
bool* mask,
float* occ1,
float* xyz3,
float* rgb3);
static void markVisible(
int P,
float* means3D,
float* viewmatrix,
float* projmatrix,
bool* present);
static void computeCov3D(
int P,
const float* scaling_xyz,
const float* rotation_l,
float* cov);
static void computeCov3DBackward(
int P,
const float* scaling_xyz,
const float* rotation_l,
const float* dL_dcov,
float* dL_dscaling_xyz,
float* dL_drotation_l);
static void computeCov4D(
int P,
const float* scaling_xyzt,
const float* rotation_l,
const float* rotation_r,
float* cov,
float* ms,
float* cov_t);
static void computeSH4D(
int P,
int deg, int deg_t, int max_coeffs,
const float* shs,
const float* dir,
const float* dir_t,
const float time_duration,
float* rgb);
static void computeSH4DBackward(
int P,
int deg, int deg_t, int max_coeffs,
const float* shs,
const float* dir,
const float* dir_t,
const float time_duration,
const float* dL_drgb,
float* dL_dsh,
float* dL_ddir,
float* dL_ddir_t);
static void computeCov4DBackward(
int P,
const float* scaling_xyzt,
const float* rotation_l,
const float* rotation_r,
const float* dL_dcov,
const float* dL_dms,
const float* dL_dcov_t,
float* dL_dscaling_xyzt,
float* dL_drotation_l,
float* dL_drotation_r);
static int forward(
std::function<char* (size_t)> geometryBuffer,
std::function<char* (size_t)> binningBuffer,
std::function<char* (size_t)> imageBuffer,
const int P, int D, int M,
const float* background,
const int width, int height,
const float* means3D,
const float* shs,
const float* colors_precomp,
const float* opacities,
const float* scales,
const float scale_modifier,
const float* rotations,
const float* cov3D_precomp,
const bool* tile_mask,
const float* viewmatrix,
const float* projmatrix,
const float* cam_pos,
const float tan_fovx, const float tan_fovy,
const bool prefiltered,
float* out_color,
float* out_depth,
float* out_alpha,
int* radii = nullptr,
bool debug = false);
static void backward(
const int P, int D, int M, int R,
const float* background,
const int width, int height,
const float* means3D,
const float* shs,
const float* colors_precomp,
const float* scales,
const float scale_modifier,
const float* rotations,
const float* cov3D_precomp,
const float* viewmatrix,
const float* projmatrix,
const float* campos,
const float tan_fovx, const float tan_fovy,
const int* radii,
char* geom_buffer,
char* binning_buffer,
char* image_buffer,
const float* accum_alphas,
const float* dL_dpix,
const float* dL_dpix_depth,
const float* dL_dpix_dalpha,
float* dL_dmean2D,
float* dL_dabsmean2D,
float* dL_dconic,
float* dL_dopacity,
float* dL_dcolor,
float* dL_ddepth,
float* dL_dmean3D,
float* dL_dcov3D,
float* dL_dsh,
float* dL_dscale,
float* dL_drot,
bool debug);
};
};
#endif