UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VertexFactory.h File Reference
#include "Containers/Array.h"
#include "Containers/ContainerAllocationPolicies.h"
#include "Containers/EnumAsByte.h"
#include "Containers/List.h"
#include "Containers/Map.h"
#include "Containers/UnrealString.h"
#include "CoreMinimal.h"
#include "CoreTypes.h"
#include "HAL/PlatformCrt.h"
#include "Math/NumericLimits.h"
#include "Misc/AssertionMacros.h"
#include "Misc/CString.h"
#include "Misc/EnumClassFlags.h"
#include "Misc/SecureHash.h"
#include "RHI.h"
#include "RHIDefinitions.h"
#include "RenderResource.h"
#include "Serialization/Archive.h"
#include "Serialization/MemoryImage.h"
#include "Serialization/MemoryLayout.h"
#include "Shader.h"
#include "ShaderCore.h"
#include "Templates/UnrealTemplate.h"
#include "UObject/NameTypes.h"
#include "VertexStreamComponent.h"
#include <atomic>

Go to the source code of this file.

Classes

struct  FVertexInputStream
 
class  FVertexFactoryShaderParameters
 
struct  TVertexFactoryParameterTraits< ShaderFrequency, VertexFactoryType >
 
class  FVertexFactoryType
 
class  FVertexFactoryTypeDependency
 
class  FCompareVertexFactoryTypes
 
class  FVertexFactory
 
struct  FVertexFactory::FVertexStream
 
class  FPrimitiveIdDummyBuffer
 

Macros

#define STRUCTMEMBER_VERTEXSTREAMCOMPONENT(VertexBuffer, VertexType, Member, MemberType)    FVertexStreamComponent(VertexBuffer,STRUCT_OFFSET(VertexType,Member),sizeof(VertexType),MemberType)
 
#define IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE(FactoryClass, ShaderFrequency, ParameterClass)
 
#define DECLARE_VERTEX_FACTORY_TYPE(FactoryClass)
 
#define DECLARE_VERTEX_FACTORY_TYPE_API(FactoryClass, ModuleApi)
 
#define IMPLEMENT_VERTEX_FACTORY_EDITOR_VTABLE(FactoryClass)
 
#define IMPLEMENT_VERTEX_FACTORY_VTABLE(FactoryClass)
 
#define IMPLEMENT_VERTEX_FACTORY_TYPE(FactoryClass, ShaderFilename, Flags)
 
#define IMPLEMENT_TEMPLATE_VERTEX_FACTORY_TYPE(TemplatePrefix, FactoryClass, ShaderFilename, Flags)
 

Typedefs

typedef TArray< FVertexInputStream, TInlineAllocator< 7 > > FVertexInputStreamArray
 

Enumerations

enum class  EVertexInputStreamType : uint8 { Default = 0 , PositionOnly , PositionAndNormalOnly , Count }
 
enum class  EVertexFactoryFlags : uint32 {
  None = 0u , UsedWithMaterials = 1u << 1 , SupportsStaticLighting = 1u << 2 , SupportsDynamicLighting = 1u << 3 ,
  SupportsPrecisePrevWorldPos = 1u << 4 , SupportsPositionOnly = 1u << 5 , SupportsCachingMeshDrawCommands = 1u << 6 , SupportsPrimitiveIdStream = 1u << 7 ,
  SupportsNaniteRendering = 1u << 8 , SupportsRayTracing = 1u << 9 , SupportsRayTracingDynamicGeometry = 1u << 10 , SupportsRayTracingProceduralPrimitive = 1u << 11 ,
  SupportsLightmapBaking = 1u << 12 , SupportsPSOPrecaching = 1u << 13 , SupportsManualVertexFetch = 1u << 14 , DoesNotSupportNullPixelShader = 1u << 15 ,
  SupportsGPUSkinPassThrough = 1u << 16 , SupportsComputeShading = 1u << 17 , SupportsLumenMeshCards = 1u << 18 , SupportsLandscape = 1u << 19 ,
  IncludesFwdShader = 1u << 20 , SupportsTriangleSorting = 1u << 21
}
 

Functions

 ENUM_CLASS_FLAGS (EVertexStreamUsage)
 
 ENUM_CLASS_FLAGS (EVertexFactoryFlags)
 
RENDERCORE_API FArchiveoperator<< (FArchive &Ar, FVertexFactoryType *&TypeRef)
 
RENDERCORE_API FVertexFactoryTypeFindVertexFactoryType (const FHashedName &TypeName)
 

Variables

RENDERCORE_API TGlobalResource< FPrimitiveIdDummyBufferGPrimitiveIdDummy
 

Macro Definition Documentation

◆ DECLARE_VERTEX_FACTORY_TYPE

#define DECLARE_VERTEX_FACTORY_TYPE (   FactoryClass)
Value:
public: \
static FVertexFactoryType StaticType; \
virtual FVertexFactoryType* GetType() const override;
Definition VertexFactory.h:314

A macro for declaring a new vertex factory type, for use in the vertex factory class's definition body.

◆ DECLARE_VERTEX_FACTORY_TYPE_API

#define DECLARE_VERTEX_FACTORY_TYPE_API (   FactoryClass,
  ModuleApi 
)
Value:
public: \
ModuleApi static FVertexFactoryType StaticType; \
ModuleApi virtual FVertexFactoryType* GetType() const override;
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127

◆ IMPLEMENT_TEMPLATE_VERTEX_FACTORY_TYPE

#define IMPLEMENT_TEMPLATE_VERTEX_FACTORY_TYPE (   TemplatePrefix,
  FactoryClass,
  ShaderFilename,
  Flags 
)
Value:
TEXT(#FactoryClass), \
TEXT(ShaderFilename), \
Flags, \
); \
PREPROCESSOR_REMOVE_OPTIONAL_PARENS(TemplatePrefix) FVertexFactoryType* FactoryClass::GetType() const { return &StaticType; }
#define TEXT(x)
Definition Platform.h:1272
#define PREPROCESSOR_REMOVE_OPTIONAL_PARENS(...)
Definition PreprocessorHelpers.h:112
#define IMPLEMENT_VERTEX_FACTORY_VTABLE(FactoryClass)
Definition VertexFactory.h:566

Templated macro to define a FVertexFactoryType. Can be used for templated Vertex Factories.

◆ IMPLEMENT_VERTEX_FACTORY_EDITOR_VTABLE

#define IMPLEMENT_VERTEX_FACTORY_EDITOR_VTABLE (   FactoryClass)

◆ IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE

#define IMPLEMENT_VERTEX_FACTORY_PARAMETER_TYPE (   FactoryClass,
  ShaderFrequency,
  ParameterClass 
)
Value:
template<> struct TVertexFactoryParameterTraits<ShaderFrequency, FactoryClass> \
{ \
static FVertexFactoryShaderParameters* Create(const class FShaderParameterMap& ParameterMap) { ParameterClass* Result = new ParameterClass(); Result->Bind(ParameterMap); return Result; } \
static void GetElementShaderBindings( \
const FVertexFactoryShaderParameters* Parameters, \
const class FSceneInterface* Scene, \
const class FSceneView* View, \
const class FMeshMaterialShader* Shader, \
ERHIFeatureLevel::Type FeatureLevel, \
const class FVertexFactory* VertexFactory, \
class FMeshDrawSingleShaderBindings& ShaderBindings, \
FVertexInputStreamArray& VertexStreams) \
{ \
static_cast<const ParameterClass*>(Parameters)->GetElementShaderBindings(Scene, View, Shader, InputStreamType, FeatureLevel, VertexFactory, BatchElement, ShaderBindings, VertexStreams); \
} \
}
EVertexInputStreamType
Definition VertexFactory.h:128
Definition MeshDrawShaderBindings.h:104
Definition MeshMaterialShader.h:68
Definition SceneInterface.h:106
Definition SceneView.h:1425
Definition ShaderCore.h:323
Definition VertexFactory.h:172
Definition VertexFactory.h:661
Type
Definition RHIFeatureLevel.h:20
Definition MeshBatch.h:232
Definition MemoryLayout.h:108
Definition VertexFactory.h:199
static const FTypeLayoutDesc * GetLayout()
Definition VertexFactory.h:200
static void GetElementShaderBindings(const FVertexFactoryShaderParameters *Parameters, const class FSceneInterface *Scene, const class FSceneView *View, const class FMeshMaterialShader *Shader, const EVertexInputStreamType InputStreamType, ERHIFeatureLevel::Type FeatureLevel, const class FVertexFactory *VertexFactory, const struct FMeshBatchElement &BatchElement, class FMeshDrawSingleShaderBindings &ShaderBindings, FVertexInputStreamArray &VertexStreams)
Definition VertexFactory.h:203

◆ IMPLEMENT_VERTEX_FACTORY_TYPE

#define IMPLEMENT_VERTEX_FACTORY_TYPE (   FactoryClass,
  ShaderFilename,
  Flags 
)
Value:
FVertexFactoryType FactoryClass::StaticType( \
TEXT(#FactoryClass), \
TEXT(ShaderFilename), \
Flags, \
); \
FVertexFactoryType* FactoryClass::GetType() const { return &StaticType; }

A macro for implementing the static vertex factory type object, and specifying parameters used by the type.

◆ IMPLEMENT_VERTEX_FACTORY_VTABLE

#define IMPLEMENT_VERTEX_FACTORY_VTABLE (   FactoryClass)
Value:
FactoryClass::GetPSOPrecacheVertexFetchElements, \
FactoryClass::ShouldCompilePermutation \
IMPLEMENT_VERTEX_FACTORY_EDITOR_VTABLE(FactoryClass)

◆ STRUCTMEMBER_VERTEXSTREAMCOMPONENT

#define STRUCTMEMBER_VERTEXSTREAMCOMPONENT (   VertexBuffer,
  VertexType,
  Member,
  MemberType 
)     FVertexStreamComponent(VertexBuffer,STRUCT_OFFSET(VertexType,Member),sizeof(VertexType),MemberType)

A macro which initializes a FVertexStreamComponent to read a member from a struct.

Typedef Documentation

◆ FVertexInputStreamArray

Number of vertex input bindings to allocate inline within a FMeshDrawCommand. This is tweaked so that the bindings for commonly cached factories (FLocalVertexFactory, FGPUBaseSkinVertexFactory) fit into the inline storage. Overflow of the inline storage will cause a heap allocation per draw (and corresponding cache miss on traversal)

Enumeration Type Documentation

◆ EVertexFactoryFlags

Enumerator
None 
UsedWithMaterials 
SupportsStaticLighting 
SupportsDynamicLighting 
SupportsPrecisePrevWorldPos 
SupportsPositionOnly 
SupportsCachingMeshDrawCommands 
SupportsPrimitiveIdStream 
SupportsNaniteRendering 
SupportsRayTracing 
SupportsRayTracingDynamicGeometry 
SupportsRayTracingProceduralPrimitive 
SupportsLightmapBaking 
SupportsPSOPrecaching 
SupportsManualVertexFetch 
DoesNotSupportNullPixelShader 
SupportsGPUSkinPassThrough 
SupportsComputeShading 
SupportsLumenMeshCards 
SupportsLandscape 
IncludesFwdShader 
SupportsTriangleSorting 

◆ EVertexInputStreamType

Enumerator
Default 
PositionOnly 
PositionAndNormalOnly 
Count 

Function Documentation

◆ ENUM_CLASS_FLAGS() [1/2]

ENUM_CLASS_FLAGS ( EVertexFactoryFlags  )

◆ ENUM_CLASS_FLAGS() [2/2]

ENUM_CLASS_FLAGS ( EVertexStreamUsage  )

◆ FindVertexFactoryType()

RENDERCORE_API FVertexFactoryType * FindVertexFactoryType ( const FHashedName TypeName)
extern

Find the vertex factory type with the given name.

Returns
NULL if no vertex factory type matched, otherwise a vertex factory type with a matching name.

◆ operator<<()

RENDERCORE_API FArchive & operator<< ( FArchive Ar,
FVertexFactoryType *&  TypeRef 
)
extern

Serializes a reference to a vertex factory type.

Variable Documentation

◆ GPrimitiveIdDummy