• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion [SOLVED] GMS2 "Shader Invalid" error when setting a shader

M

Micle

Guest
Hey everyone, I was testing out some shaders in GMS2 today but unfortunately I am getting a really annoying error whenever I try starting my game.

This is what I have in my Draw Event:
Code:
shader_set( shd );
shader_reset();
The shader is the default shader template you get when creating one and it's set to GLSL ES. When I start my game I get an error straight away.
Code:
___________________________________________
############################################################################################
FATAL ERROR in Vertex Shader compilation
ShaderName: shd

Invalid shader
 at gml_Object_obj_Surfaces_Draw_0 (line 3) - shader_set( shd );
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_Surfaces_Draw_0 (line 3)
When I download some shader demo off the internet and run it, it works fine but whenever I try creating a shader in my own project it doesn't work. This is really annoying. Any feedback will be appreciated.
 

rIKmAN

Member
Are you editing the shader yourself, or just the default shader that is created gives this error too?

If you right-click the shader in the Resource Tree, check the shader type is set to GLSL_ES.
 
T

TorradaIsToast

Guest
Make sure you're not using HLSL 11 it seems it doesn't work in gamemaker
 
M

Micle

Guest
Thanks for the replies, I went back to it after a while and it seems to be working fine now.
It was just a basic shader you get when creating one and setting it inside a draw event. It was always set to GLSL_ES.

Anyway, it's fixed itself, thanks again.
 

Masstertron

Member
Hi there!

I wanted to bump this thread instead of starting a new one in case anyone else has recently experienced this issue.
I'm getting the same crash. Default shader, GLSL ES, blank project, the works.
If anyone has insight on this issue, it would be greatly appreciated.

Windows 10
GMS2 2.3.2.560
Fresh GMS2 install
 

Yal

šŸ§ *penguin noises*
GMC Elder
Gonna reply to this since I had the same problem after recently getting a new PC, and this thread is the most recently active.

GM shader compilation relies on a bunch of Microsoft tools being installed, and it fails silently if they're not present (or rather, you can check the shader compilation status in-game, but who does that? :p). This issue is kinda hidden if you use Steam, because a lot of Steam games automatically installs VC-redist packages that contain the needed DLLs so you'll just kinda accidentally have them installed already - you'll mostly see this when you use a completely fresh machine.

(After some restarts I got lucky and started seeing this error message every time I compiled, which is what let me finally track down the cause)



You can get the bare minimum stuff needed from here: https://www.microsoft.com/en-us/download/details.aspx?id=30679#
(actual version you need might vary, but it solved my problem - if your DLL has a different number in the filename you probably need a different version of VC-Redist)
 

mrdaneeyul

Member
I didn't get a nice error message, so I had to do trial and error lol. For me it ended up being at least the 2012 redistributable, x86 (even if you're on a 64-bit PC). It might've been more though... I downloaded and installed all of them from 2008 through 2015-2022, both x86 and x64 versions. It wasn't working and when looking at my installed versions, I noticed I'd missed the 2012 x86 one. That fixed it.

Here's an updated link with all the downloads: Latest supported Visual C++ Redistributable downloads | Microsoft Docs
 
Last edited:

Welvex

Member
I didn't get a nice error message, so I had to do trial and error lol. For me it ended up being at least the 2012 redistributable, x86 (even if you're on a 64-bit PC). It might've been more though... I downloaded and installed all of them from 2008 through 2015-2022, both x86 and x64 versions. It wasn't working and when looking at my installed versions, I noticed I'd missed the 2012 x86 one. That fixed it.

Here's an updated link with all the downloads: Latest supported Visual C++ Redistributable downloads | Microsoft Docs
I also have a x64 based system, however installing the x86 2015-2022 one fixed my problem, thanks for your link, it was very helpful
 
Top