ossia / score

ossia score, an interactive sequencer for the intermedia arts
https://ossia.io
Other
1.45k stars 101 forks source link

Every process flips images vertically on Mac OS with the Metal API #1486

Open pgervais opened 11 months ago

pgervais commented 11 months ago

To reproduce

I also created a no-op process, with this fragment:

void main() {
    vec2        normSrcCoord;
    normSrcCoord.x = isf_FragNormCoord[0];
    normSrcCoord.y = isf_FragNormCoord[1];
    gl_FragColor = IMG_NORM_PIXEL(inputImage, normSrcCoord);
}

Every time this process is applied the input is flipped vertically. Applying it an even number of times is a no-op.

Bug found on Mac OS M2, pre-compiled DMG, version 3.1.11 downloaded from https://github.com/ossia/score/releases/tag/v3.1.11 It only exists when using the Metal backend. The OpenGL backend doesn't have this bug.

The above behavior can be explained by every image-process flipping the image vertically no matter what the processing is:

jcelerier commented 10 months ago

thanks, yes this is actually a thing I haven't managed to fix properly yet in the general case - OpenGL, Vulkan, Metal and D3D all have:

see e.g. https://github.com/gpuweb/gpuweb/issues/416

there's some work to do in ISF filters so that depending on the backend, IMG_NORM_PIXEL & friends get the pixel in the "right" direction... and even then I'm not sure that would fix the multipass case if there are some direct texture reads