Commit Graph

284 Commits

Author SHA1 Message Date
laura hermanns
d7fff598d5 Allow passing custom SPIV-V optimization passes to ShaderConductor. This allows us to control more fine-grained what optimization passes work best for certain render passes on different platforms.
#rb Serge.Bernier
[FYI] Carl.Lloyd, JeanNoe.Morissette
#rnx

[CL 27880727 by laura hermanns in ue5-main branch]
2023-09-14 11:39:49 -04:00
christopher waters
5dc4ce553d Removing redundant line directives from Shader Minifier.
#rb yuriy.odonnell

[CL 27872540 by christopher waters in ue5-main branch]
2023-09-14 05:20:23 -04:00
graham wihlidal
811135f653 RDNA ISA parser improvements and fixes
[FYI] rune.stubbe, brian.karis

[CL 27697998 by graham wihlidal in ue5-main branch]
2023-09-07 20:34:04 -04:00
graham wihlidal
7f36ea203a Added two missing MIMG instructions to RDNA2_ISA.h
[CL 27697990 by graham wihlidal in ue5-main branch]
2023-09-07 20:33:59 -04:00
graham wihlidal
987e25e552 Renamed NoImplicitDerivatives -> NoDerivativeOps to also handle the explicit derivative cases, and cleaned up cflag naming
#rb rune.stubbe
[FYI] dan.elksnitis

[CL 27697881 by graham wihlidal in ue5-main branch]
2023-09-07 20:30:26 -04:00
graham wihlidal
3295fddd4f Implemented RDNA 1 & 2 ISA parser to optionally detect if a compute shader has any need for implicit derivatives (image sample, ddx, ddy, etc.). Certain shaders can be marked with CFLAG_ExplicitDerivatives, indicating the shaders prefer to handle derivatives explicitly, and this instructs the shader compiler - on supporting platforms - to parse the compiled ISA and look if any instructions requiring implicit derivatives are present. If none are found, the shader is decorated with NoImplicitDerivatives, indicating it is safe to ignore shading quads, etc..
#rb jason.nadro, luke.thatcher, dan.elksnitis
[FYI] brian.karis, rune.stubbe

[CL 27697142 by graham wihlidal in ue5-main branch]
2023-09-07 20:10:55 -04:00
louisphilippe seguin
a11435338f Fix usage of const TCHAR* in the condition of checkf or ensureMsgf and test the strings for nullptr instead
#rb trivial
#rnx

[CL 27427505 by louisphilippe seguin in ue5-main branch]
2023-08-28 17:50:38 -04:00
jeannoe morissette
235b6cbfd3 VulkanRHI: Actually enable scalar_block_layout in raytracing and sm6 shaders to fix multiple alignment issues. Rename ReflectionSlot param to align with ShaderCommon code.
#rb carl.lloyd
#jira UE-171798
#rnx

[CL 27399055 by jeannoe morissette in ue5-main branch]
2023-08-25 22:19:15 -04:00
carl lloyd
34d53bc691 Added validation to ensure UAV/SRV types and UB sizes match the ones generated by the shader compiler
#rb jeannoe.morissette
#jira UE-82353

[CL 27399050 by carl lloyd in ue5-main branch]
2023-08-25 22:19:10 -04:00
jeannoe morissette
b070af8d82 VulkanRHI: Add quotes around the entrypoint name in the command line for cases where multiple entrypoints are possible (like RT hit group)
#rb carl.lloyd
[FYI] aleksander.netzel
#rnx

[CL 27204165 by jeannoe morissette in ue5-main branch]
2023-08-18 11:39:37 -04:00
laura hermanns
f5e5f41162 Fix removal of unused shader interpolators for DXC backends: Keep original semantic name including its index and separate it from its overridden binding slot.
#rb Dan.Elksnitis, Ben.Woodhouse
[FYI] Brian.White, Carl.Lloyd, Serge.Bernie
#jira UE-191963
#rnx

[CL 27133050 by laura hermanns in ue5-main branch]
2023-08-16 00:43:54 -04:00
dan elksnitis
9a5a1b6f74 [shaders] minor include cleanup
#rb Jason.Hoerner
#rb Laura.Hermanns

[CL 26817718 by dan elksnitis in ue5-main branch]
2023-08-03 13:40:32 -04:00
dan elksnitis
5f85b46590 [shaders] remove unnecessary passing of hlslcc flags as an option to debug info output. this was just used to pass a switch on the SCW directcompile cmdline which SCW no longer does anything with. also cleaned up some additional unnecessary code related to these flags in backends that no longer use hlslcc at all.
#rb Laura.Hermanns

[CL 26685354 by dan elksnitis in ue5-main branch]
2023-07-28 15:58:01 -04:00
charles derousiers
2365ee5308 Change D3D diagnostic buffer to output readable assert message (file/line/condition/message).
Use with check() / checkf()

#rb dan.elksnitis, christopher.waters
[FYI] yuriy.odonnell

[CL 26680005 by charles derousiers in ue5-main branch]
2023-07-28 13:55:18 -04:00
jason hoerner
7f22080814 Shader Compiler: Made FShaderCompilerDefinitions private, to reduce code publicly visible in ShaderCore.h. For now, it's just marked deprecated for 5.4, but will be hidden more generally in 5.5.
#rnx
#rb yuriy.odonnell dan.elksnitis jason.nadro

[CL 26534998 by jason hoerner in ue5-main branch]
2023-07-22 06:35:10 -04:00
tom holmes
c847704982 Mutate DDC string since platform symbol serialization data changed
Protect WriteSymbolData if the Filename is empty

#jira UE-190842
[REVIEW] [at]matt.peters
#tests cooking CitySample

[CL 26528753 by tom holmes in ue5-main branch]
2023-07-21 18:27:54 -04:00
tom holmes
ece26e8d8b Support for slim ShaderSymbols.info / r.Shaders.SymbolsInfo=1
Platforms can return a platform hash and a blob of text data to go with that hash
These are stored one / line in ShaderSymbols.info in lieu of full PDB info
Useful when full shader PDBs are impractically large, info-only is much smaller

#rb dan.elksnitis, john.huelin, serge.bernier
#tests test on cooking Lyra, various platforms, noddc and ddc

[CL 26496825 by tom holmes in ue5-main branch]
2023-07-20 16:51:51 -04:00
guillaume abadie
fb96324861 Adds bSupportsRealTypes=RuntimeDependent in Vulkan SM5 and SM6
#rb jeannoe.morissette
#jira UE-179496

[CL 26269642 by guillaume abadie in ue5-main branch]
2023-06-27 16:32:12 -04:00
dan elksnitis
be2cf9c56e [shaders] debug output changes - add optional shader code binary output, fix redundant write of additional outputs
#rb Laura.Hermanns

[CL 26182686 by dan elksnitis in ue5-main branch]
2023-06-22 10:53:19 -04:00
jason hoerner
e1fe70dbca Shader Compiler: GlobalBeginCompileShader define optimizations, plus a few other micro-optimizations, producing a 3.2x performance improvement.
* Major define optimization involves converting map of defines to use FName keys and variant values rather than strings -- this eliminates most of the cost of string hashing, allocation, and conversion.
* Lower overhead FHashTable used instead of TMap.
* An initial map of defines can optionally be provided globally.  Anything using an initial define can have its map index cached for optimized lookup when reading or writing.

Other micro-optimizations:
* Added Reserve calls for uniform buffer related maps, to eliminate map resizing / rehashing.  Saved around 15% perf (after define optimizations).
* Added a map for UB lookup, instead of iterating through the linked list.  Saved around 10% perf.

Non-optimization:  Sort the order in which uniform buffer variable names are searched in BuildShaderFileToUniformBufferMap, to create determinism in ShaderDebug data for A/B testing (previously order was dependent on global constructor order for UB definitions, which could vary arbitrarily with unrelated changes).

#jira UE-187334
#rnx
#rb dan.elksnitis jason.nadro yuriy.odonnell

[CL 26142884 by jason hoerner in ue5-main branch]
2023-06-21 03:26:02 -04:00
serge bernier
cc601cb7c6 Fix stripping of unused interpolator. HLSLParser used by the RemoveUnusedOutputs function wasn't able to parse bit_cast, nointrerp, ulong, and Constant tokens.
-Added support to write PSSL qualifier (similar to PrimitiveId)

[REVIEW] laura.hermanns

[CL 26100103 by serge bernier in ue5-main branch]
2023-06-19 15:09:29 -04:00
laura hermanns
fcd0debcbd Fix crash on empty string of preprocessed shader source.
#rb Dan.Elksnitis

[CL 26024402 by laura hermanns in ue5-main branch]
2023-06-15 16:15:45 -04:00
dan elksnitis
d688f1fb4d [shaders] debug output improvements/fixes
- remove redundant options struct initialization in DumpDebugShaderData - this was resulting in losing some of the options set in the input parameter options struct
- add explicit "DumpExtendedDebugShaderData" which includes the additional debug output functionality only previously available if an IShaderFormat implementation inherited from FBaseShaderFormat
- add "AdditionalOutputs" functionality which can be used by backends to dump additional (text-based) files following the file naming rules as dictated by the options struct with less boilerplate code
- add a helper for constructing a debug filename from the debug output options struct (some backends require constructing such filenames for i.e. contents of batchfiles; the helper reduces boilerplate code in such cases)
- fix condition for old path of dumping OutputHash.txt to not redundantly dump if shader format supports independent preprocessing and preprocessed cache is enabled

#rb Massimo.Tristano

[CL 25892792 by dan elksnitis in ue5-main branch]
2023-06-09 10:27:24 -04:00
dan elksnitis
06395bee56 [shaders] add Hash field to FShaderCompilerInput so debug output of InputHash.txt works correctly whether or not the preprocessed cache is enabled, and the IShaderFormat API for debug output of independent-preprocessing-enabled backends is cleaner
#rb Jason.Nadro

[CL 25814977 by dan elksnitis in ue5-main branch]
2023-06-06 09:55:43 -04:00
dan elksnitis
2acbcb9533 [shaders]
- add new fields to FShaderCompilerOutput which should be populated with the shader source and entry point name if modified by a backend compile process (in a format implementing the independent preprocessing API). this is intended to supercede "OptionalFinalShaderSource" for such shader formats, as well as being used as the source for preprocessed debug dumps when enabled.
- modify the PCD3D shader format to use these fields as intended (and so fix the debug output for pipelines which remove unused interpolators to match the final modified source).

#rb Laura.Hermanns
#preflight 64777f850848b7126dda194c

[CL 25706448 by dan elksnitis in ue5-main branch]
2023-05-31 13:31:39 -04:00