Skip to content

Commit

Permalink
evc: fix cuda osx
Browse files Browse the repository at this point in the history
  • Loading branch information
dendenxu committed Apr 6, 2024
1 parent d6d1912 commit 03e1f51
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion easyvolcap/runners/volumetric_video_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,7 +1401,6 @@ def init_camera(self, camera_cfg: dotdict = dotdict(), view_index: int = None):

def init_quad(self):
from easyvolcap.utils.gl_utils import Quad
from cuda import cudart
self.quad = Quad(H=self.H, W=self.W, use_quad_cuda=self.use_quad_cuda, compose=self.compose, compose_power=self.compose_power) # will blit this texture to screen if rendered

def init_opengl(self):
Expand Down
12 changes: 6 additions & 6 deletions easyvolcap/utils/gl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,13 @@ def init_texture(self):
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, old_fbo)

if self.use_quad_cuda:
from cuda import cudart
if self.compose:
# Both reading and writing of this resource is required
flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone
else:
flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard
try:
from cuda import cudart
if self.compose:
# Both reading and writing of this resource is required
flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsNone
else:
flags = cudart.cudaGraphicsRegisterFlags.cudaGraphicsRegisterFlagsWriteDiscard
self.cu_tex = CHECK_CUDART_ERROR(cudart.cudaGraphicsGLRegisterImage(self.tex, gl.GL_TEXTURE_2D, flags))
except RuntimeError as e:
log(red('Failed to initialize Quad with CUDA-GL interop, will use slow upload: '), e)
Expand Down

0 comments on commit 03e1f51

Please sign in to comment.