Commit Graph

110 Commits

Author SHA1 Message Date
dan elksnitis
b5acd2894d [shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers (resubmit with pipeline serialization fix)
#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23893259 by dan elksnitis in ue5-main branch]
2023-01-27 17:02:08 -05:00
dan elksnitis
017b41a8b3 [Backout] - CL23885168
#fyi dan.elksnitis
Original CL Desc
-----------------------------------------------------------------
[shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers

#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23889694 by dan elksnitis in ue5-main branch]
2023-01-27 14:57:37 -05:00
dan elksnitis
5788613c9d [shaders] unify handling of single job bSucceeded flag; wasn't getting set properly when not using workers
#rb Yuriy.ODonnell
#rb Laura.Hermanns
#rb Jason.Nadro
#preflight 63d2e011d21dbe1d29be43c1

[CL 23885168 by dan elksnitis in ue5-main branch]
2023-01-27 12:04:51 -05:00
dan elksnitis
da802ed74c [shaders]
- move compile job types into RenderCore and use them in SCW
- using the above factor out a helper function for pipeline job compilation to further reduce code duplication
- make flags indicating job success/failure conditions part of the SCW output data rather than evaluating them when reading the output (so they can be evaluated once in the helper function mentioned above)
- modify debug worker input dumps to write a single file for combined-pipeline compilation rather than one file per stage

#rb Yuriy.ODonnell
#preflight 63d1725d574ab9cae4c93d76

[CL 23868225 by dan elksnitis in ue5-main branch]
2023-01-26 10:35:39 -05:00
dan elksnitis
be95382d48 [shaders] factor out single-input compilation and exception handling into shared utility functions
#preflight 63caa36ad45afa2a8f236855
#rb Jason.Nadro
#rb Laura.Hermanns
#rb Yuriy.ODonnell

[CL 23789494 by dan elksnitis in ue5-main branch]
2023-01-20 09:39:05 -05:00
dan elksnitis
cfcde3fcbf [shaders] remove functionality which allows setting cvars via the shader input environment, along with the only existing usage of it (which is obsolete)
this has much potential for misuse, and is generally incompatible with the goal of in-process multithreaded compilation

#rb Jason.Nadro
#rb Yuriy.ODonnell
#preflight 63c94ba902024f93d83dfbbc

[CL 23772691 by dan elksnitis in ue5-main branch]
2023-01-19 09:12:23 -05:00
laura hermanns
5e725d3838 Reissue shader compile jobs on OOM error.
#rb Jason.Nadro, Yuriy.Odonnell
[FYI] Dan.Elksnitis
#jira UE-171694, FORT-540901, FORT-534644
#preflight 639273aa67018b14b5b53ddf
#rnx

[CL 23499949 by laura hermanns in ue5-main branch]
2022-12-13 18:21:32 -05:00
laura hermanns
daffbf30c9 Bump GUID in ShaderVersion.ush to invalidate shader DDC and fix SCW output file protocol on the non-error path. Appendix to CL 23427669.
#rb Aaron.Eady
[FYI] Brandon.Schaefer, Chihyu.Hsieh, Fredrik.Seehuusen, Jordan.Triomphe
#preflight none
#rnx

[CL 23429492 by laura hermanns in ue5-main branch]
2022-12-07 11:27:09 -05:00
laura hermanns
bcf95545bd Add host machine name to OOM report in DXC backend and refactor global SCW error-code handling. Bumped ShaderCompileWorkerOutputVersion to 9.
#rb Jason.Nadro, Dan.Elksnitis, Yuriy.Odonnell, Arciel.Rekman
#preflight 638e610c255f07df8ea212f4
#rnx

[CL 23428544 by laura hermanns in ue5-main branch]
2022-12-07 10:29:08 -05:00
kate ellis
839f9f1889 [Backout] - CL23401851
[FYI] Laura.Hermanns
Original CL Desc
-----------------------------------------------------------------
Add host machine name to OOM report in DXC backend and refactor global SCW error-code handling.

#rb Jason.Nadro, Dan.Elksnitis, Yuriy.Odonnell, Arciel.Rekman
#preflight 638e610c255f07df8ea212f4
#rnx

[CL 23421737 by kate ellis in ue5-main branch]
2022-12-06 19:47:06 -05:00
laura hermanns
c17b2976f9 Add host machine name to OOM report in DXC backend and refactor global SCW error-code handling.
#rb Jason.Nadro, Dan.Elksnitis, Yuriy.Odonnell, Arciel.Rekman
#preflight 638e610c255f07df8ea212f4
#rnx

[CL 23421619 by laura hermanns in ue5-main branch]
2022-12-06 19:45:07 -05:00
dan elksnitis
8801f83bb2 [shaders] add support to run STB preprocessor instead of MCPP; add a cvar to disable this and instead use the legacy preprocessor (currently this is set to true - i.e. still using MCPP - by default)
#rb Yuriy.ODonnell
#rb Jason.Nadro
#preflight 6387663c3377450900c5522b

[CL 23350844 by dan elksnitis in ue5-main branch]
2022-12-01 09:27:13 -05:00
dan elksnitis
b8959132c3 [shaders] add option to SCW to keep input files rather than deleting them; modify the cmdline args generated for the "single job" debug worker input files to include this option so the debug input file won't be deleted after executing to completion.
#rb Jeremy.Moore
#preflight 6386190af213a116eb214130

[CL 23306380 by dan elksnitis in ue5-main branch]
2022-11-29 10:00:37 -05:00
dan elksnitis
92c56f938f [ShaderCompileWorker] minor fixes:
- allow 0 TimeToLive to be specified explicitly on commandline (useful when debugging single-job debug worker input files, without this it keeps running the same job repeatedly) and modify single job worker input commandline txt file to use this instead of 0.5f
- change config-conditional behaviour serializing to memory instead of file on disk to be conditional on an optional cmdline argument instead, and move file copy into the block that does the file writing (otherwise it repeatedly tries and fails to copy the nonexistent file)

#preflight 6377fed033774509008c42c6
#rb Jason.Nadro

[CL 23234934 by dan elksnitis in ue5-main branch]
2022-11-22 09:42:02 -05:00
james hopkin
f5bf9d10c3 Added version to output when running SCW without arguments
[CL 22959067 by james hopkin in ue5-main branch]
2022-11-03 14:22:06 -04:00
dan elksnitis
847df31bfd [shaders]
- fix collisions in debug dumps for material shaders - name the folder based on the material instance name (if building a material instance) instead of just the base material name, also hash the asset path and static parameters to differentiate materials with the same name and different path and different static permutations
- add a debug dump option for writing single-job ShaderCompileWorker input files to allow debugging SCW in normal operation mode (including a separate txt file containing commandline args for SCW to do so)
- use path concatenation operator instead of + in shadercompileworker when constructing input/output file paths

#preflight 6362a45d6000216d2e15cd5b
#rb Christopher.Waters
#rb Rolando.Caloca
#rb Yuriy.ODonnell

[CL 22920594 by dan elksnitis in ue5-main branch]
2022-11-02 13:27:30 -04:00
christopher waters
0621d20368 More shader compiling code wrapped with WITH_EDITOR checks
- Focused around moving GlobalBeginCompileShader and friends.
- ModifyCompilationEnvironment and ValidateCompiledResult now only compiled in Editor builds.
- Measured 0.5MB to 1.0MB elf size reduction depending on platform.

#jira none
#rb jason.nadro, arciel.rekman, florin.pascu
#preflight 63613f992b5338aceb442902

[CL 22890964 by christopher waters in ue5-main branch]
2022-11-01 16:31:27 -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
Jason Nadro
a673e16ce5 Added the ability to do Unreal Insights traces of the Shader Compiler Worker process.
This can be enabled by modifying `UnrealEngine\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml` like so:

    <?xml version="1.0" encoding="utf-8" ?>
    <Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
        <BuildConfiguration>
            <bShaderCompilerWorkerTrace>true</bShaderCompilerWorkerTrace>
        </BuildConfiguration>
    </Configuration>

- Added a build configuration xml value, `bShaderCompilerWorkerTrace`.
- Turning this on will set USE_SHADER_COMPILER_WORKER_TRACE=1
- Move the parameter -nothreading to be set when we launch the process instead of internally as an extra cmd line arg.
- Unreal Insights uses a separate thread to send events so threading support is needed for the program.  When we have USE_SHADER_COMPILER_WORKER_TRACE enabled we need to turn off `-nothreading`.
- When USE_SHADER_COMPILER_WORKER_TRACE is enabled we pass in `-trace=default` to get CPU event markers.
- The SCW program needs to turn on the following defines to be able to perform CPU and memory traces:
	ENABLE_LOW_LEVEL_MEM_TRACKER=1
	UE_MEMORY_TAGS_TRACE_ENABLED=1
	UE_TRACE_ENABLED=1
- Instrument Shader Compiler Worker with TRACE_CPUPROFILER_EVENT_SCOPE.  This are no-ops when this is turned off.

todo: Make the shader compiler worker inherit the trace args from the main process it was launched from.

#rb Yuriy.ODonnell
#jira none
#preflight 634ef80269246074db9637c2

[CL 22625183 by Jason Nadro in ue5-main branch]
2022-10-19 10:33:36 -04:00
james hopkin
07e90343eb Fixed typo in error message
[CL 22561565 by james hopkin in ue5-main branch]
2022-10-17 08:42:39 -04:00
Florin Pascu
6b3c1469ba Preview Shader Platform using different ShaderMaps and the DDPI/Cvar values of the Previewable Actual Platform
NumPlatforms limit changed from 64 to 65536, limited by NumBits
#jira UE-120561
#rb Chris.Waters, Jack.Porter, Mihnea.Balta
#preflight 630f1604f92416fb92b373ab

[CL 21718179 by Florin Pascu in ue5-main branch]
2022-08-31 04:38:34 -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
d952341915 Temp-fix for non-Windows platforms
#rb Brandon.Schaefer
#jira none
#preflight none
#fyi  Brandon.Schaefer

[CL 20876249 by Florin Pascu in ue5-main branch]
2022-06-29 11:51:42 -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