简体   繁体   English

是否可以在 OpenGL 中终止(计算)着色器执行?

[英]Is it possible to terminate (compute) shader execution in OpenGL?

I have a compute shader that computes the Mandelbrot set.我有一个计算 Mandelbrot 集的计算着色器。 For deeper zooms this can take minutes.对于更深的缩放,这可能需要几分钟。 Is it possible to terminate the compute shader (for example if I pan or change zoom while it computes)?是否可以终止计算着色器(例如,如果我在计算时平移或更改缩放比例)? I'm using C++.我正在使用 C++。

I guess I could let the shader do its computation in stages and check on the CPU-side if parameters have changed.我想我可以让着色器分阶段进行计算,并在 CPU 端检查参数是否已更改。 But I think this would cost performance and would make the code a little messy...但我认为这会降低性能并且会使代码有点混乱......

Does anybody know a clean, fast and easy way to do this?有谁知道一个干净、快速和简单的方法来做到这一点?

There is no valid way to affect the execution of any OpenGL operation after it has already been told to execute.没有有效的方法可以影响任何 OpenGL 操作在已被告知执行后的执行。 If you dispatch the work, you dispatched the work.如果你派遣工作,你就派遣了工作。 You can't take it back later.你以后不能收回它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM