Repository: ManimCommunity/manim
File: manim/renderer/shader.py (Python)

Code before:
        else:
            self.shader.context.disable(moderngl.DEPTH_TEST)

        shader_attributes: list[Attribute] = []
        for k, v in self.shader.shader_program._members.items():
            if isinstance(v, Attribute):
                shader_attributes.append(k)
        shader_attributes_converted = filter_attributes(
            self.attributes, shader_attributes
        )

        vertex_buffer_object = self.shader.context.buffer(
            shader_attributes_converted.tobytes()
        )
        if self.indices is None:
            index_buffer_object = None
        else:
            vert_index_data = self.indices.astype("i4").tobytes()
            if vert_index_data:
                index_buffer_object = self.shader.context.buffer(vert_index_data)
            else:
                index_buffer_object = None
        vertex_array_object = self.shader.context.simple_vertex_array(
            self.shader.shader_program,
            vertex_buffer_object,
            *shader_attributes_converted.dtype.names,
            index_buffer=index_buffer_object,
        )
        vertex_array_object.render(self.primitive)
        vertex_buffer_object.release()
        vertex_array_object.release()
        if index_buffer_object is not None:
            index_buffer_object.release()


class Shader:
    def __init__(
        self,
        context: Context,
        name: Path | None = None,
        source: dict | None = None,
    ):
        global shader_program_cache
        self.context = context
        self.name = name

        # See if the program is cached.
        if (
            self.name in shader_program_cache
            and shader_program_cache[self.name].ctx == self.context
        ):

Review comment (suggestion):
```suggestion
            *filtered_shader_attributes.dtype.names,
```

Code after:
        self.shader.set_uniform(
            "u_projection_matrix",
            renderer.camera.projection_matrix,
        )

    def render(self) -> None:
        if self.skip_render:
            return

        if self.use_depth_test:
            self.shader.context.enable(moderngl.DEPTH_TEST)
        else:
            self.shader.context.disable(moderngl.DEPTH_TEST)

        shader_attribute_names: list[str] = []
        for member_name, member in self.shader.shader_program._members.items():
            if isinstance(member, moderngl.Attribute):
                shader_attribute_names.append(member_name)
        filtered_shader_attributes = filter_attributes(
            self.attributes, shader_attribute_names
        )

        vertex_buffer_object = self.shader.context.buffer(
            filtered_shader_attributes.tobytes()
        )
        if self.indices is None:
            index_buffer_object = None
        else:
            vert_index_data = self.indices.astype("i4").tobytes()
            if vert_index_data:
                index_buffer_object = self.shader.context.buffer(vert_index_data)
            else:
                index_buffer_object = None
        vertex_array_object = self.shader.context.simple_vertex_array(
            self.shader.shader_program,
            vertex_buffer_object,
            *filtered_shader_attributes.dtype.names,
            index_buffer=index_buffer_object,
        )
        vertex_array_object.render(self.primitive)
        vertex_buffer_object.release()
        vertex_array_object.release()
        if index_buffer_object is not None:
            index_buffer_object.release()


class Shader:
    def __init__(
        self,
        context: moderngl.Context,
        name: str | None = None,