简体   繁体   English

OpenGL:如何检查用户GFX卡是否可以使用我的着色器进行渲染?

[英]OpenGL: How to check if the user GFX card can render with my shader?

I need to make a fallback if the user doesnt support the shader i have made to render some things faster. 如果用户不支持我更快地呈现某些内容的着色器,我需要做一个后备。

So, how exactly do i check these things? 那么,我究竟如何检查这些东西呢? I know some of the shader functions are not supported by some GLSL versions, but, where is the complete list of these functions vs versions they need? 我知道一些GLSL版本不支持某些着色器功能,但是,这些功能的完整列表与它们需要的版本在哪里?

But the problem is, i dont know what exactly i need to know in order to know who can render that shader. 但问题是,我不知道究竟需要知道什么才能知道谁可以渲染该着色器。 Is it only about checking which function is supported by which GLSL version? 它只是关于检查哪个GLSL版本支持哪个功能? or is there something more to know? 还是有更多要知道的东西? I want to be 100% sure when to switch to fallback render and when to use GLSL render. 我想100%确定何时切换到回退渲染以及何时使用GLSL渲染。

I know how to retrieve the GLSL and OpenGL version strings. 我知道如何检索GLSL和OpenGL版本字符串。

如果glLinkProgram设置GL错误状态,则着色器与卡不兼容。

After calling glLinkProgram , it is advised to check the link status , by using : 调用glLinkProgram ,建议使用以下方法检查链接状态

glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);

This will give you a boolean value indicating if the program linked fine. 这将为您提供一个布尔值,指示程序是否链接正常。 You also have a GL_COMPILE_STATUS available. 您还有一个GL_COMPILE_STATUS可用。

Most of the time, this will indicate if the program fails to compile or link on your platform. 大多数情况下,这将指示程序是否无法在您的平台上编译或链接。

Be advised, though, that a program may link fine but not be suitable to run on your hardware, in this case the GL rendering will fallback on software rendering , and be slow slow slow. 但是,请注意,程序可能链接正常但不适合在您的硬件上运行,在这种情况下,GL渲染将回退到软件渲染 ,并且缓慢慢。

In this case, if you're lucky, you'll get a message in this link log, but this message is platform dependent. 在这种情况下,如果您很幸运,您将在此链接日志中收到消息,但此消息与平台有关。

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

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