kakashidinho / metalangle

MetalANGLE: OpenGL ES to Metal API translation layer
Other
462 stars 65 forks source link

Add support for GL_EXT_shader_framebuffer_fetch #72

Open s-inagaki923 opened 2 years ago

s-inagaki923 commented 2 years ago

WIP. I'm reading the source code to implement this feature.

s-inagaki923 commented 2 years ago

@kakashidinho I don't understand most of it yet.

Can it be implemented by simply modifying the code in this repository? Do you have any ideas on how to implement this? (For example, files that you think will need to be modified.)

I would appreciate it if you could tell me about it.

s-inagaki923 commented 2 years ago

It seems that glslang does not support framebuffer fetch and I need to modify it.

s-inagaki923 commented 2 years ago

I noticed that there is a way to convert gl_LastFragColor and gl_LastFragData to subpass input of GLES for Vulkan.

"--msl-framebuffer-fetch" argument of spirv-cross is:

   [--msl-framebuffer-fetch]:
           Implement subpass inputs with frame buffer fetch.
           Emits [[color(N)]] inputs in fragment stage.
           Requires an Apple GPU.
kakashidinho commented 2 years ago

Sorry, I was busy with other stuffs lately. I believe adding GL_EXT_shader_framebuffer_fetch support, you will need to modify the current metal back-end logic as well. Not just shader compiler. Haven't had time to take a closer look yet, but I will try when I have time later.

s-inagaki923 commented 2 years ago

Thank you!

s-inagaki923 commented 2 years ago

Now, it should work on the actual iOS device with framebuffer fetching and the iOS simulator without framebuffer fetching.

kakashidinho commented 2 years ago

Thanks for this awesome PR.

I will put it on hold for now, I will need to test it more before merging to master.

s-inagaki923 commented 2 years ago

I understand. I am looking forward to it.