Commit Graph

144 Commits

Author SHA1 Message Date
jeannoe morissette
75364b7008 VulkanRHI: Add VULKAN_SM6. Move features and requirements around to match what was done on d3d.
#rb arciel.rekman, carl.lloyd
#preflight 643996128901e5ef982dc887

[CL 25045731 by jeannoe morissette in ue5-main branch]
2023-04-14 14:26:06 -04:00
carl lloyd
7a31ca4270 Enable Android Vulkan SM5 Ray Tracing
#rb jeannoe.morissette, yuriy.odonnell
#preflight 643966259566b61450eddea4

[CL 25040539 by carl lloyd in ue5-main branch]
2023-04-14 10:52:39 -04:00
Laura Hermanns
cbc4db6343 Minor improvements in shader backends.
#rb Dan.Elksnitis
#jira none
#preflight 642ad56dc6769c6082ade6cf
#rnx

[CL 24892320 by Laura Hermanns in ue5-main branch]
2023-04-03 10:17:45 -04:00
dan elksnitis
49d7985a85 [shaders] Add "compile argument" functionality for generic parameters consumed by compile backends, along with helper to set both a compile arg AND define for cases which require both. The purpose of this is to move towards enforcing that preprocessor defines should _only_ be used during the preprocessing phase itself; the subset of defines that are currently used only as arguments to the compile backends (or used as both actual preprocessor defines and backend arguments) should use this mechanism instead. This allows us to explicitly identify and hash such parameters to be included in a stable key based primarily on a hash of preprocessed/deadstripped source; without it we would need to hash all defines which will defeat most of the deduplication benefit of doing this. A subsequent change will deprecate the GetDefinitions function on the shader compilation environment to enforce that defines cannot be read by anything outside of core shader system functionality.
#rb Massimo.Tristano
#rb Laura.Hermanns
#preflight 64258c2e5e52099fe3d03625

[CL 24854110 by dan elksnitis in ue5-main branch]
2023-03-30 10:47:09 -04:00
jeannoe morissette
f812b514c3 VulkanRHI: Add VULKAN_PROFILE_SM6 definition to shaders for upcoming VULKAN_SM6.
#preflight 641b23ce76461c460b4e395c
#rnx

[CL 24751410 by jeannoe morissette in ue5-main branch]
2023-03-22 14:20:48 -04:00
jeannoe morissette
279e3fe462 VulkanRHI: Add Vulkan_1_3 support for shader compilation. (WIP towards VULKAN_SM6)
#fyi laura.hermanns, carl.lloyd
#preflight 641b05eb32723d4a200be648
#rnx

[CL 24747522 by jeannoe morissette in ue5-main branch]
2023-03-22 10:40:26 -04:00
jeannoe morissette
dcefb8ee53 VulkanRHI: Use Vulkan profiles to validate support for a feature level on startup before call to CreateRHI(). (WIP towards VULKAN_SM6)
#rb Carl.Lloyd
#preflight 641375af1c44ff98b924739a

[CL 24739245 by jeannoe morissette in ue5-main branch]
2023-03-21 16:45:53 -04:00
jeannoe morissette
29f4674898 VulkanRHI: Move to UE::RHICore::SetResourcesFromTables to match other RHIs.
#rb Mihnea.Balta
#preflight 640a3ffed778f88975c84441
#rnx

[CL 24581810 by jeannoe morissette in ue5-main branch]
2023-03-09 15:58:42 -05:00
christopher waters
364dbe3541 Fixing bad vulkan.h include.
Switching back to referencing VulkanRHI headers correctly.

[CL 24370772 by christopher waters in ue5-main branch]
2023-02-22 17:22:28 -05:00
Laura Hermanns
0bd8d62c28 Remove redundant dumping of .spv file in VulkanShaderCompiler.
#rb Dan.Elksnitis
#fyi JeanNoe.Morissette
#jira none
#preflight 63efefc690198dffba0e4378
#rnx

[CL 24291485 by Laura Hermanns in ue5-main branch]
2023-02-17 16:39:16 -05:00
jeannoe morissette
ed793eba07 VulkanRHI: Apply Wave32 hint in Vulkan when VK_EXT_subgroup_size_control is supported. Properly check requiredSubgroupSizeStages before applying wave size. Fixes artifacts on ARC with Vulkan.
#rb Mihnea.Balta
#jira UE-173871
#preflight 63ef9934e832ea950a808150
#rnx

[CL 24282090 by jeannoe morissette in ue5-main branch]
2023-02-17 10:30:38 -05:00
jeannoe morissette
11825bb976 VulkanRHI: Genereate bindless sampler declarations the same way as resources. Vulkan Bindless WIP.
#fyi Christopher.Waters
#preflight 63ebd899514832b2425d7331
#rnx

[CL 24235933 by jeannoe morissette in ue5-main branch]
2023-02-15 13:54:03 -05:00
jeannoe morissette
c96eadede6 VulkanRHI: Fix issue where incorrect TargetEnvironment was selected when previewing other SM5 modes.
#rb Mihnea.Balta
#jira UE-171188
#preflight 63ea8f8f956709374a50bf8a

[CL 24210191 by jeannoe morissette in ue5-main branch]
2023-02-14 09:25:04 -05:00
Laura Hermanns
5a8a3b3063 Unify shader debug name in shader code output for DXC backends to improve cache hits.
The shader code output contains a little bit of plaintext such as I/O identifiers and the shader name, which was generated for the DXC backend in a way that prevents caching.
This unifies the shader name in the output code and improves the cache hit ratio for a Lyra cook from 0% to roughly 50% cache hits (for certain platforms).

#rb Jason.Nadro, Carl.Lloyd
#fyi Brian.White, Arciel.Rekman, Brandon.Schaefer
#jira FORT-548603
#preflight 63e26c6c07207b2570ba2d5b
#rnx

[CL 24050212 by Laura Hermanns in ue5-main branch]
2023-02-07 11:15:47 -05:00
Yuriy ODonnell
1dfc32d42d Enable r.Shaders.RemoveDeadCode by default for all back-ends except Metal and OpenGL
* Significantly reduces the size of shader debug data and improves shader compilation time (reducing parsing cost in the native shader compiler)
* Remove "experimental" label for the feature

#rb Jason.Nadro
#preflight 63d455d9be1970f8824c3f9b

[CL 23894592 by Yuriy ODonnell in ue5-main branch]
2023-01-27 18:24:18 -05:00
jeannoe morissette
d16b138656 VulkanRHI: Fix static analysis warning.
#rb none
#rnx
#preflight trivial

[CL 23880261 by jeannoe morissette in ue5-main branch]
2023-01-26 22:05:31 -05:00
jeannoe morissette
efd5dc3c7a VulkanRHI: Use a single descriptor set for all uniform buffers in Vulkan bindless, separate the stages with offsets inside that single decriptor set. Gets around previous issue with different descriptor sets were using the same descriptor buffer with different offsets. (Vulkan Bindless WIP)
#rb none
#preflight 63d2f6bc3656ea96dca342e9
#rnx

[CL 23877009 by jeannoe morissette in ue5-main branch]
2023-01-26 17:28:35 -05:00
zack neyland
e8eb20415f MetalRT: Laying initial groundwork, disabled by default.
* Enabling requires re-building a metalpp with appropriate flags/defines set along with an OS version that supports the RT headers/libs.

#preflight 63c72f1a0225f00e14c05c46
#jira none

[CL 23750025 by zack neyland in ue5-main branch]
2023-01-17 19:53:36 -05:00
jeannoe morissette
a4b446428f VulkanRHI: Override ShaderParameterParser for Vulkan bindless resource declarations. Use a typedef for each resource's type and declare its variable array with that type, at the end (in SPIRV) collapse all the arrays of a same descriptor type on the same binding. Move 'per-stage' uniform buffer bindings into descriptor sets AFTER the descrciptor sets for the resource arrays (since the resource array bindings will never change, but the ubo will change at a very high frequency). Also add the possibility for platform common headers to overload UB_RESOURCE_MEMBER_RESOURCE to match the altered declaration in ShaderParameterParser (temporary solution). The result gets around the lack of ResourceDescriptorHeap in Vulkan. (Vulkan Bindless WIP)
#rb Yuriy.ODonnell
#fyi Christopher.Waters
#jira UE-162018
#preflight 63c6e1933f587d9e14f6f27c
#rnx

[CL 23741527 by jeannoe morissette in ue5-main branch]
2023-01-17 13:23:40 -05:00
Yuriy ODonnell
bddca76c94 ShaderMinifier - Add support for dead code removal to all shader formats
* Add code to all shader format back-ends to take dead code removal into account when computing the version ID
* Not enabled in Metal and OpenGL back-ends (require further testing)

#rb dan.elksnitis
#preflight 6390f1f15c5308d18c7364fb

[CL 23433448 by Yuriy ODonnell in ue5-main branch]
2022-12-07 15:13:42 -05:00
chris kulla
408b0b8553 Ray Tracing: Compute the maximum payload size from the shader's payload type
Serialize the payload size as part of the raytracing shader so it can be examined in the RHI layer.

Validate that the RTPSO is configured with the appropriate payload size.

Add macros to ensure the payloads have the expected size

Ensure that all raytracing pipelines explicitly bind a miss shader

Add a shared shader header to implement static asserts for those shader compilers that support them (like dxc).

Fix payload type on main deferred reflection raygen shader

Fix incorrect raygen shader included in the deferred RTPSO list for RTGI

Don't add builtin shaders to the RTPSO from the RHI layer as these are unlikely to ever match the required payload type

Add new method to register payload types so that plugins can more easily describe custom payloads they may be using (up to a maximum of 32 unique payload types since we use a bitmask to represent payload sets).

#rb Yuriy.ODonnell
#jira UE-157946
#preflight 636aff4363037c102679f13a
#preflight 63869dde170bc34a93e8c90e

[CL 23337139 by chris kulla in ue5-main branch]
2022-11-30 13:53:00 -05:00
jeannoe morissette
2b32be5f32 VulkanRHI: Quick patch to add support for WAVESIZE in Vulkan.
#rb Guillaume.Abadie
#preflight 6369327edc30a4ce96465e16

[CL 23012164 by jeannoe morissette in ue5-main branch]
2022-11-07 11:48:53 -05:00
dan elksnitis
ecab3b4a9a [shaders] refactor usf/directcompile.txt dump into a utility in ShaderCompilerCommon to reduce code duplication in the shader backends
#rb Jason.Nadro
#rb Christopher.Waters
#preflight 635bf1e1df01edd149f5727e

[CL 22829548 by dan elksnitis in ue5-main branch]
2022-10-28 11:45:49 -04:00
chris kulla
b00b7d70d0 Organize Ray Tracing shaders by their payload
Every shader now has the ability to declare which payload it uses. HitGroup, Miss and Callable shaders may only specify a single type, whereas Raygen shaders may provide more than one.

The global raytracing shader libraries have been categorized according to their payload type, which helps facilitate the creation of minimal ray-tracing pipelines.

Avoid adding callable shaders to the RTPSO if they are not being used.

All RHI shader compilers and shader loaders that support ray tracing have been modified to track an extra uint representing the payload type flagged in the source (at time of compilation).

Add the RayTracingPayloadType to the shadermap DDC key so that we can properly detect when a shader's payload type is invalidated. This is required because we serialize the payload type into the shaders from the C++ side.

#rb Yuriy.ODonnell
#jira none
#preflight 635715cae6096564af4dd28e

[CL 22742893 by chris kulla in ue5-main branch]
2022-10-24 20:11:02 -04:00
christopher waters
f5ff98f2e1 ShaderParameterParser cleanup
- Making ConstantBufferType a constructor only argument. This removes the duplicated logic of calling ShouldUseStableConstantBuffer.
- Moving ShouldUseStableConstantBuffer to ShaderCompilerCommon.
- Made UE::ShaderCompilerCommon::ParseParameterType array arguments const

#jira UE-166341
#rb Guillaume.Abadie
#preflight 634eeceea1527f6b3bda9ff0

[CL 22608320 by christopher waters in ue5-main branch]
2022-10-18 15:25:05 -04:00