// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreTypes.h" #include "PixelFormat.h" #include "RHIDefinitions.h" #include "RenderGraphDefinitions.h" #include "Templates/SharedPointer.h" class FRDGBuilder; class FRHICommandListImmediate; class FRHISamplerState; class FRHITexture; struct FGenerateMipsStruct; struct FGenerateMipsParams { ESamplerFilter Filter = SF_Bilinear; ESamplerAddressMode AddressU = AM_Clamp; ESamplerAddressMode AddressV = AM_Clamp; ESamplerAddressMode AddressW = AM_Clamp; }; enum class EGenerateMipsPass { AutoDetect, Compute, Raster }; class RENDERCORE_API FGenerateMips { public: static bool WillFormatSupportCompute(EPixelFormat InPixelFormat); /** (ES3.1+) Generates mips for the requested RHI texture using the feature-level appropriate means (Compute, Raster, or Fixed-Function). */ static void Execute( FRDGBuilder& GraphBuilder, ERHIFeatureLevel::Type FeatureLevel, FRDGTextureRef Texture, FGenerateMipsParams Params = {}, EGenerateMipsPass Pass = EGenerateMipsPass::AutoDetect); /** (SM5+) Generates mips for the requested RDG texture using the requested compute / raster pass. */ static void Execute( FRDGBuilder& GraphBuilder, ERHIFeatureLevel::Type FeatureLevel, FRDGTextureRef Texture, FRHISamplerState* Sampler, EGenerateMipsPass Pass = EGenerateMipsPass::AutoDetect); static void ExecuteCompute( FRDGBuilder& GraphBuilder, ERHIFeatureLevel::Type FeatureLevel, FRDGTextureRef Texture, FRHISamplerState* Sampler); /** (SM5+) Generate mips for the requested RDG texture using the compute pass conditionally. if( uint(ConditionBuffer[Offset]) > 0) Execute(...) */ static void ExecuteCompute( FRDGBuilder& GraphBuilder, ERHIFeatureLevel::Type FeatureLevel, FRDGTextureRef Texture, FRHISamplerState* Sampler, FRDGBufferRef ConditionBuffer, uint32 Offset = 0); static void ExecuteRaster( FRDGBuilder& GraphBuilder, ERHIFeatureLevel::Type FeatureLevel, FRDGTextureRef Texture, FRHISamplerState* Sampler); ////////////////////////////////////////////////////////////////////////// UE_DEPRECATED(5.1, "This function now requires a ERHIFeatureLevel argument. You can obtain the correct Feature Level from a Scene or View.") static void Execute(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FGenerateMipsParams Params = {}, EGenerateMipsPass Pass = EGenerateMipsPass::AutoDetect); UE_DEPRECATED(5.1, "This function now requires a ERHIFeatureLevel argument. You can obtain the correct Feature Level from a Scene or View.") static void Execute(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FRHISamplerState* Sampler, EGenerateMipsPass Pass = EGenerateMipsPass::AutoDetect); UE_DEPRECATED(5.1, "This function now requires a ERHIFeatureLevel argument. You can obtain the correct Feature Level from a Scene or View.") static void ExecuteCompute(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FRHISamplerState* Sampler); UE_DEPRECATED(5.1, "This function now requires a ERHIFeatureLevel argument. You can obtain the correct Feature Level from a Scene or View.") static void ExecuteCompute(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FRHISamplerState* Sampler, FRDGBufferRef ConditionBuffer, uint32 Offset = 0); UE_DEPRECATED(5.1, "This function now requires a ERHIFeatureLevel argument. You can obtain the correct Feature Level from a Scene or View.") static void ExecuteRaster(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FRHISamplerState* Sampler); ////////////////////////////////////////////////////////////////////////// };