Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Render Targets support #64

Open
JustFreePirate opened this issue Jul 16, 2021 · 6 comments
Open

Multiple Render Targets support #64

JustFreePirate opened this issue Jul 16, 2021 · 6 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@JustFreePirate
Copy link

Hi!

On the main page it says that multiple render targets are supported, but I when I tried to render to a framebuffer with 4 RGAB32F draw buffers I got this error:
-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2623: failed assertion `This set of render targets requires 64 bytes of pixel storage. This device supports 16 bytes.'

I tested it on iPad Air with Apple A7 (OS 12.4.9 (16H5)) with using OpenGL ES 3.0 on MetalANGLE.
I looked up the Metal Feature Set Table (https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf) for this chip and found out that it supports only 128bit of maximum total render target size, per pixel, when using multiple color render targets.
So I assume that it does not support natively 4 render targets with RGBA32F format, it can only handle up to 4 render targets with RGBA8 format.

As far as I know, there are no such thing as "maximum total render target size, per pixel, when using multiple color render targets" in OpenGL ES spec. So there is no way to fully support multiple render targets for all texture formats, or am I missing something?

@kakashidinho
Copy link
Owner

kakashidinho commented Jul 16, 2021

Yes, unfortunately, I overlooked this Metal's limitation on older GPUs. If you want to use 4 RGBA32F render targets, you need to use Apple GPU Family 4 and later (iPhone X+).
This limitation actually doesn't really violate OpenGL ES 3.0 spec. Because by default, GL_RGAB32F is not mandated to be color renderable on all devices (you can view the list of color renderable formats' reference here https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glTexStorage2D.xhtml)

@kakashidinho
Copy link
Owner

Actually, I took a look again, GL_RGAB32F is not mandated to be renderable but GL_RGAB32UI is, and MetalANGLE probably won't support 4 render targets of GL_RGAB32UI on Apple A7 due to pixel storage limit as you mentioned. So yeah, On older devices, MetalANGLE is not fully compliant. I could just limit the GLES 3.0 to GPU family 4 and later but decided to enable it for every device, because the other GLES 3.0 features are still useful for general use cases (3D, array, R/G textures, etc).

@kakashidinho
Copy link
Owner

Are you trying to implement deferred rendering? I think traditional deferred rendering doesn't perform well on mobile GPUs. I would try to implement frame buffer fetch extension in future to allow in-tile memory version of deferred rendering as mentioned here https://community.arm.com/developer/tools-software/graphics/b/blog/posts/deferred-shading-on-mobile

@JustFreePirate
Copy link
Author

Thank you for your response!

Now it is all clear to me. Just wanted to be sure.
Can you posibly mention that multiple render targets are not 100% supported on the main page? I think it could help other people not to get this problem

@JustFreePirate
Copy link
Author

I am using MRT for GPU particles

@kakashidinho
Copy link
Owner

Done.

@kakashidinho kakashidinho added documentation Improvements or additions to documentation question Further information is requested labels Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants