Testing the alpha detection based on the channel source info. This CL incorporates the original 30692988 as well as the fixes under review 30729887. The base problem is a race condition touching the lock mip data - read only mip locking shoulid if at all possible favor the MipData interface rather than LockMip*. RB list is from the two input CLs.

#rb fabian.giesen
#jira UE-204348

[CL 30785833 by dan thompson in ue5-main branch]
This commit is contained in:
dan thompson
2024-01-22 16:36:00 -05:00
parent 11eddcc219
commit 47c94de653
7 changed files with 338 additions and 28 deletions

View File

@@ -251,6 +251,13 @@ struct FTextureBuildSettings
// to TextureFormatName.
FName BaseTextureFormatName;
// Whether bHasTransparentAlpha is valid.
bool bKnowAlphaTransparency = false;
// Only valid if bKnowAlphaTransparency is true. This is whether the resulting texture is expected to require
// an alpha channel based on scanning the source mips and analyzing the build settings.
bool bHasTransparentAlpha = false;
static constexpr uint32 MaxTextureResolutionDefault = TNumericLimits<uint32>::Max();
/** Default settings. */
@@ -413,6 +420,18 @@ public:
uint32 MipChainDepth
);
/**
* Given the channel min/max for the top mip of a texture's source, determine whether there will be any transparency
* after image processing occurs, and thus the texture will need to be BC3 for the purposes of AutoDXT format selection.
*
* @param bOutAlphaIsTransparent *This is undetermined if the return is false!*. If true, we expect the image after
* processing to require an alpha channel.
* @return Whether the alpha channel can be determined. There are plenty of edge cases where
* it's not feasible to determine the result prior to full processing, however these
* are rare in practice.
*/
TEXTURECOMPRESSOR_API static bool DetermineAlphaChannelTransparency(const FTextureBuildSettings& InBuildSettings, const FLinearColor& InChannelMin, const FLinearColor& InChannelMax, bool& bOutAlphaIsTransparent);
/**
* Adjusts the colors of the image using the specified settings
*