Files
filament/shaders/src/post_process.fs
Mathias Agopian ea34691625 Support a maximum of 8 render buffers (from 4)
We chose 8 renderbuffer because it seems to be commonly supported
on mobile gpu and is more than 6 which is needed for generating
cubemaps. 4 was the minimum guaranteed by ES3.0.

The main changes here are:
- TargetBufferFlags is now a uint32_t instead of uint8_t
- The number of render buffer supported by filament and supported by
  the hardware can now be different. Applications/users now must
  query this value if more than 4 is needed.
- added a backend query (used gl terminology)


This is a redo of a previous attempt. There was an issue in the GL
backend that caused MRT to fail on some devices.
2021-05-04 10:53:07 -07:00

62 lines
1.7 KiB
GLSL

void main() {
PostProcessInputs inputs;
// Invoke user code
postProcess(inputs);
#if defined(TARGET_MOBILE)
#if defined(FRAG_OUTPUT0)
inputs.FRAG_OUTPUT0 = clamp(inputs.FRAG_OUTPUT0, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT1)
inputs.FRAG_OUTPUT1 = clamp(inputs.FRAG_OUTPUT1, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT2)
inputs.FRAG_OUTPUT2 = clamp(inputs.FRAG_OUTPUT2, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT3)
inputs.FRAG_OUTPUT3 = clamp(inputs.FRAG_OUTPUT3, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT4)
inputs.FRAG_OUTPUT4 = clamp(inputs.FRAG_OUTPUT4, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT5)
inputs.FRAG_OUTPUT5 = clamp(inputs.FRAG_OUTPUT5, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT6)
inputs.FRAG_OUTPUT6 = clamp(inputs.FRAG_OUTPUT6, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#if defined(FRAG_OUTPUT7)
inputs.FRAG_OUTPUT7 = clamp(inputs.FRAG_OUTPUT7, -MEDIUMP_FLT_MAX, MEDIUMP_FLT_MAX);
#endif
#endif
#if defined(FRAG_OUTPUT0)
FRAG_OUTPUT_AT0 = inputs.FRAG_OUTPUT0;
#endif
#if defined(FRAG_OUTPUT1)
FRAG_OUTPUT_AT1 = inputs.FRAG_OUTPUT1;
#endif
#if defined(FRAG_OUTPUT2)
FRAG_OUTPUT_AT2 = inputs.FRAG_OUTPUT2;
#endif
#if defined(FRAG_OUTPUT3)
FRAG_OUTPUT_AT3 = inputs.FRAG_OUTPUT3;
#endif
#if defined(FRAG_OUTPUT4)
FRAG_OUTPUT_AT4 = inputs.FRAG_OUTPUT4;
#endif
#if defined(FRAG_OUTPUT5)
FRAG_OUTPUT_AT5 = inputs.FRAG_OUTPUT5;
#endif
#if defined(FRAG_OUTPUT6)
FRAG_OUTPUT_AT6 = inputs.FRAG_OUTPUT6;
#endif
#if defined(FRAG_OUTPUT7)
FRAG_OUTPUT_AT7 = inputs.FRAG_OUTPUT7;
#endif
#if defined(FRAG_OUTPUT_DEPTH)
gl_FragDepth = inputs.depth;
#endif
}