Commit Graph

249 Commits

Author SHA1 Message Date
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
christopher waters
a1af36037f Shader versioning cleanup
- Changing all shader versions to Guid.
- Fixing shader version guids in shaders to not be in comments.
- Adding a shader version to RayTracingCommon.ush.

#rb dan.elksnitis, Jason.Nadro, Yuriy.ODonnell, Laura.Hermanns

[CL 29168287 by christopher waters in ue5-main branch]
2023-10-26 23:06:40 -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
jeannoe morissette
f30a320eeb VulkanRHI: Fix Vulkan bindless and ray tracing shader compilation to work with new UB generation code.
#rb none
#jira UE-171798
#rnx

[CL 28125266 by jeannoe morissette in ue5-main branch]
2023-09-22 04:12:24 -04:00
christopher waters
bb0a274b8c Reworking UniformBuffer code generation to not use an intermediate struct
- When generating Uniform Buffer HLSL code, a 'static const struct {} Name' was created which has been causing compiler issues off and on for years.
- When RemoveUniformBuffersFromSource removed said struct, it parsed the struct's structure to figure out how to translate UniformBuffer.Member into UniformBuffer_Member in code that accessed Uniform Buffers.
- Now, instead of a struct, a "UniformBuffer <Name>" declaration is created and filled with mappings from "UniformBuffer.Member" into the correct code.
- This allows ConstantBuffer objects to be used differently from cbuffer where the former generates "UniformBuffer.Member" and the latter generates "UniformBuffer_Member"
- This also allows resources to always be translated to "UniformBuffer_Member"
- Shader define 'PLATFORM_SUPPORTS_UB_STRUCT' is now 'PLATFORM_SUPPORTS_CONSTANTBUFFER_OBJECT' and will be set on shader formats that support ConstantBuffer<> objects.
- Removed lots of unused code from BindlessResources.ush

#jira UE-195103
#rb dan.elksnitis, jeannoe.morissette

[CL 28058373 by christopher waters in ue5-main branch]
2023-09-20 17:33:36 -04:00
jeannoe morissette
b7c12c8b0e VulkanRHI: VK RT WIP: Use tighly packed indices for the bindless UBs in the shader parameters, and at runtime use ConstantDataOriginalBindingIndex to write the handle in the correct slot.
#rb none
#jira UE-171798
#rnx

[CL 27409804 by jeannoe morissette in ue5-main branch]
2023-08-28 09:44:39 -04:00
jeannoe morissette
235b6cbfd3 VulkanRHI: Actually enable scalar_block_layout in raytracing and sm6 shaders to fix multiple alignment issues. Rename ReflectionSlot param to align with ShaderCommon code.
#rb carl.lloyd
#jira UE-171798
#rnx

[CL 27399055 by jeannoe morissette in ue5-main branch]
2023-08-25 22:19:15 -04:00
carl lloyd
34d53bc691 Added validation to ensure UAV/SRV types and UB sizes match the ones generated by the shader compiler
#rb jeannoe.morissette
#jira UE-82353

[CL 27399050 by carl lloyd in ue5-main branch]
2023-08-25 22:19:10 -04:00
jeannoe morissette
ec701f8ca4 VulkanRHI: VK RT WIP: Shader compiler changes for Vulkan RT. Add an option for extra blobs for AnyHit and Intersection shaders in HitGroup. Add option of bindless UBs for ray tracing shaders. Correctly set GRHISupportsRayTracingDispatchIndirect.
#rb Aleksander.Netzel
#jira UE-190075
#rnx

[CL 27231539 by jeannoe morissette in ue5-main branch]
2023-08-19 19:17:32 -04:00
jeannoe morissette
e97f023224 VulkanRHI: Add handling of multiple entrypoints for RayHitGroup shaders (VK RT WIP, does not change current output)
#rb carl.lloyd
[FYI] aleksander.netzel
#jira UE-171798
#rnx

[CL 27209304 by jeannoe morissette in ue5-main branch]
2023-08-18 13:12:21 -04:00
jeannoe morissette
4e65bdc179 VulkanRHI: Start adding code in VulkanShaderCompiler to track bindless UB and handle RootParametersStructure. (VK RT WIP, disabled for now)
#rb none
#jira UE-171798
#rnx

[CL 27185944 by jeannoe morissette in ue5-main branch]
2023-08-17 17:14:45 -04:00
jeannoe morissette
150748bbaa VulkanRHI: (VK RT WIP) Move all serialized parameter of the shader compilation process into a struct together (Header, SRT, Spirv).
#rb none
#jira UE-171798
#rnx

[CL 27151506 by jeannoe morissette in ue5-main branch]
2023-08-16 15:44:45 -04:00
jeannoe morissette
8102581292 VulkanRHI: Remove unnecessary code in VulkanShaderCompiler (clean up WIP). Remove some of the CombinedImageSampler code (and some ImmutableSamplers). Removed some parts of FOLDVulkanCodeHeader. Remove the use of FHlslccHeaderWriter and FHlslccHeader to generate a string and then parse it, work directly from SPIRV and reflection.
#rb Laura.Hermanns
#jira UE-176887,UE-176175
#rnx

[CL 27132998 by jeannoe morissette in ue5-main branch]
2023-08-16 00:42:57 -04:00
jeannoe morissette
01c3ef3a8f VulkanRHI: Start a clean up of the VulkanShaderCompiler, small steps at first (WIP). Reduce parameters in shader compilation functions by batching them together in a struct (more params coming with RT). Remove FCompilerInfo class. Replace repeated loops with lambdas.
#rb carl.lloyd
#rnx

[CL 26867591 by jeannoe morissette in ue5-main branch]
2023-08-04 23:59:50 -04:00
dan elksnitis
9a5a1b6f74 [shaders] minor include cleanup
#rb Jason.Hoerner
#rb Laura.Hermanns

[CL 26817718 by dan elksnitis in ue5-main branch]
2023-08-03 13:40:32 -04:00
dan elksnitis
78b1767069 [shaders] implement independent preprocessing API for vulkan shader format
#rb Massimo.Tristano

[CL 26739541 by dan elksnitis in ue5-main branch]
2023-08-01 11:03:24 -04:00
dan elksnitis
5f85b46590 [shaders] remove unnecessary passing of hlslcc flags as an option to debug info output. this was just used to pass a switch on the SCW directcompile cmdline which SCW no longer does anything with. also cleaned up some additional unnecessary code related to these flags in backends that no longer use hlslcc at all.
#rb Laura.Hermanns

[CL 26685354 by dan elksnitis in ue5-main branch]
2023-07-28 15:58:01 -04:00