Commit Graph

339 Commits

Author SHA1 Message Date
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
matt peters
e53bae0868 MPCook: Add global function UE::GetMultiprocessId to handle the commandline parsing of MultiprocessId for CookWorkers.
#rnx
#rb Zousar.Shaker

[CL 28938402 by matt peters in ue5-main branch]
2023-10-19 18:18:01 -04:00
yuriy odonnell
57397e6c36 Add CPU profiler scope to UE::ShaderCompilerCommon::RemoveDeadCode
#rb none

[CL 28744091 by yuriy odonnell in ue5-main branch]
2023-10-13 04:02:29 -04:00
yuriy odonnell
355a38075e Fix compile error on linux/mac due to indexing arrays with char type
#rb none

[CL 28699927 by yuriy odonnell in ue5-main branch]
2023-10-11 23:46:03 -04:00
yuriy odonnell
dd72ffe26c ShaderMinifier - Optimize BuildLineBreakMap, SkipUntilNonIdentifierCharacter, ExtractIdentifiers and few other bits
* Generate line directive map during parsing
* Use xxhash instead of cityhash
* Avoid FStringView operator [] in ExtractIdentifiers
* Use TArray Reset instead of Empty where appropriate
* Vectorize SkipUntilNonIdentifierCharacter
* Vectorize ExtractBlock
* Vectorize line ending search
* Use FString directly instead of FStringBuilderBase for the final output to avoid a copy

#rb christopher.waters
#rb jason.hoerner

[CL 28699609 by yuriy odonnell in ue5-main branch]
2023-10-11 23:32:28 -04:00
christopher waters
0403f2caa0 Always set the HLSL version and don't assume the default is 2018.
#rb David.Harvey, Yuriy.Odonnell

[CL 28692390 by christopher waters in ue5-main branch]
2023-10-11 19:52:44 -04:00
laura hermanns
0320f2f528 D3D11 cross-compilation fixes:
- Patch HLSL to support SV_DepthGreaterEqual and SV_DepthLessEqual.
- Maintain order of shader input/output variables in cross-compiled HLSL.

#rb Jason.Nadro
#jira UE-186066, UE-192125
#rnx

[CL 28633421 by laura hermanns in ue5-main branch]
2023-10-10 15:30:19 -04:00
christopher waters
0121d81804 Fixing crash that was hidden by hardcoded namespaces.
[CL 28495033 by christopher waters in ue5-main branch]
2023-10-05 08:27:30 -04:00
christopher waters
b9351620ad HlslParser
- Adding ability to 'forward declare' symbols per platform.
- Removes hardcoded symbols in HlslParser.cpp
- Converting a few array/string input types to views.

#rb dan.elksnitis

[CL 28494936 by christopher waters in ue5-main branch]
2023-10-05 08:26:39 -04:00
yuriy odonnell
eb793d3fb5 ShaderMinifier - Use inline implementations of string view Equals and StartsWith
* Also use TEXTVIEW instead of TEXT where possible
* ~1.5x speedup

#rb dan.elksnitis

[CL 28494884 by yuriy odonnell in ue5-main branch]
2023-10-05 08:26:07 -04:00
jason hoerner
bca274f611 Shader Compiler: CleanupUniformBufferCodeNew minor fix to account for escaped quotes in text. Continue string parsing if character before quote is a backslash. Note that there are no escaped quotes in any existing .usf or .ush file at the moment, so I don't think the bug should have caused any issues.
#rnx
#rb dan.elksnitis jason.nadro

[CL 28494850 by jason hoerner in ue5-main branch]
2023-10-05 08:25:49 -04:00
christopher waters
9b84b8accd Fixing enum handling in the shader minifier. Since the enum elements weren't marked as reachable identifiers, the minifier was considering the whole enum block unused.
#rb yuriy.odonnell

[CL 28438918 by christopher waters in ue5-main branch]
2023-10-03 19:32:26 -04:00
yuriy odonnell
d635588f1b ShaderMinifier - Don't skip keyword blocks when building ChunksByIdentifier (temporary workaround for an issue introduced in 28384399)
#rb christopher.waters

[CL 28417897 by yuriy odonnell in ue5-main branch]
2023-10-03 12:08:28 -04:00
yuriy odonnell
86d5bb7306 ShaderMinifier - Add basic support for global operator overloads
#rb christopher.waters

[CL 28417810 by yuriy odonnell in ue5-main branch]
2023-10-03 12:06:47 -04:00
christopher waters
c1487a0042 Adding typedef support to ShaderMinifier.
- Before this, every typedef and the code using them was being included in the final source.
- This was primarily affecting Bindless Resources where all bindless resources were included in the minified code even if they weren't used.

#rb yuriy.odonnell

[CL 28365749 by christopher waters in ue5-main branch]
2023-09-30 11:10:06 -04:00