You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-171674 #rb robert.srinivasiah #preflight 639785c5c16855964d56d502 [CL 23481504 by christopher fiala in ue5-main branch]
37 lines
1.1 KiB
Plaintext
37 lines
1.1 KiB
Plaintext
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "../Common.ush"
|
|
|
|
RWTexture2D<uint> RWOutputTexture;
|
|
Texture2D<uint> SourceTexture0;
|
|
Texture2D<uint> SourceTexture1;
|
|
|
|
uint2 DecodeShadingRate(uint EncodedRate)
|
|
{
|
|
uint2 DecodedRate;
|
|
DecodedRate.x = ((1U << SHADING_RATE_DIMENSION_BITS) - 1U) & (EncodedRate >> SHADING_RATE_DIMENSION_BITS);
|
|
DecodedRate.y = ((1U << SHADING_RATE_DIMENSION_BITS) - 1U) & EncodedRate;
|
|
return DecodedRate;
|
|
}
|
|
|
|
uint2 EncodeShadingRate(uint2 DecodedRate)
|
|
{
|
|
return (DecodedRate.x << SHADING_RATE_DIMENSION_BITS) + DecodedRate.y;
|
|
}
|
|
|
|
uint ShadingRateMax(uint InputRate0, uint InputRate1)
|
|
{
|
|
uint2 DecodedRate0 = DecodeShadingRate(InputRate0);
|
|
uint2 DecodedRate1 = DecodeShadingRate(InputRate1);
|
|
uint2 DecodedMaxRate = max(DecodedRate0, DecodedRate1);
|
|
return EncodeShadingRate(DecodedMaxRate);
|
|
}
|
|
|
|
[numthreads(THREADGROUP_SIZEX, THREADGROUP_SIZEY, 1)]
|
|
void CombineShadingRateTextures(uint3 DispatchThreadId : SV_DispatchThreadID)
|
|
{
|
|
const uint2 TexelCoord = DispatchThreadId.xy;
|
|
RWOutputTexture[TexelCoord] = ShadingRateMax(SourceTexture0[TexelCoord], SourceTexture1[TexelCoord]);
|
|
}
|
|
|