Skip to content

Commit

Permalink
fail - rxcpp woulda been cool but theres a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPerlman committed Feb 15, 2023
1 parent d95e1e2 commit 4419037
Show file tree
Hide file tree
Showing 13 changed files with 205 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "includes/pybind11"]
path = includes/pybind11
url = [email protected]:pybind/pybind11.git
[submodule "includes/RxCpp"]
path = includes/RxCpp
url = [email protected]:ReactiveX/RxCpp
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ include_directories(${OPENGL_INCLUDE_DIR})
add_subdirectory(includes/glad)
include_directories(includes/glad/include)

# RxCpp
include_directories(includes/RxCpp/Rx/v2/src)

# tiny-cuda-nn
set(TCNN_BUILD_EXAMPLES OFF)
Expand Down
1 change: 1 addition & 0 deletions includes/RxCpp
Submodule RxCpp added at 761b93
2 changes: 0 additions & 2 deletions src/api/python_bindings.cu
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,6 @@ PYBIND11_MODULE(PyTurboNeRF, m) {
py::class_<BlenderRenderEngine>(m, "BlenderRenderEngine")
.def(py::init<>())
.def("set_tag_redraw_callback", &BlenderRenderEngine::set_tag_redraw_callback)
.def("did_begin_drawing", &BlenderRenderEngine::did_begin_drawing)
.def("did_finish_drawing", &BlenderRenderEngine::did_finish_drawing)
.def(
"request_render",
&BlenderRenderEngine::request_render,
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/nerf-rendering-controller.cu
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void NeRFRenderingController::wait_until_finished() const {
}

void NeRFRenderingController::submit(
RenderRequest* request,
RenderRequest& request,
bool async
) {
// if we are still rendering in the background...
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/nerf-rendering-controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct NeRFRenderingController {
);

void submit(
RenderRequest* request,
RenderRequest& request,
bool async = false
);

Expand Down
24 changes: 12 additions & 12 deletions src/core/renderer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ using namespace tcnn;

void Renderer::enlarge_workspace_if_needed(
Renderer::Context& ctx,
RenderRequest* request
RenderRequest& request
) {
const uint32_t new_render_area = request->output->width * request->output->height;
const uint32_t new_render_area = request.output->width * request.output->height;

// TODO: NeRF network property getters could be made into static members.
// For now we assume all NeRFs have the same network configuration.
NeRF& nerf = request->proxies[0]->nerfs[0];
NeRF& nerf = request.proxies[0]->nerfs[0];

if (ctx.workspace.n_pixels != new_render_area) {
ctx.workspace.enlarge(
Expand All @@ -34,22 +34,22 @@ void Renderer::enlarge_workspace_if_needed(

void Renderer::submit(
Renderer::Context& ctx,
RenderRequest* request
RenderRequest request
) {
RenderingWorkspace& workspace = ctx.workspace;

// TODO: this should happen for all NeRFs
NeRF& nerf = request->proxies[0]->nerfs[0];
NeRF& nerf = request.proxies[0]->nerfs[0];

enlarge_workspace_if_needed(ctx, request);

cudaStream_t stream = ctx.stream;

// workspace.camera = request->camera
// workspace.camera = request.camera
CUDA_CHECK_THROW(
cudaMemcpyAsync(
workspace.camera,
&request->camera,
&request.camera,
sizeof(Camera),
cudaMemcpyHostToDevice,
stream
Expand Down Expand Up @@ -163,8 +163,8 @@ void Renderer::submit(

// TODO: march rays to bounding box first
while (n_rays_alive > 0) {
if (request->is_canceled()) {
request->on_cancel();
if (request.is_canceled()) {
request.on_cancel();
return;
}

Expand Down Expand Up @@ -238,8 +238,8 @@ void Renderer::submit(

// We have an opportunity to render a partial result here
// this progress is not very accurate, but it is fast.
float progress = (float)(n_rays - n_rays_alive) / (float)n_rays;
request->on_progress(progress);
// float progress = (float)(n_rays - n_rays_alive) / (float)n_rays;
request.on_progress();

n_steps += n_steps_per_ray;
if (n_steps < NeRFConstants::n_steps_per_render_compaction) {
Expand Down Expand Up @@ -311,7 +311,7 @@ void Renderer::submit(
n_pixels_filled += n_pixels_to_fill;
}

request->on_complete();
request.on_complete();
};

void Renderer::write_to(
Expand Down
4 changes: 2 additions & 2 deletions src/core/renderer.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Renderer {

void submit(
Context& ctx,
RenderRequest* request
RenderRequest request
);

void write_to(
Expand All @@ -38,7 +38,7 @@ struct Renderer {

private:

void enlarge_workspace_if_needed(Context& ctx, RenderRequest* request);
void enlarge_workspace_if_needed(Context& ctx, RenderRequest& request);
};

NRC_NAMESPACE_END
Loading

0 comments on commit 4419037

Please sign in to comment.