Commit Graph

45 Commits

Author SHA1 Message Date
Laura Hermanns
6cac5e04e5 Allow allocation of zero bytes in DXC custom allocator, use portable STDCALL declaration, and add error code translation for DXC specific HRESULT values.
#rb Yuriy.Odonnell
#fyi Dan.Elksnitis, Jason.Nadro
#jira none
#preflight 63779846f514e1ded9af11b0
#rnx

[CL 23194073 by Laura Hermanns in ue5-main branch]
2022-11-18 09:43:23 -05:00
laura hermanns
58e529b618 Use custom memory allocator for DXC to report better callstack on OOM event.
#rb Yuriy.ODonnell
[FYI] Jason.Nadro, Dan.Elksnitis, Carl.Lloyd
#preflight none
#rnx

[CL 23072013 by laura hermanns in ue5-main branch]
2022-11-10 01:18:07 -05:00
laura hermanns
b3e8c553e3 Fix "Compile failed without errors" message and unify this error report for FXC and DXC.
#rb Dan.Elksnitis
#rnx

[CL 23034307 by laura hermanns in ue5-main branch]
2022-11-08 14:20:14 -05:00
laura hermanns
b32256418b Log available system memory when DXC crashes on E_OUTOFMEMORY to verify system is in fact out of memory.
#rb Jason.Nadro, Yuriy.Odonnell
[FYI] Dan.Elksnitis
#preflight 636924014d3c1d9d925e05ab
#rnx

[CL 23029673 by laura hermanns in ue5-main branch]
2022-11-08 11:15:46 -05: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
laura hermanns
7785c20330 Abstract number of instructions for complexity visualization by estimated metric.
#preflight 6356f6b30313c24974fc5535
#jira UE-168166
#rb jason.nadro

[CL 22788160 by laura hermanns in ue5-main branch]
2022-10-26 16:15:17 -04:00
chris kulla
b00b7d70d0 Organize Ray Tracing shaders by their payload
Every shader now has the ability to declare which payload it uses. HitGroup, Miss and Callable shaders may only specify a single type, whereas Raygen shaders may provide more than one.

The global raytracing shader libraries have been categorized according to their payload type, which helps facilitate the creation of minimal ray-tracing pipelines.

Avoid adding callable shaders to the RTPSO if they are not being used.

All RHI shader compilers and shader loaders that support ray tracing have been modified to track an extra uint representing the payload type flagged in the source (at time of compilation).

Add the RayTracingPayloadType to the shadermap DDC key so that we can properly detect when a shader's payload type is invalidated. This is required because we serialize the payload type into the shaders from the C++ side.

#rb Yuriy.ODonnell
#jira none
#preflight 635715cae6096564af4dd28e

[CL 22742893 by chris kulla in ue5-main branch]
2022-10-24 20:11:02 -04:00
christopher waters
1b8ad85eaa Working around DXC issue https://github.com/microsoft/DirectXShaderCompiler/issues/4715
When filling out D3D12_FUNCTION_DESC, DXC does not populate RequiredFeatureFlags. Given we rely on these flags to validate bindless support at runtime, we need to emulate these flags being set.

#jira UE-162014
#rb elizabeth.baumel
#preflight 634488a6c272487ed4784593

[CL 22458354 by christopher waters in ue5-main branch]
2022-10-11 11:06:47 -04:00
Laura Hermanns
32c8d9eb49 Don't remove PDB from DXIL container if it wasn't generated in the first place to prevent hlsl::Exception to be thrown by DXC if PDB part is not present.
#rb Yuriy.ODonnell
#fyi Christopher.Waters
#jira UE-164622
#preflight 6334c8ea691c0168b71d7e0d
#rnx

[CL 22233889 by Laura Hermanns in ue5-main branch]
2022-09-28 18:43:53 -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
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
784625ccec Include Reflection data with SM6 embedded PDBs. This makes them way more useful in PIX.
#jira none
#rb jason.nadro, arciel.rekman, zach.bethel
#preflight 628e8695592ae524e3daac98

[CL 20400241 by christopher waters in ue5-main branch]
2022-05-27 17:56:55 -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
Jason Nadro
e76f354daa Set InstructionCount when compiling shaders with DXC
- This fixes an issue where all SM6 compiles were reporting 0 instructions.

#rb christopher.waters
#jira FORT-468097
#preflight none

[CL 19742347 by Jason Nadro in ue5-main branch]
2022-04-13 13:37:00 -04:00
Jason Nadro
65a90154a6 Add scoped cpu markers to various D3D shader compiler functions to make this easier to profile when shader compilation is done in process.
#rb trivial
#jira none
#preflight 62389f8fec68595f3b78e9df

[CL 19453136 by Jason Nadro in ue5-main branch]
2022-03-21 12:17:22 -04:00
Lukas Hermanns
999fb99c6c Enable HLSL 2021 language version (CFLAG_HLSL2021) in shader compiler backends.
#rb Guillaume.Abadie, Will.Damon
#fyi Carl.Lloyd, Ryan.Vance, Christopher.Waters, Mihnea.Balta, Rolando.Caloca, Yuriy.ODonnell, Graham.Wihlidal
#jira UE-138358
#preflight 6227b6b3c653e7ef9f571dc8

[CL 19319858 by Lukas Hermanns in ue5-main branch]
2022-03-09 09:47:28 -05:00
mark lintott
c604aff49b Fix for HRESULT return value
#rb trivial
#jira none
#preflight 61ee86a3ef289ffc6de12b99

#ROBOMERGE-AUTHOR: mark.lintott
#ROBOMERGE-SOURCE: CL 18706928 in //UE5/Release-5.0/... via CL 18706930 via CL 18706941
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18706945 by mark lintott in ue5-main branch]
2022-01-24 06:12:09 -05:00
mark lintott
bc890828d2 Status Analysis fix.
[FYI] christopher.waters
#rb none
#jira none
#preflight 61eadd9eea0da8133dce0e29

#ROBOMERGE-AUTHOR: mark.lintott
#ROBOMERGE-SOURCE: CL 18690463 in //UE5/Release-5.0/... via CL 18690505 via CL 18690525
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18690546 by mark lintott in ue5-main branch]
2022-01-21 11:40:12 -05:00
Lukas Hermanns
1d839de73a Fix static analysis warning in IDxcResult::GetOutput function call.
#rb none
#fyi Kevin.Ortegren
#jira UE-137627
#preflight 61dd91ae582e125e5126a809
#rnx

[CL 18576611 by Lukas Hermanns in ue5-main branch]
2022-01-11 16:01:07 -05:00
christopher waters
4cfc94b91a DXC provides the PDB name along with the DXC_OUT_PDB blob so we should use that instead of trying to (incorrectly) generate the hash ourselves. Removing the unnecessary string blob argument from all the other calls to GetOutput.
#jira none
#rb Yujiang.Wang
#preflight 61b8ca009c7c3936c8c7e6f0

#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 18455753 in //UE5/Release-5.0/... via CL 18455789
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v898-18417669)

[CL 18455825 by christopher waters in ue5-release-engine-test branch]
2021-12-14 12:22:58 -05:00
christopher waters
8d9fb8186f Initial work on SM6.6 support
- SM6.6 not enabled just yet.
- Adding our own defines of __SHADER_TARGET_MAJOR and __SHADER_TARGET_MINOR to mimic the DXC defines. Since we preprocess, we can't rely on DXC to define them for us.
- Adding support for 64bit atomic operations
- Changing part of Nanite PC atomic permutation selection to be based on DataDrivenPlatformInfo
- Fixing DXC shader debugging. The PDB section was still being stripped from the final DXIL.

#jira none
#rb rune.stubbe
#preflight 61548928f5e4fd0001d7d0b3

#ROBOMERGE-OWNER: christopher.waters
#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 17665881 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v875-17642767)
#ROBOMERGE-CONFLICT from-shelf

[CL 17665943 by christopher waters in ue5-release-engine-test branch]
2021-09-29 15:13:20 -04:00
christopher waters
fb46ed18a4 D3D shader cleanup:
- Removed some unnecessary code from D3D shader compilers.
- Removing shader VendorExtensions runtime data from platforms that don't need them.
- Turning FShaderCodeFeatures into a set of flags to reduce its size. Adding a few new flags for future use.
- Moved the common D3D12 shader data and creation code into shared locations to cut down on code duplication.
- Removed the unnecessary copying of header data from all D3D12 shader types.
- Removed FD3D12ShaderBytecode since its values can be inferred from other shader data.

#jira none
#rb rolando.caloca, arciel.rekman
#preflight 6140c2df3aa82d000149f13b

#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 17509617 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17509631 by christopher waters in ue5-release-engine-test branch]
2021-09-14 16:28:37 -04:00
guillaume abadie
d56bfe7b07 Migrates D3D to submit all loose shaders parameters in a single RHISetShaderParameter()
#rb none
#preflight 61323f857d30040001b77b61

#ROBOMERGE-OWNER: guillaume.abadie
#ROBOMERGE-AUTHOR: guillaume.abadie
#ROBOMERGE-SOURCE: CL 17431343 via CL 17438616
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v870-17433530)

[CL 17438618 by guillaume abadie in ue5-release-engine-test branch]
2021-09-06 11:28:30 -04:00
lukas hermanns
b405def68b Undo //UE5/Main/Engine/Source/... changelist 17355504
[FYI] Krzysztof.Narkowicz, Rolando.Caloca, Mihnea.Balta
#jira none
#rnx

#ROBOMERGE-SOURCE: CL 17408288 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17408305 by lukas hermanns in ue5-release-engine-test branch]
2021-09-02 16:06:07 -04:00