First of all,
.. however I really need this (sorta).
Context
I'm coding a sorta "video editor" / layers compositor for music visualization and having layers is essential to this task, not only I can separate the elements but apply effects on each and individually.
Issue / reproducing
I tried manually to set up two shaders with almost the same code called layer1.glsl and layer2.glsl:
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = fragCoord.xy / iResolution.xy;
fragColor = vec4(0.0, 0.0, uv.y, 1);
}
The only difference was that layer2.glsl returns fragColor = vec4(uv.x, 0.0, 0.0, 1); so I could mix the two with some textureLod method and expect a purple at top right corder, black bottom left, red bottom right and blue top left by adding each other's vec4 pixel_color.
However either by defining on the layer2.glsl file the map buffer with:
#pragma map layer1=buffer:/path/to/layer1.glsl;1280x720
Or by giving to the CLI: ./shady -i layer2.glsl -g 1280x720 -map "layer1=buffer:/path/to/layer1.glsl;1280x720"
It just didn't work, outputting the following error:
Error reloading environment: failed to call eglCreateContext, edit: which ended up being a bug on the code where the GL version wasn't being passed properly to the OnScreenEngine render method.
What I tried
See next comments, edited this one for consistency
First of all,
NOTE: Buffer support is not very well tested, your mileage may vary... however I really need this (sorta).
Context
I'm coding a sorta "video editor" / layers compositor for music visualization and having layers is essential to this task, not only I can separate the elements but apply effects on each and individually.
Issue / reproducing
I tried manually to set up two shaders with almost the same code called
layer1.glslandlayer2.glsl:The only difference was that
layer2.glslreturnsfragColor = vec4(uv.x, 0.0, 0.0, 1);so I could mix the two with sometextureLodmethod and expect a purple at top right corder, black bottom left, red bottom right and blue top left by adding each other'svec4 pixel_color.However either by defining on the
layer2.glslfile the map buffer with:#pragma map layer1=buffer:/path/to/layer1.glsl;1280x720Or by giving to the CLI:
./shady -i layer2.glsl -g 1280x720 -map "layer1=buffer:/path/to/layer1.glsl;1280x720"It just didn't work, outputting the following error:
Error reloading environment: failed to call eglCreateContext, edit: which ended up being a bug on the code where the GL version wasn't being passed properly to the OnScreenEngine render method.What I tried
See next comments, edited this one for consistency