Commit Graph

138 Commits

Author SHA1 Message Date
Sebastien Hillaire
cd4aa07281 Strata - added high quality normal according to GBuffer format.
#rb none
#preflight https://horde.devtools.epicgames.com/job/6374f970b6636838280f3278
#fyi charles.derousiers

[CL 23155230 by Sebastien Hillaire in ue5-main branch]
2022-11-16 11:35:48 -05:00
Sebastien Hillaire
f34b2df7d5 Fixed Strata looking bad on some platforms requiring render target format specification (not account for Strata target count, motion blur not specifying the correct index)
#rb none
#preflight https://horde.devtools.epicgames.com/job/63749aff3248425305676b3b
#fyi charles.derousiers, jamie.hayes

[CL 23151575 by Sebastien Hillaire in ue5-main branch]
2022-11-16 03:26:45 -05:00
chris kulla
5ed75e222b Path Tracer: Remove PixelCoord from Payload and PixelIndex from PathState
This field is no longer used, which frees up 4 bytes in the payload and in the path state.

#rb Patrick.Kelly
#jira none
#preflight 636d6ab185629dff9115b77c

[CL 23088414 by chris kulla in ue5-main branch]
2022-11-10 17:15:53 -05:00
graham wihlidal
2097725408 Resurrected and reimplemented the HiZ visualizations, as well as a bunch of code cleanup.
#rb rune.stubbe
[FYI] brian.karis
#preflight skip

[CL 23004198 by graham wihlidal in ue5-main branch]
2022-11-06 08:19:39 -05:00
eric mcdaniel
502749c59a Fix for async compute on platforms with memory boundary restrictions on async compute dispatch indirect arguments
*** This change will incur a full shader invalidation across all platforms ***

Issues:
  - Some platforms require async compute dispatch indirect arguments to not cross specific memory boundaries
    - This places restrictions on the valid sizes for a dispatch indirect argument set.  We were not conforming to these restrictions which could result in GPU crashes on these async passes

Fixes:
  - FRHIDispatchIndirectParameters is padded out to meet per-platform memory boundary restrictions
    - This is driven via new per-platform preprocessor define PLATFORM_DISPATCH_INDIRECT_ARGUMENT_BOUNDARY_SIZE
    - Some platforms require FRHIDispatchIndirectParameters to align with their internal structure hence we cannot universally size to meet all platform's requirements

  - Introduce new FRHIDispatchIndirectParametersNoPadding for uses when we explicitly do not want the padding and otherwise avoid the memory boundary restrictions

  - Revise and expand indirect argument validation code to catch further such issues in the future

  - Update shaders which write to dispatch indirect argument buffers to account for optional per-platform padding
    - New utility function WriteDispatchIndirectArgs introduced to faciliate this
    - platforms which require other than the default nonpadded dispatch indirect arguments must define DISPATCH_INDIRECT_UINT_COUNT and their own WriteDispatchIndirectArgs in their CommonPlatform.ush

  - move creation of DispatchIndirectGraphicsCommandSignature command signature to be per-platform
    - DispatchIndirectGraphicsCommandSignature and DispatchIndirectComputeCommandSignature stride changed to account for additional padding on impacted platforms

Testing:
  - ran Lyra with and without async compute Lumen on impacted platforms as well as Win64
  - ran FN replay on impacted platforms

#rb Krzysztof.Narkowicz, Ben.Woodhouse, Benjamin.Rouveyrol
#jira UE-167950
#preflight 6359563b2e6690262a11bc06

[CL 22862498 by eric mcdaniel in ue5-main branch]
2022-10-31 10:15:11 -04:00
chris kulla
60ddb1867f Hide unused payload structs from shaders which did not declare them
This is meant to help avoid inconsistencies between GetRayTracingPayloadType() and the shader code.

As an example of the usage, convert RayTracingDebug related shaders to only enable the payload conditionally. Fix the current incorrect mixing of payload uses in the same shader by introducing a permutation for the material version of the debug shader vs. the one that uses the debug payload (this was previously a runtime shader parameter only which implied two different payloads could theoretically be compiled into one RTPSO).

Also conditionaly enable some of the simpler payload types like the niagara and decal ones that are only used in a few places. Other payloads will be handled in future refactors.

Split RayTracingDebug.usf into smaller files that only have one raytracing entry in them to reduce the amount of counditional logic needed around payloads.

#rb Yuriy.ODonnell
#jira none
#preflight 635c49e9ae6840072d4df82f

[CL 22849513 by chris kulla in ue5-main branch]
2022-10-28 23:28:11 -04:00
Charles deRousiers
48b3286bc0 Add IES atlas texture manager.
This persistent atlas hold IES texture in a unique texture array which is used by all systems (raster/RT/PT/Lumen), and unify IES profile rendering.

#rb chris.kulla, sebastien.hillaire, krzysztof.narkowicz
#jira UE-167618
#preflight 6356fd907261e565c436a0fb

[CL 22806455 by Charles deRousiers in ue5-main branch]
2022-10-27 04:36:31 -04:00
Yuriy ODonnell
1467e1ef82 Remove deprecated RHIRayTraceOcclusion and RHIRayTraceIntersection methods. They are replaced with equivalent new high-level functions in RayTracingBasicShaders.cpp.
#jira UE-167534
#preflight 63584e6f765b435dddecbb0c
#rb Chris.Kulla

[CL 22764325 by Yuriy ODonnell in ue5-main branch]
2022-10-25 17:55:27 -04:00
wouter dek
60222e1105 Add list of lights to GPU scene, mirroring Scene::Lights. Each element contains the view-independent properties of the light.
#rb ola.olsson, charles.derousiers, sebastien.hillaire, matt.peters
#preflight 6356a0707261e565c41de278
#jira none

[CL 22727778 by wouter dek in ue5-main branch]
2022-10-24 11:07:32 -04:00
ola olsson
0210731408 Added support for using a stride to skip marking VSM every pixel, this improves performance on page marking (at the potential loss of some quality).
- Also moved Single Layer Water tile classification pass to the depth pre-pass and generated a mask to let the VSM page marking skip fetching water data for every pixel.

#rb tim.doerries,wouter.dek
[FYI] andrew.lauritzen
#preflight 635150d7047f3570ade21f92

[CL 22726871 by ola olsson in ue5-main branch]
2022-10-24 10:19:13 -04:00
aleksander netzel
040aab38c6 Add new ray tracing debug visualization mode to show heatmap for primary rays instance overlap:
* Collect instance AABBs when building RayTracingScene
* Output depth from RayTracingDebug pass for depth testing the instance AABBs
* Render instance AABBs as boxes with depth testing to accumulate the overlap which is then converted to heatmap and blended on top of RayTracingDebug output
* Non-GPUScene instances are not yet supported in this mode.

#rb yuriy.odonnell, tiago.costa
#preflight 63485810ad0f7e2f20eb5db2

[CL 22524168 by aleksander netzel in ue5-main branch]
2022-10-14 05:35:28 -04:00
yuriy odonnell
0e08f4aa38 Add bindless resource support as a requirement for ray tracing on PC (SM 6.6 + Resource Binding Tier 3).
Compile DXR shaders using the same profile when targeting PCD3D_SM5 and PCD3D_SM6 (i.e. lib_6_6 or lib_6_5 based on USE_SHADER_MODEL_6_6 define).

#rb christopher.waters
#preflight 63376cc6466fb43669315f62

[CL 22286556 by yuriy odonnell in ue5-main branch]
2022-09-30 23:05:36 -04:00
ola olsson
d077efdf50 Dirty-page marking skips dynamic pages and merge only when static is dirty, also initialize dynamic pages from cached static pages, when available.
#preflight 6321b8948838676d103d3e75
#rb andrew.lauritzen
#preflight 632ae18af87253e02153cd56

[CL 22201428 by ola olsson in ue5-main branch]
2022-09-27 02:14:18 -04:00
graham wihlidal
bd09970367 Bump NANITE_FILTER_FLAGS_NUM_BITS from 4 to 6 since landscape and SM was added
[FYI] jamie.hayes
#preflight skip

[CL 22196089 by graham wihlidal in ue5-main branch]
2022-09-26 19:49:06 -04:00
jamie hayes
eb348be5aa - Add the ability to disable WPO on instances that are a specified distance from the camera.
- Also add the ability for clusters to be able to be sorted into up to two bins so that WPO-disabled clusters will render with the most optimal shaders possible.

#rb rune.stubbe
#preflight skip

[CL 22193070 by jamie hayes in ue5-main branch]
2022-09-26 16:20:30 -04:00
Charles deRousiers
ecf8b88fde Add dedicated 'decal tile' data to Strata (optional), to dispatch decal work only where there are decals on the frame.
This makes the dbuffer pass 0.05ms faster, but the makes the classification slower by 0.1ms. So no win for now, but further optimization are coming. Disabled for now.

#rb none
#jira none
#preflight 632979ec9840225da24fc245
#fyi sebastien.hillaire

[CL 22091302 by Charles deRousiers in ue5-main branch]
2022-09-20 09:05:17 -04:00
Charles deRousiers
c98236981f Strata - 3 MRTs + legacy shading model fast packing option.
* This CL adds dedicated legacy material compaction and writes 3uint through mrt (for simple clear coat/sss wrap/cloth) instead of 4 uint with 2 through UAV ops). This allows faster base pass in particular on slower platform.
* Activating DBuffer make the entire base pass slower with this change list, but this will be addressed with subsequent changes.

Work done by Seb, submitted on his behalf.

#rb charles.derousiers
#jira none
#preflight 631f8804065c4ac9ce61e81d
#fyi sebastien.hillaire

[CL 22002833 by Charles deRousiers in ue5-main branch]
2022-09-14 03:23:07 -04:00
tiago costa
c5b7787bb3 Store segment FirstPrimitive in FHitGroupSystemRootConstants.
#rb patrick.kelly
#preflight skip

[CL 21989595 by tiago costa in ue5-main branch]
2022-09-13 15:03:24 -04:00
ola olsson
a9b46eb202 Dirty page tracking for non-nanite implementation & WPO-invalidations from Nanite
- bMaterialMayModifyPosition -> bMaterialUsesWorldPositionOffset for non-nanite, we don't want to invalidate due to PDO
- Nanite instance culling records static primitives that invalidate the VSM (so they get cached as dynamic)
- Dirty page flags now store the invalidation as well (static & dynamic) so 3x in size
- Nanite VSM instance/cluster culling uses PRIMITIVE_SCENE_DATA_FLAG_EVALUATE_WORLD_POSITION_OFFSET to drive bHasMoved and invalidaiton.
- Non-nanite instance culling outputs dirty page flags for invalidating instances, with in-group load balancing for large footprints
- Store invalidation flags in physical page metadata flags (removed the cumulative dirty flags buffer).
- Added bAnyMaterialHasWorldPositionOffset (accessor AnyMaterialHasWorldPositionOffset()) to FPrimitiveSceneProxy.
- Driving PRIMITIVE_SCENE_DATA_FLAG_EVALUATE_WORLD_POSITION_OFFSET from bAnyMaterialHasWorldPositionOffset in addition to EvaluateWorldPositionOffset.
- Removed near clip permutation for non-nanite VSM culling shader.
- Non-nanite vsm raster passes are all batched in a single RDG pass to better allow overlap between draws and lower pass overhead.
- Removed old GPU->GPU invalidation logic.
- Removed dynamic caster flags and update the physical page metadata directly
- Renamed PRIMITIVE_SCENE_DATA_FLAG_SHOULD_CACHE_SHADOW -> PRIMITIVE_SCENE_DATA_FLAG_SHOULD_CACHE_SHADOW

#rb andrew.lauritzen,jamie.hayes
#jira UE-147061
#preflight 631b0a18a60c539c98cf1308

[CL 21973831 by ola olsson in ue5-main branch]
2022-09-12 18:06:57 -04:00
Sebastien Hillaire
e27b68cc9b Strata - moving SSSData at the end of the strata material buffer to reduce UAV count limitation on dx11.
Fixed a bug wehre loadiung fast material would not be done correctly inside the classification pass for the sharedmemeory path.
#rb none
#jira UE-161415
#preflight https://horde.devtools.epicgames.com/job/630909b9987e7155b1af0aec
#fyi charles.derousiers

[CL 21661992 by Sebastien Hillaire in ue5-main branch]
2022-08-29 02:55:17 -04:00
ola olsson
6c563cf263 Batch of improvements to page management, that help improve passes of page allocation.
Implemented single-page page table support for distant lights
- store only a single page table entry for distant lights
- modify page lookup logic in various places to handle this

Implemented override behavior to render everything to dynamic pages for a light that always invalidates using r.Shadow.Virtual.Cache.ForceInvalidateClipmaps (behave as uncached, despite caching being enabled).
This brings performance to par with uncached rendering by removing various overheads that are not achieving anything for this case.
- Added a new flag to the nanite view to indicate if it is uncached VSM_PROJ_FLAG_UNCACHED, currently driven by the cvar r.Shadow.Virtual.Cache.ForceInvalidateClipmaps
- If this flag is set on a view ShouldCacheInstanceAsStatic, which now takes a nanite view, returns false, causing all rendering to go to the dynamic pages.
- To preserve HZB functionality, the HZB build is modified to load from the dynamic depth pages (normally it uses the static)
- The page initializer (that clears depth) skips static pages for uncached bviews as they will not be used.
- Finally the page merge pass that combines static & dynamic depth into the dynamic page also skips pages from uncached views.

Optimized page allocation pass by storing the actual pages needing allocation from the cache init pass.
Optimized hierarchical page flag generation by dispatching over physical pages instead of virtual.
Fixed dynamic primitive cache invalidation logic.

#jira UE-122102
#rb andrew.lauritzen
#preflight 63087c2592620e5ec3aa3f2f

[CL 21590421 by ola olsson in ue5-main branch]
2022-08-26 11:06:04 -04:00
Sebastien Hillaire
f50162be6f Strata - made the ConvertToDecal node force using parameter blending now that it is a requiremeent.
#rb none
#prelfight none
#fyi charles.derousiers
#preflight none

[CL 21423589 by Sebastien Hillaire in ue5-main branch]
2022-08-17 08:43:39 -04:00
Sebastien Hillaire
bd10222f91 Strata - fixed decals and all legacy material conversion to be a lot simpler and consistent with the strata.
We are no longer fighting the Strata tree but just using it now, since Legacyconversion node can only oputput a single BSDF at any time. Conversion to decals parameter blending will now correctly work.

#rb charles.derousiers
#jira UE-160739
#fyi charles.derousiers
#preflight none

[CL 21423524 by Sebastien Hillaire in ue5-main branch]
2022-08-17 08:26:48 -04:00
Yuriy ODonnell
f040e7c458 Update RAY_TRACING_SHADER_VERSION to force-rebuild all ray tracing shaders after target shader model was changed to 6.5 (CL 21200656)
#rb Chris.Waters
#preflight skip (trivial)

[CL 21208508 by Yuriy ODonnell in ue5-main branch]
2022-07-21 16:06:33 -04:00
tiago costa
4799bfee44 Add definition of NANITE_MAX_CLUSTER_TRIANGLES_BITS and NANITE_MAX_CLUSTER_TRIANGLES_MASK
- also delete some unused variables.

#rb rune.stubbe
#jira none
#preflight 62d70476d76ea4b50332e234

[CL 21166243 by tiago costa in ue5-main branch]
2022-07-19 15:44:41 -04:00