Commit Graph

347 Commits

Author SHA1 Message Date
christopher waters
cfc6f343df Uniform Buffer improvements
- Moving various UB booleans into a flags enum.
- UB booleans could not be reasonably deprecated without incurring memory overhead, so this will break custom code that uses them.
- Adding UB flag to force the shader compilers to generate reflection for the UB members which are normally excluded from reflection.
- Adding UB flag that tells MeshCommands that a UB will be bound during pass drawing and that it doesn't need to be set via MDCs.
- New flags are not used in this CL, they are prerequisites for subsequent, larger changes.

#rb jeannoe.morissette

[CL 34356503 by christopher waters in ue5-main branch]
2024-06-13 17:59:13 -04:00
florin pascu
6bca8ef20e Change the CHECK_METAL_COMPILER_TOOLCHAIN_SETUP define to a cvar Metal.CheckCompilerToolChainSetup
#rb carl.lloyd

[CL 34100249 by florin pascu in ue5-main branch]
2024-06-04 13:57:09 -04:00
florin pascu
549e2d4a2e Add MetalOptimizeBySize setting for MetalShaderFormat
#rb carl.lloyd

[CL 34096192 by florin pascu in ue5-main branch]
2024-06-04 12:10:32 -04:00
laura hermanns
7a0927103c [Shaders] Remove last remaining use case of DXC rewriter in MetalCompileShaderMSC and deprecate RewriteHlsl.
#rnx
#rb carl.lloyd, dan.elksnitis

[CL 33279539 by laura hermanns in ue5-main branch]
2024-04-26 17:10:10 -04:00
dmitriy dyomin
1afc70a95a Metal: reduce shader metadata size by ~20% for most cases
#rb carl.lloyd

[CL 33259903 by dmitriy dyomin in ue5-main branch]
2024-04-26 06:17:17 -04:00
zach bethel
0674d30d69 Added SRVNonPixel, SHADER_PARAMETER_RDG_NON_PIXEL_SRV, and modified RDG_TEXTURE_ACCESS to support texture subresources.
- SRVNonPixel is needed by mobile to insert a barrier between fragment -> vertex texture fetch, but since this is a heavyweight barrier, it is opt-in with SHADER_PARAMETER_RDG_NON_PIXEL_SRV.
 - Small refactor to FRDGTextureAccess to allow for arbitrary subresources, as the current model only allows full resource transitions.

#rb mihnea.balta, luke.thatcher, serge.bernier
#jira UE-211883

[CL 33179861 by zach bethel in ue5-main branch]
2024-04-23 17:02:48 -04:00
dan elksnitis
d64ae2b124 [shaders] add error code to spirv reflect failure assert
#rb Jason.Nadro

[CL 33000052 by dan elksnitis in ue5-main branch]
2024-04-16 10:08:24 -04:00
dan elksnitis
05dbf5d214 [shaders] strip unnecessary source file hashing from metal compiler. this was dead code and the result wasn't being used anywhere.
#rb Laura.Hermanns
#jira UE-211354

[CL 32732231 by dan elksnitis in ue5-main branch]
2024-04-04 12:20:22 -04:00
laura hermanns
67217ad5ad [Shaders] Replace DXC rewriter with new SPIRV-Tools pass to pack "$Globals" cbuffer.
- Adds StructPackingPass to SPIRV-Tools which re-assigns all struct member offsets of the global cbuffer ("type.$Globals" when translated in DXC/SPIR-V) according to the std140 memory layout rules.
- Remove DXC rewriter from shader backends as the shader minifier can already handle the majority of dead code removal.
- Rebuilt DXC for Win64, Mac, Linux.

#jira UE-207703
#rnx
#rb Yuriy.ODonnell
[FYI] Dan.Elksnitis, JeanNoe.Morissette, Serge.Bernier, Florin.Pascu

[CL 32646612 by laura hermanns in ue5-main branch]
2024-04-01 14:46:17 -04:00
florin pascu
08ecd19aad Fix Metal freeze when cooking on Windows
#rb Jack.Porter

[CL 32637155 by florin pascu in ue5-main branch]
2024-04-01 09:06:24 -04:00
florin pascu
5d7794302b Re-submit
Autosdk MetalDeveloperTools support
On Win64 MetalShaderFormat module is always loaded
#rb Josh.Adams

[CL 32543102 by florin pascu in ue5-main branch]
2024-03-27 10:25:21 -04:00
florin pascu
f081d42456 [Backout] - CL32490223
[FYI] Florin.Pascu
Original CL Desc
-----------------------------------------------------------------
Autosdk MetalDeveloperTools support
On Win64 MetalShaderFormat module is always loaded
#rb zack.neyland

[CL 32507758 by florin pascu in ue5-main branch]
2024-03-26 09:56:21 -04:00
florin pascu
830c02b99d Autosdk MetalDeveloperTools support
On Win64 MetalShaderFormat module is always loaded
#rb zack.neyland

[CL 32490237 by florin pascu in ue5-main branch]
2024-03-25 18:51:55 -04:00
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
florin pascu
945d8892ea Read the windows native toolchain from the right path
#rb carl.lloyd

[CL 32375324 by florin pascu in ue5-main branch]
2024-03-20 14:25:24 -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
luke thatcher
a329ec3e01 Move the FShaderResourceTable and StaticSlots arrays from platform RHI implementations into the base FRHIShader type
- This data is required by uniform binding code, and was copy/paste across platform RHIs. Moving it to the base RHI type will allow the RHI validation layer to enumerate resources in uniform buffers, which have been opaque up until now.
 - FShaderResourceTable has moved from RenderCore to RHI.
 - UE::RHICore::ApplyStaticUniformBuffers and UE::RHICore::SetResourcesFromTables now only need the shader, since the binding info is stored within it.
 - The serializer functions in shader format modules and platform RHIs have been fixed up to handle the SRT being in the base type. The data format has not changed, so no shader versions need bumping.
 - Removed unnecessary operator == and GetTypeHash functions in some places.

Includes all platforms / RHIs except OpenGL, which will follow in another CL.

#rb Kenzo.Terelst

[CL 31871815 by luke thatcher in ue5-main branch]
2024-02-28 10:47:02 -05:00
laura hermanns
623800cc99 [Shaders] Forward CFLAG_WarningsAsErrors to DXC compiler in SPIR-V backends.
This affects Vulkan, Metal, GLES, and SPIR-V based platform backends.
Warnings will not be treated as errors for intermediate shader code, such as the one generated by the HLSL rewriter for dead-code removal.

#rnx
#rb carl.lloyd, massimo.tristano

[CL 31645356 by laura hermanns in ue5-main branch]
2024-02-20 10:23:08 -05:00
carl lloyd
ba27035a00 Added support for Metal Shader Converter with Bindless in MetalRHI
- Available on SM6
 - Disabled with config
 - Includes support for heap allocations on Metal, enabled by default, can be disabled with -nometalheap

#rb Luke.Thatcher, Chris.Waters, Laura.Hermanns
#jira UE-204112

[CL 31531113 by carl lloyd in ue5-main branch]
2024-02-15 14:58:02 -05:00
carl lloyd
e8f8a7f3a0 Added support for Metal Shader Converter to Metal
- Disabled by default
    - Removed MetalDerivedData and moved shader compiler specific code to seperate files

#rb Laura.Hermanns
#jira UE-204112

[CL 31527482 by carl lloyd in ue5-main branch]
2024-02-15 13:52:17 -05:00
carl lloyd
17c286a83c Added Texture atomic array flattening for TSR to SM5
#rb Jon.Cain

[CL 31287602 by carl lloyd in ue5-main branch]
2024-02-08 07:13:30 -05:00
aris theophanidis
8ae2292282 Remove Compression.h from CoreMinimal.h
It's about 1/4 of CoreMinimal.h but rarely needed (Compression.h pulls on CriticalSection.h and Map.h that are costly).
#rb Yoan.StAmant

[CL 30683417 by aris theophanidis in ue5-main branch]
2024-01-18 09:56:55 -05:00
dan elksnitis
3dc719a6f7 [shaders] fix IOS path to not assume ShaderConductor ignores nulls when loading source; I don't think this is an obvious or desirable choice in the API (despite the fact that changing this behaviour in my SC refactoring was unintentional)
#jira UE-203997
#rb Laura.Hermanns

[CL 30660432 by dan elksnitis in ue5-main branch]
2024-01-17 11:48:03 -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
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