that is why you should use buffer_get_surface because that will restructure the data to make getting all the data out of that surface quick.This function should not be used very often as it is extremely slow and may cause a pause in your game.
You could replace "GML" with "Unity" or "Unreal Engine" or whatever and the answer is the same, because that's how shaders work. It is akin to a script. You set up the shader, you run it, the shader does its magic, and the only stuff you get out of it is whatever graphical manipulation you set it up to do. Well, you could inject your values into the graphic data and then read them out, that's what some stuff does to speed themselves up with GPU processing.There's any way to get data from shader to pass into a variable to gml?
Or to put it more appropriately, GPUs have their own languages, so shaders must be written in them (GML only supports GLSL I recall). Technically, YoYo could write their own vertex and fragment stuff and then have it intepreted into GLSL but there'd really be no point in that. (Well, blend modes are GPU shader pipeline manipulation, so they've actually done that already.)and it's also why you can't just use normal gml to make sharers.
shaders work on the gpu to manipulate images. Because it works through the gpu it's able to do calculations extremely fast and it's also why you can't just use normal gml to make sharers.
because of where the data is stored for the shaders use it can not permanently save data, in fact (I could be mistaken) but all data in the shader is cleared after every pixel.
But the shader can manipulate data instead. That's what it's doing when it modifies an image. It's just changing the rgba channels to match what you want and then rendering that instead of the original.
If you use a shader on a surface you are changing the data that is stored inside of that surface.
surfaces are stuctured internally in a way that makes drawing them to the screen very quick. However if you want to get a single pixel (using surface_getpixel) it's actually really slow:
that is why you should use buffer_get_surface because that will restructure the data to make getting all the data out of that surface quick.
However it is in general rare that you should need to get the data straight out of a shader like this. You are trying to extract normal data? For what though? normal data is usually used in shaders so you can just use the created surface or image as an input for the shader that needs it.
If you need to save out the normal data to a file just save the surface directly.
Again, it's rare that you should need a shader for it. I'm sure whatever you are doing there is a better way, it's like asking how to cut a steak with a spoon. You'll have to take extra steps and it would be easier to just get a knife. But I'm not here to question that.Well, is for storing some float,int or whatever values; if it's possible.
Thanks