gpt4 book ai didi

c++ - 如何清除opengl着色器缓存

转载 作者:行者123 更新时间:2023-11-28 00:00:20 27 4
gpt4 key购买 nike

当前的 opengl 驱动程序使用编译的着色器缓存位于c:/users/name/appdata/roaming/amd|nvidia/glcache/...

不幸的是,几乎每次我更改一些着色器时,它都会导致程序崩溃,我目前通过手动删除着色器缓存来修复这个问题。

问题是,当我发布新版本的程序时,有什么好的方法可以清除缓存吗?任何 opengl 扩展来控制缓存?或者来自操作系统的一些神奇的api?或者,至少,找到文件夹的正确方法?

另一个问题:驱动程序使用什么键来识别各个着色器?这样我每次更改着色器时都可以以某种方式更改 key 。

最佳答案

unfortunately, it causes program crashes almost every time i change some of the shaders, which i currently fix by manually deleting the shader cache.

如果发生这种情况,则表明您的系统和/或驱动程序安装出现严重问题。这绝不能发生,如果发生了,那么这不是 OpenGL 程序应该关心的事情。

another question: what keys do the drivers use to identify individual shaders?

通常一些从着色器源代码 AST 派生的散列(即仅仅添加一个空格或重命名一个符号并不能解决问题)。

the question is, is there any good way of purging the cache when i ship new version of the program?

据我所知没有。着色器是 OpenGL 规范中的“黑盒子”。您发送 GLSL 源文本,它会被编译和链接,仅此而已。 OpenGL 未指定诸如着色器缓存或内部表示之类的内容。

any opengl extension to control the caching?

没有。从技术上讲,供应商可以为此添加供应商特定的扩展,但没有人这样做。

or some magical api from the operating system?

官方对此没有具体说明。

or, at least, a proper way to find the folder?

同样,没有任何内容被正确指定。

关于c++ - 如何清除opengl着色器缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39558234/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com