Skip to content

Commit

Permalink
upgrade pyre version in fbcode/vision - batch 2
Browse files Browse the repository at this point in the history
Differential Revision: D57183103

fbshipit-source-id: 7e2f42ddc6a1fa02abc27a451987d67a00264cbb
  • Loading branch information
generatedunixname89002005307016 authored and facebook-github-bot committed May 10, 2024
1 parent aec76bb commit 1711710
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion pytorch3d/renderer/mesh/rasterize_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class _RasterizeFaceVerts(torch.autograd.Function):
"""

@staticmethod
# pyre-fixme[14]: `forward` overrides method defined in `Function` inconsistently.
def forward(
ctx,
face_verts: torch.Tensor,
Expand Down
8 changes: 8 additions & 0 deletions pytorch3d/renderer/opengl/rasterizer_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,13 @@ def release(self) -> None:

# Free GL resources.
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, self.fbo)
# pyre-fixme[16]: Module `GL_3_0` has no attribute `glDeleteFramebuffers`.
gl.glDeleteFramebuffers(1, [self.fbo])
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, 0)
del self.fbo

gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, self.mesh_buffer_object)
# pyre-fixme[16]: Module `GL_1_5` has no attribute `glDeleteBuffers`.
gl.glDeleteBuffers(1, [self.mesh_buffer_object])
gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, 0)
del self.mesh_buffer_object
Expand All @@ -402,6 +404,7 @@ def _projection_matrix_to_opengl(self, projection_matrix: torch.Tensor) -> None:
projection matrix: A 3x3 float tensor.
"""
gl.glUseProgram(self.program)
# pyre-fixme[16]: Module `GL_2_0` has no attribute `glUniformMatrix4fv`.
gl.glUniformMatrix4fv(
self.perspective_projection_uniform,
1,
Expand Down Expand Up @@ -592,6 +595,7 @@ def _prepare_persistent_opengl_objects(program, max_faces: int):
# from pytorch/cuda. The buffer needs enough space to store the three vertices
# of each face, that is its size in bytes is
# max_faces * 3 (vertices) * 3 (coordinates) * 4 (bytes)
# pyre-fixme[16]: Module `GL_1_5` has no attribute `glGenBuffers`.
mesh_buffer_object = gl.glGenBuffers(1)
gl.glBindBufferBase(gl.GL_SHADER_STORAGE_BUFFER, 0, mesh_buffer_object)

Expand All @@ -604,25 +608,29 @@ def _prepare_persistent_opengl_objects(program, max_faces: int):

# Input vertex array object. We will only use it implicitly for indexing the
# vertices, but the actual input data is passed in the shader storage buffer.
# pyre-fixme[16]: Module `GL_3_0` has no attribute `glGenVertexArrays`.
vao = gl.glGenVertexArrays(1)

# Create the framebuffer object (fbo) where we'll store output data.
MAX_EGL_WIDTH = global_device_context_store.max_egl_width
MAX_EGL_HEIGHT = global_device_context_store.max_egl_height
# pyre-fixme[16]: Module `GL_3_0` has no attribute `glGenRenderbuffers`.
color_buffer = gl.glGenRenderbuffers(1)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, color_buffer)
gl.glRenderbufferStorage(
gl.GL_RENDERBUFFER, gl.GL_RGBA32F, MAX_EGL_WIDTH, MAX_EGL_HEIGHT
)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, 0)

# pyre-fixme[16]: Module `GL_3_0` has no attribute `glGenRenderbuffers`.
depth_buffer = gl.glGenRenderbuffers(1)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, depth_buffer)
gl.glRenderbufferStorage(
gl.GL_RENDERBUFFER, gl.GL_DEPTH_COMPONENT, MAX_EGL_WIDTH, MAX_EGL_HEIGHT
)
gl.glBindRenderbuffer(gl.GL_RENDERBUFFER, 0)

# pyre-fixme[16]: Module `GL_3_0` has no attribute `glGenFramebuffers`.
fbo = gl.glGenFramebuffers(1)
gl.glBindFramebuffer(gl.GL_FRAMEBUFFER, fbo)
gl.glFramebufferRenderbuffer(
Expand Down
1 change: 0 additions & 1 deletion pytorch3d/renderer/points/rasterize_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ def _format_radius(

class _RasterizePoints(torch.autograd.Function):
@staticmethod
# pyre-fixme[14]: `forward` overrides method defined in `Function` inconsistently.
def forward(
ctx,
points, # (P, 3)
Expand Down

0 comments on commit 1711710

Please sign in to comment.