Commit Graph

567 Commits

Author SHA1 Message Date
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
luke thatcher
ee70bc02da Remove use of FRHIBoundShaderState resources in D3D12RHI
- No longer necessary, since they were only used to find/create root signatures, which can be implemented directly in the adapter class.
 - RHICreateBoundShaderState is never called.

Remove D3D12_SUPPORTS_PARALLEL_RHI_EXECUTE
 - This is always true.

#rb Chris.Waters
#preflight 6384cd3afa053c489af10129

[CL 23300192 by luke thatcher in ue5-main branch]
2022-11-28 19:13:10 -05:00
christopher waters
0e8e4d0dd6 After extracting all parameters from D3D12 reflection, the "bSucceeded" flag was being forced to true which would prevent any parameter validation from being reported. Most notably, this would hide errors caused by missing global parameters when using shader parameter structs.
Bumping D3D_SM5 and D3D_SM6 versions.

#jira none
#rb jason.nadro
#preflight 6384f5d2170bc34a935c960c

[CL 23298219 by christopher waters in ue5-main branch]
2022-11-28 17:06:24 -05:00
Luke Thatcher
f5136f75e2 Unify code that binds shader resources from uniform buffers across platform RHIs
- All platforms were extending FBaseShaderResourceTable to add a TArray<uint32> TextureMap member, along with copies of the same RHI code to bind these resources.
 - Moved the TextureMap member into the base shader table type, and removed all platform versions. They are all serializer-compatible with the original code, so no shader DDC keys need to be bumped.
 - Also moved the "ResourceTable" array of RHI resources into the base FRHIUniformBuffer class.
 - Added a SetResourcesFromTables function in RHICoreShader.h

Removed GetD3D11TextureFromRHITexture in D3D11RHI, replaced with a ResourceCast.
 - The ResourceCast function for FRHITexture types now always follows the texture reference pointer via the vtable call, like other platforms.

#jira none
#rb Chris.Waters
#preflight 637e6cd43377450900f10fd2

[CL 23252815 by Luke Thatcher in ue5-main branch]
2022-11-23 14:17:01 -05:00
Tim Smith
29f509cf8d Fixed compile issue
#rb self
#rnx
#jira UE-170534
#preflight 63779f5faa2fe2b05f8d73c5

[CL 23194313 by Tim Smith in ue5-main branch]
2022-11-18 10:10:41 -05:00
Laura Hermanns
6cac5e04e5 Allow allocation of zero bytes in DXC custom allocator, use portable STDCALL declaration, and add error code translation for DXC specific HRESULT values.
#rb Yuriy.Odonnell
#fyi Dan.Elksnitis, Jason.Nadro
#jira none
#preflight 63779846f514e1ded9af11b0
#rnx

[CL 23194073 by Laura Hermanns in ue5-main branch]
2022-11-18 09:43:23 -05:00
Tim Smith
9f52c3aa2d Fix to allow settings objects to be properly handled by LiveCoding and HotReload.
#rb matt.peters
#jira UE-169808
#preflight 6373dbaf232e3d12cbd1e9a0

[CL 23139425 by Tim Smith in ue5-main branch]
2022-11-15 13:39:47 -05:00
laura hermanns
58e529b618 Use custom memory allocator for DXC to report better callstack on OOM event.
#rb Yuriy.ODonnell
[FYI] Jason.Nadro, Dan.Elksnitis, Carl.Lloyd
#preflight none
#rnx

[CL 23072013 by laura hermanns in ue5-main branch]
2022-11-10 01:18:07 -05:00
laura hermanns
b3e8c553e3 Fix "Compile failed without errors" message and unify this error report for FXC and DXC.
#rb Dan.Elksnitis
#rnx

[CL 23034307 by laura hermanns in ue5-main branch]
2022-11-08 14:20:14 -05:00
laura hermanns
b32256418b Log available system memory when DXC crashes on E_OUTOFMEMORY to verify system is in fact out of memory.
#rb Jason.Nadro, Yuriy.Odonnell
[FYI] Dan.Elksnitis
#preflight 636924014d3c1d9d925e05ab
#rnx

[CL 23029673 by laura hermanns in ue5-main branch]
2022-11-08 11:15:46 -05:00
Tim Smith
684a5edf74 Fixed issue where Live Coding Console would fail to properly enable when it is started on demand.
#rb self
#jira UE-169199
#preflight 63655cf1882365b859bea5e4

[CL 22992274 by Tim Smith in ue5-main branch]
2022-11-04 14:48:13 -04:00
Zak Middleton
73efd27f6c #ue5 - Truncation fixes for modules:
StatsViewer
StatusBar
TargetDeviceServices
TargetPlatform
Teleporter
TimeManagement
TranslationEditor
ViewportInteraction
Virtualization
WindowsPlatformFeatures
WindowsTargetPlatform

#jira UE-160837, UE-160843
#rb Andrew.Davidson, Dave.Jones2
#preflight 636024751c75ff834a526197

[CL 22873932 by Zak Middleton in ue5-main branch]
2022-10-31 18:33:27 -04:00
yuriy odonnell
9de862ab0b Add UE::ShaderCompilerCommon::RemoveDeadCode() high-level wrapper for shader minifier, to be consistently used in all shader compiler back-ends
#preflight 635af3aa1b7de936a5295629
#rb jason.nadro

[CL 22850483 by yuriy odonnell in ue5-main branch]
2022-10-29 01:51:27 -04: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
laura hermanns
7785c20330 Abstract number of instructions for complexity visualization by estimated metric.
#preflight 6356f6b30313c24974fc5535
#jira UE-168166
#rb jason.nadro

[CL 22788160 by laura hermanns in ue5-main branch]
2022-10-26 16:15:17 -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
henrik karlsson
bd5352a0c3 [UE]
* More fixes to be preprocessor conformant (/Zc:preprocessor)

#rb none
#preflight skipped

[CL 22705198 by henrik karlsson in ue5-main branch]
2022-10-21 19:52:08 -04:00
henrik karlsson
dbe0123ff5 * Fixed so preprocessor conforms to C99 and C++11 (/Zc:preprocessor)
Not proud over the LC_* files but don't dare touching the actual log macros since that is hard to get right and I don't know how to test this code

#preflight 6351d6de777a77c440123e2c
#rb none

[CL 22705170 by henrik karlsson in ue5-main branch]
2022-10-21 19:50:32 -04:00
dan elksnitis
b81ae6648c [shader compilation] changes to error handling in ShaderCompileWorker
- each platform compilation request is now wrapped in __try/__except rather than a single exception handling block at the top level of the worker; this allows us to log an exception (with callstack) as a compilation error and continue the batch
- remove SEH code from ShaderConductorContext, the above makes this redundant (and it didn't provide any actionable information)
- strip down SEH code in D3DShaderCompiler; now only used for the purposes of pre-compiling with DXC in the case of an FXC crash. dumping preprocessed source will be handled in a different manner in a forthcoming CL
- minor change in the DXC precompile path to not log an unnecessary warning when performing an explicitly-requested DXC precompile

#rb Jason.Nadro
#rb Laura.Hermanns
#rb Yuriy.ODonnell
#preflight 63514c798176062ea73acb41
#jira FORT-524383

[CL 22654436 by dan elksnitis in ue5-main branch]
2022-10-20 09:43:50 -04:00
Tim Smith
d087b03671 Improved Live Coding startup time to make starting the console an asyncronous task.
#rb Robert.Miller
#preflight 635143efc9559712ed540c11

[CL 22654049 by Tim Smith in ue5-main branch]
2022-10-20 09:21:20 -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
christopher waters
1b8ad85eaa Working around DXC issue https://github.com/microsoft/DirectXShaderCompiler/issues/4715
When filling out D3D12_FUNCTION_DESC, DXC does not populate RequiredFeatureFlags. Given we rely on these flags to validate bindless support at runtime, we need to emulate these flags being set.

#jira UE-162014
#rb elizabeth.baumel
#preflight 634488a6c272487ed4784593

[CL 22458354 by christopher waters in ue5-main branch]
2022-10-11 11:06:47 -04:00
Yuriy ODonnell
9ab9403717 ShaderMinifier - Track and output line directives
#rb Jason.Nadro
#preflight 63406dd22a0a2c1ead8d1145

[CL 22405822 by Yuriy ODonnell in ue5-main branch]
2022-10-07 14:31:38 -04:00
christopher waters
281072e217 Don't count shader parameters that we don't bind through resource tables. Resources like UEDiagnosticBuffer and vendor extensions are handled through Root Signatures.
#jira
#rb yuriy.odonnell, elizabeth.baumel
#preflight 633ef2f7511dd8cb01cc51db

[CL 22381598 by christopher waters in ue5-main branch]
2022-10-06 15:23:50 -04:00
christopher waters
38cc1eb3b2 Instead of adding the different D3D shader format versions together, combine their hashes. This will prevent version overlaps when someone changes the shared version.
#jira none
#rb yuriy.odonnell
#preflight 633e43653a20cf302c9fee76

[CL 22371688 by christopher waters in ue5-main branch]
2022-10-05 23:57:45 -04:00