You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
The feature is disabled by default, and may be considered Beta for the current release. - Added support for passing an FSceneInstanceCullingQuery to Nanite::IRenderer::DrawGeometry - Added some more interface (inline) functions to Nanite::IRenderer to help guide the user. - Implemented FInstanceHierarchyCull_CS to handle the hierarchy culling in the Nanite culling passes. - Added FInstanceHierarchyAppendUncullable_CS to append "uncullable" instances - Adapted FCompactViewsVSM_CS to handle view group ranges, use with the new hierarchy - Moved VirtualShadowMapViews from FSortedShadowMaps to FShadowSceneRenderer (public -> private) #rb brian.karis,jamie.hayes #jira UE-147060 #preflight 6448d4961150e908d01f0049 [CL 25194831 by Ola Olsson in ue5-main branch]
90 lines
2.4 KiB
C++
90 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
|
|
// 1 + 7 + 24 bits_
|
|
#define INSTANCE_HIERARCHY_ITEM_CHUNK_COUNT_SHIFT (24u)
|
|
#define INSTANCE_HIERARCHY_ITEM_CHUNK_ID_MASK ((1u << INSTANCE_HIERARCHY_ITEM_CHUNK_COUNT_SHIFT) - 1u)
|
|
#define INSTANCE_HIERARCHY_ITEM_CHUNK_COMPRESSED_FLAG (1u << 31u)
|
|
#define INSTANCE_HIERARCHY_ITEM_CHUNK_COMPRESSED_PAYLOAD_MASK ((1u << 31u) - 1u)
|
|
#define INSTANCE_HIERARCHY_MAX_CHUNK_SIZE (64u)
|
|
|
|
#ifdef __cplusplus
|
|
#include "HLSLTypeAliases.h"
|
|
|
|
namespace UE::HLSL
|
|
{
|
|
#endif
|
|
#ifndef __cplusplus //HLSL
|
|
#include "/Engine/Private/LargeWorldCoordinates.ush"
|
|
#endif
|
|
|
|
// Representation in hierarchy buffer
|
|
struct FCellHeader
|
|
{
|
|
uint NumItemChunks;
|
|
uint ItemChunksOffset;
|
|
};
|
|
|
|
struct FCellBlockData
|
|
{
|
|
FLWCVector3 WorldPos;
|
|
float LevelCellSize; // Note, not the block size, but the cell size.
|
|
uint Pad;
|
|
};
|
|
|
|
/**
|
|
* Represent one item of work for the hierarchical culling stage, linking a cell to either a group of views (main-pass) or a singlular view (post-pass).
|
|
*/
|
|
struct FCellDraw
|
|
{
|
|
uint CellId;
|
|
uint ViewGroupId;
|
|
};
|
|
|
|
/**
|
|
* Represent one item of work for the post-pass of the hierarchical culling stage.
|
|
*/
|
|
struct FOccludedCellDraw
|
|
{
|
|
FCellDraw CellDraw;
|
|
uint OccludedViewMask;
|
|
uint Pad;
|
|
};
|
|
/**
|
|
* Represents a group of views, e.g., for a clipmap or point light, or anything else really that share the same broad-phase culling result.
|
|
* Wrt mip-views, there is no explicit handling in the hierarchical culling stage, as they are expected to come in a compact range (post view compaction)
|
|
* A view group should typically share view flags, might want/need to make assumptions around that.
|
|
*/
|
|
struct FViewDrawGroup
|
|
{
|
|
uint FirstView;
|
|
uint NumViews;
|
|
};
|
|
|
|
// Info for one instance culling workgroup (64 threads).
|
|
// TODO: Pack/unpack into fewer bits?
|
|
// TODO: Move to some nanite specific header probably.
|
|
struct FInstanceCullingGroupWork
|
|
{
|
|
uint ViewGroupId;
|
|
uint PackedItemChunkDesc;
|
|
uint ActiveViewMask; // Up to 32 active views in the group (NOTE: this may overflow for example if all mip levels were mapped at the same time on a point light, 48 mips)
|
|
uint Pad;
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} // namespace
|
|
|
|
using FCellHeader = UE::HLSL::FCellHeader;
|
|
using FCellBlockData = UE::HLSL::FCellBlockData;
|
|
using FCellDraw = UE::HLSL::FCellDraw;
|
|
using FOccludedCellDraw = UE::HLSL::FOccludedCellDraw;
|
|
using FViewDrawGroup = UE::HLSL::FViewDrawGroup;
|
|
using FInstanceCullingGroupWork = UE::HLSL::FInstanceCullingGroupWork;
|
|
|
|
#endif
|