shader_is_compiled

Checks a shader to make sure that it has compiled okay.

Syntax:

GML Code Example

shader_is_compiled(shader);


Argument Description
shader The shader to check.


Returns: N/A


Description

This function will check a shader at run-time to make sure that it has been successfully compiled. If it has then the function returns true otherwise it returns false. This function should be used at the start of the game to make sure that the platform running your game has successfully compiled any shaders used (particularly on Windows where some computers may be using DX9 with Shader Level 2.0 and not a later version using shader level 3.0).

If your shader has NOT been compiled and you call shader_set the game will crash, so it is worth while having some sort of check whenever you are using anything other than simple GLSL ES shaders.


Example:

GML Code Example

global.GFX = false;
 if shader_is_compiled(sh_glass) && shader_is_compiled(sh_warp)
    {
    global.GFX = true;
    }
 

The above code will set a global variable to false, and then if both the shaders being checked have compiled correctly, it will be set to true.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here