Commit Graph

237 Commits

Author SHA1 Message Date
Yuriy ODonnell
398f6e6d79 ShaderMinifier - Add an option to preserve comment lines
#rb dan.elksnitis
#preflight 63630eac522c8f7ab36344e0

[CL 22943808 by Yuriy ODonnell in ue5-main branch]
2022-11-03 02:13:18 -04:00
Yuriy ODonnell
f9824703c2 ShaderMinifier - Add basic test for MinifyShader, change SkipUntilNextLine to exclude new line character
#rb none (trivial)
#preflight 636068cde271e75dea59c739

[CL 22876523 by Yuriy ODonnell in ue5-main branch]
2022-10-31 21:34:29 -04:00
yuriy odonnell
9de862ab0b Add UE::ShaderCompilerCommon::RemoveDeadCode() high-level wrapper for shader minifier, to be consistently used in all shader compiler back-ends
#preflight 635af3aa1b7de936a5295629
#rb jason.nadro

[CL 22850483 by yuriy odonnell in ue5-main branch]
2022-10-29 01:51:27 -04:00
dan elksnitis
ecab3b4a9a [shaders] refactor usf/directcompile.txt dump into a utility in ShaderCompilerCommon to reduce code duplication in the shader backends
#rb Jason.Nadro
#rb Christopher.Waters
#preflight 635bf1e1df01edd149f5727e

[CL 22829548 by dan elksnitis in ue5-main branch]
2022-10-28 11:45:49 -04:00
dan elksnitis
b81ae6648c [shader compilation] changes to error handling in ShaderCompileWorker
- each platform compilation request is now wrapped in __try/__except rather than a single exception handling block at the top level of the worker; this allows us to log an exception (with callstack) as a compilation error and continue the batch
- remove SEH code from ShaderConductorContext, the above makes this redundant (and it didn't provide any actionable information)
- strip down SEH code in D3DShaderCompiler; now only used for the purposes of pre-compiling with DXC in the case of an FXC crash. dumping preprocessed source will be handled in a different manner in a forthcoming CL
- minor change in the DXC precompile path to not log an unnecessary warning when performing an explicitly-requested DXC precompile

#rb Jason.Nadro
#rb Laura.Hermanns
#rb Yuriy.ODonnell
#preflight 63514c798176062ea73acb41
#jira FORT-524383

[CL 22654436 by dan elksnitis in ue5-main branch]
2022-10-20 09:43:50 -04:00
jeremy moore
4fd942ac5e Consider the minimizer to not have succeeded if it returns an empty result.
[CL 22636282 by jeremy moore in ue5-main branch]
2022-10-19 15:51:11 -04:00
christopher waters
f5ff98f2e1 ShaderParameterParser cleanup
- Making ConstantBufferType a constructor only argument. This removes the duplicated logic of calling ShouldUseStableConstantBuffer.
- Moving ShouldUseStableConstantBuffer to ShaderCompilerCommon.
- Made UE::ShaderCompilerCommon::ParseParameterType array arguments const

#jira UE-166341
#rb Guillaume.Abadie
#preflight 634eeceea1527f6b3bda9ff0

[CL 22608320 by christopher waters in ue5-main branch]
2022-10-18 15:25:05 -04:00
Yuriy ODonnell
9ab9403717 ShaderMinifier - Track and output line directives
#rb Jason.Nadro
#preflight 63406dd22a0a2c1ead8d1145

[CL 22405822 by Yuriy ODonnell in ue5-main branch]
2022-10-07 14:31:38 -04:00
christopher waters
66f2a6bcc5 Make the parsed resource/sampler name be the authoritative casing of the variable names. The rest of the shader system is case insensitive but the shader code that uses the variables isn't, so we need to preserve the case we found in the shader.
#jira UE-166341
#rb Guillaume.Abadie, mihnea.balta, jeannoe.morissette
#preflight 634055772a0a2c1ead83dc02

[CL 22404161 by christopher waters in ue5-main branch]
2022-10-07 13:35:29 -04:00
christopher waters
2a22fbe25b Bindless Resource shader support
- Adding better support for resources that have multiple template arguments (Texture2DMS<float4,2>, etc).
- Requires typedef'ing all Resource types to avoid their extra comments being given to our AUTO_BINDLESS macros
- Adding support for globallycoherent
- Reworked BindlessConversionType to use its own enum.

#jira UE-166341
#rb guillaume.abadie, elizabeth.baumel
#preflight 633f2bde587d6afac82007e4

[CL 22383098 by christopher waters in ue5-main branch]
2022-10-06 16:27:11 -04:00
christopher waters
93ae33e36e Fixing parsing resource types like "Texture3D < uint4 >" where the space between the type and the "<" prevented the type from being found.
#jira UE-166341
#rb yuriy.odonnell
#preflight 633f0069607039cbc1082ef0

[CL 22378331 by christopher waters in ue5-main branch]
2022-10-06 13:04:52 -04:00
christopher waters
41c44beead Cleaning up deprecated items in "Shader" files for 5.2
#jira none
#rb yuriy.odonnell
#preflight 633cab5d0e66c104f1daed41

[CL 22356197 by christopher waters in ue5-main branch]
2022-10-05 11:38:15 -04:00
Yuriy ODonnell
7e99cc870a ShaderMinifier - Ignore known resource types when looking for potential identifier names. Also add inclusion reason tracking for global variables.
#rb Jason.Nadro
#preflight 6322645eb602881e8e54709f

[CL 22029907 by Yuriy ODonnell in ue5-main branch]
2022-09-15 11:33:09 -04:00
bryan sefcik
a3dddc6630 Pass 1 on Developer include fixes:
Removed redundant private include paths from build.cs files.
Fixed include paths to be relative to the private or public folders.
Hid or removed includes that reached into other private module folders.
Updated PublicInclude paths when necessary.

#jira
#preflight 631e281694758d0bf2ea1399

[CL 21960082 by bryan sefcik in ue5-main branch]
2022-09-11 18:32:18 -04:00
Yuriy ODonnell
a18b223061 Groundwork for custom shader preprocessing step that removes unused code from shader source before compilation (not used yet by the shader pipeline)
#preflight 631bca62304480f8f8c2db54
#rb Jason.Nadro

[CL 21931128 by Yuriy ODonnell in ue5-main branch]
2022-09-09 19:33:52 -04:00
Yuriy ODonnell
bdcb1cc814 Move duplicated implementations of ParseRayTracingEntryPoint() to ShaderCommon module
#preflight 631a28a0967ffc68fbe3d8a7
#rb jason.nadro

[CL 21900443 by Yuriy ODonnell in ue5-main branch]
2022-09-08 15:20:52 -04:00
christopher waters
bd14aa177e Moving bindless resource count validation into the new UE::ShaderCompilerCommon::ValidatePackedResourceCounts
#jira UE-161950
#rb kenzo.terelst, yuriy.odonnell
#preflight 6307a0d03703fd9528673032

[CL 21567446 by christopher waters in ue5-main branch]
2022-08-25 13:02:21 -04:00
bryan sefcik
de1956f47b Ran IWYU on Public headers under Engine/Source/Developer/...
Headers are updated to contain any missing #includes needed to compile and #includes are sorted.  Nothing is removed.

#ushell-cherrypick of 21064294 by bryan.sefcik
#jira
#preflight 62d5c2111062f2e63015e598

#ROBOMERGE-OWNER: bryan.sefcik
#ROBOMERGE-AUTHOR: bryan.sefcik
#ROBOMERGE-SOURCE: CL 21155249 via CL 21158121 via CL 21161259
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21182053 by bryan sefcik in ue5-main branch]
2022-07-20 12:03:45 -04:00
christopher waters
a987160f55 Reworking the parameter rewrite code to do automatic bindless
- Refactoring FShaderParameterParser to use more string views since we can rely on OriginalParsedShader not changing.
- Split FShaderParameterParser::ParseAndMoveShaderParametersToRootConstantBuffer into smaller functions
- Moving FShaderParametersMetadata::IterateShaderParameterMembers into the only module it's used in, ShaderParameterParser.cpp
- Adding CFLAG_BindlessResources which will be set when ENABLE_BINDLESS_RESOURCES is set
- Adding CFLAG_BindlessSamplers which will be set when ENABLE_BINDLESS_SAMPLERS is set
- Adding resource/sampler detection and conversion to bindless in FShaderParameterParser

#jira UE-139616
#rb guillaume.abadie, jeannoe.morissette, yuriy.odonnell, laura.hermanns
#preflight 62d180cce468fcfd0b7001a0

[CL 21111994 by christopher waters in ue5-main branch]
2022-07-15 12:25:44 -04:00
Charles deRousiers
f28dbfe6dd Fix false-positive error when adding an empty TEXT("") macro to a shader.
#rb none
#jira none
#preflight 62c84bc3e060ecd065bc63a9

[CL 21036977 by Charles deRousiers in ue5-main branch]
2022-07-11 02:41:07 -04:00
Florin Pascu
f64fc575d2 Re-submiting with Mac fixes
Changed ShaderArchive, GlobalShaderCache, ShaderDebugInfo and Autogen to use ShaderPlatformName and not ShaderFormat when naming their output files.
#rb Jack.Porter, Chris.Waters, Mihnea.Balta, Jason.Nadro
#jira UE-120561
#preflight 62c31f6fc9410537282296c6

[CL 20937870 by Florin Pascu in ue5-main branch]
2022-07-04 19:06:33 -04:00
Florin Pascu
09cb19fcfd Backout 20871665 to fix Mac cook
#rb none
#jira none
#preflight 62be0c68d94b57687c3ff309

[CL 20904999 by Florin Pascu in ue5-main branch]
2022-06-30 17:41:55 -04:00
Florin Pascu
1844e8e514 Changed ShaderArchive, GlobalShaderCache, ShaderDebugInfo and Autogen to use ShaderPlatformName and not ShaderFormat when naming their output files.
#rb Jack.Porter, Chris.Waters, Mihnea.Balta, Jason.Nadro
#jira UE-120561
#preflight 62bbf93ae353c20ac2361d94

[CL 20871665 by Florin Pascu in ue5-main branch]
2022-06-29 04:19:06 -04:00
christopher waters
b28a0c467f Moving ShaderParameterParser into its own source files.
#jira none
#rb guillaume.abadie, kenzo.terelst
#preflight 62b0ecb8ec13d14b5a1897ba

[CL 20757788 by christopher waters in ue5-main branch]
2022-06-21 10:49:56 -04:00
christopher waters
1e01768e33 Bindless shader parameters
- Adding support for bindless resources/samplers. The loose resources have to be wrapped in a macro that generates an index and proxy resource when bindless is enabled. Reflection has to parse these differently from other resources since they're parsed as uint parameters. The runtime also has to bind these differently since they end up needing to find their real resource in the binding data and then update a constant buffer.
- To assist in conversions, the shader compiler will detect if a shader is compiled with both bindless and non-bindless resources/samplers and will emit errors if that is the case.
- Adding support for bindless Uniform Buffer resources/samplers. Because Uniform Buffers aren't per-shader, they'll always update their constants with the bindless indices of their resources.
- Adding more flags to FShaderCodePackedResourceCounts required changing all the array initializations to individual parameters since not all the new flags are used everywhere.
- No shaders have been configured to support bindless resources/samplers. Yet.

#jira UE-139616
#rb zach.bethel, arciel.rekman
#preflight 6282b8ec44349a6581a21a39

[CL 20250348 by christopher waters in ue5-main branch]
2022-05-17 16:30:48 -04:00