Commit Graph

53 Commits

Author SHA1 Message Date
christopher waters
d909f420c4 More shader parameter batching utilities
- Adding Uniform Buffer parameter batching functions to ShaderParameterUtils.h
- Adding batched Uniform Buffer binding helper to GlobalShader
- Adding batched Uniform Buffer bindings helpers to FMaterialShader
- Adding SetShaderParameters variant that uses batched parameters.
- Changing UnsetShaderUAVs and UnsetShaderSRVs to use the RHICmdList scratch parameters instead of their own arrays.

#rb zach.bethel
#preflight 63e28ea0e86828e8c830fb50

[CL 24059333 by christopher waters in ue5-main branch]
2023-02-07 16:19:47 -05:00
christopher waters
1b79bdc222 Adding more widespread use of FRHIBatchedShaderParameters
- RHI Command lists now have their own "scratch" batched parameters for code setting parameters to use. The parameters are reset when the scratch is returned so it's up to the callers to actually set them on the command list.
- Enabling Uniform Buffers in batched shader parameters from shader parameter structs.
- Changing MeshPassProcessor to use FRHIBatchedShaderParameters instead of its own type.
- Updating BasePassRendering to use FRHIBatchedShaderParameters.

#rb zach.bethel
#preflight 63dd54a34d25c400b7c040a6

[CL 23996881 by christopher waters in ue5-main branch]
2023-02-03 15:45:12 -05:00
christopher waters
4e779095ab Chaning more code to use SetShaderParameters
- MeshPassProcessor converted to use SetShaderParameters instead of setting individual resources. Caching of SRVs and Samplers was also removed.
- UnsetShaderSRVs and UnsetShaderUAVs now set all the null binds in a single SetShaderParameters command.
- Made some FRHIShaderParameterResource utilities more public.

#jira none
#rb jeannoe.morrisette, luke.thatcher
#preflight 637565eebf76990b71eb38d0

[CL 23197327 by christopher waters in ue5-main branch]
2022-11-18 12:10:55 -05:00
christopher waters
4b57998013 Set all parameters and resources for SetShaderParameters in a single RHI command
- Expands all RDG and non-RDG bindings into a list of RHIResource bindings.
- Future work could batch up all non-SetShaderParameters calls into similar data structures.

#rb zach.bethel, jeannoe.morissette
#preflight 637320ad3248425305112b91

[CL 23147896 by christopher waters in ue5-main branch]
2022-11-15 19:41:53 -05:00
christopher waters
584de7cf77 Make FShaderParametersMetadata authoritative on the parameters size, not the parameter type. Systems like Niagara can have more data allocated than can fit in the passed in data type, so the metadata has to be the source of the sizes here.
This ends up reverting parts of my last changes here, including a deprecation.

#jira none
#rb zach.bethel, rob.krajcarski
#preflight 636952af7c2b505190525ed7

[CL 23018217 by christopher waters in ue5-main branch]
2022-11-07 16:32:05 -05:00
christopher waters
5a3acc4945 ShaderParameters cleanup
- SetShaderParameters and ValidateShaderParameters now require the caller pass in the size of the parameter data. This will be useful when making SetShaderParameters run on the RHI thread.
- SetShaderParameters no longer requires a FShaderParametersMetadata argument since it was never used.

#jira none
#rb jeannoe.morissette
#preflight 636445aaf233f06a1286d576

[CL 22993813 by christopher waters in ue5-main branch]
2022-11-04 16:00:20 -04:00
christopher waters
862033a6a3 Working around DXC issues that caused constant buffers to be marked used when we initialized bindless resources for Uniform Buffers.
Uniform Buffer struct initializing now just use a global resource/sampler to instead of calling the getter function.
Adding bindless support to FShaderResourceParameter.

#jira UE-139616
#rb yuriy.odonnell
#preflight 62d9da7fd54af4b9a222d9c5

[CL 21273494 by christopher waters in ue5-main branch]
2022-08-08 15:22:39 -04:00
christopher waters
5a7c632f9b Fixing static analysis warning.
#jira UE-152849
#rb none
#preflight 628518b41f474f0660f18580

[CL 20262533 by christopher waters in ue5-main branch]
2022-05-18 12:33:38 -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
christopher waters
8abb1959d8 Making a FShaderParameterMap::FindParameterAllocation method that returns the parameter struct instead of using reference parameters.
Cleaning up SetShaderParameters implementations using a new helper class to load parameters from the binary blobs passed in.

#jira none
#rb kenzo.terelst, zach.bethel
#preflight 625f009f9c09ef439d9e8089

[CL 19830463 by christopher waters in ue5-main branch]
2022-04-20 10:43:15 -04:00
christopher waters
ca031aa73b Moving the bulk of SetShaderParameters to a cpp file. The shader type template arguments are only used to get data that's common for all binding paths and the command list types are minimal and boiled down to just 3 sets of parameters.
#jira none
#rb mihnea.balta
#preflight 6256ffd677269238e16b5915

[CL 19742199 by christopher waters in ue5-main branch]
2022-04-13 13:29:15 -04:00
guillaume abadie
0bb3821623 Allows SHADER_USE_PARAMETER_STRUCT() to submit all shader parameters in a single RHISetShaderParameter()
#rb yuriy.odonnell
#preflight 611d572d9db7df000134eb13


#ROBOMERGE-SOURCE: CL 17222098
#ROBOMERGE-BOT: (v855-17104924)

[CL 17222140 by guillaume abadie in ue5-main branch]
2021-08-18 16:55:41 -04:00
graham wihlidal
2262907144 Initial D3D12 mesh shader implementation for Nanite - disabled by default, and not yet in a working state (few issues to address still), but the bulk of the implementation is done now.
#rb christopher.waters, rune.stubbe
[FYI] brian.karis, eric.mcdaniel
#preflight 61118028f19b37000163972d


#ROBOMERGE-SOURCE: CL 17107196
#ROBOMERGE-BOT: (v854-17104634)

[CL 17107229 by graham wihlidal in ue5-main branch]
2021-08-09 16:36:09 -04:00
zach bethel
a19414341b Fix for RDG_{TEXTURE, BUFFER}_ACCESS asserting when used with shader parameter bindings.
#rb guillaume.abadie

[CL 16450846 by zach bethel in ue5-main branch]
2021-05-25 12:18:27 -04:00
christopher waters
d1f02225a4 Adding support for R32_FLOAT depth buffers.
#jira UE-85382
#rb brian.white, will.damon, mihnea.balta
#fyi andrew.lauritzen
#preflight 609de73fbfbee500013afd47

[CL 16330130 by christopher waters in ue5-main branch]
2021-05-14 11:17:41 -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
marc audy
bf2e06bca2 Added initial support for RDG_{TEXTURE, BUFFER}_ACCESS_ARRAY, which enables a dynamic number of inputs into an RDG pass. Removed unused / deprecated SHADER_PARAMETER_RDG_BUFFER.
#rb none

#ROBOMERGE-OWNER: marc.audy
#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 15905815 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v786-15839533)
#ROBOMERGE-CONFLICT from-shelf

[CL 15907353 by marc audy in ue5-main branch]
2021-04-02 20:35:50 -04:00
zach bethel
0d7dc4d4ed Refactor of uniform buffer binding to allow for runtime selection of static or per-shader binding. This is a necessary precursor to moving the View uniform buffer to use static bindings on mesh passes; it is used in so many places that both binding models are required to preserve compatibility. Added validation to catch when a uniform buffer is bound using both methods at the same time. Added CVar to RHI transition validation to control whether to break in the debugger on a transition failure.
#rb christopher.waters

[CL 14873973 by zach bethel in ue5-main branch]
2020-12-07 17:42:32 -04:00
Zabir Hoque
3493c1df43 Fix type-o from prior checkin.
[CL 14530598 by Zabir Hoque in ue5-main branch]
2020-10-20 20:31:31 -04:00
Zabir Hoque
109922b8a6 Check statement should be using "frozen" API during validation.
#rb: Ben.Ingram;

[CL 14530590 by Zabir Hoque in ue5-main branch]
2020-10-20 20:29:35 -04:00
Daniel Wright
000f55f41b Changed unbound parameters assert to ensure, since you can fix it with recompile shaders
#rb none

[CL 14392516 by Daniel Wright in ue5-main branch]
2020-09-24 19:46:43 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
Marc Audy
11f5b21210 Merging //UE5/Release-Engine-Staging @ 13752110 to Main (//UE5/Main)
#rnx

[CL 13753156 by Marc Audy in ue5-main branch]
2020-06-23 18:40:00 -04:00
ben ingram
d9d0535ddc Add freezable hash table, use to accelerate lookup of shaders within ShaderMap
- Shaders are searched by TypeName and PermutationId, so move those fields out of FShader and into separate arrays inside ShaderMap, to reduce cache misses while finding shaders
#rb none

#ROBOMERGE-OWNER: ben.ingram
#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 12646854 via CL 12646966 via CL 12646981
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)

[CL 12646995 by ben ingram in Main branch]
2020-04-06 21:12:18 -04:00
dmitriy dyomin
193a3b97ad Reduce FShader object size in cooked games from 264 bytes to 160 bytes (saves ~7MB in the lobby)
#rb zach.bethel


#ROBOMERGE-OWNER: dmitriy.dyomin
#ROBOMERGE-AUTHOR: dmitriy.dyomin
#ROBOMERGE-SOURCE: CL 12099362 via CL 12099363 via CL 12099738
#ROBOMERGE-BOT: (v657-12064184)

[CL 12099753 by dmitriy dyomin in Main branch]
2020-03-10 08:04:05 -04:00