Rookie
Rookie

Reputation: 3793

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?

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? 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.

I know how to retrieve the GLSL and OpenGL version strings.

Upvotes: 4

Views: 456

Answers (2)

rotoglup
rotoglup

Reputation: 5238

After calling glLinkProgram, it is advised to check the link status, by using :

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.

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.

In this case, if you're lucky, you'll get a message in this link log, but this message is platform dependent.

Upvotes: 1

Ben Voigt
Ben Voigt

Reputation: 283634

If glLinkProgram sets the GL error state then the shader(s) are not compatible with the card.

Upvotes: 5

Related Questions