Page MenuHome

Cleanup: Move common CUDA/OptiX Cycles device code into separate file

Authored by Patrick Mours (pmoursnv) on Tue, Feb 11, 7:29 PM.



In spirit of the code quality day last Friday, this tackles the long overdue task of reducing code duplication between the CUDA and OptiX device implementations. The CUDA device class is now split into declaration and definition (similar to the OpenCL device) and the OptiX device class implements that and only overrides the functions it actually has to change, while using the CUDA implementation for everything else.

This may look like a lot of changes at first glance, but device_cuda_impl.cpp is mostly just a straight copy of the previous device_cuda.cpp (I've kept the layout intact, so a quick diff with whitespace ignored will show as much). The only actual change is in CUDADevice::tex_alloc, which now calls const_copy_to to bind the texture device pointers, instead of doing it in-place (since that allows overriding the behavior in the OptiX device implementation). I also renamed the OpenCL device code files for consistency (with no further changes to them).

Diff Detail

rB Blender

Event Timeline

Excellent, thanks!

This revision is now accepted and ready to land.Wed, Feb 12, 11:10 AM

This commit broke viewport denoising for me, it shows some corrupted image in the viewport.