Commit Graph

33 Commits

Author SHA1 Message Date
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
lukas hermanns
2825679ac2 Enable '-fdiagnostics-format' option in DXC and emit asbolute file paths in '#line'-directives.
#rb Krzysztof.Narkowicz
[FYI] Rolando.Caloca, Mihnea.Balta
#jira none
#rnx

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

[CL 17355524 by lukas hermanns in ue5-release-engine-test branch]
2021-08-30 14:05:48 -04:00
christopher waters
1c21a5489c Shader symbol terminology changes
- Splitting symbol generation and shader "debug info" generation into two different cvars. This should now allow us to generate symbols post-packaging without generating different shader variants. This should also enable us to always generate symbols and still have the final deduplicated shader sizes.
- r.Shaders.Symbols is now the primary way to enable shader symbols for debugging.
- r.Shaders.GenerateSymbols can be enabled to always generate symbols without writing them to disk.
- r.Shaders.WriteSymbols can be used to force write symbols if they were previously generated.
- r.Shaders.ExtraData can be used to generate shader names for engine runtime systems to use.
- NotifyShaderCooked replaced with NotifyShaderCompiled, prep for upcoming non-cook symbol writing.
- PC DXC shader compiles should only generate debug info when requested, not all the time.
- PC FXC shader compiles should generate debug info when requested, not just when r.Shaders.Optimize is 0.

#jira none
#rb arciel.rekman, lukas.hermanns
#preflight 611ad9035e737200015992db

#ROBOMERGE-SOURCE: CL 17186155 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17186162 by christopher waters in ue5-release-engine-test branch]
2021-08-16 23:18:23 -04:00
guillaume abadie
ecff5e4123 Implements CFLAG_AllowRealTypes on SP_PCD3D_SM6
#rb chris.waters
#preflight 611ab4c19db7df0001caead4

#ROBOMERGE-SOURCE: CL 17179929 via CL 17179943
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17179974 by guillaume abadie in ue5-release-engine-test branch]
2021-08-16 15:12:30 -04:00
christopher waters
5c38dbfd39 Removing validation skipping from the SM6.6 code path as it's a fully supported feature in our version of DXC.
#rb none
#jira none
[FYI] graham.wihlidal, rune.stubbe

#ROBOMERGE-SOURCE: CL 16756585 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16756586 by christopher waters in ue5-release-engine-test branch]
2021-06-23 10:14:53 -04:00
Yuriy ODonnell
aa9e6a0c41 Added a basic implementation of assert in shaders for D3D12. Requires SM6 support which can be enabled through r.D3D12.AllowShaderModel6=1.
Example usage in a shader:

PLATFORM_ASSERT4(GroupThread > 4321, 0xDF7DC903, GroupThread, GroupIndex, GroupBase, asuint(123.456f));

Example GPU crash report output:

LogD3D12RHI: Error: [GPUBreadCrumb] Last tracked GPU operations:
LogD3D12RHI: Error: [GPUBreadCrumb]	3D Queue 0 - Begin: Frame 348 - Scene - ReflectionIndirect - RayTracingReflections - RayTracingDeferredReflectionsShade 957x466
LogD3D12RHI: Error: [GPUBreadCrumb]	Shader assertion failed! ID: 0xDF7DC903
LogD3D12RHI: Error: [GPUBreadCrumb]	Payload  [int32]: 416 42 172032 1123477881
LogD3D12RHI: Error: [GPUBreadCrumb]	Payload [uint32]: 416 42 172032 1123477881
LogD3D12RHI: Error: [GPUBreadCrumb]	Payload    [hex]: 0x000001A0 0x0000002A 0x0002A000 0x42F6E979
LogD3D12RHI: Error: [GPUBreadCrumb]	Payload  [float]: 0.000000 0.000000 0.000000 123.456001

This works through automatic diagnostic buffer binding in D3D12 RHI, which becomes available in *any* shader as a UAV.
Opens the door for arbitrary human-readable message output from any shader in the future.

PLATFORM_ASSERT macro is always enabled and available on supported platforms. It is intended to be a low-level mechanism for a higher-level check() that would be controlled via CVars.

#rb Christopher.Waters

[CL 16167404 by Yuriy ODonnell in ue5-main branch]
2021-04-30 08:37:35 -04:00
christopher waters
83f70197d3 Tessellation Removal: Removing RHI Hull/Domain shader types and enums.
#rb lukas.hermanns
#jira UE-94564
#preflight 607f2e11eb4f050001d4655e

[CL 16066223 by christopher waters in ue5-main branch]
2021-04-20 17:00:25 -04:00
graham wihlidal
7b6ec4d476 Work in progress support for D3D12 Shader Model 6.6, specifying validator version, and workarounds to disable validation/signing until validator v1.6 is available that supports the 6.6 profile (requires developer mode and experimental features).
Disabled by default (guarded by USE_SHADER_MODEL_6_6).

Includes work done by Yuriy.

#rb yuriy.odonnell
#fyi brian.karis, christopher.waters, lukas.hermanns

[CL 15914077 by graham wihlidal in ue5-main branch]
2021-04-05 04:40:52 -04:00
Yuriy ODonnell
9219cb046d Differentiate between engine custom shader validation errors and real D3DCompileToDxil failures.
#rb Graham.Wihlidal

[CL 15732460 by Yuriy ODonnell in ue5-main branch]
2021-03-17 20:12:52 -04:00
christopher waters
bd8fabd199 Fixing UAVMask support.
- Removed OutputMask since nothing was using it anymore.
- Made UAVMask an optional output from FXC compiles, only d3d11 reads it.
- UAVMask now created from entire set of UAVs and not just UAVs in Uniform Buffers.

#jira none
#rb mihnea.balta

#ROBOMERGE-SOURCE: CL 15643920 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v779-15635321)

[CL 15643927 by christopher waters in ue5-main branch]
2021-03-08 15:13:56 -04:00
Yuriy ODonnell
2565f44a7b More verbose error message on DXC compile failure. Helps to differentiate shader compile errors from compiler crashes.
#rb Lukas.Hermanns

[CL 15349245 by Yuriy ODonnell in ue5-main branch]
2021-02-06 07:48:09 -04:00
Lukas Hermanns
a015b2c2e3 Use custom built dxc.exe for D3D shader compilation batch scripts.
#rb Yuriy.ODonnell
#fyi Graham.Wihlidal, Emil.Persson, Kenzo.Terelst
#jira none
#rnx

[CL 15284807 by Lukas Hermanns in ue5-main branch]
2021-02-02 17:12:57 -04:00
christopher waters
d1e9a0ce0b Adding ERHIFeatureLevel::SM6 and SP_PCD3D_SM6. Initially, both are disabled by default. The shader model is enabled with r.D3D12.AllowShaderModel6 and the feature level is only used when the shader model is enabled and the PC runtime supports 12_1 and SM6.5. The idea here is to raise these requirements to 12_2 and SM6.6 when those come online.
#jira none
#rb kenzo.terelst, arciel.rekman, lukas.hermanns, mihnea.balta, yuriy.odonnell

[CL 15222057 by christopher waters in ue5-main branch]
2021-01-27 16:08:00 -04:00