GPU内存随每帧增加(泄漏)?

2024-04-25 22:39:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我渲染的图像是更新每一帧,使其成为一个正方形的2D板(由2个三角形组成)的纹理。然而,GPU内存似乎随着每一帧的增加而单调增加。你知道吗

draw函数如下所示:

prog = gloo.Program(vertex, fragment, count=4)

def Draw(self, inImRGB):
    texture = inImRGB.copy().view(gloo.Texture2D)
    texture.interpolation = gl.GL_LINEAR
    CBackgroundImage._prog['texture'] = texture
    CBackgroundImage._prog.draw(gl.GL_TRIANGLE_STRIP)

对于每个新的可用映像,都会使用以下回调周期性地调用它:

from glumpy import app
window = app.Window(...)
@window.event
def on_draw():
    window.clear()
    bgImageObj.Draw(newImRGB)

你知道为什么GPU内存一直在积累吗?我应该在每个新帧中释放纹理,还是以不同的方式填充它?如果是,怎么做?你知道吗


Tags: 内存appgpudefwindowdraw纹理gl