Skip to content

Commit

Permalink
Update 3rdparty (#2252)
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 authored Nov 29, 2024
1 parent c37bcf8 commit a4a7564
Show file tree
Hide file tree
Showing 19 changed files with 1,847 additions and 612 deletions.
29 changes: 20 additions & 9 deletions 1k/1kiss.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ $1k = [_1kiss]::new()
# * : any
# x.y.z~x2.y2.z2 : range
$manifest = @{
msvc = '14.39+'; # cl.exe @link.exe 14.39 VS2022 17.9.x
# cl.exe @link.exe 14.39 VS2022 17.9.x
# exactly match format: '14.42.*'
msvc = '14.39+';
vs = '12.0+';
ndk = 'r23c';
xcode = '13.0.0+'; # range
Expand All @@ -203,7 +205,7 @@ $manifest = @{
# clang-cl msvc14.40 require 17.0.0+
llvm = '17.0.6+';
gcc = '9.0.0+';
cmake = '3.23.0+';
cmake = '3.23.0~3.31.1+';
ninja = '1.10.0+';
python = '3.8.0+';
jdk = '17.0.10+'; # jdk17+ works for android cmdlinetools 7.0+
Expand Down Expand Up @@ -458,19 +460,24 @@ if ($1k.isfile($manifest_file)) {
# 1kdist
$sentry_file = Join-Path $myRoot '.gitee'
$mirror = if ($1k.isfile($sentry_file)) { 'gitee' } else { 'github' }
$mirror_url_base = @{'github' = 'https://github.com/'; 'gitee' = 'https://gitee.com/' }[$mirror]
$1kdist_url_base = $mirror_url_base
$mirror_conf_file = $1k.realpath("$myRoot/../manifest.json")
$mirror_current = $null
$devtools_url_base = $null
$1kdist_ver = $null

if ($1k.isfile($mirror_conf_file)) {
$mirror_conf = ConvertFrom-Json (Get-Content $mirror_conf_file -raw)
$mirror_current = $mirror_conf.mirrors.$mirror
$mirror_url_base = "https://$($mirror_current.host)/"
$1kdist_url_base = $mirror_url_base

$1kdist_url_base += $mirror_current.'1kdist'
$devtools_url_base += "$1kdist_url_base/devtools"
$1kdist_ver = $mirror_conf.versions.'1kdist'
$1kdist_url_base += "/$1kdist_ver"
} else {
$mirror_url_base = 'https://github.com/'
$1kdist_url_base = $mirror_url_base
}

function 1kdist_url($filename) {
Expand Down Expand Up @@ -773,8 +780,9 @@ function find_vs() {
$required_vs_ver = $manifest['vs']
if (!$required_vs_ver) { $required_vs_ver = '12.0+' }

$require_comps = @('Microsoft.Component.MSBuild', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64')
$vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version $required_vs_ver.TrimEnd('+') -format 'json' -requires $require_comps)"
# refer: https://learn.microsoft.com/en-us/visualstudio/install/workload-and-component-ids?view=vs-2022
$require_comps = @('Microsoft.VisualStudio.Component.VC.Tools.x86.x64', 'Microsoft.VisualStudio.Product.BuildTools')
$vs_installs = ConvertFrom-Json "$(&$VSWHERE_EXE -version $required_vs_ver.TrimEnd('+') -format 'json' -requires $require_comps -requiresAny)"
$ErrorActionPreference = $eap

if ($vs_installs) {
Expand All @@ -789,7 +797,7 @@ function find_vs() {
}
$Global:VS_INST = $vs_inst_latest
} else {
throw "No suitable visual studio installed, required: $required_vs_ver"
Write-Warning "Visual studio not found, your build may not work, required: $required_vs_ver"
}
}
}
Expand Down Expand Up @@ -1275,16 +1283,19 @@ function setup_msvc() {
if (!$cl_prog) {
if ($Global:VS_INST) {
$vs_path = $Global:VS_INST.installationPath
Import-Module "$vs_path\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
$dev_cmd_args = "-arch=$target_cpu -host_arch=x64 -no_logo"

# if explicit version specified, use it
if (!$manifest['msvc'].EndsWith('+')) { $dev_cmd_args += " -vcvars_ver=$cl_ver" }

Import-Module "$vs_path\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstanceId $Global:VS_INST.instanceId -SkipAutomaticLocation -DevCmdArguments $dev_cmd_args

$cl_prog, $cl_ver = find_prog -name 'msvc' -cmd 'cl' -silent $true -usefv $true
$1k.println("Using msvc: $cl_prog, version: $cl_ver")
}
else {
throw "Visual Studio not installed!"
Write-Warning "MSVC not found, your build may not work, required: $cl_ver"
}
}

Expand Down
2 changes: 1 addition & 1 deletion 1k/install-pwsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mkdir -p $cacheDir

pwsh_ver=$1
if [ "$pwsh_ver" = "" ] ; then
pwsh_ver='7.4.5'
pwsh_ver='7.4.6'
fi

pwsh_min_ver=$2
Expand Down
5 changes: 3 additions & 2 deletions 1k/resolv-uri.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ param(

if(Test-Path $manifest_file -PathType Leaf) {
$mirror = if (!(Test-Path (Join-Path $PSScriptRoot '.gitee') -PathType Leaf)) {'github'} else {'gitee'}
$url_base = @{'github' = 'https://github.com/'; 'gitee' = 'https://gitee.com/' }[$mirror]

$manifest_map = ConvertFrom-Json (Get-Content $manifest_file -raw)
$ver = $manifest_map.versions.PSObject.Properties[$name].Value
$url_path = $manifest_map.mirrors.PSObject.Properties[$mirror].Value.PSObject.Properties[$name].Value
$mirror_current = $manifest_map.mirrors.PSObject.Properties[$mirror].Value.PSObject.Properties
$url_base = "https://$($mirror_current['host'].Value)/"
$url_path = $mirror_current[$name].Value

Write-Host "$url_base$url_path#$ver" -NoNewline
}
8 changes: 4 additions & 4 deletions 3rdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## astcenc
- [![Upstream](https://img.shields.io/github/v/release/ARM-software/astc-encoder?label=Upstream)](https://github.com/ARM-software/astc-encoder)
- Version: 4.8.0
- Version: 5.1.0
- License: Apache-2.0

## Box2D
Expand All @@ -22,7 +22,7 @@

## c-ares
- [![Upstream](https://img.shields.io/github/v/release/c-ares/c-ares?label=Upstream)](https://github.com/c-ares/c-ares)
- Version: 1.34.2
- Version: 1.34.3
- License: MIT

## Chipmunk2D
Expand All @@ -47,7 +47,7 @@

## curl
- [![Upstream](https://img.shields.io/github/v/release/curl/curl?label=Upstream)](https://github.com/curl/curl)
- Version: 8.10.1
- Version: 8.11.0
- License: Curl (MIT/X)

## doctest
Expand Down Expand Up @@ -124,7 +124,7 @@

- luajit
- Upstream: https://github.com/LuaJIT/LuaJIT
- Version: 2.1-97813fb
- Version: 2.1-fe71d0f
- License: MIT

- tolua
Expand Down
18 changes: 9 additions & 9 deletions 3rdparty/astcenc/astcenc_averages_and_directions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,12 @@ void compute_error_squared_rgba(
for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
{
vmask mask = lane_ids < vint(texel_count);
vint texel_idxs(texel_indexes + i);
const uint8_t* texel_idxs = texel_indexes + i;

vfloat data_r = gatherf(blk.data_r, texel_idxs);
vfloat data_g = gatherf(blk.data_g, texel_idxs);
vfloat data_b = gatherf(blk.data_b, texel_idxs);
vfloat data_a = gatherf(blk.data_a, texel_idxs);
vfloat data_r = gatherf_byte_inds<vfloat>(blk.data_r, texel_idxs);
vfloat data_g = gatherf_byte_inds<vfloat>(blk.data_g, texel_idxs);
vfloat data_b = gatherf_byte_inds<vfloat>(blk.data_b, texel_idxs);
vfloat data_a = gatherf_byte_inds<vfloat>(blk.data_a, texel_idxs);

vfloat uncor_param = (data_r * l_uncor_bs0)
+ (data_g * l_uncor_bs1)
Expand Down Expand Up @@ -892,11 +892,11 @@ void compute_error_squared_rgb(
for (unsigned int i = 0; i < texel_count; i += ASTCENC_SIMD_WIDTH)
{
vmask mask = lane_ids < vint(texel_count);
vint texel_idxs(texel_indexes + i);
const uint8_t* texel_idxs = texel_indexes + i;

vfloat data_r = gatherf(blk.data_r, texel_idxs);
vfloat data_g = gatherf(blk.data_g, texel_idxs);
vfloat data_b = gatherf(blk.data_b, texel_idxs);
vfloat data_r = gatherf_byte_inds<vfloat>(blk.data_r, texel_idxs);
vfloat data_g = gatherf_byte_inds<vfloat>(blk.data_g, texel_idxs);
vfloat data_b = gatherf_byte_inds<vfloat>(blk.data_b, texel_idxs);

vfloat uncor_param = (data_r * l_uncor_bs0)
+ (data_g * l_uncor_bs1)
Expand Down
31 changes: 11 additions & 20 deletions 3rdparty/astcenc/astcenc_decompress_symbolic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,22 @@ void unpack_weights(
if (!is_dual_plane)
{
// Build full 64-entry weight lookup table
vint4 tab0 = vint4::load(scb.weights + 0);
vint4 tab1 = vint4::load(scb.weights + 16);
vint4 tab2 = vint4::load(scb.weights + 32);
vint4 tab3 = vint4::load(scb.weights + 48);

vint tab0p, tab1p, tab2p, tab3p;
vtable_prepare(tab0, tab1, tab2, tab3, tab0p, tab1p, tab2p, tab3p);
vtable_64x8 table;
vtable_prepare(table, scb.weights);

for (unsigned int i = 0; i < bsd.texel_count; i += ASTCENC_SIMD_WIDTH)
{
vint summed_value(8);
vint weight_count(di.texel_weight_count + i);
int max_weight_count = hmax(weight_count).lane<0>();
int max_weight_count = hmax_s(weight_count);

promise(max_weight_count > 0);
for (int j = 0; j < max_weight_count; j++)
{
vint texel_weights(di.texel_weights_tr[j] + i);
vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);

summed_value += vtable_8bt_32bi(tab0p, tab1p, tab2p, tab3p, texel_weights) * texel_weights_int;
summed_value += vtable_lookup_32bit(table, texel_weights) * texel_weights_int;
}

store(lsr<4>(summed_value), weights_plane1 + i);
Expand All @@ -128,33 +123,29 @@ void unpack_weights(
{
// Build a 32-entry weight lookup table per plane
// Plane 1
vint4 tab0_plane1 = vint4::load(scb.weights + 0);
vint4 tab1_plane1 = vint4::load(scb.weights + 16);
vint tab0_plane1p, tab1_plane1p;
vtable_prepare(tab0_plane1, tab1_plane1, tab0_plane1p, tab1_plane1p);
vtable_32x8 tab_plane1;
vtable_prepare(tab_plane1, scb.weights);

// Plane 2
vint4 tab0_plane2 = vint4::load(scb.weights + 32);
vint4 tab1_plane2 = vint4::load(scb.weights + 48);
vint tab0_plane2p, tab1_plane2p;
vtable_prepare(tab0_plane2, tab1_plane2, tab0_plane2p, tab1_plane2p);
vtable_32x8 tab_plane2;
vtable_prepare(tab_plane2, scb.weights + 32);

for (unsigned int i = 0; i < bsd.texel_count; i += ASTCENC_SIMD_WIDTH)
{
vint sum_plane1(8);
vint sum_plane2(8);

vint weight_count(di.texel_weight_count + i);
int max_weight_count = hmax(weight_count).lane<0>();
int max_weight_count = hmax_s(weight_count);

promise(max_weight_count > 0);
for (int j = 0; j < max_weight_count; j++)
{
vint texel_weights(di.texel_weights_tr[j] + i);
vint texel_weights_int(di.texel_weight_contribs_int_tr[j] + i);

sum_plane1 += vtable_8bt_32bi(tab0_plane1p, tab1_plane1p, texel_weights) * texel_weights_int;
sum_plane2 += vtable_8bt_32bi(tab0_plane2p, tab1_plane2p, texel_weights) * texel_weights_int;
sum_plane1 += vtable_lookup_32bit(tab_plane1, texel_weights) * texel_weights_int;
sum_plane2 += vtable_lookup_32bit(tab_plane2, texel_weights) * texel_weights_int;
}

store(lsr<4>(sum_plane1), weights_plane1 + i);
Expand Down
6 changes: 3 additions & 3 deletions 3rdparty/astcenc/astcenc_find_best_partitioning.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
// ----------------------------------------------------------------------------
// Copyright 2011-2023 Arm Limited
// Copyright 2011-2024 Arm Limited
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -425,8 +425,8 @@ static unsigned int get_partition_ordering_by_mismatch_bits(
}

// Create a running sum from the histogram array
// Cells store previous values only; i.e. exclude self after sum
unsigned int sum = 0;
// Indices store previous values only; i.e. exclude self after sum
uint16_t sum = 0;
for (unsigned int i = 0; i < texel_count; i++)
{
uint16_t cnt = mscount[i];
Expand Down
Loading

0 comments on commit a4a7564

Please sign in to comment.