修复Nvidia和AMD的GLSL着色器 [英] Fixing GLSL shaders for Nvidia and AMD

查看:104
本文介绍了修复Nvidia和AMD的GLSL着色器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法让我的GLSL着色器在AMD和Nvidia硬件上都能工作.

I am having problems getting my GLSL shaders to work on both AMD and Nvidia hardware.

我不是在寻求修复特定着色器的帮助,而是通常如何避免出现这些问题.是否可以检查着色器是否可以在AMD/Nvidia驱动程序上编译,而无需在具有相应硬件的计算机上运行该应用程序并进行实际尝试呢?

I am not looking for help fixing a particular shader, but how to generally avoid getting these problems. Is it possible to check if a shader will compile on AMD/Nvidia drivers without running the application on a machine with the respective hardware and actually trying it?

最后,我知道测试是唯一可以确保的方法,但是在开发过程中,我至少希望避免出现明显的问题.

I know, in the end, testing is the only way to be sure, but during development I would like to at least avoid the obvious problems.

每个使用GLSL的人都必须有这些问题,为什么我找不到解决它们的好方法?

Everyone using GLSL must have these problems, so why can't I find a good way to fix them?

推荐答案

是否可以检查着色器是否可以在AMD/Nvidia驱动程序上编译,而无需在具有相应硬件的计算机上运行应用程序并进行实际尝试呢?

Is it possible to check if a shader will compile on AMD/Nvidia drivers without running the application on a machine with the respective hardware and actually trying it?

不.如果您打算认真开发应用程序,那么在各种硬件上进行测试是唯一的可靠方法.而且,如果您不认真的话,那么谁在乎.

No. If you are going to be serious about developing applications, testing on a variety of hardware is the only reliable way to go about it. And if you're not going to be serious, then who cares.

通常来说,对于一个小型团队来说,解决此问题的最简单方法是完全避免该问题.大多数驱动程序不兼容性来自尝试做一些非常规的事情:将数组作为输出/输入可变变量传递,将矩阵作为属性传递,使用最新的驱动程序功能等.因此...不要这样做.仅使用GLSL中已经存在并且几乎可以肯定地用于实际OpenGL应用程序中的坚固,安全的东西.

Generally speaking, the easiest way to handle this for a small team is to avoid the problem altogether. Most driver incompatibilities come from attempting to do something unorthodox: passing arrays as output/input varying variables, passing matrices as attributes, using more recent driver features, etc. So... don't do that. Use only solid, safe stuff that's been around in GLSL and has been almost certainly used in real-world OpenGL applications.

这篇关于修复Nvidia和AMD的GLSL着色器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆