UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GPUSkinVertexFactory.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 GPUSkinVertexFactory.h: GPU skinning vertex factory definitions.
5=============================================================================*/
6
7#pragma once
8
9#include "CoreMinimal.h"
10#include "Stats/Stats.h"
11#include "RHI.h"
12#include "RenderResource.h"
13#include "BoneIndices.h"
14#include "GPUSkinPublicDefs.h"
15#include "UniformBuffer.h"
16#include "VertexFactory.h"
17#include "LocalVertexFactory.h"
18#include "ResourcePool.h"
19#include "Matrix3x4.h"
20#include "SkeletalMeshTypes.h"
21
22template <class T> class TConsoleVariableData;
23
24#define SET_BONE_DATA(B, X) B.SetMatrixTranspose(X)
25
28{
29public:
32 enum
33 {
38 };
39
45
51
52private:
54 static uint32 BucketSizes[NumPoolBucketSizes];
55};
56
59{
61
63 {
64 *this = MoveTemp(RHS);
65 }
66
68 {
69 VertexBufferRHI = MoveTemp(RHS.VertexBufferRHI);
70 VertexBufferSRV = MoveTemp(RHS.VertexBufferSRV);
71 Size = RHS.Size;
72 return *this;
73 }
74
81
85};
86
93{
94 return IsValidRef(Buffer.VertexBufferRHI) && IsValidRef(Buffer.VertexBufferSRV);
95}
96
124
126class FBoneBufferPool : public TRenderResourcePool<FVertexBufferAndSRV, FBoneBufferPoolPolicy, FSharedPoolPolicyData::CreationArguments>
127{
128public:
130 virtual ~FBoneBufferPool();
131
132public: // From FTickableObjectRenderThread
133 virtual TStatId GetStatId() const override;
134};
135
145
147class FClothBufferPool : public TRenderResourcePool<FVertexBufferAndSRV, FClothBufferPoolPolicy, FSharedPoolPolicyData::CreationArguments>
148{
149public:
151 virtual ~FClothBufferPool();
152
153public: // From FTickableObjectRenderThread
154 virtual TStatId GetStatId() const override;
155};
156
158{
159 DefaultBoneInfluence, // up to 8 bones per vertex
160 UnlimitedBoneInfluence // unlimited bones per vertex
162
199
202{
203public:
205 {
206 public:
207 FUpdateScope();
208
209 private:
212 };
213
215 {
217 {
218 // BoneDataOffset and BoneTextureSize are not set as they are only valid if IsValidRef(BoneTexture)
219 MaxGPUSkinBones = GetMaxGPUSkinBones();
220 check(MaxGPUSkinBones <= GHardwareMaxGPUSkinBones);
221 }
222
223 static void AllocateBoneBuffer(FRHICommandList& RHICmdList, uint32 BufferSize, FVertexBufferAndSRV& OutBoneBuffer);
224
225 static void UpdateBoneData(
226 FRHICommandList& RHICmdList,
227 const FName& AssetPathName,
230 FRHIBuffer* VertexBufferRHI);
231
232 void ReleaseBoneData();
233
234 bool HasBoneBufferForReading(bool bPrevious) const
235 {
236 bPrevious = GetPreviousForRead(bPrevious);
237 const FVertexBufferAndSRV* Output = &GetBoneBufferInternal(bPrevious);
238 if (bPrevious && !Output->VertexBufferRHI.IsValid())
239 {
240 Output = &GetBoneBufferInternal(false);
241 }
242 return Output->VertexBufferRHI.IsValid();
243 }
244
245 const FVertexBufferAndSRV& GetBoneBufferForReading(bool bPrevious) const
246 {
247 bPrevious = GetPreviousForRead(bPrevious);
248 const FVertexBufferAndSRV* Output = &GetBoneBufferInternal(bPrevious);
249
250 if(!Output->VertexBufferRHI.IsValid())
251 {
252 // Data is only allowed to be null when requesting the previous buffers.
253 checkf(bPrevious, TEXT("Trying to access current bone buffer for reading, but it is null. BoneBuffer[0] = %p, BoneBuffer[1] = %p, CurrentRevisionNumber = %u, PreviousRevisionNumber = %u"),
254 BoneBuffer[0].VertexBufferRHI.GetReference(), BoneBuffer[1].VertexBufferRHI.GetReference(), CurrentRevisionNumber, PreviousRevisionNumber);
255
256 Output = &GetBoneBufferInternal(false);
257 check(Output->VertexBufferRHI.IsValid());
258 }
259
260 return *Output;
261 }
262
264 {
265 return const_cast<FVertexBufferAndSRV&>(GetBoneBufferInternal(bPrevious));
266 }
267
269 {
270 PreviousRevisionNumber = InPreviousRevisionNumber != INDEX_NONE ? InPreviousRevisionNumber : CurrentRevisionNumber;
271 CurrentRevisionNumber = InCurrentRevisionNumber;
272 CurrentBuffer = 1 - CurrentBuffer;
273 }
274
275 uint32 GetRevisionNumber(bool bPrevious) const
276 {
277 return bPrevious ? PreviousRevisionNumber : CurrentRevisionNumber;
278 }
279
280 UE_DEPRECATED(5.6, "Use SetRevisionNumbers instead")
282
285 // Frame number of the bone data that is last updated
287
288 private:
290 uint32 CurrentBuffer = 0;
291 uint32 PreviousRevisionNumber = 0;
292 uint32 CurrentRevisionNumber = 0;
293
294 static uint32 MaxGPUSkinBones;
295
296 bool GetPreviousForRead(bool bPrevious) const
297 {
298 // If the revision number has incremented too much, ignore the request and use the current buffer.
299 // With ClearMotionVector calls, we intentionally increment revision number to retrieve current buffer for bPrevious true.
300 return (CurrentRevisionNumber - PreviousRevisionNumber) <= 1 ? bPrevious : false;
301 }
302
303 const FVertexBufferAndSRV& GetBoneBufferInternal(bool bPrevious) const
304 {
305 return BoneBuffer[CurrentBuffer ^ (uint32)bPrevious];
306 }
307 };
308
318
320
321 UE_DEPRECATED(5.7, "Use FInitializer instead")
332
334
337 {
338 return ShaderData;
339 }
340
341 inline const FShaderDataType& GetShaderData() const
342 {
343 return ShaderData;
344 }
345
351 UE_DEPRECATED(5.3, "Use SetData with a command list.")
353
355
357 {
358 return BoneBufferSize;
359 }
360
362 {
363 return NumBones;
364 }
365
367 {
368 return BoneOffset;
369 }
370
372 {
373 return NumVertices;
374 }
375
377 {
378 return BaseVertexIndex;
379 }
380
381 /*
382 * Return the smallest platform MaxGPUSkinBones value.
383 */
385 ENGINE_API static int32 GetMaxGPUSkinBones(const class ITargetPlatform* TargetPlatform = nullptr);
386
387 static const uint32 GHardwareMaxGPUSkinBones = 65536;
388
389 ENGINE_API static bool UseUnlimitedBoneInfluences(uint32 MaxBoneInfluences, const ITargetPlatform* TargetPlatform = nullptr);
390 ENGINE_API static bool GetUnlimitedBoneInfluences(const ITargetPlatform* TargetPlatform = nullptr);
391
392 /*
393 * Returns the maximum number of bone influences that should be used for a skeletal mesh, given
394 * the user-requested limit.
395 *
396 * If the requested limit is 0, the limit will be determined from the project settings.
397 *
398 * The return value is guaranteed to be greater than zero, but note that it may be higher than
399 * the maximum supported bone influences.
400 */
402
408
411 const class FMorphVertexBuffer* GetMorphVertexBuffer(bool bPrevious) const;
413
416 virtual class FGPUBaseSkinAPEXClothVertexFactory const* GetClothVertexFactory() const { return nullptr; }
417
419 virtual uint32 GetNumBoneInfluences() const { return Data.IsValid() ? Data->NumBoneInfluences : 0; }
420 virtual bool Use16BitBoneIndex() const { return Data.IsValid() ? Data->bUse16BitBoneIndex : false; }
421 virtual const FShaderResourceViewRHIRef GetPositionsSRV() const { return Data.IsValid() ? Data->PositionComponentSRV : nullptr; }
422 virtual const FShaderResourceViewRHIRef GetTangentsSRV() const { return Data.IsValid() ? Data->TangentsSRV : nullptr; }
425 virtual uint32 GetNumTexCoords() const { return Data.IsValid() ? Data->NumTexCoords : 0; }
426 virtual const uint32 GetColorIndexMask() const { return Data.IsValid() ? Data->ColorIndexMask : 0; }
427 virtual bool IsMorphTarget() const { return Data.IsValid() ? Data->bMorphTarget : false; }
428
430 {
431 return GetPositionsSRV();
432 }
433
435
437 {
438 return UniformBuffer;
439 }
440
446
452
454
455 void GetOverrideVertexStreams(FVertexInputStreamArray& VertexStreams) const;
456
457 bool IsReadyForStaticMeshCaching() const { return UniformBuffer != nullptr; }
458
460 {
461 bUniformBufferDirty = true;
462 }
463
465 {
466 return UniformBuffer.IsValid();
467 }
468
469protected:
470 virtual void InitRHI(FRHICommandListBase& RHICmdList) override;
471 virtual void ReleaseRHI() override;
472
479
482
485
488
491
492private:
493 uint32 NumBones;
494 uint32 BoneOffset;
495 uint32 BoneBufferSize;
496 uint32 NumVertices;
497 uint32 BaseVertexIndex;
498 bool bUsedForPassthroughVertexFactory;
499 bool bUniformBufferDirty = true;
500};
501
503template<GPUSkinBoneInfluenceType BoneInfluenceType>
505{
507
508public:
512
513 UE_DEPRECATED(5.7, "Use FInitializer instead")
518 {}
519
520 virtual GPUSkinBoneInfluenceType GetBoneInfluenceType() const override
521 {
522 return BoneInfluenceType;
523 }
524
527
530
531 // FRenderResource interface.
532 virtual void InitRHI(FRHICommandListBase& RHICmdList) override;
533 virtual void ReleaseRHI() override;
534
535protected:
542
544};
545
546
549{
550public:
551
553 {
555 {
556 Reset();
557 }
558
560 FRHICommandList& RHICmdList,
563 uint32 RevisionNumber,
564 const FName& AssetPathName);
565
567
568 void EnableDoubleBuffer() { bDoubleBuffer = true; }
569
570 void SetCurrentRevisionNumber(uint32 RevisionNumber);
571
573 bool HasClothBufferForReading(bool bPrevious) const;
574 const FVertexBufferAndSRV& GetClothBufferForReading(bool bPrevious) const;
575
577 const FMatrix44f& GetClothToLocalForReading(bool bPrevious) const;
578
583 float ClothBlendWeight = 1.0f;
587
589 bool bEnabled = false;
590
591 private:
592 // Helper for GetClothBufferIndexForWriting and GetClothBufferIndexForReading
593 uint32 GetClothBufferIndexInternal(bool bPrevious) const;
594 // Helper for GetClothBufferForWriting and GetClothToLocalForWriting
595 uint32 GetClothBufferIndexForWriting() const;
596 // Helper for GetClothBufferForReading and GetClothToLocalForReading
597 uint32 GetClothBufferIndexForReading(bool bPrevious) const;
598
599 FVertexBufferAndSRV ClothSimulPositionNormalBuffer[2];
600
604 FMatrix44f ClothToLocal[2];
605
607 bool bDoubleBuffer = false;
608
609 // 0 / 1 to index into BoneBuffer
610 uint32 CurrentBuffer = 0;
611 // RevisionNumber Tracker
612 uint32 PreviousRevisionNumber = 0;
613 uint32 CurrentRevisionNumber = 0;
614
615 void Reset()
616 {
617 CurrentBuffer = 0;
618 PreviousRevisionNumber = 0;
619 CurrentRevisionNumber = 0;
620
621 ClothToLocal[0] = FMatrix44f::Identity;
622 ClothToLocal[1] = FMatrix44f::Identity;
623
624 bDoubleBuffer = false;
625 }
626 };
627
632
634
637 {
638 return ClothShaderData;
639 }
640
642 {
643 return ClothShaderData;
644 }
645
647
649 virtual const FGPUBaseSkinVertexFactory* GetVertexFactory() const = 0;
650
652 virtual FShaderResourceViewRHIRef GetClothBuffer() { return nullptr; }
653 virtual const FShaderResourceViewRHIRef GetClothBuffer() const { return nullptr; }
655 virtual uint32 GetClothIndexOffset(uint32 VertexIndex, uint32 LODBias = 0) const { return 0; }
656
657protected:
659};
660
668
669template<GPUSkinBoneInfluenceType BoneInfluenceType>
671{
673
675
676public:
678 {
679 return ClothDataPtr ? ClothDataPtr->ClothBuffer : nullptr;
680 }
681
683 {
684 return ClothDataPtr ? ClothDataPtr->ClothBuffer : nullptr;
685 }
686
687 uint32 GetClothIndexOffset(uint32 VertexIndex, uint32 LODBias = 0) const override
688 {
689 if (ClothDataPtr)
690 {
692 {
693 if (Mapping.BaseVertexIndex == VertexIndex)
694 {
695 return Mapping.MappingOffset + Mapping.LODBiasStride * LODBias;
696 }
697 }
698 }
699
700 checkf(0, TEXT("Cloth Index Mapping not found for Vertex Index %u"), VertexIndex);
701 return 0;
702 }
703
708
709 UE_DEPRECATED(5.7, "Use FInitializer instead")
715 {}
716
721 virtual ~TGPUSkinAPEXClothVertexFactory() override
722 {
723 checkf(!ClothDataPtr->ClothBuffer.IsValid(), TEXT("ClothBuffer RHI resource should have been released in ReleaseRHI"));
724 delete ClothDataPtr;
725 (void)this->Data.Release();
726 }
727
730
736 virtual void SetData(FRHICommandListBase& RHICmdList, const FGPUSkinDataType* InData) override;
737
739 {
740 return this;
741 }
742
743 virtual const FGPUBaseSkinVertexFactory* GetVertexFactory() const override
744 {
745 return this;
746 }
747
749 {
750 return this;
751 }
752
754 {
755 return this;
756 }
757
758 // FRenderResource interface.
759
764 virtual void InitRHI(FRHICommandListBase& RHICmdList) override;
765 virtual void ReleaseRHI() override;
766
767protected:
770};
771
773 SHADER_PARAMETER(uint32, FrameNumber)
774 SHADER_PARAMETER_SRV(Buffer<float>, PositionBuffer)
775 SHADER_PARAMETER_SRV(Buffer<float>, PreviousPositionBuffer)
778
779
785{
786public:
797
806
808 {
809 None = 0,
810 Position = 1 << EVertexAttribute::VertexPosition,
811 Tangent = 1 << EVertexAttribute::VertexTangent,
812 Color = 1 << EVertexAttribute::VertexColor,
813 };
814
815 UE_DEPRECATED(5.7, "FGPUSkinPassthroughVertexFactory now requires NumVertices.")
819
821
836
841 void ResetVertexAttributes(FRHICommandListBase& RHICmdList);
842
843 void SetVertexAttributes(FRHICommandListBase& RHICmdList, FGPUBaseSkinVertexFactory const* InSourceVertexFactory, FAddVertexAttributeDesc const& InDesc);
844
845 // Begin FVertexFactory Interface.
846 bool SupportsPositionOnlyStream() const override { return false; }
847 bool SupportsPositionAndNormalOnlyStream() const override { return false; }
848 // End FVertexFactory Interface.
849
850 void GetOverrideVertexStreams(FVertexInputStreamArray& VertexStreams) const;
851
852 EPixelFormat GetTangentFormat() const { return TangentFormat; }
853
854 uint32 GetNumVertices() const { return NumVertices; }
855
856 static ENGINE_API void GetVertexElements(ERHIFeatureLevel::Type FeatureLevel, EVertexInputStreamType InputStreamType, bool bSupportsManualVertexFetch, FDataType& Data, FVertexDeclarationElementList& Elements);
857
858public:
860
861private:
862 void InitRHI(FRHICommandListBase& RHICmdList) override;
863 void ReleaseRHI() override
864 {
865 LooseParametersUniformBuffer.SafeRelease();
867 }
868 void UpdateUniformBuffer(FRHICommandListBase& RHICmdList, FGPUBaseSkinVertexFactory const* InSourceVertexFactory);
869 void UpdateLooseUniformBuffer(FRHICommandListBase& RHICmdList, FGPUBaseSkinVertexFactory const* InSourceVertexFactory, uint32 InFrameNumber);
870
872 TStaticArray<TRefCountPtr<FRHIStreamSourceSlot>, EVertexAttribute::NumAttributes> StreamSourceSlots;
874 FRHIShaderResourceView* PreSkinnedTangentSRV = nullptr;
875 uint32 UpdatedFrameNumber = ~0u;
876 uint32 NumVertices;
877 EVertexAttributeFlags VertexAttributesRequested;
878 EVertexAttributeFlags VertexAttributesToBind = EVertexAttributeFlags::None;
879 EPixelFormat TangentFormat = PF_Unknown;
880};
881
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
@ InPlace
Definition CoreMiscDefines.h:162
#define TEXT(x)
Definition Platform.h:1272
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
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
GPUSkinBoneInfluenceType
Definition GPUSkinVertexFactory.h:158
@ DefaultBoneInfluence
Definition GPUSkinVertexFactory.h:159
@ UnlimitedBoneInfluence
Definition GPUSkinVertexFactory.h:160
bool IsValidRef(const FVertexBufferAndSRV &Buffer)
Definition GPUSkinVertexFactory.h:92
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
EPixelFormat
Definition PixelFormat.h:16
@ PF_Unknown
Definition PixelFormat.h:17
EShaderPlatform
Definition RHIShaderPlatform.h:11
#define END_GLOBAL_SHADER_PARAMETER_STRUCT
Definition ShaderParameterMacros.h:1669
#define SHADER_PARAMETER_SRV(ShaderType, MemberName)
Definition ShaderParameterMacros.h:1720
#define BEGIN_GLOBAL_SHADER_PARAMETER_STRUCT
Definition ShaderParameterMacros.h:1663
#define SHADER_PARAMETER(MemberType, MemberName)
Definition ShaderParameterMacros.h:1684
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
#define DECLARE_VERTEX_FACTORY_TYPE(FactoryClass)
Definition VertexFactory.h:548
EVertexInputStreamType
Definition VertexFactory.h:128
uint32 Size
Definition VulkanMemory.cpp:4034
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition GPUSkinVertexFactory.h:99
@ NumPoolBuckets
Definition GPUSkinVertexFactory.h:104
@ CullAfterFramesNum
Definition GPUSkinVertexFactory.h:106
@ NumSafeFrames
Definition GPUSkinVertexFactory.h:103
@ NumToDrainPerFrame
Definition GPUSkinVertexFactory.h:105
FVertexBufferAndSRV CreateResource(FRHICommandListBase &RHICmdList, FSharedPoolPolicyData::CreationArguments Args)
Definition GPUSkinVertexFactory.cpp:190
void FreeResource(const FVertexBufferAndSRV &Resource)
Definition GPUSkinVertexFactory.cpp:217
FSharedPoolPolicyData::CreationArguments GetCreationArguments(const FVertexBufferAndSRV &Resource)
Definition GPUSkinVertexFactory.cpp:212
Definition GPUSkinVertexFactory.h:127
virtual TStatId GetStatId() const override
Definition GPUSkinVertexFactory.cpp:250
virtual ~FBoneBufferPool()
Definition GPUSkinVertexFactory.cpp:246
Definition GPUSkinVertexFactory.h:138
FVertexBufferAndSRV CreateResource(FRHICommandListBase &RHICmdList, FSharedPoolPolicyData::CreationArguments Args)
Definition GPUSkinVertexFactory.cpp:221
Definition GPUSkinVertexFactory.h:148
virtual TStatId GetStatId() const override
Definition GPUSkinVertexFactory.cpp:259
virtual ~FClothBufferPool()
Definition GPUSkinVertexFactory.cpp:255
Definition GPUSkinVertexFactory.h:549
ClothShaderType & GetClothShaderData()
Definition GPUSkinVertexFactory.h:636
static bool IsClothEnabled(EShaderPlatform Platform)
Definition GPUSkinVertexFactory.cpp:1090
virtual ~FGPUBaseSkinAPEXClothVertexFactory()
Definition GPUSkinVertexFactory.h:633
virtual const FShaderResourceViewRHIRef GetClothBuffer() const
Definition GPUSkinVertexFactory.h:653
virtual uint32 GetClothIndexOffset(uint32 VertexIndex, uint32 LODBias=0) const
Definition GPUSkinVertexFactory.h:655
virtual FGPUBaseSkinVertexFactory * GetVertexFactory()=0
ClothShaderType ClothShaderData
Definition GPUSkinVertexFactory.h:658
virtual const FGPUBaseSkinVertexFactory * GetVertexFactory() const =0
FGPUBaseSkinAPEXClothVertexFactory(uint32 InNumInfluencesPerVertex)
Definition GPUSkinVertexFactory.h:628
const ClothShaderType & GetClothShaderData() const
Definition GPUSkinVertexFactory.h:641
virtual FShaderResourceViewRHIRef GetClothBuffer()
Definition GPUSkinVertexFactory.h:652
Definition GPUSkinVertexFactory.h:205
FUpdateScope()
Definition GPUSkinVertexFactory.cpp:1584
Definition GPUSkinVertexFactory.h:202
void SetData(const FGPUSkinDataType *InData)
Definition GPUSkinVertexFactory.cpp:658
virtual const FShaderResourceViewRHIRef GetTangentsSRV() const
Definition GPUSkinVertexFactory.h:422
virtual class FGPUBaseSkinAPEXClothVertexFactory * GetClothVertexFactory()
Definition GPUSkinVertexFactory.h:415
uint32 GetNumVertices() const
Definition GPUSkinVertexFactory.h:371
virtual uint32 GetNumBoneInfluences() const
Definition GPUSkinVertexFactory.h:419
static ENGINE_API bool GetAlwaysUseDeformerForUnlimitedBoneInfluences(EShaderPlatform Platform)
Definition GPUSkinVertexFactory.cpp:549
virtual bool Use16BitBoneIndex() const
Definition GPUSkinVertexFactory.h:420
uint32 GetBoneOffset() const
Definition GPUSkinVertexFactory.h:366
virtual void InitRHI(FRHICommandListBase &RHICmdList) override
Definition GPUSkinVertexFactory.cpp:676
TUniquePtr< FGPUSkinDataType > Data
Definition GPUSkinVertexFactory.h:484
const FShaderDataType & GetShaderData() const
Definition GPUSkinVertexFactory.h:341
static ENGINE_API int32 GetMinimumPerPlatformMaxGPUSkinBonesValue()
Definition GPUSkinVertexFactory.cpp:385
static const uint32 GHardwareMaxGPUSkinBones
Definition GPUSkinVertexFactory.h:387
FUniformBufferRHIRef UniformBuffer
Definition GPUSkinVertexFactory.h:487
bool IsUniformBufferValid() const
Definition GPUSkinVertexFactory.h:464
virtual const FShaderResourceViewRHIRef GetColorComponentsSRV() const
Definition GPUSkinVertexFactory.h:424
static ENGINE_API int32 GetMaxGPUSkinBones(const class ITargetPlatform *TargetPlatform=nullptr)
Definition GPUSkinVertexFactory.cpp:403
FRHIUniformBuffer * GetUniformBuffer() const
Definition GPUSkinVertexFactory.h:436
virtual const uint32 GetColorIndexMask() const
Definition GPUSkinVertexFactory.h:426
static ENGINE_API bool UseUnlimitedBoneInfluences(uint32 MaxBoneInfluences, const ITargetPlatform *TargetPlatform=nullptr)
Definition GPUSkinVertexFactory.cpp:456
TRefCountPtr< FRHIStreamSourceSlot > MorphDeltaBufferSlot
Definition GPUSkinVertexFactory.h:489
const class FMorphVertexBuffer * GetMorphVertexBuffer(bool bPrevious) const
Definition GPUSkinVertexFactory.cpp:774
virtual bool IsMorphTarget() const
Definition GPUSkinVertexFactory.h:427
virtual const FShaderResourceViewRHIRef GetTextureCoordinatesSRV() const
Definition GPUSkinVertexFactory.h:423
virtual uint32 GetNumTexCoords() const
Definition GPUSkinVertexFactory.h:425
uint32 GetBaseVertexIndex() const
Definition GPUSkinVertexFactory.h:376
FShaderDataType & GetShaderData()
Definition GPUSkinVertexFactory.h:336
static ENGINE_API bool GetUnlimitedBoneInfluences(const ITargetPlatform *TargetPlatform=nullptr)
Definition GPUSkinVertexFactory.cpp:488
virtual ~FGPUBaseSkinVertexFactory()
Definition GPUSkinVertexFactory.h:333
void CopyDataTypeForLocalVertexFactory(FLocalVertexFactory::FDataType &OutDestData) const
Definition GPUSkinVertexFactory.cpp:753
virtual FShaderResourceViewRHIRef GetTriangleSortingPositionSRV() const override
Definition GPUSkinVertexFactory.h:429
virtual void AddVertexElements(FVertexDeclarationElementList &OutElements)=0
int32 MorphDeltaStreamIndex
Definition GPUSkinVertexFactory.h:490
virtual const FShaderResourceViewRHIRef GetPositionsSRV() const
Definition GPUSkinVertexFactory.h:421
FShaderDataType ShaderData
Definition GPUSkinVertexFactory.h:481
void UpdateMorphState(FRHICommandListBase &RHICmdList, bool bUseMorphTarget)
Definition GPUSkinVertexFactory.cpp:741
const FVertexStreamComponent & GetTangentStreamComponent(int Index) const
Definition GPUSkinVertexFactory.h:447
uint32 GetBoneBufferSize() const
Definition GPUSkinVertexFactory.h:356
void MarkUniformBufferDirty()
Definition GPUSkinVertexFactory.h:459
virtual GPUSkinBoneInfluenceType GetBoneInfluenceType() const
Definition GPUSkinVertexFactory.h:418
virtual class FGPUBaseSkinAPEXClothVertexFactory const * GetClothVertexFactory() const
Definition GPUSkinVertexFactory.h:416
bool IsReadyForStaticMeshCaching() const
Definition GPUSkinVertexFactory.h:457
void UpdateUniformBuffer(FRHICommandListBase &RHICmdList)
Definition GPUSkinVertexFactory.cpp:700
const FVertexStreamComponent & GetPositionStreamComponent() const
Definition GPUSkinVertexFactory.h:441
uint32 GetNumBones() const
Definition GPUSkinVertexFactory.h:361
static ENGINE_API int32 GetBoneInfluenceLimitForAsset(int32 AssetProvidedLimit, const ITargetPlatform *TargetPlatform=nullptr)
Definition GPUSkinVertexFactory.cpp:513
void GetOverrideVertexStreams(FVertexInputStreamArray &VertexStreams) const
Definition GPUSkinVertexFactory.cpp:786
uint32 GetMorphVertexBufferUpdatedFrameNumber() const
Definition GPUSkinVertexFactory.cpp:780
virtual void ReleaseRHI() override
Definition GPUSkinVertexFactory.cpp:694
Definition GPUSkinVertexFactory.h:785
EPixelFormat GetTangentFormat() const
Definition GPUSkinVertexFactory.h:852
bool SupportsPositionAndNormalOnlyStream() const override
Definition GPUSkinVertexFactory.h:847
TUniformBufferRef< FGPUSkinPassThroughFactoryLooseParameters > LooseParametersUniformBuffer
Definition GPUSkinVertexFactory.h:859
EVertexAttributeFlags
Definition GPUSkinVertexFactory.h:808
uint32 GetNumVertices() const
Definition GPUSkinVertexFactory.h:854
EVertexAttribute
Definition GPUSkinVertexFactory.h:800
@ VertexTangent
Definition GPUSkinVertexFactory.h:802
@ VertexColor
Definition GPUSkinVertexFactory.h:803
@ VertexPosition
Definition GPUSkinVertexFactory.h:801
bool SupportsPositionOnlyStream() const override
Definition GPUSkinVertexFactory.h:846
EShaderResource
Definition GPUSkinVertexFactory.h:789
@ TexCoord
Definition GPUSkinVertexFactory.h:794
@ PreviousPosition
Definition GPUSkinVertexFactory.h:791
@ Position
Definition GPUSkinVertexFactory.h:790
@ Color
Definition GPUSkinVertexFactory.h:793
@ Tangent
Definition GPUSkinVertexFactory.h:792
Definition LocalVertexFactory.h:51
virtual void ReleaseRHI() override
Definition LocalVertexFactory.h:95
Definition SkeletalRenderGPUSkin.h:325
Definition SkeletalRenderGPUSkin.h:198
Definition NameTypes.h:617
Definition RHIResources.h:1581
Definition RHICommandList.h:455
Definition RHICommandList.h:3819
Definition RHIResources.h:3304
Definition RHIResources.h:1232
Definition GPUSkinVertexFactory.h:28
uint32 GetPoolBucketSize(uint32 Bucket)
Definition GPUSkinVertexFactory.cpp:175
uint32 GetPoolBucketIndex(uint32 Size)
Definition GPUSkinVertexFactory.cpp:149
@ CullAfterFramesNum
Definition GPUSkinVertexFactory.h:37
@ NumSafeFrames
Definition GPUSkinVertexFactory.h:34
@ NumPoolBucketSizes
Definition GPUSkinVertexFactory.h:35
@ NumToDrainPerFrame
Definition GPUSkinVertexFactory.h:36
uint32 CreationArguments
Definition GPUSkinVertexFactory.h:31
Definition VertexFactory.h:661
static void ModifyCompilationEnvironment(const FVertexFactoryShaderPermutationParameters &Parameters, FShaderCompilerEnvironment &OutEnvironment)
Definition VertexFactory.h:683
TArray< FVertexStream, TInlineAllocator< 8 > > FVertexStreamList
Definition VertexFactory.h:834
Definition IConsoleManager.h:1721
Definition GPUSkinVertexFactory.h:671
virtual void InitRHI(FRHICommandListBase &RHICmdList) override
Definition GPUSkinVertexFactory.cpp:1329
virtual void ReleaseRHI() override
Definition GPUSkinVertexFactory.cpp:1037
FShaderResourceViewRHIRef GetClothBuffer() override
Definition GPUSkinVertexFactory.h:677
FGPUSkinAPEXClothDataType * ClothDataPtr
Definition GPUSkinVertexFactory.h:769
virtual void SetData(FRHICommandListBase &RHICmdList, const FGPUSkinDataType *InData) override
Definition GPUSkinVertexFactory.cpp:1309
virtual FGPUBaseSkinVertexFactory * GetVertexFactory() override
Definition GPUSkinVertexFactory.h:738
TGPUSkinAPEXClothVertexFactory(const FGPUBaseSkinVertexFactory::FInitializer &Initializer, uint32 NumInfluencesPerVertex)
Definition GPUSkinVertexFactory.h:704
uint32 GetClothIndexOffset(uint32 VertexIndex, uint32 LODBias=0) const override
Definition GPUSkinVertexFactory.h:687
const FShaderResourceViewRHIRef GetClothBuffer() const override
Definition GPUSkinVertexFactory.h:682
static TGPUSkinAPEXClothVertexFactory(ERHIFeatureLevel::Type InFeatureLevel, uint32 InNumBones, uint32 InNumVertices, uint32 InBaseVertexIndex, uint32 InNumInfluencesPerVertex, bool bInUsedForPassthroughVertexFactory) bool ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters &Parameters)
Definition GPUSkinVertexFactory.cpp:1301
virtual FGPUBaseSkinAPEXClothVertexFactory * GetClothVertexFactory() override
Definition GPUSkinVertexFactory.h:748
virtual const FGPUBaseSkinVertexFactory * GetVertexFactory() const override
Definition GPUSkinVertexFactory.h:743
virtual FGPUBaseSkinAPEXClothVertexFactory const * GetClothVertexFactory() const override
Definition GPUSkinVertexFactory.h:753
Definition GPUSkinVertexFactory.h:505
virtual void ReleaseRHI() override
Definition GPUSkinVertexFactory.cpp:1026
static TGPUSkinVertexFactory(ERHIFeatureLevel::Type InFeatureLevel, uint32 InNumBones, uint32 InNumVertices, uint32 InBaseVertexIndex, bool bInUsedForPassthroughVertexFactory) PRAGMA_DISABLE_DEPRECATION_WARNINGS bool ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters &Parameters)
Definition GPUSkinVertexFactory.cpp:799
static void GetVertexElements(ERHIFeatureLevel::Type FeatureLevel, EVertexInputStreamType InputStreamType, FGPUSkinDataType &GPUSkinData, FVertexDeclarationElementList &Elements)
Definition GPUSkinVertexFactory.cpp:981
virtual void InitRHI(FRHICommandListBase &RHICmdList) override
Definition GPUSkinVertexFactory.cpp:1013
static void GetPSOPrecacheVertexFetchElements(EVertexInputStreamType VertexInputStreamType, FVertexDeclarationElementList &Elements)
Definition GPUSkinVertexFactory.cpp:850
TGPUSkinVertexFactory(const FInitializer &Initializer)
Definition GPUSkinVertexFactory.h:509
virtual void AddVertexElements(FVertexDeclarationElementList &OutElements) override
Definition GPUSkinVertexFactory.cpp:1000
UE_FORCEINLINE_HINT bool IsValid() const
Definition RefCounting.h:594
UE_FORCEINLINE_HINT void SafeRelease()
Definition RefCounting.h:599
Definition ResourcePool.h:220
Definition ResourcePool.h:170
Definition StaticArray.h:26
Definition ShaderParameterMacros.h:136
Definition UniquePtr.h:107
T * Release()
Definition UniquePtr.h:334
bool IsValid() const
Definition UniquePtr.h:280
Definition SceneComponent.h:24
Type
Definition RHIFeatureLevel.h:20
@ Num
Definition RHIFeatureLevel.h:54
U16 Index
Definition radfft.cpp:71
Definition SkeletalMeshTypes.h:127
Definition GPUSkinVertexFactory.h:553
const FVertexBufferAndSRV & GetClothBufferForReading(bool bPrevious) const
Definition GPUSkinVertexFactory.cpp:1223
const FMatrix44f & GetClothToLocalForReading(bool bPrevious) const
Definition GPUSkinVertexFactory.cpp:1236
FVector3f WorldScale
Definition GPUSkinVertexFactory.h:585
void UpdateClothSimulationData(FRHICommandList &RHICmdList, TConstArrayView< FVector3f > InSimulPositions, TConstArrayView< FVector3f > InSimulNormals, uint32 RevisionNumber, const FName &AssetPathName)
Definition GPUSkinVertexFactory.cpp:1144
void SetCurrentRevisionNumber(uint32 RevisionNumber)
Definition GPUSkinVertexFactory.cpp:1197
uint32 NumInfluencesPerVertex
Definition GPUSkinVertexFactory.h:586
FVertexBufferAndSRV & GetClothBufferForWriting()
Definition GPUSkinVertexFactory.cpp:1211
float ClothBlendWeight
Definition GPUSkinVertexFactory.h:583
void ReleaseClothSimulData()
Definition GPUSkinVertexFactory.cpp:1132
bool bEnabled
Definition GPUSkinVertexFactory.h:589
ClothShaderType()
Definition GPUSkinVertexFactory.h:554
bool HasClothBufferForReading(bool bPrevious) const
Definition GPUSkinVertexFactory.cpp:1217
void EnableDoubleBuffer()
Definition GPUSkinVertexFactory.h:568
FMatrix44f & GetClothToLocalForWriting()
Definition GPUSkinVertexFactory.cpp:1230
Definition GPUSkinVertexFactory.h:310
ERHIFeatureLevel::Type FeatureLevel
Definition GPUSkinVertexFactory.h:311
uint32 BoneOffset
Definition GPUSkinVertexFactory.h:313
bool bUsedForPassthroughVertexFactory
Definition GPUSkinVertexFactory.h:316
uint32 NumVertices
Definition GPUSkinVertexFactory.h:314
uint32 NumBones
Definition GPUSkinVertexFactory.h:312
uint32 BaseVertexIndex
Definition GPUSkinVertexFactory.h:315
Definition GPUSkinVertexFactory.h:215
uint64 UpdatedFrameNumber
Definition GPUSkinVertexFactory.h:286
void SetRevisionNumbers(uint32 InCurrentRevisionNumber, uint32 InPreviousRevisionNumber)
Definition GPUSkinVertexFactory.h:268
void SetCurrentRevisionNumber(uint32)
Definition GPUSkinVertexFactory.h:281
void ReleaseBoneData()
Definition GPUSkinVertexFactory.cpp:291
int32 InputWeightIndexSize
Definition GPUSkinVertexFactory.h:283
const FVertexBufferAndSRV & GetBoneBufferForReading(bool bPrevious) const
Definition GPUSkinVertexFactory.h:245
static void UpdateBoneData(FRHICommandList &RHICmdList, const FName &AssetPathName, TConstArrayView< FMatrix44f > ReferenceToLocalMatrices, TConstArrayView< FBoneIndexType > BoneMap, FRHIBuffer *VertexBufferRHI)
Definition GPUSkinVertexFactory.cpp:303
FShaderDataType()
Definition GPUSkinVertexFactory.h:216
FVertexBufferAndSRV & GetBoneBufferForWriting(bool bPrevious)
Definition GPUSkinVertexFactory.h:263
FShaderResourceViewRHIRef InputWeightStream
Definition GPUSkinVertexFactory.h:284
uint32 GetRevisionNumber(bool bPrevious) const
Definition GPUSkinVertexFactory.h:275
static void AllocateBoneBuffer(FRHICommandList &RHICmdList, uint32 BufferSize, FVertexBufferAndSRV &OutBoneBuffer)
Definition GPUSkinVertexFactory.cpp:279
bool HasBoneBufferForReading(bool bPrevious) const
Definition GPUSkinVertexFactory.h:234
Definition GPUSkinVertexFactory.h:663
FShaderResourceViewRHIRef ClothBuffer
Definition GPUSkinVertexFactory.h:664
TArray< FClothBufferIndexMapping > ClothIndexMapping
Definition GPUSkinVertexFactory.h:666
Definition GPUSkinVertexFactory.h:165
uint32 NumBoneInfluences
Definition GPUSkinVertexFactory.h:182
FVertexStreamComponent DeltaPositionComponent
Definition GPUSkinVertexFactory.h:191
FVertexStreamComponent BlendOffsetCount
Definition GPUSkinVertexFactory.h:179
class FMorphVertexBufferPool * MorphVertexBufferPool
Definition GPUSkinVertexFactory.h:197
bool bUse16BitBoneIndex
Definition GPUSkinVertexFactory.h:185
bool bMorphTarget
Definition GPUSkinVertexFactory.h:188
FVertexStreamComponent BoneIndices
Definition GPUSkinVertexFactory.h:167
FVertexStreamComponent ExtraBoneIndices
Definition GPUSkinVertexFactory.h:170
FVertexStreamComponent DeltaTangentZComponent
Definition GPUSkinVertexFactory.h:194
FVertexStreamComponent ExtraBoneWeights
Definition GPUSkinVertexFactory.h:176
FVertexStreamComponent BoneWeights
Definition GPUSkinVertexFactory.h:173
TStaticArray< FRHIBuffer *, EVertexAttribute::NumAttributes > StreamBuffers
Definition GPUSkinVertexFactory.h:831
FAddVertexAttributeDesc()
Definition GPUSkinVertexFactory.h:825
TStaticArray< FRHIShaderResourceView *, EShaderResource::NumShaderResources > SRVs
Definition GPUSkinVertexFactory.h:834
Definition LocalVertexFactory.h:60
Definition ShaderCore.h:544
Definition Components.h:38
uint32 ColorIndexMask
Definition Components.h:64
FRHIShaderResourceView * TextureCoordinatesSRV
Definition Components.h:59
FVertexStreamComponent TangentBasisComponents[2]
Definition Components.h:43
uint8 NumTexCoords
Definition Components.h:66
FRHIShaderResourceView * TangentsSRV
Definition Components.h:56
FRHIShaderResourceView * PositionComponentSRV
Definition Components.h:54
FVertexStreamComponent PositionComponent
Definition Components.h:40
FRHIShaderResourceView * ColorComponentsSRV
Definition Components.h:62
Definition GPUSkinVertexFactory.h:59
FShaderResourceViewRHIRef VertexBufferSRV
Definition GPUSkinVertexFactory.h:83
uint32 Size
Definition GPUSkinVertexFactory.h:84
void SafeRelease()
Definition GPUSkinVertexFactory.h:75
FVertexBufferAndSRV()=default
FVertexBufferAndSRV(FVertexBufferAndSRV &&RHS)
Definition GPUSkinVertexFactory.h:62
FVertexBufferAndSRV & operator=(FVertexBufferAndSRV &&RHS)
Definition GPUSkinVertexFactory.h:67
FBufferRHIRef VertexBufferRHI
Definition GPUSkinVertexFactory.h:82
Definition MeshMaterialShader.h:44
Definition VertexStreamComponent.h:22
const FVertexBuffer * VertexBuffer
Definition VertexStreamComponent.h:24
Definition LightweightStats.h:416
static CORE_API const TMatrix Identity
Definition Matrix.h:52
static CORE_API const TVector< float > OneVector
Definition Vector.h:82