This was previously changed to move all system value semantics (e.g. SV_Position) at the end of the declaration in entry points because sometimes these values are not used in the pixel shader (see CL 34200367).
This change relys solely on the input shader source to re-construct the original order of interpolators after it has been cross-compiled via DXC/SPIRV-Cross.
#jira UE-223808
#rnx
#rb dan.elksnitis
[CL 36451425 by laura hermanns in 5.5 branch]
[FYI] dan.elksnitis
Original CL Desc
-----------------------------------------------------------------
[shaders]
- move population of output.target field into core code so each backend doesn't need to do it manually (do so before calling the compile function so any existing code expecting the output field to be set at any point during the compile process is unaffected)
- add a check in FShaderCompileJob::SerializeOutput and FShaderCompileJob::SerializeWorkerOutput that the FShaderTarget for a job output matches that of its input. This should catch cases of shaders with the wrong frequency being associated with jobs; further the callstack should indicate where this incorrect association is coming from (since SerializeOutput is called in different places for each cache path: duplicate in-flight jobs, jobs which hit in the in-memory job cache, and jobs which hit in the DDC cache, and SerializeWorkerOutput is only called when the job is read back from SCW output).
#rb Laura.Hermanns
[CL 35080902 by dan elksnitis in ue5-main branch]
- move population of output.target field into core code so each backend doesn't need to do it manually (do so before calling the compile function so any existing code expecting the output field to be set at any point during the compile process is unaffected)
- add a check in FShaderCompileJob::SerializeOutput and FShaderCompileJob::SerializeWorkerOutput that the FShaderTarget for a job output matches that of its input. This should catch cases of shaders with the wrong frequency being associated with jobs; further the callstack should indicate where this incorrect association is coming from (since SerializeOutput is called in different places for each cache path: duplicate in-flight jobs, jobs which hit in the in-memory job cache, and jobs which hit in the DDC cache, and SerializeWorkerOutput is only called when the job is read back from SCW output).
#rb Laura.Hermanns
[CL 35053511 by dan elksnitis in ue5-main branch]
Info is now stored in shader map in editor only data alongside platform data
Includes shader bump
#jira UE-218748
#rb dan.elksnitis
#tests local tests on Lyra cooking and DDC-Verify
[FYI] Zousar.Shaker
[CL 34906103 by tom holmes in ue5-main branch]
- add strings as an option for shader statistics, and a flags member/option to hide specific shader statistics from UI (so we can use statistics for other internal usage)
- add debug output for shader platform hashes (use to track down cases of shader job output which has identical bytecode but differing metadata), using the above to record a stat containing the shader hash computed by the compiler. currently only implemented for a subset of platforms
- fix a bug in shader diagnostic remapping for cache hits - the value stored in the cache/DDC for a job should contain non-remapped diagnostics (so cache hits can properly remap them to their version of the unstripped shader code). this also slightly improves deduplication within the job cache/DDC. fixed by storing the job output in the cache/DDC before running the job oncomplete callback (which performs the remapping)
- cleanup dxc hash retrieval code to use actual type instead of hacking around with an offset into the opaque blob
#rb Jason.Nadro
[CL 34864220 by dan elksnitis in ue5-main branch]
- Moving various UB booleans into a flags enum.
- UB booleans could not be reasonably deprecated without incurring memory overhead, so this will break custom code that uses them.
- Adding UB flag to force the shader compilers to generate reflection for the UB members which are normally excluded from reflection.
- Adding UB flag that tells MeshCommands that a UB will be bound during pass drawing and that it doesn't need to be set via MDCs.
- New flags are not used in this CL, they are prerequisites for subsequent, larger changes.
#rb jeannoe.morissette
[CL 34356503 by christopher waters in ue5-main branch]
There are special cases for semantics when the index is omitted and defaults to zero, e.g. "SV_ClipDistance0" or "SV_ClipDistance[0]".
In those cases, our HlslParser does not provide the semantic index so we have to handle it when re-ordering the interpolators in the DXBC backend.
#rnx
#rb Charles.deRousiers
[CL 34274363 by laura hermanns in ue5-main branch]
When cross-compiling HLSL 2021 to HLSL 2018 for D3D11, DXC/SPIRV-Cross re-arrange the vertex/pixel interpolators in a way that can cause mismatches in the PSO.
The previous method to re-order shader interpolators was to just search the source for their variable declaration semantics, but that search can confuse semantics like TEXCOORD1 with TEXCOORD10.
This change includes two fixes:
1. The new approach parses the semantics and match the entire name, not just searching for the presence of the respective semantic identifier.
2. Always declare system value semantics such as SV_Position after user-defined semantics in case they are not used in the pixel shader to preserve the DXBC register assignments.
This fixes issues with Substrate as we have to cross-compile lots of shaders for D3D11 and some ES31 preview platforms.
#jira UE-214192
#rnx
#rb Jason.Nadro
[CL 34200377 by laura hermanns in ue5-main branch]
- Found while investigating compressed size (by FabianG), seemst to have been that way since 22233889. Shader size down significanty, to about 30-40% of the previous (both disk size and the runtime footprint).
#rb christopher.waters, dan.elksnitis, Laura.Hermanns
[CL 34155347 by arciel rekman in ue5-main branch]
- Removed reliance on ShaderParameterParser for most platforms as it doesn't always parse parameters
#rb Luke.Thatcher
[CL 33822449 by carl lloyd in ue5-main branch]
- Add option for ShaderType to declare which FShaderBindingLayout needs to be used for shader gen and runtime binding
- Add helper function to generate FShaderBindingLayoutContainer from array of uniform buffers and EShaderResourceTableFlags (only supports bindless mode right now)
- Serialize the FRHIShaderBindingLayout in FShaderCompilerEnvironment so it can be used by the shader compiler backends
- FShaderBindingLayout can add required symbols to the FShaderCompilerInput which shouldn't be dead code eliminated (required for Shader resource table building)
- Serialize the hash of RHIShaderResourceTable in the platform specific shader binary data so it can be used during runtime RTPSO validation (all shaders in the RTPSO need the same RHIShaderResourceTable)
- Renamed pRootSignaure member to RootSignature (style guide)
#jira UE-212347
[CL 33624453 by kenzo terelst in ue5-main branch]
Split Work Graph shaders into multiple frequencies.
This is somewhat in anticipation of graphic nodes.
But also it is a replacement for using CFLAG_WorkgraphLocalNodes to differentiate nodes with local or global root signature.
#rb Yuriy.ODonnell
[CL 33146442 by jeremy moore in ue5-main branch]
- Array-based bindless (Vulkan) only needed one more piece of data to use "GenerateBindlessAccess"
- Now all bindless shader platforms will generate a getter function for each bindless resource/sampler.
#rb dan.elksnitis, jeannoe.morissette
[CL 32375983 by christopher waters in ue5-main branch]
This re-introduced the backed-out CL for the DXC update including fixes to detect derivitive opcodes in DXIL containers and a null-pointer fix in the DXIL code generator (GitHub draf #6411).
Only the Windows binary is updated since no other platform uses the DXIL code generator. Linux and Mac binary updates will follow in a separate CL.
Also replaced DXIL binary with v1.8 obtained from https://github.com/microsoft/DirectXShaderCompiler/releases/tag/v1.8.2403
#jira UE-203636
#rb Graham.Wihlidal, Jeremy.Moore
[FYI] Bob.Tellez, Dan.Elksnitis
[CL 32257727 by matanshukry in ue5-main branch]
- Only WorkGraph shaders use this currently.
- SM6.8 needs to set the __SHADER_TARGET_MAJOR and __SHADER_TARGET_MINOR defines
- Changing some logic that was SM6.6 specific to now allow the higher shader model.
#rb Jeremy.Moore
[CL 32220197 by christopher waters in ue5-main branch]