Commit Graph

353 Commits

Author SHA1 Message Date
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00
aris theophanidis
8ae2292282 Remove Compression.h from CoreMinimal.h
It's about 1/4 of CoreMinimal.h but rarely needed (Compression.h pulls on CriticalSection.h and Map.h that are costly).
#rb Yoan.StAmant

[CL 30683417 by aris theophanidis in ue5-main branch]
2024-01-18 09:56:55 -05:00
yuriy odonnell
a09c23c4f6 ShaderMinifier - Use memstack for various temporary allocations
#jira UE-203990
#rb Jason.Nadro

[CL 30647996 by yuriy odonnell in ue5-main branch]
2024-01-16 17:45:20 -05:00
dan elksnitis
89776aba21 [shaders] add ANSICHAR path for FShaderSource and enable by default
#rb Yuriy.ODonnell, Laura.Hermanns
#jira UE-196110

[CL 30632304 by dan elksnitis in ue5-main branch]
2024-01-16 09:15:51 -05:00
dan elksnitis
f230a0d2d0 [shaders] shaderconductorcontext improvements:
- add support to shaderconductor to load shader source from a FAnsiStringView
- remove internal string conversion helpers in favour of using FAnsiString
- don't make copies of input strings if they are provided in ANSI format

#rb Laura.Hermanns

[CL 30594203 by dan elksnitis in ue5-main branch]
2024-01-12 11:06:50 -05:00
dan elksnitis
9bcbc546f7 [shaders] fix minifier test inputs to include simd padding
#rb Yuriy.ODonnell
#jira UE-203438

[CL 30567118 by dan elksnitis in ue5-main branch]
2024-01-11 09:14:09 -05:00
graham wihlidal
74a234bb5d RDNA disassembler fixes
**
- Support for DS instructions
- Fixed DS microcode format
- Added missing instructions

#rb Rune.Stubbe
#fyi brian.karis, yuriy.odonnell, dan.elksnitis, luke.thatcher
#jira none

[CL 30513791 by graham wihlidal in ue5-main branch]
2024-01-09 14:57:00 -05:00
dan elksnitis
3dacd52109 [shaders] add support for single byte char path for minifier simd optimizations
#rb Yuriy.ODonnell
#jira UE-196110

[CL 30393653 by dan elksnitis in ue5-main branch]
2023-12-19 08:59:03 -05:00
dan elksnitis
a9037b25ed [shaders]
- add FShaderSource class which wraps source as populated by preprocessing and subsequently accessed by compilation and other debug features; this class automatically inserts zeroed padding such that 16-byte-wide SIMD string comparison operations do not require a non-SIMD tail to process any overhang.
- add typedefs for the string/view/character types and update preprocessing code to use these typedefs instead of the explicit types
- add explicit if constexprs in minifier code around char width to disable simd optimizations for char width != 2 (and subsequently skip the non-simd tail if char width == 2 since FShaderSource automatically adds the required padding)

#rb Jason.Nadro, Yuriy.ODonnell

[CL 30358137 by dan elksnitis in ue5-main branch]
2023-12-15 15:28:27 -05:00
dan elksnitis
be1f64ef8d [shaders] remove unused remnants of TEXT macro parsing code
#rb massimo.tristano

[CL 30214077 by dan elksnitis in ue5-main branch]
2023-12-08 12:36:13 -05:00
dan elksnitis
6ed653a189 [shaders] further preprocessing cleanup
- move sequence of preprocessing steps out of ShaderPreprocessor module and into UE::ShaderCompilerCommon::ExecuteShaderPreprocessingSteps; the former is now explicitly just the low-level preprocessor lib
- add an implementation of PreprocessShader in FBaseShaderFormat so backends which have no custom code to execute as part of preprocessing can just automatically inherit this implementation, and fix up such backends to eliminate now-unnecessary overrides

#rb christopher.waters, Laura.Hermanns

[CL 30178136 by dan elksnitis in ue5-main branch]
2023-12-07 08:55:41 -05:00
dan elksnitis
c1f33c7a82 [shaders] debug usf/direct compile cleanup
- never append the environment defines as commented code to the source used for further preprocessing/compilation; instead only append it to the debug USF
- strip comments after loading the debug usf in direct compile mode as some backends expect comments to have already been removed and the extra ones we add to the debug dump cause them to barf
- change all #if 0s in the debug usf to block comments instead so the above can strip them (said backends also don't like preprocessor directives left in the file)

#rb Jason.Nadro, rob.krajcarski

[CL 30161438 by dan elksnitis in ue5-main branch]
2023-12-06 13:32:32 -05:00
dan elksnitis
cc7c2c54f4 [shaders] shader format preprocessing cleanup & refactoring
- move uniform buffer cleanup and dead stripping into ShaderPreprocessor module's PreprocessShader function
- add "required symbols" to compiler input struct to specify additional symbols to keep during minification aside from those specified by the entrypoint; modify API such that both an entry point string and additional symbols can be specified (to avoid each backend needing to manually parse the compound RT entry point string)
- make use of ModifyShaderCompilerInput in all backends to set additional defines and required symbols on input struct up front; only use the AdditionalDefines map in cases where it's actually necessary
- remove the various per-platform defines for enabling minifier, no longer required now that this has been rolled out for all backends
- fix SCW directcompile mode; this had rotted due to pieces of the FShaderCompilerEnvironment having been added that weren't explicitly serialized to either cmdline or in the shader source. this now serializes as a base64 string written inside the USF containing all portions of the environment required for compilation (using the same serialization function as is used to write/read the SCW input file)
- use a debug flag for indicating we're in "direct compile" mode and should load the debug USF off disk, rather than the poorly named "bSkipPreprocessedCache" (this name is both inaccurate and also confusing due to the addition of the preprocessed job cache)
- modify platform "force wave32" mechanism to use a pragma directive to set a compiler define, instead of doing string replacement in the preprocessed source
- add a view version of the RT entrypoint parsing to use in preprocessing, note that other paths still need to construct fstrings due to further manipulation so keeping the FString path around too
- clean up backends manually checking the "directcompile" cmdline arg

#rb christopher.waters, Yuriy.ODonnell
#rb Chris.Waters
#rb Laura.Hermanns

[CL 30023082 by dan elksnitis in ue5-main branch]
2023-11-30 15:56:34 -05:00
marc audy
763a611985 Fix C4072 warnings
#rnx

[CL 29852844 by marc audy in ue5-main branch]
2023-11-20 17:26:53 -05:00
daniele vettorel
e39770acde Support exporting shader symbols info for PC D3D_SM6 shaders.
The PDB name is either retrieved from the PDB blob part of DXC's output, or is generated using the shader hash that DXC reports even when no PDB is requested. We don't export PDBs because it would result in duplicate data as we use embedded PDBs.

#rb christopher.waters, Laura.Hermanns

[CL 29723169 by daniele vettorel in ue5-main branch]
2023-11-14 15:18:29 -05:00
marc audy
399bcf9971 Disable PVS warning V758
Silence V570 false positives for bit field assignments
Silence various other PVS warnings
#rnx

[CL 29706746 by marc audy in ue5-main branch]
2023-11-14 00:29:43 -05:00
laura hermanns
d6acdc4eab Make DXC compile arguments consistent between Vulkan backend and CompileDXC.bat script.
#jira UE-198594
#rb Dan.Elksnitis
#rnx

[CL 29569710 by laura hermanns in ue5-main branch]
2023-11-08 14:23:36 -05:00
christopher waters
6f3f63b186 Bindless Conversion Changes
- Removing the need for COMPILER_DEFINE on GetResourceFromHeap and GetSamplerFromHeap
- FShaderParameterParser constructor now requires a FPlatformConfiguration object that each shader format can configure.
- FPlatformConfiguration::GenerateBindlessAccess allows each platform to generate the code for accessing a bindless resource or sampler.
- Added EShaderParameterParserConfigurationFlags to specify support for stable constant buffers and bindless.
- Moved EBindlessParameterMode into EShaderParameterParserConfigurationFlags::BindlessUsesArrays
- While moving things around, I was able to convert some TCHAR* uses to FStringView

#jira UE-166341
#rb mihnea.balta

[CL 29533376 by christopher waters in ue5-main branch]
2023-11-07 16:26:20 -05:00
laura hermanns
fd8e0deffe Add support for operator overloading in HlslParser.
#jira UE-199758
#rb Jason.Nadro
#rnx

[CL 29533249 by laura hermanns in ue5-main branch]
2023-11-07 16:23:11 -05:00
serge bernier
9ce7402b1f Support INVARIANT on platform using DXC-SPIRV
-Add a new define to wrap the output semantic that we want to be post declare as precise.
-Modify DXC-SIRV to add the NoContraction decorator on precise output semantics.
-Modify spirv_glsl to post declare as precise output semantics
  -Example: out precise float4 gl_positon; will add precise gl_position; post declaration.

[REVIEW] [at]laura.hermanns

[CL 29338529 by serge bernier in ue5-main branch]
2023-11-01 19:14:21 -04:00
laura hermanns
1daf299a10 Patch order of entry point parameters in cross-compiled HLSL of D3D11 backend using HlslParser.
#jira UE-186066
#rb Dan.Elksnitis
#rnx

[CL 29257708 by laura hermanns in ue5-main branch]
2023-10-30 19:37:05 -04:00
jason hoerner
0e18ea7e81 Shader Preprocessor: Roll TEXT macro substitution into the C preprocessor step, via custom macro callback feature, making it effectively free. Saves 3% overall on preprocess, but also represents a simplification by reducing the number of unique preprocess passes.
#jira UE-198496
#rnx
#rb dan.elksnitis yuriy.odonnell jason.nadro

[CL 29100104 by jason hoerner in ue5-main branch]
2023-10-25 16:01:11 -04:00
jason hoerner
4bb44a53c7 Shader Preprocessor: Compact commented out uniform buffer declarations out of the source code in CleanupUniformBufferCode. Saves 9% of overall preprocess time by avoiding comment scanning in minifier parse step. Also took this opportunity to remove the unused original CleanupUniformBufferCode implementation -- the new version has been stable, so we don't need a CVar toggle any more.
#rnx
#rb yuriy.odonnell jason.nadro

[CL 29095286 by jason hoerner in ue5-main branch]
2023-10-25 13:58:44 -04:00
christopher waters
ab21e17d39 Bindless Resources
- Splitting "Bindless Resource" shader parameter types into "Bindless SRV" and "Bindless UAV" to make sure reflection/binding validation is correct.

#jira UE-166341
#rb jeannoe.morissette

[CL 28995862 by christopher waters in ue5-main branch]
2023-10-20 23:12:44 -04:00
laura hermanns
1f90f8d0a2 Extend HlslParser to support Substrate:
- Support struct forward declarations.
- Support static member functions.
- Support scoped function definitions.

#jira UE-186066
#rb Jason.Nadro
[FYI] Sebastien.Hillaire, Christopher.Waters
#rnx

[CL 28959874 by laura hermanns in ue5-main branch]
2023-10-20 06:51:39 -04:00