在着色器汇编失败之后,可以打电话给GlshaderSource更新着色器源代码吗?

发布于 2025-02-12 06:32:13 字数 245 浏览 2 评论 0原文

我目前正在编写着着色器类,很好奇OpenGL中的使用情况是否有效。

假设您将源代码(Sourcode)添加到着色器(由句柄指定):

void glShaderSource(handle, 1, sourceCode, nullptr);

然后,您尝试编译着着色器并失败。

它是有效和/或经过良好测试的用例以更新Sourcecode,再次致电GlshaderSource,然后重新编译?

I am currently writing a Shader class, and was curious whether following use case in opengl is valid.

Suppose you added source code (SourceCode) to a shader (specified by handle):

void glShaderSource(handle, 1, sourceCode, nullptr);

Then you try to compile the shader and it fails.

Is it a valid and/or well tested use case to update sourceCode, call glShaderSource again as above, and recompile?

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

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

发布评论

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

评论(1

甜中书 2025-02-19 06:32:17

当然,您可以在一个失败后编译其他着色器。

测试良好的用例

我确定它已经测试过,但是没有人这样做。修复着色器,甚至在启动程序之前,而不是之后。

Sure, you can compile other shaders after one failed.

well tested use case

I'm sure it's tested, but nobody does this. Fix your shader before you even start your program, not after.

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