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

Question - Code "shader_current()" - why isn't it in GMS2?

Pretty much just the title.

This function was added to 1.X a little while ago and was finally made public in the most recent EA update for 1.X, yet it isn't present in GMS2 for whatever reason.

I filed a bug report and was advised that we should discuss it here

Basically, I would like to know why it hasn't been implemented (maybe it was overlooked or something?), though I believe that it should - especially since 1.X has it.
The report itself basically states why:
Why? Let's say you want to update uniforms if shader was switched. Making own global variable for currently used shader will work as long as you use only your own shader switching functions. But you can't say if user won't change shader using shader_set somewhere outside. And there is no way to check it right now.
and I know I'd personally find it useful - I have a psuedo-material system using scripts+shaders and this'd be handy to reduce shader changes/uniform updates.
 
Last edited:

Mike

nobody important
GMC Elder
Aside from an extension that's can't know, I've never seen the need for these.... whats so hard about storing the current shader in a variable?

Set shader
store shader ID in variable

what shader am I using? check variable..... why is this deemed too hard?
 
Aside from an extension that's can't know, I've never seen the need for these.... whats so hard about storing the current shader in a variable?

Set shader
store shader ID in variable

what shader am I using? check variable..... why is this deemed too hard?
To quote the intial post, and report, if you make an extension and a user changes a shader, you can't possibly know that the shader has changed as they won't update your global. In this case, I intend to release an extension, and this function would be highly beneficial to avoid the user messing something up unintentionally.
Nevertheless, it seems this function is to be added - it was already added in 1.X, Nocturne has stated that it will be added, and Russell also seemed in favour in the intitial report.

And it's not too hard - it's just beneficial. Please don't assume this is laziness.
 
Top