after initializing contents of two buffers, first pass can read first buffer, but second pass gets pixels from the first buffer, not the second as expected.
Code: Select all
/*{
"CREDIT": "dtristram",
"DESCRIPTION": "illustrates bug in multipass support, note image 1 updates for 2 seconds then becomes static, then after four seconds, reading from store2 gives the pixels from store1",
"CATEGORIES": [ "generator" ],
"INPUTS": [
{
"TYPE": "image",
"NAME": "image1",
"LABEL": "Image 1",
},
{
"TYPE": "image",
"NAME": "image2",
"LABEL": "Image 2",
}
],
"PASSES": [
{
"TARGET": "store1",
"PERSISTENT": true,
},
{
"TARGET": "store2",
"PERSISTENT": true,
},
{},
]
}*/
int init_delay = 2;
void main() {
vec4 color1;
vec4 color2;
vec4 c;
switch (PASSINDEX) {
case 0:
if (TIME < init_delay) {
c = IMG_THIS_PIXEL(image1);
} else {
c = IMG_THIS_PIXEL(store1);
}
break;
case 1:
if (TIME < 2 * init_delay) {
c = IMG_THIS_PIXEL(image2);
} else {
c = IMG_THIS_PIXEL(store2);
}
break;
case 2:
color1 = IMG_THIS_PIXEL(store1);
color2 = IMG_THIS_PIXEL(store2);
c = mix(color1, color2, 0.5);
break;
}
gl_FragColor = c;
}