Fixes PVR SGX 540 crashes in UE-5155
[Requires shader compile worker rebuild.]
codereview nick.penwarden, chris.babcock, rolando.caloca
[CL 2460254 by Allan Bentham in Main branch]
- This is especially important on OS X OpenGL where these hitches can be equivalent to several frames, so it is enabled by default for this platform.
- The logging of draw calls is turned on/off with r.UseShaderDrawLog and incurs a fixed overhead as all RHI state is tracked & recorded into the shader cache.
- The actual predrawing is turned on/off with r.UseShaderPredraw and requires an existing cache to be useful, the predrawing takes place at frame-end and can be controlled with r.PredrawBatchTime which the time in ms to spend predrawing each frame until complete, or -1 to do it in one go (currently the default).
- The shader cache is now also versioned with the game able to supply a version distinct from the engine, so that old caches may be invalidated if/when required.
- The shader cache is now compatible with OpenGL SM4 & SM5 on Windows & probably Linux too.
- It may not work correctly with desktop ES2 emulation as that is still untested.
- To make it easier to add to other RHIs the API has been made simper to avoid lots of exposed branches.
#codereview michael.trepka, dmitry.rekman
[CL 2460109 by Mark Satterthwaite in Main branch]
- Shaders which emit layout location data use INTERFACE_LOCATION & INTERFACE_BLOCK macros to defer to the runtime whether they can be used as separable or non-separable shaders.
- The runtime supplies the correct #define for each so that the shaders still work on platforms where the glLinkProgram implementation fails with separable shader code.
- Shader model 5 platforms (GLSL 430 or ES 3.10) which were already specifying & using layout location data continue to do so, even when using glLinkProgram.
- The 'OpenGL.UseSeparateShaderObjects' console variable allows switching between SSO/Link modes between executions, but not dynamically at runtime.
- Only defaults to on for Mac as that is the only platform which can guarantee that the extension is always available & so far the most tested platform.
- Updated hlslcc binaries are supplied for Mac, Linux & Windows.
- Added an OpenGL RHI stat for shader first draw time so that it is easy to see why hitches occur during runtime due to in-driver shader compilation.
reviewedby michael.trepka, nick.penwarden, dmitry.rekman, rolando.caloca
[CL 2435530 by Mark Satterthwaite in Main branch]
ES2 emulation now uses UBOs instead of packed uniform blocks.
Fixed issue with ogl shader compiler introducing '__' into padding variable names.
[CL 2264084 by Allan Bentham in Main branch]
- Part of PR #306 by amigo and #ue4linux folks.
- Undoing my previous change with cross-compilation define (too dangerous).
#codereview Josh.Adams, Michael.Trepka
[CL 2243292 by Dmitry Rekman in Main branch]