diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-25 11:00:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 11:00:57 +0100 |
commit | 7c37ab53be4e47befe866cbf125e3aa18c27f4fe (patch) | |
tree | 8cda765c07afa5c45f60961b650e1c954d50ce37 /thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp | |
parent | 3990152f6b7fcbac39ed68f0cc0fd36131bc9e2f (diff) | |
parent | 3529141b4bf548218f70a713b4328220a566802d (diff) |
Merge pull request #59503 from V-Sekai/basis-universal-update
Diffstat (limited to 'thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp')
-rw-r--r-- | thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp b/thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp index ca2b325693..271bbc6f1d 100644 --- a/thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp +++ b/thirdparty/basis_universal/encoder/basisu_uastc_enc.cpp @@ -13,7 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. #include "basisu_uastc_enc.h" + +#if BASISU_USE_ASTC_DECOMPRESS #include "basisu_astc_decomp.h" +#endif + #include "basisu_gpu_texture.h" #include "basisu_bc7enc.h" @@ -509,14 +513,14 @@ namespace basisu if (pForce_selectors == nullptr) { - int s0 = g_astc_unquant[endpoint_range][astc_results.m_endpoints[0]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[2]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[4]].m_unquant; - int s1 = g_astc_unquant[endpoint_range][astc_results.m_endpoints[1]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[3]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[5]].m_unquant; - if (s1 < s0) - { - std::swap(astc_results.m_endpoints[0], astc_results.m_endpoints[1]); - std::swap(astc_results.m_endpoints[2], astc_results.m_endpoints[3]); - std::swap(astc_results.m_endpoints[4], astc_results.m_endpoints[5]); - invert = true; + int s0 = g_astc_unquant[endpoint_range][astc_results.m_endpoints[0]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[2]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[4]].m_unquant; + int s1 = g_astc_unquant[endpoint_range][astc_results.m_endpoints[1]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[3]].m_unquant + g_astc_unquant[endpoint_range][astc_results.m_endpoints[5]].m_unquant; + if (s1 < s0) + { + std::swap(astc_results.m_endpoints[0], astc_results.m_endpoints[1]); + std::swap(astc_results.m_endpoints[2], astc_results.m_endpoints[3]); + std::swap(astc_results.m_endpoints[4], astc_results.m_endpoints[5]); + invert = true; } } @@ -3562,7 +3566,8 @@ namespace basisu basist::color32 temp_block_unpacked[4][4]; success = basist::unpack_uastc(temp_block, (basist::color32 *)temp_block_unpacked, false); VALIDATE(success); - + +#if BASISU_USE_ASTC_DECOMPRESS // Now round trip to packed ASTC and back, then decode to pixels. uint32_t astc_data[4]; @@ -3590,6 +3595,7 @@ namespace basisu VALIDATE(temp_block_unpacked[y][x].c[3] == decoded_uastc_block[y][x].a); } } +#endif } #endif |