OpenGL:渲染时间限制 linux

OpenGL: render time limit on linux

我正在通过 OpenGL 和 Qt 实现一些计算算法。所有计算都在片段着色器中执行。

有时,当我尝试执行一些困难的计算(在 GPU 上需要超过 5 秒)时,OpenGL 会在计算结束前中断计算。我想这是来自 Windows.

TDR 系统

我认为我应该将输入数据分成几部分,但我需要知道允许计算多长时间。

如何在 linux 上获得渲染时间限制(如果有跨平台解决方案会很酷)?

恐怕这是不可能的。在对 X 和 Wayland 的文档进行大量搜索之后,我找不到 任何东西 提到 GPU 看门狗定时器设置,所以我相信这是驱动程序特定的并且用户可能无法访问(或者我不擅长搜索)。

然而,可以在 NVIDIA 硬件 上的 X 下禁用此看门狗,方法是向 xorg.conf 添加一行,然后将其传递给图形驱动程序。

Option "Interactive" "boolean"

This option controls the behavior of the driver's watchdog, which attempts to detect and terminate GPU programs that get stuck, in order to ensure that the GPU remains available for other processes. GPU compute applications, however, often have long-running GPU programs, and killing them would be undesirable. If you are using GPU compute applications and they are getting prematurely terminated, try turning this option off.

请注意,即使是 NVIDIA 文档也没有提及超时的数值。