Flipped image when rendering to a MTLTexture

33 views
Skip to first unread message

Linfeng Li

unread,
Jul 7, 2023, 12:52:45 AM7/7/23
to angleproject
not sure if it is a bug or is there a configuration to flip it.

1. created MTLTexture with [MTLDevice newTextureWithDescriptor:]
2. under a surfaceless context get the EGLImage via eglCreateImageKHR
3. get the GL texture by glEGLImageTargetTexture2DOES
4. create a frame buffer backed by the texture
5. make draw calls
6. glFinish
7. render the MTLTexture in Metal

the resulting image is flipped. The black box is the metal texture that I render onto where I drew a upward triangle with ANGLE.

Simulator Screenshot - iPhone 14 Pro - 2023-07-07 at 12.45.23.png

the frame buffer is only flipped with a window surface

Ken Russell

unread,
Jul 7, 2023, 6:20:01 PM7/7/23
to crye...@gmail.com, angleproject
(Resending from correct email address)

This is probably expected behavior. OpenGL's coordinate system differs from most of the other native APIs', including Metal's. If a toggle were to be added, it might be best to implement the already-specified  https://registry.khronos.org/OpenGL/extensions/MESA/MESA_framebuffer_flip_y.txt for ANGLE's Metal backend.

-Ken



--
You received this message because you are subscribed to the Google Groups "angleproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angleproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angleproject/a58e9435-9eaf-49e7-9da1-a4876d4676c9n%40googlegroups.com.

Linfeng Li

unread,
Jul 8, 2023, 11:57:51 AM7/8/23
to angleproject
I think so. should I open a feature request in https://bugs.chromium.org/p/angleproject/issues/list ?

Linfeng Li

unread,
Jul 10, 2023, 1:05:54 AM7/10/23
to angleproject

Ken Russell

unread,
Jul 10, 2023, 8:22:55 PM7/10/23
to crye...@gmail.com, angleproject
Thanks, added some labels and asked for an Xcode project on it.


Reply all
Reply to author
Forward
0 new messages