是否可以使用顶点着色器作为计算着色器?

发布于 2025-01-31 17:27:39 字数 243 浏览 7 评论 0原文

我想在顶点着色器阶段之前使用计算着色器,但是我使用OpenGL ES 3.0,并且Compute着色器仅在3.1中可用。我的想法是通过将变化作为数据馈送来使用顶点着色器作为计算着色器。

我知道我可以使用顶点着色器并使用转换反馈重新提高其输出,但是我听说它很慢,它将失败高度平行的计算机着色器的优势。

那么,是否可以将顶点着色器的结果送入另一个顶点着色器?

如果没有,是否可以使用顶点着色器作为计算着色器?

I would like to use a compute shader before my vertex shader stage, but I'm using OpenGL es 3.0, and compute shaders are only available in 3.1. My idea would be to use a vertex shader as a compute shader by feeding varyings as data.

I know that I could use a vertex shader and retreive its output with transform feedback, but I've heard that it's slow and it would defeat the advantage of the highly parallelized compute shader.

So is it possible to feed the result of the vertex shader into another vertex shader?

If not, is there a way to use a vertex shader as a compute shader?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮萍、无处依 2025-02-07 17:27:39

使用变换反馈,再加上抛弃式的抛弃器来跳过片段阴影,应该可以正常工作。

在移动渲染器中,实现皮肤网状动画是一种常见的技术(将其动画成转换反馈缓冲区,将其多次输出用作顶点着色器的输入,例如Shadow Pass和3D Pass)。

像任何东西一样,它并不总是最好的解决方案,但这对上下文非常敏感。

Using transform feedback, coupled with rasterizer discard to skip fragment shading, should work fine.

It was quite a common technique in mobile renderers to implement skinned mesh animation (animate once into a transform feedback buffer, use the output of that multiple times as an input into vertex shaders e.g. shadow pass and 3D pass).

Like anything, it's not always the best solution, but that's very context sensitive.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文