UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StreamableRenderResourceState.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4StreamableRenderResourceState.h: Render resource state for streamable assets.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10
23{
24 // The maximum number of streaming LODs the streaming supports.
25 static const uint32 MAX_LOD_COUNT = 16;
26
28
29 // Manually implement copy operations, because MSVC produces bad codegen for bitfields in unions
30 // (as of the 14.35.32217 toolchain)
36 {
37 Data = Other.Data;
38 }
39
40 union
41 {
42 struct
43 {
44 /* Whether the resource LODs can be streamed or not. Even when false, the structure can contain valid information if IsValid(). */
46
49
50 /* Whether the render resources have pending InitRHI(). Used in HasPendingInitOrStreaming() to avoid dereferencing the different resource pointers unless required. Once false, expected to stay false. */
52
53 /* Whether there is currently a visual LOD transition, following a streaming operation. Used to prevent accessing the render resource unless necessary. */
55
56 /* The number of always loaded LODs, which can not be streamed out. */
58 /* The number of LODs (streaming or not) that are guarantied to be installed, for example in PAKs. */
59 uint8 NumNonOptionalLODs; // >= NumberOfNonStreamingLODs
60 /* The maximum number of LODs the resource can possibly have. Might be less than the asset LOD count. */
61 uint8 MaxNumLODs; // >= NumberOfNonOptionalLODs
62
65
70
73 };
75 };
76
82
85 {
86 return MaxNumLODs - InLODCount;
87 }
88
91 {
93 }
94
100
102 inline bool IsValid() const { return Data != 0; }
103
104 inline void Clear() { Data = 0; }
105
115
118 {
119 // InLODCount can be higher than MaxNumLODs, as long as there are some LODs to yet stream in.
121 {
122 NumRequestedLODs = (uint8)FMath::Min<int32>(InLODCount, MaxNumLODs);
124 return true;
125 }
126 else
127 {
128 return false;
129 }
130 }
131
133 {
134 // InLODCount can be lower than MaxNumLODs, as long as there are some LODs to yet stream in.
136 {
139 return true;
140 }
141 else
142 {
143 return false;
144 }
145 }
146};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
static constexpr UE_FORCEINLINE_HINT bool IsWithinInclusive(const T &TestValue, const U &MinValue, const U &MaxValue)
Definition UnrealMathUtility.h:376
Definition StreamableRenderResourceState.h:23
static const uint32 MAX_LOD_COUNT
Definition StreamableRenderResourceState.h:25
void operator=(const FStreamableRenderResourceState &Other)
Definition StreamableRenderResourceState.h:35
void Clear()
Definition StreamableRenderResourceState.h:104
bool IsValid() const
Definition StreamableRenderResourceState.h:102
int32 LODCountToAssetFirstLODIdx(int32 InLODCount) const
Definition StreamableRenderResourceState.h:78
bool StreamIn(int32 InLODCount)
Definition StreamableRenderResourceState.h:117
uint8 LODBiasModifier
Definition StreamableRenderResourceState.h:72
uint8 bSupportsStreaming
Definition StreamableRenderResourceState.h:45
uint8 MaxNumLODs
Definition StreamableRenderResourceState.h:61
FStreamableRenderResourceState(const FStreamableRenderResourceState &Other)
Definition StreamableRenderResourceState.h:31
uint64 Data
Definition StreamableRenderResourceState.h:74
bool StreamOut(int32 InLODCount)
Definition StreamableRenderResourceState.h:132
uint8 NumRequestedLODs
Definition StreamableRenderResourceState.h:69
uint8 AssetLODBias
Definition StreamableRenderResourceState.h:64
uint8 bSupportsVirtualStreaming
Definition StreamableRenderResourceState.h:48
int32 LODCountToFirstLODIdx(int32 InLODCount) const
Definition StreamableRenderResourceState.h:84
int32 RequestedFirstLODIdx() const
Definition StreamableRenderResourceState.h:96
uint8 NumNonStreamingLODs
Definition StreamableRenderResourceState.h:57
uint8 NumNonOptionalLODs
Definition StreamableRenderResourceState.h:59
bool IsValidForStreamingRequest() const
Definition StreamableRenderResourceState.h:107
uint8 NumResidentLODs
Definition StreamableRenderResourceState.h:67
uint8 bHasPendingInitHint
Definition StreamableRenderResourceState.h:51
int32 ResidentFirstLODIdx() const
Definition StreamableRenderResourceState.h:90
uint8 bHasPendingLODTransitionHint
Definition StreamableRenderResourceState.h:54
FStreamableRenderResourceState()
Definition StreamableRenderResourceState.h:27