Commit Graph

196 Commits

Author SHA1 Message Date
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
jeannoe morissette
fcde1b58c4 VulkanRHI: Always remove dead code from Vulkan ray tracing shaders (necessary to remove the unused entrypoints).
#rb dan.elksnitis
#rnx

[CL 32901455 by jeannoe morissette in ue5-main branch]
2024-04-11 15:08:46 -04:00
jeannoe morissette
0e683e27ce VulkanRHI: fix Vulkan ray tracing to use indices in shader record for bindless HitGroupSystemIndexBuffer and HitGroupSystemVertexBuffer.
#rb christopher.waters
#rnx

[CL 32896240 by jeannoe morissette in ue5-main branch]
2024-04-11 13:24:57 -04:00
jeannoe morissette
98f1f6fef7 VulkanRHI: Fix some errors in Vulkan ray tracing shader compilation.
[FYI] Laura.Hermanns, christopher.waters

[CL 32778051 by jeannoe morissette in ue5-main branch]
2024-04-05 19:18:00 -04:00
christopher waters
dd2f49d25c Adding RHIResourceCollection RHI resource type which can store bindless indices in a buffer.
#rb Luke.Thatcher

[CL 32764889 by christopher waters in ue5-main branch]
2024-04-05 13:22: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
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
jeannoe morissette
b719d8b3f1 VulkanRHI: Fix Vulkan bindless shader compilation
#rb Kenzo.Terelst
#rnx

[CL 32336017 by jeannoe morissette in ue5-main branch]
2024-03-19 15:32:28 -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
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
steve robb
f8d47335a4 Replaced RemoveAt(N, 1, EAllowShrinking::*) with RemoveAt(N, EAllowShrinking::*).
[CL 31626444 by steve robb in ue5-main branch]
2024-02-19 16:51:58 -05:00
steve robb
6d5b974842 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30735396 by steve robb in ue5-main branch]
2024-01-19 19:41:56 -05:00
dan elksnitis
89776aba21 [shaders] add ANSICHAR path for FShaderSource and enable by default
#rb Yuriy.ODonnell, Laura.Hermanns
#jira UE-196110

[CL 30632304 by dan elksnitis in ue5-main branch]
2024-01-16 09:15:51 -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
christopher waters
aaeb9ff464 Fixing Vulkan compiles on Mac.
[CL 30166357 by christopher waters in ue5-main branch]
2023-12-06 15:35:23 -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
laura hermanns
3ae332cccb Only check empty SPIR-V module when compilation was reported as successful.
#rb JeanNoe.Morissette
#rnx

[CL 29827128 by laura hermanns in ue5-main branch]
2023-11-17 19:47:08 -05:00
laura hermanns
d6acdc4eab Make DXC compile arguments consistent between Vulkan backend and CompileDXC.bat script.
#jira UE-198594
#rb Dan.Elksnitis
#rnx

[CL 29569710 by laura hermanns in ue5-main branch]
2023-11-08 14:23:36 -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
jeannoe morissette
8a024170db VulkanRHI: Fix Vulkan bindless and RT heap prefix issues.
#rb none
#rnx

[CL 29168365 by jeannoe morissette in ue5-main branch]
2023-10-26 23:07:24 -04:00
christopher waters
5c304ed095 Removing FShaderParameterParser from FShaderPreprocessOutput.
#jira UE-197328
#rb dan.elksnitis

[CL 29168356 by christopher waters in ue5-main branch]
2023-10-26 23:07:19 -04:00
dan elksnitis
54fb5cf56d [shaders] further deprecation (SupportsIndependentPreprocessing/OptionalFinalShaderSource/bIndependentPreprocessed are no longer needed since all backends are migrated)
#rb Laura.Hermanns

[CL 29117027 by dan elksnitis in ue5-main branch]
2023-10-25 22:21:30 -04:00
jason hoerner
0e18ea7e81 Shader Preprocessor: Roll TEXT macro substitution into the C preprocessor step, via custom macro callback feature, making it effectively free. Saves 3% overall on preprocess, but also represents a simplification by reducing the number of unique preprocess passes.
#jira UE-198496
#rnx
#rb dan.elksnitis yuriy.odonnell jason.nadro

[CL 29100104 by jason hoerner in ue5-main branch]
2023-10-25 16:01:11 -04:00
christopher waters
ab21e17d39 Bindless Resources
- Splitting "Bindless Resource" shader parameter types into "Bindless SRV" and "Bindless UAV" to make sure reflection/binding validation is correct.

#jira UE-166341
#rb jeannoe.morissette

[CL 28995862 by christopher waters in ue5-main branch]
2023-10-20 23:12:44 -04:00
christopher waters
6797229f23 Moving more platforms to use ShaderParameterParser in the compile step.
#rb Jason.Nadro
#jira UE-197328

[CL 28655234 by christopher waters in ue5-main branch]
2023-10-11 03:20:39 -04:00