OpenGL-超过gpu内存,可能的情况 [英] OpenGL - gpu memory exceeded, possible scenarios

查看:896
本文介绍了OpenGL-超过gpu内存,可能的情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用glTexImage2DglBufferData将一些数据发送到GPU内存.假设我请求驱动程序向gpu发送更多数据,但gpu内存已满.我可能会得到GL_OUT_OF_MEMORY.渲染线程可能会发生什么?有哪些可能的方案?渲染线程是否有可能终止?

I can use glTexImage2D or glBufferData to send some data to the gpu memory. Let's assume that I request driver to send more data to the gpu but the gpu memory is already full. I probably get GL_OUT_OF_MEMORY. What might happen with a rendering thread ? What are possible scenarios ? Is it possible that a rendering thread will be terminated ?

推荐答案

这取决于实际的OpenGL实现.但是最有可能发生的情况是,您将遇到严重的性能下降,但是一切都会继续进行.

It depends on the actual OpenGL implementation. But the most likely scenario is, that you'll just encounter a serious performance drop, but things will just keep working.

OpenGL使用抽象内存模型,该模型的实际实现威胁到GPU自身的内存作为缓存.实际上,对于大多数OpenGL实现,当您加载纹理数据时,一开始甚至都不会直接进入GPU.仅在实际需要渲染时才将其加载到GPU RAM中.如果使用的纹理超出了GPU RAM的容纳量,则可以根据需要从GPU RAM中交换纹理,以完成渲染.

OpenGL uses an abstract memory model, for which actual implementation threat the GPU's own memory as a cache. In fact for most OpenGL implementation when you load texture data it doesn't even go directly to the GPU at first. Only when it's actually required for rendering it gets loaded into the GPU RAM. If there are more textures in use than fit into GPU RAM, textures are swapped in and out from GPU RAM as needed to complete the rendering.

纹理完全适合其RAM所需的旧GPU代.实际上,2012年之后问世的GPU可以根据需要从主机内存访问纹理子集,从而提高了这一限制.实际上,您很快就会遇到最大纹理尺寸限制,而不是内存限制(BT; DT).

Older GPU generations required for a texture to completely fit into their RAM. The GPUs that came out after 2012 actually can access texture subsets from host memory as required thereby lifting that limit. In fact you're sooner running into maximum texture dimension limits, rather than memory limits (BT;DT).

当然,其他开发程度较差的OpenGL实现可能会因内存不足错误而失败.但是至少对于AMD和NVidia而言,这不是问题.

Of course other, less well developed OpenGL implementations may bail out with an out of memory error. But at least for AMD and NVidia that's not an issue.

这篇关于OpenGL-超过gpu内存,可能的情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆