kaolin.render.mesh.nvdiffrast_context¶
API¶
- kaolin.render.mesh.nvdiffrast_context.default_nvdiffrast_context(device, raise_error=False)¶
Returns existing context for device, or creates one. To configure nvdiffrast to use opengl or CUDA back end by default call
nvdiffrast_use_cuda()
or func:nvdiffrast_use_opengl.- Parameters
device (str or torch.device) – device for the context
- Returns
nvdiffrast.torch.RasterizeCudaContext or nvdiffrast.torch.RasterizeGLContext
- kaolin.render.mesh.nvdiffrast_context.nvdiffrast_is_available()¶
Returns True if nvdiffrast is available, False otherwise.
- kaolin.render.mesh.nvdiffrast_context.nvdiffrast_use_cuda()¶
Configures nvdiffrast back end to use nvdiffrast.torch.RasterizeCudaContext by default.
This reset the cached nvdiffrast contexts.
Note
nvdiffrast only support a resolution multiple of 8.
- kaolin.render.mesh.nvdiffrast_context.nvdiffrast_use_opengl()¶
Configures nvdiffrast back end to use nvdiffrast.torch.RasterizeGLContext by default.
This reset the cached nvdiffrast contexts.
- kaolin.render.mesh.nvdiffrast_context.set_default_nvdiffrast_context(context, device='cuda')¶
Allows manually setting default nvdiffrast context to the given value for a specific device.
- Parameters
context (nvdiffrast.torch.RasterizeCudaContext or nvdiffrast.torch.RasterizeGLContext) – context instance
device (str, torch.device) – pytorch device