UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NaniteStreamingShared.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
8
9namespace Nanite
10{
11
12// Round up to smallest value greater than or equal to x of the form k*2^s where k < 2^NumSignificantBits.
13// This is the same as RoundUpToPowerOfTwo when NumSignificantBits=1.
14// For larger values of NumSignificantBits each po2 bucket is subdivided into 2^(NumSignificantBits-1) linear steps.
15// This gives more steps while still maintaining an overall exponential structure and keeps numbers nice and round (in the po2 sense).
16
17// Example:
18// Representable values for different values of NumSignificantBits.
19// 1: ..., 16, 32, 64, 128, 256, 512, ...
20// 2: ..., 16, 24, 32, 48, 64, 96, ...
21// 3: ..., 16, 20, 24, 28, 32, 40, ...
23{
25
26 const int32_t Shift = FMath::Max((int32)FMath::CeilLogTwo(x) - (int32)NumSignificantBits, 0);
27 const uint32 Mask = (1u << Shift) - 1u;
28 return (x + Mask) & ~Mask;
29}
30
37
38} // namespace Nanite
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition SkinnedMeshComponent.h:50
FORCEINLINE uint32 RoundUpToSignificantBits(uint32 x, uint32 NumSignificantBits)
Definition NaniteStreamingShared.h:22
Definition NaniteStreamingShared.h:32
uint32 RuntimeResourceID_Magic
Definition NaniteStreamingShared.h:33
uint32 Priority_Magic
Definition NaniteStreamingShared.h:35
FPageRangeKey ResourcePageRangeKey
Definition NaniteStreamingShared.h:34
Definition NaniteResources.h:217