Commit Graph

298 Commits

Author SHA1 Message Date
christopher waters
cb17f328e6 Unifying bindless code generation.
- Array-based bindless (Vulkan) only needed one more piece of data to use "GenerateBindlessAccess"
- Now all bindless shader platforms will generate a getter function for each bindless resource/sampler.

#rb dan.elksnitis, jeannoe.morissette

[CL 32375983 by christopher waters in ue5-main branch]
2024-03-20 14:41:02 -04:00
matanshukry
4de594b05f [DXC] DXC release-1.8.2403 update; Re-introduce CL 32167265 with fixes.
This re-introduced the backed-out CL for the DXC update including fixes to detect derivitive opcodes in DXIL containers and a null-pointer fix in the DXIL code generator (GitHub draf #6411).
Only the Windows binary is updated since no other platform uses the DXIL code generator. Linux and Mac binary updates will follow in a separate CL.

Also replaced DXIL binary with v1.8 obtained from https://github.com/microsoft/DirectXShaderCompiler/releases/tag/v1.8.2403

#jira UE-203636
#rb Graham.Wihlidal, Jeremy.Moore
[FYI] Bob.Tellez, Dan.Elksnitis

[CL 32257727 by matanshukry in ue5-main branch]
2024-03-14 16:16:24 -04:00
christopher waters
63dcb443e0 Removing LogD3D11ShaderCompiler and LogD3D12ShaderCompiler in favor of LogD3DShaderCompiler.
#rb Laura.Hermanns

[CL 32250370 by christopher waters in ue5-main branch]
2024-03-14 13:29:58 -04:00
christopher waters
5a8c01556a Adding proper SM6.8 support to ShaderFormatD3D
- Only WorkGraph shaders use this currently.
- SM6.8 needs to set the __SHADER_TARGET_MAJOR and __SHADER_TARGET_MINOR defines
- Changing some logic that was SM6.6 specific to now allow the higher shader model.

#rb Jeremy.Moore

[CL 32220197 by christopher waters in ue5-main branch]
2024-03-13 13:48:54 -04:00
christopher waters
cd0d92d515 Moving copy-pasted code into ShaderCompilerCommon.
#rb dan.elksnitis, jeannoe.morissette

[CL 32215186 by christopher waters in ue5-main branch]
2024-03-13 11:33:04 -04:00
jeremy moore
804418158d #jira UE-206245, UE-206247
Add basic DX12 Work Graph support.
For this first pass there is no exposed RHI functionality for directly dispatching a work graph. Instead shader bundles have been extended to support a work graph based implementation.
Nanite compute materials now can use work graph shader bundles on D3D12 when r.Nanite.AllowWorkGraphMaterials and r.Nanite.Bundle.Shading are both set. Both of these default to off at the moment.
Also DataDrivenPlatformInfo now expose bSupportsWorkGraphs. This is false everywhere, but will be enabled for D3D12_SM6 as soon as we have the latest DXC shader compiler with lib_6_8 support submitted.
#rb Kenzo.Terelst, Yuriy.ODonnell

[CL 32196717 by jeremy moore in ue5-main branch]
2024-03-12 18:42:09 -04:00
bob tellez
786acc30b5 [Backout] - CL32167265
[FYI] Laura.Hermanns
Original CL Desc
-----------------------------------------------------------------
[DXC] DXC release-1.8.2403 update

This is the last CL of the DXC update including the binary files and API headers. The other CLs including all source changes are:
- 32164743 SPIRV-Headers
- 32166600 SPIRV-Tools
- 32165724 SPIRV-Cross
- 32165890 DirectXShaderCompiler
- 32165937 ShaderConductor
- 32165762 googletest
- 32165815 cxxopts

#jira UE-203636
#rb Graham.Wihlidal, Carl.Lloyd, JeanNoe.Morissette, Florin.Pascu, Serge.Bernier
[FYI] Dan.Elksnitis, Jason.Nadro, Yuriy.Odonnell, Jeremy.Moore

[CL 32172513 by bob tellez in ue5-main branch]
2024-03-11 23:38:27 -04:00
laura hermanns
183be489c9 [DXC] DXC release-1.8.2403 update
This is the last CL of the DXC update including the binary files and API headers. The other CLs including all source changes are:
- 32164743 SPIRV-Headers
- 32166600 SPIRV-Tools
- 32165724 SPIRV-Cross
- 32165890 DirectXShaderCompiler
- 32165937 ShaderConductor
- 32165762 googletest
- 32165815 cxxopts

#jira UE-203636
#rb Graham.Wihlidal, Carl.Lloyd, JeanNoe.Morissette, Florin.Pascu, Serge.Bernier
[FYI] Dan.Elksnitis, Jason.Nadro, Yuriy.Odonnell, Jeremy.Moore

[CL 32167352 by laura hermanns in ue5-main branch]
2024-03-11 17:55:53 -04:00
graham wihlidal
831fff0c59 Added CFLAG_ShaderBundle and decorated Nanite CS materials with it (some platforms can use this to build relevant data structures for internal bundle implementations).
#rb yuriy.odonnell
[REVIEW] https://p4-swarm.epicgames.net/reviews/32011926

[CL 32012726 by graham wihlidal in ue5-main branch]
2024-03-05 00:40:11 -05:00
christopher waters
62f06a4bb7 Disabling PLATFORM_SUPPORTS_CONSTANTBUFFER_OBJECT for now.
We can't get usage information from reflection with this enabled, mainly for bindless, so we'll need to revisit this later.

#rb Laura.Hermanns

[CL 31741310 by christopher waters in ue5-main branch]
2024-02-22 18:32:53 -05:00
christopher waters
68308c5193 Shader statistics
- Adding utility function for easier additions to FShaderCompilerOutput::ShaderStatistics
- Simplified existing uses of FShaderCompilerOutput::ShaderStatistics
- Reworked D3D compilation to allow DXC vs FXC to specify their different shader limits.
- Adding Shader Statistics for D3D SamplerState and Resource usages.
- Adding Shader Statistics for D3D SM6.6 bindless resource usages.

#rb Jason.Nadro, Laura.Hermanns

[CL 31740056 by christopher waters in ue5-main branch]
2024-02-22 18:16:34 -05:00
yuriy odonnell
01419a8913 Add strongly typed EShaderOptionalDataKey to access shader optional data instead of adhoc characters
#rb carl.lloyd, christopher.waters, Colton.Daniels

[CL 30572888 by yuriy odonnell in ue5-main branch]
2024-01-11 13:36:32 -05:00
chris kulla
2cd6fd99d1 Shader Compiler - Propagate filename to dxc command line instead of using the same dummy name (zzz) for all shaders.
This is helpful when using a profiler such as nSight

#rb christopher.waters

[CL 30514398 by chris kulla in ue5-main branch]
2024-01-09 15:23:12 -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
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
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
christopher waters
b2f21e1cd0 D3D Bindless
- Forcing EShaderResourceUsageFlags bindless flags when bindless is enabled to avoid ping ponging issues at runtime.

#jira UE-162014
#rb dan.elksnitis

[CL 30001874 by christopher waters in ue5-main branch]
2023-11-29 18:13:23 -05:00
christopher waters
a58fadbd0e Removing invalid check on AutoBindingSpace. The ~0 check was leftover from a long-gone default argument.
[CL 29848711 by christopher waters in ue5-main branch]
2023-11-20 15:10:55 -05:00
jason nadro
eb817693a3 Remove redundant error logging from DXC.
- Only log a system error message if we didn't get any error messages back from the DXC error blob.

#rb Laura.Hermanns
#rnx

[CL 29810728 by jason nadro in ue5-main branch]
2023-11-17 11:58:36 -05:00
christopher waters
15bc726977 Adding Barycentrics support checks
- Adding EShaderCodeFeatures::Barycentrics
- Adding GRHIGlobals.SupportsBarycentricsSemantic
- Adding FDataDrivenShaderPlatformInfo::GetSupportsBarycentricsIntrinsics to control COMPILER_SUPPORTS_BARYCENTRIC_INTRINSICS
- Adding FDataDrivenShaderPlatformInfo::GetSupportsBarycentricsSemantic to control PLATFORM_SUPPORTS_BARYCENTRICS_SEMANTIC

#jira UE-193429
#rb graham.wihlidal, mihnea.balta

[CL 29771745 by christopher waters in ue5-main branch]
2023-11-16 00:28:03 -05:00
daniele vettorel
1baceeffbf Bump PC SM6 and SM5 GUIDs.
[CL 29723661 by daniele vettorel in ue5-main branch]
2023-11-14 15:34:43 -05:00
daniele vettorel
b7da497a83 Fix merge error
[CL 29723250 by daniele vettorel in ue5-main branch]
2023-11-14 15:22:04 -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
christopher waters
ceded8a2b5 Reworking D3D Shader Format support checks
- ELanguage and Input flags were being used inconsistently to determine defines and shader profiles to use.
- ED3DShaderModel now communicates the exact shader model to use to the FXC and DXC backends.
- Moved all D3D custom definitions to ModifyShaderCompilerInput
- D3D definitions have been fixed to be based on specific needs of input flags. ie- "PLATFORM_MAX_SAMPLERS" doesn't imply that wave operations are wanted/supported.

#jira UE-199838
#rb laura.hermanns, michael.wanderson

[CL 29632531 by christopher waters in ue5-main branch]
2023-11-10 01:03:12 -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