77
88from optix .sutil .vecmath import vtype_to_dtype
99
10+
1011class BufferImageFormat (enum .Enum ):
1112 UCHAR4 = 0
1213 FLOAT3 = 1
@@ -27,11 +28,12 @@ def dtype(self):
2728 def itemsize (self ):
2829 return self .dtype .itemsize
2930
31+
3032class CudaOutputBufferType (enum .Enum ):
31- CUDA_DEVICE = 0 , # not preferred, typically slower than ZERO_COPY
32- GL_INTEROP = 1 , # single device only, preferred for single device
33- ZERO_COPY = 2 , # general case, preferred for multi-gpu if not fully nvlink connected
34- CUDA_P2P = 3 , # fully connected only, preferred for fully nvlink connected
33+ CUDA_DEVICE = 0 , # not preferred, typically slower than ZERO_COPY
34+ GL_INTEROP = 1 , # single device only, preferred for single device
35+ ZERO_COPY = 2 , # general case, preferred for multi-gpu if not fully nvlink connected
36+ CUDA_P2P = 3 , # fully connected only, preferred for fully nvlink connected
3537
3638
3739class CudaOutputBuffer :
@@ -51,17 +53,16 @@ def __init__(self, buffer_type, pixel_format, width, height, device_idx=0):
5153
5254 self ._reallocate_buffers ()
5355
54-
5556 def resize (self , width , height ):
5657 self .width = width
5758 self .height = height
5859
5960 def get_host_buffer (self ):
60- if buffer_type is CudaOutputBufferType .CUDA_DEVICE :
61+ if self . buffer_type is CudaOutputBufferType .CUDA_DEVICE :
6162 self .copy_device_to_host ()
6263 return self ._host_buffer
6364 else :
64- msg = f'Buffer type { buffer_type } has not been implemented yet.'
65+ msg = f'Buffer type { self . buffer_type } has not been implemented yet.'
6566 raise NotImplementedError (msg )
6667
6768 def map (self ):
0 commit comments