1. IntroduceAs we all know, most of mobile devices are base on tile-based GPU architecture. For these kinds of GPU, There's no extra performance to fetch frame buffer directly in pixel shader. Correspondingly, OpenGL ES add an extension 'EXT_shader_framebuffer_fetch'. Apple present a very detail description and sample code to introduce this feature.https://developer.apple.com/library/content/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/BestPracticesforShaders/BestPracticesforShaders.html #version 300 es #extension GL_EXT_shader_framebuffer_fetch : require layout(location = 0) inout lowp vec4 destColor; void main() { lowp float luminance = dot(vec3(0.3, 0.59, 0.11), destColor.rgb); destColor.rgb = vec3(luminance); }2. UE4 Shader CompilerUE4 Almost store all of shader related document under 'Graphics Programming'.1) Shader, Material And Shader CacheIn generally, UE4 has two types of shader: global shader and Material. Global shaders are shaders defined low level and be directly used on engine level. For example, shadow filtering, post processing. Only one shader of any given global shader type exists in memory.Materials are defined by a set of states that control how material is rendered(blend mode, two sided, etc) and a set of material inputs that control how the material interacts with the various rendering passes(BaseColor, Roughness, Normal, etc).More details in Shader Development.As we all know, OpenGL/OpenGL ES use GLSL to programming GPU. The shader should be compiled at runtime before using it instead of HLSL using compiled binary shader. So, UE4 support cache mechanism which will reduce shader hitching in-
UE4 To Support Framebuffer Fetch For OpenGL ES3.1
![](https://img-home.csdnimg.cn/images/20240611030827.png)