Steps to Reproduce

 

The vector was divided by 32768 in VectorLoadSRGBA16N

And do this again outside.

Since this vector is used in normal only, final result is right after normalization. 

FORCEINLINE VectorRegister4Float FPackedRGBA16N::GetVectorRegister() const
{
    VectorRegister4Float VectorToUnpack = VectorLoadSRGBA16N((void*)this);
    VectorToUnpack = VectorMultiply(VectorToUnpack, VectorSetFloat1(1.0f / 32767.0f));
    // Return unpacked vector register.
    return VectorToUnpack;
}

 

 

 

// FPU
FORCEINLINE VectorRegister4Float VectorLoadSRGBA16N(void* Ptr)
{
    float V[4];
    int16* E = (int16*)Ptr;
    V[0] = float(E[0]) / 32767.0f;
    V[1] = float(E[1]) / 32767.0f;
    V[2] = float(E[2]) / 32767.0f;
    V[3] = float(E[3]) / 32767.0f;
    return MakeVectorRegisterFloat(V[0], V[1], V[2], V[3]);
}

// NEON
FORCEINLINE VectorRegister4Float VectorLoadSRGBA16N(const void* Ptr)
{
    alignas(16) float V[4];
    int16* E = (int16*)Ptr;
    V[0] = float(E[0]);
    V[1] = float(E[1]);
    V[2] = float(E[2]);
    V[3] = float(E[3]);
    VectorRegister4Float Vec = VectorLoad(V);
    VectorRegister4Float Div = vdupq_n_f32(1.0f / 32767.0f);
    return VectorMultiply(Vec, Div);
}

 

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-151249 in the post.

1
Login to Vote

Fixed
ComponentUE - Platform - Mobile
Affects Versions4.275.0
Target Fix5.1
Fix Commit20131539
Main Commit20131539
CreatedMay 6, 2022
ResolvedMay 10, 2022
UpdatedJun 16, 2022