Files
UnrealEngineUWP/Engine/Source/Runtime/RenderCore/Public/GenerateMips.h
christopher waters 90123ba526 Adding "Auto" setting to GenerateMips that detects format support before blindly using the compute version. Adding helper to GenerateMips to tell if you need to add UAV support to a texture based on its texture format.
#rb mihnea.balta, stu.mckenna, jeannoe.morissette
#preflight 61b0cd8fe0430ca43894c405

#ROBOMERGE-AUTHOR: christopher.waters
#ROBOMERGE-SOURCE: CL 18409838 via CL 18409849 via CL 18409916 via CL 18409958 via CL 18434935 via CL 18437297
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18437354 by christopher waters in ue5-release-engine-test branch]
2021-12-10 20:36:40 -05:00

61 lines
2.3 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "RenderGraphDefinitions.h"
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,
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,
FRDGTextureRef Texture,
FRHISamplerState* Sampler,
EGenerateMipsPass Pass = EGenerateMipsPass::AutoDetect);
static void ExecuteCompute(FRDGBuilder& GraphBuilder, 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, FRDGTextureRef Texture, FRHISamplerState* Sampler,
FRDGBufferRef ConditionBuffer, uint32 Offset = 0);
static void ExecuteRaster(FRDGBuilder& GraphBuilder, FRDGTextureRef Texture, FRHISamplerState* Sampler);
//////////////////////////////////////////////////////////////////////////
UE_DEPRECATED(4.26, "Please use the FRDGBuilder version of this function instead.")
static void Execute(FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, TSharedPtr<FGenerateMipsStruct>& GenerateMipsStruct, FGenerateMipsParams Params = {}, bool bAllowRenderBasedGeneration = false);
UE_DEPRECATED(4.26, "Please use the FRDGBuilder version of this function instead.")
static void Execute(FRHICommandListImmediate& RHICmdList, FRHITexture* Texture, FGenerateMipsParams Params = {}, bool bAllowRenderBasedGeneration = false);
//////////////////////////////////////////////////////////////////////////
};