You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
----------------------------------------------------------------- Slate batching improvements for large element sets --- Group similar elements at compile time using tuples instead of maps (Also preps for slate payload removal). Merge similar renderbatches in same-typed element buckets (Currently for box and lines only). Reserve verticies / elements in a batch before using them Add some comments to invalidation. #rb Patrick.Boutot #preflight 646ff8505b484acfee7cc9fa #jira UE-173455 [CL 25738553 by daren cheng in ue5-main branch]
94 lines
2.6 KiB
C++
94 lines
2.6 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
class SWindow;
|
|
class SWidget;
|
|
class FSlateDrawElement;
|
|
class FSlateClippingState;
|
|
class FSlateWindowElementList;
|
|
class FPaintArgs;
|
|
struct FGeometry;
|
|
class FSlateRect;
|
|
class FSlateInvalidationRoot;
|
|
struct FSlateDebuggingElementTypeAddedEventArgs;
|
|
enum class EElementType : uint8;
|
|
|
|
class FVisualEntry
|
|
{
|
|
public:
|
|
FVector2D TopLeft;
|
|
FVector2D TopRight;
|
|
FVector2D BottomLeft;
|
|
FVector2D BottomRight;
|
|
|
|
int32 LayerId;
|
|
int32 ClippingIndex;
|
|
int32 ElementIndex;
|
|
EElementType ElementType;
|
|
bool bFromCache;
|
|
TWeakPtr<const SWidget> Widget;
|
|
|
|
FVisualEntry(const TWeakPtr<const SWidget>& Widget, int32 InElementIndex, EElementType InElementType);
|
|
FVisualEntry(const TSharedRef<const SWidget>& Widget, const FSlateDrawElement& InElement);
|
|
|
|
void Resolve(const FSlateWindowElementList& ElementList);
|
|
|
|
bool IsPointInside(const FVector2D& Point) const;
|
|
};
|
|
|
|
class FVisualTreeSnapshot : public TSharedFromThis<FVisualTreeSnapshot>
|
|
{
|
|
public:
|
|
TSharedPtr<const SWidget> Pick(FVector2D Point);
|
|
|
|
public:
|
|
TArray<FVisualEntry> Entries;
|
|
TArray<FSlateClippingState> ClippingStates;
|
|
TArray<FSlateClippingState> CachedClippingStates;
|
|
TArray<TWeakPtr<const SWidget>> WidgetStack;
|
|
};
|
|
|
|
class FVisualTreeCapture
|
|
{
|
|
public:
|
|
FVisualTreeCapture();
|
|
~FVisualTreeCapture();
|
|
|
|
/** Enables visual tree capture */
|
|
void Enable();
|
|
|
|
/** Disables visual tree capture */
|
|
void Disable();
|
|
|
|
/** Resets the visual tree capture to a pre-capture state and destroys the cached visual tree captured last. */
|
|
void Reset();
|
|
|
|
TSharedPtr<FVisualTreeSnapshot> GetVisualTreeForWindow(SWindow* InWindow);
|
|
|
|
private:
|
|
|
|
void AddInvalidationRootCachedEntries(TSharedRef<FVisualTreeSnapshot> Tree, const FSlateInvalidationRoot* Entries);
|
|
|
|
|
|
void BeginWindow(const FSlateWindowElementList& ElementList);
|
|
void EndWindow(const FSlateWindowElementList& ElementList);
|
|
|
|
void BeginWidgetPaint(const SWidget* Widget, const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, const FSlateWindowElementList& ElementList, int32 LayerId);
|
|
|
|
/** */
|
|
void EndWidgetPaint(const SWidget* Widget, const FSlateWindowElementList& ElementList, int32 LayerId);
|
|
|
|
/** */
|
|
void ElementTypeAdded(const FSlateDebuggingElementTypeAddedEventArgs& ElementTypeAddedArgs);
|
|
|
|
void OnWindowBeingDestroyed(const SWindow& WindowBeingDestoyed);
|
|
private:
|
|
TMap<const SWindow*, TSharedPtr<FVisualTreeSnapshot>> VisualTrees;
|
|
bool bIsEnabled;
|
|
int32 WindowIsInvalidationRootCounter;
|
|
int32 WidgetIsInvalidationRootCounter;
|
|
int32 WidgetIsInvisibleToWidgetReflectorCounter;
|
|
}; |