MobileUsesExtenedGBuffer returns false?

Hello

I am trying to use mobile deferred in Unreal 5.3.
On mobile, the default setting doesn’t decode GBuffer.ShadingModelID properly, so it comes out differently than the value when encoding (I’ve modified the source code to add Shading Model).
So I want to enable MOBILE_EXTENDED_GBUFFER.

I looked in the code and found that in ShaderComplier.cpp there is a line that says

Input.Environment.SetDefine(TEXT(“MOBILE_EXTENDED_GBUFFER”), MobileUsesExtendedGBuffer((EShaderPlatform)Target.Platform) ? 1 : 0);

and then it says

// Whether to support more than 4 color attachments for GBuffer
RENDERCORE_API bool MobileUsesExtenedGBuffer(FStaticShaderPlatform ShaderPlatform)
{
// Android GLES: uses PLS for deferred shading and limited to 128 bits
// Vulkan requires:
// maxDescriptorSetInputAttachments > 4
// maxColorAttachments > 4
// iOS: A8+
return (ShaderPlatform != SP_OPENGL_ES3_1_ANDROID) && false;
}

Here’s what it looks like: a function that returns false unconditionally.

I tried to remove the “&& false” part and it works fine for me.
However, I’m still not sure what problems this will cause.

Do you have any idea why they’ve implemented the function to return false for some reason? I’ve been losing sleep over this for days and it’s shortening my lifespan.

I would really appreciate an answer.

Thanks in advance.

1 Like

Hi, its fine to change that function to return true. However it will limit devices that can use deferred rendering on mobile. Because some older devices might not support ExtendedGBuffer
On iOS only devices with A8 GPU or newer will work.
On Android OpenGL: only devices with Adreno GPUs will work (Mali GPUs will not)
On Android Vulkan: only devices with maxColorAttachments > 4 and maxDescriptorSetInputAttachments > 4 will work
You can see list of devices with maxColorAttachments and maxDescriptorSetInputAttachments limits here:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.