Compare commits

..
1516 changed files with 19731 additions and 162509 deletions

No files matched your search

-2
View File
@@ -1,9 +1,7 @@
ASEbrahim
FX192
FryMcNugget
K11MCH1
KeegantheVeganat0r
kingokksa
ovurrsl
KeegantheVeganat0r
EnzoDLofi
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
validate:
name: Validate source and build result
runs-on: ubuntu-24.04
timeout-minutes: 70
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
@@ -1,35 +0,0 @@
name: Build bionic runtime pack and DroidDeck-Bionic tool
on:
push:
paths:
- 'tools/bionic-runtime/**'
- 'tools/gamescope/patches/0117-wsi-cache-present-bypass-check.patch'
- 'tools/gamescope/patches/0119-wsi-default-images-under-limiter.patch'
- 'app/src/main/cpp/fakeinput_steam.cpp'
- 'tools/gpuload/**'
- '.github/workflows/build-bionic-runtime.yml'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- name: Host tools
run: |
set -euo pipefail
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends libwayland-bin libwayland-dev libx11-dev libx11-xcb-dev \
libxcb1-dev libxcb-composite0-dev libglm-dev zstd
- name: Build
run: |
set -euo pipefail
export NDK="${ANDROID_NDK_LATEST_HOME:-${ANDROID_NDK_HOME:-$ANDROID_NDK_ROOT}}"
export BUILD_NUMBER=${{ github.run_number }}
tools/bionic-runtime/build.sh "$RUNNER_TEMP/bionic-runtime" "$PWD/out"
- uses: actions/upload-artifact@v4
with:
name: droiddeck-bionic-runtime-${{ github.sha }}
path: out/*
+1 -4
View File
@@ -29,14 +29,11 @@ jobs:
persist-credentials: false
- name: Build in Arch Linux ARM
env:
GH_TOKEN: ${{ github.token }}
FEX_EXTRA_CXXFLAGS: ${{ inputs.cxxflags }}
FEX_THUNKS: ${{ inputs.thunks == 'true' && '1' || '0' }}
run: |
set -euo pipefail
FEX_VERSION=$(gh api repos/FEX-Emu/FEX/releases/latest --jq .tag_name)
echo "Building $FEX_VERSION, FEX's latest release"
docker run --rm -e FEX_VERSION="$FEX_VERSION" -e FEX_EXTRA_CXXFLAGS="$FEX_EXTRA_CXXFLAGS" -e FEX_THUNKS="$FEX_THUNKS" -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/fex/build-in-arch.sh
docker run --rm -e FEX_EXTRA_CXXFLAGS="$FEX_EXTRA_CXXFLAGS" -e FEX_THUNKS="$FEX_THUNKS" -v "$PWD:/work" -w /work menci/archlinuxarm:base-devel bash tools/fex/build-in-arch.sh
sudo chown -R "$(id -u):$(id -g)" .
- uses: actions/upload-artifact@v4
with:
+24 -201
View File
@@ -127,7 +127,6 @@ jobs:
name: xbox-arm64
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
retention-days: 14
overwrite: true
- uses: actions/upload-artifact@v4
with:
name: xbox-corresponding-source
@@ -136,7 +135,6 @@ jobs:
app/build/xbox/runtime/*-source.tar.xz
if-no-files-found: error
retention-days: 14
overwrite: true
components-runner:
needs: source
@@ -152,9 +150,6 @@ jobs:
runs-on: ${{ fromJSON(needs.components-runner.outputs.labels) }}
timeout-minutes: 40
steps:
- name: Reclaim files a cancelled container build left owned by root
if: runner.environment == 'self-hosted'
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -164,9 +159,6 @@ jobs:
!/docs/releases/media/
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Clear scratch earlier runs left behind
if: runner.environment == 'self-hosted'
run: bash tools/ci/clear-runner-scratch.sh "$GITHUB_WORKSPACE"
- name: Merge the pinned APK base
if: github.event_name == 'pull_request'
env:
@@ -198,17 +190,17 @@ jobs:
app/src/main/assets/linuxfs
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-comet
!app/src/main/assets/linuxfs/usr/local/lib/droiddeck-xbox
!app/src/main/assets/linuxfs/i386/libddsession.so
!app/src/main/assets/linuxfs/i386/libblsession.so
!app/src/main/assets/linuxfs/i386/libfakeinput.so
!app/src/main/assets/linuxfs/i386/libfaultreport.so
!app/src/main/assets/linuxfs/libddaudit.so
!app/src/main/assets/linuxfs/libddfastpath.so
!app/src/main/assets/linuxfs/libblaudit.so
!app/src/main/assets/linuxfs/libblfastpath.so
!app/src/main/assets/linuxfs/libddnatv-hook.so
!app/src/main/assets/linuxfs/libddsession.so
!app/src/main/assets/linuxfs/libblsession.so
!app/src/main/assets/linuxfs/libfakeinput.so
!app/src/main/assets/linuxfs/libssbs.so
!app/src/main/assets/linuxfs/usr/local/bin/droiddeck-clipboard
!app/src/main/assets/linuxfs/x86_64/libddsession.so
!app/src/main/assets/linuxfs/x86_64/libblsession.so
!app/src/main/assets/linuxfs/x86_64/libfakeinput.so
!app/src/main/assets/linuxfs/x86_64/libfaultreport.so
!app/src/main/assets/linuxfs/x86_64/libvulkan-thunk.so
@@ -294,7 +286,7 @@ jobs:
- name: Build the non-Adreno test additions (Mali bridge client, Venus GL probe, Xclipse layer)
run: |
set -euo pipefail
bash tools/ci/install-ubuntu-packages.sh gcc-aarch64-linux-gnu libc6-dev-arm64-cross libvulkan-dev
bash tools/ci/install-ubuntu-packages.sh gcc-aarch64-linux-gnu libvulkan-dev
D=app/src/main/assets/linuxfs
mkdir -p "$D/usr/local/bin" "$D/usr/local/lib/droiddeck-xclipse"
aarch64-linux-gnu-gcc -shared -fPIC -O2 -Wall -Wextra -Wno-unused-parameter -fvisibility=hidden -pthread \
@@ -338,7 +330,6 @@ jobs:
if-no-files-found: error
compression-level: 0
retention-days: 14
overwrite: true
build-runner:
needs: [components]
@@ -356,9 +347,6 @@ jobs:
outputs:
variants: ${{ steps.variants.outputs.list }}
steps:
- name: Reclaim files a cancelled container build left owned by root
if: runner.environment == 'self-hosted'
run: sudo -n chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || echo "::warning::could not reclaim $GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
@@ -370,10 +358,6 @@ jobs:
persist-credentials: false
submodules: recursive
- name: Clear scratch earlier runs left behind
if: runner.environment == 'self-hosted'
run: bash tools/ci/clear-runner-scratch.sh "$GITHUB_WORKSPACE"
- name: Check human authorship
env:
EVENT_NAME: ${{ github.event_name }}
@@ -572,65 +556,11 @@ jobs:
SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
run: python3 tools/components/prepare.py unpack --tree "$SOURCE_TREE"
# A hosted runner needs over 20 minutes per launcher; rebuild only when its sources change, and save each
# build as soon as it finishes so a later timeout cannot discard it.
- name: Restore the Ubisoft launcher build
id: ubisoft-cache
uses: actions/cache/restore@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-ubisoft
key: ubisoft-launcher-v1-${{ steps.rust.outputs.rustc }}-${{ hashFiles('tools/ubisoft-launcher/src/**', 'tools/ubisoft-launcher/Cargo.toml', 'tools/ubisoft-launcher/Cargo.lock', 'tools/ubisoft-launcher/build.sh', 'tools/ubisoft-launcher/build.rs', 'tools/ubisoft-launcher/.cargo/**') }}
- name: Ubisoft launcher service (x86_64-pc-windows-gnu)
if: steps.ubisoft-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
command -v x86_64-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-x86-64; }
bash tools/ubisoft-launcher/build.sh
- name: Save the Ubisoft launcher build
if: steps.ubisoft-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-ubisoft
key: ${{ steps.ubisoft-cache.outputs.cache-primary-key }}
- name: Restore the Rockstar launcher build
id: rockstar-cache
uses: actions/cache/restore@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar
key: rockstar-launcher-v1-${{ steps.rust.outputs.rustc }}-${{ hashFiles('tools/rockstar-launcher/src/**', 'tools/rockstar-launcher/Cargo.toml', 'tools/rockstar-launcher/Cargo.lock', 'tools/rockstar-launcher/build.sh', 'tools/rockstar-launcher/build.rs', 'tools/rockstar-launcher/.cargo/**') }}
- name: Rockstar launcher service (32-bit and 64-bit)
if: steps.rockstar-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
command -v i686-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-i686; }
command -v x86_64-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-x86-64; }
bash tools/rockstar-launcher/build.sh
- name: Save the Rockstar launcher build
if: steps.rockstar-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar
key: ${{ steps.rockstar-cache.outputs.cache-primary-key }}
- name: Restore the Epic launcher build
id: epic-cache
uses: actions/cache/restore@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-epic
key: epic-launcher-v1-${{ steps.rust.outputs.rustc }}-${{ hashFiles('tools/epic-launcher/src/**', 'tools/epic-launcher/Cargo.toml', 'tools/epic-launcher/Cargo.lock', 'tools/epic-launcher/build.sh', 'tools/epic-launcher/build.rs', 'tools/epic-launcher/.cargo/**') }}
- name: Epic Games Launcher parent stand-in (x86_64-pc-windows-gnu)
if: steps.epic-cache.outputs.cache-hit != 'true'
run: |
set -euo pipefail
command -v x86_64-w64-mingw32-gcc >/dev/null || { sudo apt-get update -qq && sudo apt-get install -y -qq gcc-mingw-w64-x86-64; }
bash tools/epic-launcher/build.sh
- name: Save the Epic launcher build
if: steps.epic-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: app/src/main/assets/linuxfs/usr/local/lib/droiddeck-epic
key: ${{ steps.epic-cache.outputs.cache-primary-key }}
- uses: actions/download-artifact@v4
with:
@@ -643,7 +573,7 @@ jobs:
path: |
~/.cache/droiddeck-pack-inputs
~/.cache/droiddeck-build
key: pack-inputs-v2-${{ hashFiles('tools/packs/build.sh', 'tools/packs/fetch-verified.sh', 'tools/packs/tracking/release.env', 'tools/packs/zstd/release.env', 'tools/powervr/release.json') }}
key: pack-inputs-v2-${{ hashFiles('tools/packs/build.sh', 'tools/packs/fetch-verified.sh', 'tools/packs/tracking/release.env', 'tools/powervr/release.json') }}
restore-keys: pack-inputs-v2-
- name: Build the add-on packs
run: |
@@ -674,28 +604,25 @@ jobs:
export NDK="$ANDROID_HOME/ndk/$NDK_VERSION"
tools/syncthing/build.sh app/src/main/jniLibs/arm64-v8a
- name: Check the proot pack pin against this build
- name: Note when the proot pack pin is behind this build
run: |
set -euo pipefail
# shellcheck disable=SC1091
source tools/packs/proot/release.env
sha=$(sha256sum app/build/packs/proot.tar.zst | cut -d' ' -f1)
size=$(stat -c %s app/build/packs/proot.tar.zst)
if [ "$sha" != "$PROOT_PACK_SHA256" ] || [ "$size" != "$PROOT_PACK_SIZE" ]; then
level=warning
if [ "$GITHUB_EVENT_NAME" = pull_request ]; then level=error; fi
echo "::$level::built proot pack $sha ($size bytes) does not match tools/packs/proot/release.env ($PROOT_PACK_SHA256, $PROOT_PACK_SIZE bytes). Source builds download the pinned pack, so set PROOT_PACK_SHA256=$sha and PROOT_PACK_SIZE=$size in tools/packs/proot/release.env."
if [ "$level" = error ]; then exit 1; fi
if [ "$sha" != "$PROOT_PACK_SHA256" ]; then
echo "::warning::built proot pack $sha does not match tools/packs/proot/release.env ($PROOT_PACK_SHA256). This build publishes the pack it just built. Source builds keep downloading the pinned pack until release.env is updated."
fi
- name: Check out MaliBridge
run: git submodule update --init external/MaliBridge
- name: Fetch the Mali (Venus) component (tools/venus/release.env)
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
. tools/venus/release.env
curl -fsSL --retry 5 --retry-all-errors --retry-delay 10 -o venus.tzst \
"https://github.com/${VENUS_REPO}/releases/download/${VENUS_TAG}/venus.tzst"
gh release download "${VENUS_TAG}" -R "${VENUS_REPO}" -p venus.tzst -O venus.tzst
echo "${VENUS_SHA256} venus.tzst" | sha256sum -c -
tar --use-compress-program=unzstd -xf venus.tzst -C app/src/main
test -f app/src/main/jniLibs/arm64-v8a/libvirgl_test_server.so
@@ -732,39 +659,7 @@ jobs:
name: stores-cargo-lock
path: app/src/main/rust/stores/Cargo.lock
if-no-files-found: ignore
overwrite: true
- name: Resolve the Robolectric version
id: robolectric
run: |
echo "version=$(grep -o "org.robolectric:robolectric:[0-9.]*" app/build.gradle | cut -d: -f3)" >> "$GITHUB_OUTPUT"
# Robolectric downloads these from Maven Central on first use without retrying, and 429s fail whole test classes.
# The cache path sits beside the workspace because runner homes are at different depths from it, and
# actions/cache stores paths relative to the workspace. Runners that keep their own ~/.m2 skip the cache.
- name: Place Robolectric's Android jars beside the workspace
id: robolectric-jars
run: |
set -euo pipefail
jars="$GITHUB_WORKSPACE/../robolectric-jars"
m2="$HOME/.m2/repository/org/robolectric/android-all-instrumented"
if [ -d "$m2" ] && [ ! -L "$m2" ]; then
echo "cache=false" >> "$GITHUB_OUTPUT"
else
mkdir -p "$jars" "$(dirname "$m2")"
ln -sfn "$(cd "$jars" && pwd)" "$m2"
echo "cache=true" >> "$GITHUB_OUTPUT"
fi
- name: Restore Robolectric's Android jars
id: robolectric-cache
if: steps.robolectric-jars.outputs.cache == 'true'
uses: actions/cache/restore@v4
with:
path: ../robolectric-jars
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
- name: Count the restored Robolectric jars
if: steps.robolectric-jars.outputs.cache == 'true'
run: echo "ROBOLECTRIC_JARS_BEFORE=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)" >> "$GITHUB_ENV"
- name: Unit tests
id: unit-tests
env:
@@ -775,34 +670,6 @@ jobs:
mkdir -p app/build
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
- name: Save Robolectric's Android jars
id: robolectric-jars-final
if: always() && steps.robolectric-jars.outputs.cache == 'true'
run: |
python3 - <<'PY'
import glob, os, zipfile
root = os.path.join(os.environ['GITHUB_WORKSPACE'], '..', 'robolectric-jars')
for f in glob.glob(os.path.join(root, '**', '*'), recursive=True):
if not os.path.isfile(f):
continue
try:
ok = f.endswith('.jar') and zipfile.ZipFile(f).testzip() is None
except Exception:
ok = False
if not ok:
os.remove(f)
PY
after=$(find "$GITHUB_WORKSPACE/../robolectric-jars" -name '*.jar' | wc -l)
[ "$after" -gt "${ROBOLECTRIC_JARS_BEFORE:-0}" ] && echo "save=true" >> "$GITHUB_OUTPUT" || true
- name: Store Robolectric's Android jars
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
uses: actions/cache/save@v4
with:
path: ../robolectric-jars
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
- name: Upload unit test diagnostics
id: unit-test-diagnostics
if: always() && steps.unit-tests.outcome != 'skipped'
@@ -815,7 +682,6 @@ jobs:
app/build/reports/tests/testReleaseUnitTest/
if-no-files-found: ignore
retention-days: 14
overwrite: true
- name: Sign with the testkey (v1 + v2 + v3)
run: |
@@ -853,7 +719,6 @@ jobs:
if-no-files-found: error
retention-days: 30
compression-level: 0
overwrite: true
- uses: actions/upload-artifact@v4
with:
@@ -862,7 +727,6 @@ jobs:
if-no-files-found: error
retention-days: 30
compression-level: 0
overwrite: true
- name: Report on the pull request
if: always() && github.event_name == 'pull_request'
@@ -883,6 +747,7 @@ jobs:
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
runs-on: ubuntu-24.04
timeout-minutes: 15
continue-on-error: true
permissions:
contents: read
actions: read
@@ -928,16 +793,14 @@ jobs:
stores-host-v1-${{ runner.os }}-${{ runner.arch }}-${{ steps.rust.outputs.rustc }}-
- name: Store engines host unit tests
timeout-minutes: 10
continue-on-error: true
run: |
set -o pipefail
cd app/src/main/rust/stores
cargo test --locked 2>&1 | tail -60
- name: Windows launcher service host unit tests
- name: Ubisoft launcher service host unit tests
timeout-minutes: 10
run: |
cargo test --locked --manifest-path tools/ubisoft-launcher/Cargo.toml
cargo test --locked --manifest-path tools/rockstar-launcher/Cargo.toml
cargo test --locked --manifest-path tools/epic-launcher/Cargo.toml
run: cargo test --locked --manifest-path tools/ubisoft-launcher/Cargo.toml
python-tests:
name: Python and native regression tests
@@ -970,9 +833,12 @@ jobs:
env:
XBOX_SOURCE_TREE: ${{ needs.source.outputs.tree-sha }}
run: test "$(git rev-parse 'HEAD^{tree}')" = "$XBOX_SOURCE_TREE"
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Python test dependencies
timeout-minutes: 7
run: bash tools/ci/install-ubuntu-packages.sh python3-yaml gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user libvulkan-dev mesa-vulkan-drivers spirv-tools
run: bash tools/ci/install-ubuntu-packages.sh python3-yaml gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user libvulkan-dev mesa-vulkan-drivers
- name: Resolve the pinned Android NDK
run: bash tools/ci/resolve-ndk.sh
@@ -1002,22 +868,12 @@ jobs:
-ldl -o /tmp/test-presenter-shutdown
timeout 10 /tmp/test-presenter-shutdown
- name: Fetch the Mali compatibility layer's headers
run: |
set -euo pipefail
sdk=$(sed -n 's/^SDK=//p' tools/venus/ci-build.sh)
bcdec=$(grep -o 'https://raw.githubusercontent.com/iOrange/bcdec/[^ ]*' tools/venus/ci-build.sh)
mkdir -p build/layer-deps/bcdec
git -c advice.detachedHead=false clone -q --depth 1 -b "$sdk" https://github.com/KhronosGroup/Vulkan-Headers.git build/layer-deps/vulkan
git -c advice.detachedHead=false clone -q --depth 1 -b "$sdk" https://github.com/KhronosGroup/SPIRV-Headers.git build/layer-deps/spirv
curl -sSfL -o build/layer-deps/bcdec/bcdec.h "$bcdec"
- name: Steam import and game environment tests
run: bash tools/ci/run-python-tests.sh
checks:
name: Compile and test APK
needs: [build, python-tests, store-tests]
needs: [build, python-tests]
if: ${{ !cancelled() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) }}
runs-on: ubuntu-24.04
timeout-minutes: 5
@@ -1026,8 +882,7 @@ jobs:
env:
BUILD_RESULT: ${{ needs.build.result }}
PYTHON_RESULT: ${{ needs.python-tests.result }}
STORE_RESULT: ${{ needs.store-tests.result }}
run: test "$BUILD_RESULT" = success && test "$PYTHON_RESULT" = success && test "$STORE_RESULT" = success
run: test "$BUILD_RESULT" = success && test "$PYTHON_RESULT" = success
sign:
needs: [build, checks]
@@ -1071,7 +926,7 @@ jobs:
pull-requests: read
env:
CI_REPO: Droid-Deck/DroidDeck-CI
KEEP_DAYS: 14
KEEP: 10
steps:
- uses: actions/checkout@v4
with:
@@ -1116,35 +971,3 @@ jobs:
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.announce.result != 'skipped' }}
uses: ./.github/workflows/update-catalog.yml
secrets: inherit
retire-tests:
needs: catalog
if: ${{ always() && github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && needs.catalog.result == 'success' }}
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: actions/create-github-app-token@v2
id: ci-token
with:
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-CI
- name: Delete the test builds this Preview build replaces
env:
SOURCE_GITHUB_TOKEN: ${{ github.token }}
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
run: python3 tools/release/retire_test_builds.py
catalog-after-retire:
needs: retire-tests
if: ${{ always() && needs.retire-tests.result == 'success' }}
uses: ./.github/workflows/update-catalog.yml
secrets: inherit
-141
View File
@@ -1,141 +0,0 @@
name: PR Rebuild On Version Bump
run-name: rebuild test builds below versionCode on main
on:
push:
branches: [main]
paths: [app/build.gradle]
workflow_dispatch:
permissions:
actions: write
contents: read
issues: write
pull-requests: read
concurrency:
group: pr-rebuild-on-version
cancel-in-progress: false
queue: max
jobs:
rebuild:
runs-on: ubuntu-24.04
timeout-minutes: 180
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
persist-credentials: false
- name: Rebuild open PRs whose test build Android would refuse over main
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
BEFORE: ${{ github.event.before }}
PUSHED_AT: ${{ github.event.repository.pushed_at }}
run: |
set -euo pipefail
code() { sed -n 's/^[[:space:]]*versionCode[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p'; }
now=$(code < app/build.gradle)
[[ "$now" =~ ^[0-9]+$ ]] || { echo "::error::No numeric versionCode on main"; exit 1; }
if [ "$EVENT_NAME" = push ]; then
was=$(git show "$BEFORE:app/build.gradle" 2>/dev/null | code || true)
if [[ "$was" =~ ^[0-9]+$ ]] && [ "$was" -ge "$now" ]; then
echo "versionCode stayed at $now"
exit 0
fi
fi
# This run is created right after the push, so a PR build that started earlier may have pinned the old main.
bumped=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --jq .created_at)
# A build can finish between the push and this run's creation; the push event carries the push time.
if [[ "${PUSHED_AT:-}" =~ ^[0-9]+$ ]]; then
pushed=$(date -u -d "@$PUSHED_AT" +%Y-%m-%dT%H:%M:%SZ)
[[ "$pushed" < "$bumped" ]] && bumped=$pushed
else
pushed=$(date -u -d "$bumped - 10 minutes" +%Y-%m-%dT%H:%M:%SZ)
fi
note() {
local number=$1
local marker="<!-- droiddeck-rebuild-$now -->"
gh api "repos/$GITHUB_REPOSITORY/issues/$number/comments?per_page=100" --jq '.[].body' | grep -qF "$marker" && return 0
gh api -X POST "repos/$GITHUB_REPOSITORY/issues/$number/comments" -f body="$marker
Main is now at versionCode $now, so this PR's test build no longer installs over current DroidDeck, and its last build is too old for GitHub to re-run. Push a commit or merge main to get a new test build." >/dev/null
}
latest() {
gh api "repos/$GITHUB_REPOSITORY/actions/workflows/build.yml/runs?event=pull_request&head_sha=$1&per_page=20" \
--jq '[.workflow_runs[] | select(.head_sha == "'"$1"'")] | sort_by(.created_at) | last // empty | [.id, .status, (.run_started_at // .created_at), .created_at, .updated_at] | @tsv'
}
consider() {
local number=$1 head=$2 built=$3 id status started created updated
IFS=$'\t' read -r id status started created updated <<<"$4"
if [[ "$started" > "$bumped" ]]; then
echo "PR #$number: build $id started after the bump"
elif ! gh api "repos/$GITHUB_REPOSITORY/pulls/$number" |
jq -e --arg head "$head" '.state == "open" and .draft == false and .base.ref == "main" and .head.sha == $head' >/dev/null; then
echo "PR #$number: moved on since the scan, its own build covers it"
elif gh run rerun "$id" -R "$GITHUB_REPOSITORY"; then
echo "PR #$number: rebuilding ${head:0:7} on main (versionCode $built -> $now)"
else
echo "::warning::PR #$number: could not rerun build $id"
# GitHub only re-runs a workflow within 30 days of its first run.
if [[ "$created" < "$(date -u -d '-30 days' +%Y-%m-%dT%H:%M:%SZ)" ]]; then
note "$number" || echo "::warning::PR #$number: could not leave a note"
fi
fi
}
pending=()
declare -A seen=()
candidates() {
gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" \
--jq '.[] | select(.tag_name | test("^pr-[0-9]+$")) | [(.tag_name | ltrimstr("pr-")), ((.body // "") | capture("(?m)^VersionCode: (?<v>[0-9]+)").v // "0")] | @tsv'
# The latest build of every open PR: one that started before the bump and was still running at it
# may have pinned the old main. This also covers a PR's first build and fork builds.
gh api --paginate -X GET "repos/$GITHUB_REPOSITORY/pulls" -f state=open -f base=main -f per_page=100 \
--jq '.[] | select(.draft | not) | [(.number | tostring), .head.sha] | @tsv' |
while IFS=$'\t' read -r number sha; do
run=$(latest "$sha")
[ -n "$run" ] || continue
IFS=$'\t' read -r _ status started _ updated <<<"$run"
if [[ "$started" < "$bumped" ]] && { [ "$status" != completed ] || [[ ! "$updated" < "$pushed" ]]; }; then
printf '%s\t?\n' "$number"
fi
done
}
found=$(mktemp)
candidates > "$found"
while IFS=$'\t' read -r number built; do
[ "$built" = "?" ] || [ "$built" -lt "$now" ] || continue
[ -z "${seen[$number]:-}" ] || continue
seen[$number]=1
pr=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$number") || continue
jq -e '.state == "open" and .draft == false and .base.ref == "main"' <<<"$pr" >/dev/null || continue
head=$(jq -r .head.sha <<<"$pr")
run=$(latest "$head")
if [ -z "$run" ]; then
echo "PR #$number: no build of ${head:0:7} to rerun"
elif [ "$(cut -f2 <<<"$run")" = completed ]; then
consider "$number" "$head" "$built" "$run"
else
pending+=("$number $head $built")
fi
done < "$found"
# Builds still running are polled together so one slow build cannot hold up the rest.
deadline=$((SECONDS + 150 * 60))
while [ ${#pending[@]} -gt 0 ] && [ "$SECONDS" -lt "$deadline" ]; do
sleep 60
left=()
for item in "${pending[@]}"; do
read -r number head built <<<"$item"
run=$(latest "$head")
if [ -n "$run" ] && [ "$(cut -f2 <<<"$run")" = completed ]; then
consider "$number" "$head" "$built" "$run"
else
left+=("$item")
fi
done
pending=(${left[@]+"${left[@]}"})
done
for item in ${pending[@]+"${pending[@]}"}; do
echo "::warning::PR #${item%% *}: its build did not finish in time"
done
+25 -8
View File
@@ -40,19 +40,36 @@ jobs:
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-CI
- name: Delete the test build
if: ${{ steps.state.outputs.closed == 'true' }}
env:
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
retry() {
for attempt in 1 2 3 4; do
"$@" && return 0
[ "$attempt" = 4 ] || sleep $((attempt * 20))
done
return 1
}
existing=$(retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name')
found=0
for tag in "pr-$PR_NUMBER" "pr-$PR_NUMBER.0"; do
if grep -qxF "$tag" <<<"$existing"; then
retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag
echo "Deleted $tag"
found=1
fi
done
[ "$found" = 1 ] || echo "No test build for PR #$PR_NUMBER"
- uses: actions/checkout@v4
if: ${{ steps.state.outputs.closed == 'true' }}
with:
ref: main
persist-credentials: false
- name: Delete the test build unless main still needs it
if: ${{ steps.state.outputs.closed == 'true' }}
env:
SOURCE_GITHUB_TOKEN: ${{ github.token }}
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
# A merged PR's build stays until a Preview build carries the merge; build.yml and the sweep remove it then.
run: python3 tools/release/retire_test_builds.py --pr "$PR_NUMBER"
- name: Retire the Discord PR announcement
if: ${{ steps.state.outputs.closed == 'true' }}
env:
+6 -42
View File
@@ -226,8 +226,6 @@ jobs:
publish:
needs: [authorize, sign]
runs-on: ubuntu-24.04
outputs:
keep: ${{ steps.publish.outputs.keep }}
permissions:
actions: read
contents: read
@@ -324,8 +322,12 @@ jobs:
cp pr-packs/* signed/ 2>/dev/null || true
gh release upload "$tag" signed/* -R "$repo" --clobber
gh release edit "$tag" -R "$repo" --title "PR #$PR_NUMBER" --notes "$notes" --prerelease
# The previous push's files stay until the catalog names these (the prune job), so a download started from the old catalog still finds its APK.
echo "keep=$(cd signed && ls | jq -R . | jq -sc .)" >> "$GITHUB_OUTPUT"
keep=$(cd signed && ls | jq -R . | jq -sc .)
gh api "repos/$repo/releases/tags/$tag" |
jq -r --argjson keep "$keep" '.assets[] | select(.name as $n | $keep | index($n) | not) | .id' |
while IFS= read -r id; do
gh api --method DELETE "repos/$repo/releases/assets/$id" >/dev/null
done
published=$(gh release view "$tag" -R "$repo" --json tagName,assets)
jq -e --arg tag "$tag" '.tagName == $tag and (.assets | length) > 0' <<<"$published" >/dev/null
@@ -415,41 +417,3 @@ jobs:
if: ${{ always() && needs.publish.result != 'skipped' }}
uses: ./.github/workflows/update-catalog.yml
secrets: inherit
prune:
needs: [authorize, publish, catalog]
if: ${{ always() && needs.publish.result == 'success' && needs.catalog.result == 'success' }}
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/create-github-app-token@v2
id: ci-token
with:
app-id: ${{ vars.DROIDDECK_CI_APP_ID }}
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-CI
- name: Remove the previous push's files
env:
GH_TOKEN: ${{ steps.ci-token.outputs.token }}
PR_NUMBER: ${{ needs.authorize.outputs.pr_number }}
KEEP: ${{ needs.publish.outputs.keep }}
run: |
set -euo pipefail
repo=Droid-Deck/DroidDeck-CI
tag="pr-$PR_NUMBER"
# An app that read the catalog just before it changed may still be starting that download.
sleep 300
# Delete nothing the published catalog still names.
named=$(gh api -H "Accept: application/vnd.github.raw+json" "repos/$repo/contents/catalog.json?ref=main" |
jq -c --argjson pr "$PR_NUMBER" '[.tests[] | select(.pr == $pr) | .apks[].name]')
stale=$(jq -nr --argjson named "$named" --argjson keep "$KEEP" '$named - $keep | join(" ")')
if [ -n "$stale" ]; then
echo "::warning::The catalog still names $stale; keeping every file of $tag"
exit 0
fi
gh api "repos/$repo/releases/tags/$tag" |
jq -r --argjson keep "$KEEP" '.assets[] | select(.name as $n | $keep | index($n) | not) | .id' |
while IFS= read -r id; do
gh api --method DELETE "repos/$repo/releases/assets/$id" >/dev/null
done
+28 -14
View File
@@ -26,18 +26,32 @@ jobs:
private-key: ${{ secrets.DROIDDECK_CI_APP_KEY }}
owner: Droid-Deck
repositories: DroidDeck-CI
- uses: actions/checkout@v4
with:
ref: main
persist-credentials: false
- name: Delete test builds of closed PRs, and of merged PRs a Preview build carries
- name: Delete test builds whose PR is no longer open
env:
SOURCE_GITHUB_TOKEN: ${{ github.token }}
CI_GITHUB_TOKEN: ${{ steps.ci-token.outputs.token }}
run: python3 tools/release/retire_test_builds.py
catalog:
needs: sweep
if: ${{ always() }}
uses: ./.github/workflows/update-catalog.yml
secrets: inherit
CI_TOKEN: ${{ steps.ci-token.outputs.token }}
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
retry() {
for attempt in 1 2 3 4; do
"$@" && return 0
[ "$attempt" = 4 ] || sleep $((attempt * 20))
done
return 1
}
tags=$(GH_TOKEN="$CI_TOKEN" retry gh api --paginate "repos/Droid-Deck/DroidDeck-CI/releases?per_page=100" --jq '.[].tag_name' |
grep -E '^pr-[0-9]+(\.0)?$' || true)
failed=0
for tag in $tags; do
number=${tag#pr-}
number=${number%.0}
state=$(retry gh api "repos/$GITHUB_REPOSITORY/pulls/$number" --jq .state) || { failed=1; continue; }
if [ "$state" != open ]; then
if GH_TOKEN="$CI_TOKEN" retry gh release delete "$tag" -R Droid-Deck/DroidDeck-CI --yes --cleanup-tag; then
echo "Deleted $tag (PR #$number is $state)"
else
failed=1
fi
fi
done
exit "$failed"
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
jq -r --arg n "$2" '.assets // [] | .[] | select(.name == $n) | .digest // empty'
}
commit=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$BUILD_RUN" --jq .head_sha 2>/dev/null || echo "$GITHUB_SHA")
for name in proot directaudio tracking xbox comet butler powervr ubisoft rockstar dirt epic; do
for name in proot directaudio tracking xbox comet butler powervr ubisoft; do
file="packs/$name.tar.zst"
[ -f "$file" ] || { echo "::error::$name.tar.zst is missing from Build APK run $BUILD_RUN"; exit 1; }
sha=$(sha256sum "$file" | cut -d' ' -f1)
-2
View File
@@ -36,5 +36,3 @@ __pycache__/
app/src/main/assets/directaudio/
app/src/main/assets/hybris/
/tools/vr/out/
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-rockstar/
app/src/main/assets/linuxfs/usr/local/lib/droiddeck-epic/
-45
View File
@@ -1,48 +1,3 @@
# Rules
- Comments should be rare, factual, and explain only non-obvious external constraints or business invariants.
# Building and testing
- For an install-and-look iteration, use `tools/quick_deploy.sh` (build without lint, sign, install, about 30 s). Run `tools/build_local.sh` once to prepare the runtime and again only before a PR. It is not a per-change step.
- `tools/build_local.sh` reuses the components a main CI run prepared when every recipe identity matches the local tree (it prints `components: … reusing`). It builds them locally when no usable CI artifact matches (after you change their inputs, or when the lookup fails) or with `DROIDDECK_CI_COMPONENTS=0`.
- Helper scripts (`tools/linuxfs/overlay`, `tools/linuxfs/desktop`) are staged on every Gradle build, so editing them needs no `build_local.sh`. After preloads or other runtime components change, the fast loop warns and reuses the old binaries; run `tools/build_local.sh` when those matter. "Missing or changed runtime input" means the prepared files themselves changed: run `tools/build_local.sh` once. Do not revert scripts or copy `app/build` between checkouts; `tools/seed_worktree.sh` seeds a new worktree from the main checkout.
- Every build defaults to the NDK in `tools/ci/toolchains.env`, as CI does. CI runs `testReleaseUnitTest`; when a test fails only in CI, run the release variant locally.
- Run the tests that cover what you changed, including unchanged tests of code you edited: `./gradlew -PskipRust=true :app:testDebugUnitTest --tests '<class>'` and `python3 -m unittest discover -s tools/tests -p 'test_<area>*.py'`. The full Python suite takes about 9 minutes, and some preload tests fail on any host without zram/ntsync. Leave full runs to CI.
- For UI screenshots without a device, run `./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*PreviewRenderTest'` and read `app/build/preview-renders/{handheld,portrait}/`. Add cases per `docs/compose-previews.md`. Check portrait, not just landscape.
- After changing `SettingsIndex`, regenerate the doc: `UPDATE_SETTINGS_MAP=1 ./gradlew -PskipRust=true :app:testDebugUnitTest --tests '*SettingsMapTest*'`.
- Compile errors in code you didn't touch, after switching branches, are usually stale incremental state. Rebuild once before you change anything.
# Worktrees and shared machines
- After `git worktree add`, run `git submodule update --init --recursive`. Without it, `buildVkBridgeServer` fails on missing `external/MaliBridge`. Do not commit the `tools/syncthing/syncthing-android` pointer the build dirties.
- Other agents may be building on the same machine. Never run `./gradlew --stop` or kill Gradle/Kotlin daemons you did not start. If you need isolation, use `GRADLE_USER_HOME=<own dir> GRADLE_RO_DEP_CACHE=$HOME/.gradle/caches`.
# Driving the app and device
- Do it yourself with `tools/droiddeckctl` (see `docs/agent-control.md`) instead of asking the user: `cdp eval` for Steam's UI (`SteamClient.Apps.TerminateApp('<appid>', false)` quits a game, including on a Remote Play host), `input`, `quit`, `displays`, `screenshot --display <id>`.
- A stream has started only when the session state reads `Streaming`. `SteamClient.Apps.StreamGame` alone can leave Steam on its menu, so open the game page and press Stream.
- Test controller navigation with `tools/droiddeckctl input gamepad ...`, a real uinput pad. `adb shell input keyevent DPAD_*` does not arrive as a joystick event and hides d-pad/stick bugs.
- A release-signed build installs over a release-signed install with `adb install -r`. Don't back up, uninstall or clear data to update. Scope `pm` and permission resets to `com.droiddeck.launcher`, never the whole device.
# CI
- Before pushing a PR, run `tools/pre_pr.sh`. It checks authorship and the merge onto `main`, then, when app sources change, compiles and runs lint as CI does. It picks tests by name: `<File>*Test` for changed Kotlin files, and `tools/tests` modules that mention a changed path. Add any other tests that cover your change, and leave the full suites to CI.
- CI builds the PR merged onto `main`. Before pushing, merge or rebase onto `origin/main` and compile: most "works locally" Kotlin failures come from that merge.
- Before a PR that touches strings or resources, run `./gradlew :app:lintVitalRelease`. The fast loop skips lint, and lint catches `ExtraTranslation` and missing-locale errors.
- Commit messages and PR bodies must not carry `Co-Authored-By` or other bot trailers. `tools/release/check_authorship.py` fails the build on them.
- `gh run view --log-failed` truncates the unit-test log, so the failing test may not show. Read the whole job log with `gh api repos/Droid-Deck/DroidDeck/actions/jobs/<job-id>/logs`, or `gh run download <run> -n unit-test-results`. Don't call a failure a runner problem until you have read it.
- Only these are known flakes worth a `gh run rerun <run> --failed`: `ProtonMenuAutoTest` "Proton work did not finish", Robolectric `HTTP response code: 429` from Maven, `Gradle Test Executor N finished with non-zero exit value 2`, apt mirror and GitHub API rate-limit errors. Treat any other failure as real.
- A workflow step that names a script your branch lacks means the branch predates a CI change. Rebase onto `main`.
# Agents running on the device (DroidDeck's in-app agent)
These apply only where `dd-lab-build` exists. Agents on a dev host use `tools/quick_deploy.sh` instead.
- `dd-lab-build` builds only committed work. Check `git status` and `gh api user` for the identity before committing; if `git config user.name` is empty, use the `gh` login's name and noreply email for this repo, never a guess.
- Do not commit or start a build in the same step: a build started next to a failed commit fails too. Commit first, check it, then build.
- Uncommitted changes in the tree may not be yours. Read `git diff` before committing them and tell the user what they do.
- If `dd-lab-build` says "could not read DroidDeck's state", loopback adb is down and `$ADB_SERIAL` is stale. Run `adb devices`; the port changes whenever wireless debugging is toggled. Ask the user to turn it on rather than retrying.
- A build that "did not start" can be adb, not the app. Read `~/.cache/dd-lab-build.json` and `.log` for the real reason; they can be stale from an earlier build, so compare their times with `date`.
- Run `dd-lab-build` with `run_in_background` and read its output file. A foreground `sleep` is blocked; wait with Monitor and an until-loop.
- The build restarts DroidDeck and ends your process. A turn that ends this way is not a failure.
+16 -19
View File
@@ -7,10 +7,10 @@
DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linux desktop, integration with GOG, Epic Games, Xbox, and other storefronts, Steam VR, and more!
<p align="center"><b>100% open source. No ads. No Subscriptions. No telemetry. No proprietary components. No source withheld.</b></p>
<p align="center"><b>100% open source. No ads. No telemetry. No proprietary components. No source withheld.</b></p>
<p align="center">
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.11%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.11"></a>
<a href="https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk"><img src="https://img.shields.io/badge/Download-DroidDeck%200.7.1%20APK-3DDC84?style=for-the-badge&logo=android&logoColor=white" alt="Download DroidDeck 0.7.1"></a>
<a href="https://discord.gg/JRGAvawjsm"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join the DroidDeck Discord"></a>
</p>
@@ -23,9 +23,9 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
<a href="https://trendshift.io/repositories/267852"><img src="https://trendshift.io/api/badge/trendshift/repositories/267852/daily?language=Kotlin" alt="Droid-Deck%2FDroidDeck | Trendshift" width="250" height="55"></a>
</p>
<p align="center"><a href="https://www.youtube.com/watch?v=ruaTSm_7a2c"><img src="docs/media/droiddeck-showcase.gif" width="60%" alt="A table of handhelds and phones all running DroidDeck, one waking to the Steam menu, the AYN Thor's bottom screen used as a touchpad, and scrolling around Steam on a phone before swiping to the home screen. Footage from Cyber Dopamine's video, linked."></a></p>
<p align="center"><img src="docs/media/steam-to-desktop.gif" width="100%" alt="On a Retroid Pocket Duo: Play Steam from the DroidDeck launcher, open Pac-Man in Steam Big Picture and play it, exit the game, then Switch to Desktop from the Power menu"></p>
> The official website is [droid-deck.dev](https://droid-deck.dev). Only download DroidDeck from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
> DroidDeck has no website. Only download it from this repository's [Releases](https://github.com/Droid-Deck/DroidDeck/releases).
<p align="center">
<img src="docs/releases/media/0.6.7/library.gif" width="49%" alt="The Library switching source chips, changing the card size and opening the Filter menu">
@@ -38,7 +38,7 @@ DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linu
1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx, Mali, Xclipse and PowerVR are experimental. Adreno 710 is currently unsupported. No root needed.
2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.11/DroidDeck-0.7.11.apk), install the Linux runtime, press **Play** and sign in to Steam.
3. Install the [APK](https://github.com/Droid-Deck/DroidDeck/releases/download/0.7.1/DroidDeck-0.7.1.apk), install the Linux runtime, press **Play** and sign in to Steam.
4. On Android 14 and newer, turn on **Disable child process restrictions** in Developer options. On Android 12 and 13, Steam's first launch shows a **Fix it for me** button that walks you through it.
Smart glasses setup is in the [support matrix](docs/smart-glasses-support.md). Release notes are in [docs/releases](docs/releases).
@@ -47,7 +47,7 @@ Help, Preview builds and device reports are on [Discord](https://discord.gg/JRGA
## Build
Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, Go, a host C compiler, the x86_64 and i686 MinGW-w64 compilers (i686 with DWARF-2 exceptions, as Debian and Ubuntu ship it; SJLJ builds such as Homebrew's cannot link Rust's `i686-pc-windows-gnu`), GitHub CLI, Python 3 and `zstd`. On x86_64 Linux, Docker also needs an arm64 binfmt handler (`docker run --privileged --rm tonistiigi/binfmt --install arm64`).
Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and `zstd`.
```bash
tools/build_local.sh
@@ -57,6 +57,9 @@ The APK lands in `app/build/outputs/apk/release/`. Install it with `tools/deploy
On Windows, see `tools/run_windows.ps1` and `tools/prepare_windows_runtime.py`.
## Limits
Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.
## Credits and licence
@@ -67,20 +70,17 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
- mmap ring buffer controller input by ribbit384 ([WinNative #345](https://github.com/WinNative-Emu/WinNative/pull/345)).
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT), and its GL thunk hands X errors to the program's own error handler. FEX's code disk cache was checked in its source. The fix for host stack left behind when a program leaves a signal handler without returning follows the approach suggested in [FEX-Emu/FEX#2487](https://github.com/FEX-Emu/FEX/issues/2487). The host stack fix for system calls that end a block is a backport of Ryan Houdek's [FEX-Emu/FEX#6122](https://github.com/FEX-Emu/FEX/pull/6122).
- x86-64 programs on Wayland reach the GPU through FEX's Wayland client, wayland-egl and EGL thunks. The guest `wl_list` and `wl_array` helpers follow [libwayland](https://gitlab.freedesktop.org/wayland/wayland)'s `src/wayland-util.c` (MIT). The EGL extension table comes from the [Khronos EGL registry](https://github.com/KhronosGroup/EGL-Registry) (Apache-2.0) and Mesa's `egl_other.xml` (MIT).
- [FEX](https://github.com/FEX-Emu/FEX) (MIT) runs x86 code. DroidDeck's build puts the platform name under `AT_PLATFORM` so [sharun](https://github.com/VHSgunzo/sharun) AppImages by VHSgunzo (MIT) start through its [userland-execve](https://crates.io/crates/userland-execve) loader (MIT). FEX's code disk cache was checked in its source.
- x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with [uruntime](https://github.com/VHSgunzo/uruntime) by VHSgunzo (MIT), shipped unmodified with its licence.
- DwarFS AppImages are unpacked without proot by `dwarfsextract` from [DwarFS](https://github.com/mhx/dwarfs) by Marcus Holland-Moritz (MIT), the release binary uruntime embeds, taken out of its self-extracting wrapper and shipped with its licence.
- x86 programs linking OpenSSL 3 use the copy in the [Steam Linux Runtime 4.0](https://gitlab.steamos.cloud/steamrt/steamrt). x86 Linux games get the `/etc/asound.conf` that [pressure-vessel](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools) writes.
- `WriteProcessMemory` hooks fall back to `/proc/<pid>/mem` the way [Wine](https://gitlab.winehq.org/wine/wine)'s `server/ptrace.c` did before Wine 11.
- Windows programs on noexec storage get executable copies of their image pages, following [@yujikaido](https://github.com/yujikaido)'s finding in [droiddeck-rp4pro](https://github.com/yujikaido/droiddeck-rp4pro) that Wine's own processes need the noexec shim.
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libddsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
- libddsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
- Wine write watches use userfaultfd support in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/ntdll/unix/virtual.c` (LGPL-2.1-or-later). libblsession supplies the arm64 syscall number and answers `PAGEMAP_SCAN` from `/proc/self/pagemap`.
- libblsession runs Wine's arm64 `SIGUSR2` context handler (`dlls/ntdll/unix/signal_arm64.c`, LGPL-2.1-or-later) in place on a frame laid out like [Linux](https://github.com/torvalds/linux)'s `arch/arm64/kernel/signal.c`, and serves `fill_vm_counters` in `dlls/ntdll/unix/process.c` the kernel's own `/proc/<pid>/status`.
- droiddeck-ntsync follows the [Linux](https://github.com/torvalds/linux) ntsync semantics in `Documentation/userspace-api/ntsync.rst` (GPL-2.0).
- The proot fast path orders bindings like [PRoot](https://github.com/proot-me/proot)'s `path/binding.c` (GPL-2.0-or-later).
- DiRT 3 and DiRT Showdown keep their telemetry socket the way RoccoC's DiRTTelemetryErrorFix (MIT) does, based on the fix by Carsten Gottschling.
- Zink on PowerVR keeps colour textures in colour with Icenowy Zheng's upstream [Mesa](https://gitlab.freedesktop.org/mesa/mesa) fix d55418dae7 (MIT), carried as a runtime patch.
- Games and AppImage, Flatpak and Snap programs such as emulators use `TU_DEBUG=sysmem` by default, as does the Steam client. Turnip sysmem rendering can be turned off in Performance settings, except with the Adreno 710/720 driver, which always uses it.
- Games and AppImage, Flatpak and Snap programs such as emulators use [Mesa](https://gitlab.freedesktop.org/mesa/mesa) Turnip's per render pass memory choice. The Steam client and Chromium-based apps keep `TU_DEBUG=sysmem`.
- Black Ops III and Dark Souls Remastered start without [umu-protonfixes](https://github.com/Open-Wine-Components/umu-protonfixes) (BSD-2-Clause), whose `311210.py` and `570940.py` fail under ARM64 Proton.
- [ReSkate](https://github.com/Dingo-Shenanigans/ReSkate) (GPL-3.0) by Dingo Shenanigans uses the launch option from its README and D3D12 feature level 12_1.
- The arm64 client's sign in was checked by reading Steam's saved token with the `ConnectCache` format from [deadlock-api-ingest](https://github.com/deadlock-api/deadlock-api-ingest).
@@ -90,16 +90,14 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
<details>
<summary><b>Stores</b></summary>
- Epic Games and GOG build on [Phobos](https://github.com/phobos665)'s adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl). GOG install script registry entries are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (GPL-3.0) reads them. GOG cloud storage requests send the Galaxy communication-service User-Agent that gogdl and [Lutris](https://github.com/lutris/lutris) (GPL-3.0) send. Deleted GOG cloud saves are recognised by the empty-gzip deletion hash gogdl and Lutris skip.
- Epic Games and GOG build on [Phobos](https://github.com/phobos665)'s adaptation of [Legendary](https://github.com/legendary-gl/legendary) and [gogdl](https://github.com/Heroic-Games-Launcher/heroic-gogdl). GOG install script registry entries are read the way [Heroic Games Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (GPL-3.0) reads them.
- Epic's official Linux launcher preview runs through FEX. That setup is outside Epic's listed Linux support.
- The launcher's .deb gets the WebKitGTK and GTK 3 libraries it needs from unmodified [Debian](https://www.debian.org) 13 packages, following [@zooluis](https://github.com/zooluis)'s research in [#2268](https://github.com/Droid-Deck/DroidDeck/pull/2268).
- Battle.net is by [@kayakyakr](https://github.com/kayakyakr). It runs Blizzard's own client in Proton (downloaded from Blizzard, not included) and shows key art from the [Battle.net Shop](https://shop.battle.net). Without Steam, its games see the pad as an Xbox 360 controller via `PROTON_SPOOF_STEAMINPUT_VIDPID` in [Proton](https://github.com/ValveSoftware/wine)'s `dlls/winebus.sys`.
- The EA store follows the EA app's protocols as documented by [ArmchairDevelopers](https://github.com/ArmchairDevelopers)' [Maxima](https://github.com/ArmchairDevelopers/Maxima) (GPL-3.0): sign-in, the GraphQL queries (included verbatim, since EA matches them by hash), build archives, online activation licences and the LSX game endpoint. The code is DroidDeck's own.
- Battle.net installs drive Blizzard's Agent the way [@barncastle](https://github.com/barncastle)'s [Battle.Net-Installer](https://github.com/barncastle/Battle.Net-Installer) does, with requests from [wowdev.wiki](https://wowdev.wiki/Agent). Read without taking code: [@mubaraknumann](https://github.com/mubaraknumann)'s [unifideck](https://github.com/mubaraknumann/unifideck), [@djmittens](https://github.com/djmittens)'s [neo-mittens](https://github.com/djmittens/neo-mittens) `bnetswitch`, [@BCD1210](https://github.com/BCD1210)'s [soju](https://github.com/BCD1210/soju) and [Lutris](https://github.com/lutris/lutris)'s `product.db` reader.
- The Rockstar launcher service looks for launcher pipe names in the executables beside the game, since [CitizenFX](https://github.com/citizenfx/fivem)'s `ros-patches-five` shows GTA V opening `GTAVLauncher_Pipe` and [@pingod](https://github.com/pingod)'s [rdr2-linux-launcher](https://github.com/pingod/rdr2-linux-launcher) notes that Rockstar's protected executables resolve such strings only at run time. Read without taking code.
- World of Warcraft addon imports replace an addon's folder from a temporary copy, as [WowUp](https://github.com/WowUp/WowUp) does, and read flavour folders the way [WoWDeck](https://github.com/sigboe/wowdeck) does. No code from either is used.
- The World of Warcraft addon Download window searches [WoWInterface](https://www.wowinterface.com) through its MMOUI API. Installed addons show their `.toc` version and `X-WoWI-ID`, and are checked against that list for updates, as [WowUp](https://github.com/WowUp/WowUp) does. The Addons tab installs the official [CurseForge](https://www.curseforge.com/download/app) Linux app from CurseForge's own update feed (downloaded at install time and checked against its SHA-512, not included), which keeps its own sign-in.
- The Xbox store runs [@domsvoboda](https://github.com/domsvoboda)'s [nexus-backend](https://github.com/domsvoboda/nexus-backend) 0.2.15 (GPL-3.0, a fork of [Xodus](https://github.com/xodus-gaming/xodus)), and Xbox games load the Windows modules of his [nexus-runtime](https://github.com/domsvoboda/nexus-runtime) (LGPL-2.1-or-later), including the C++ [nexus-xgameruntime](https://github.com/domsvoboda/nexus-xgameruntime) and `wintypes.dll`. Content licensing sends delegation-compact device tickets in the licensing wire form, as nexus-backend's Store license path (commit `27c335e`) does. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
- The World of Warcraft addon Download window searches [WoWInterface](https://www.wowinterface.com) through its MMOUI API. [CurseForge](https://www.curseforge.com/wow) opens in the user's browser, with no API and no key.
- Xbox games load [@domsvoboda](https://github.com/domsvoboda)'s [xodus-nexus](https://github.com/domsvoboda/xodus-nexus) modules (LGPL-2.1-or-later), including `wintypes.dll`. Minecraft's GameInput setup was checked against [@Wyze3306](https://github.com/Wyze3306)'s [BedrockOnLinux](https://github.com/Wyze3306/BedrockOnLinux) (MIT).
- The Xbox Cloud Gaming player uses the WebRTC client of [@unknownskl](https://github.com/unknownskl)'s [Greenlight](https://github.com/unknownskl/greenlight) (MIT), and its offer tweaks and sharpening follow [@redphx](https://github.com/redphx)'s [Better xCloud](https://github.com/redphx/better-xcloud) (MIT). See `tools/xcloud-player/NOTICE.md`.
- The itch.io butler pack ships butler's `7z.so`, itch.io's build of [7-Zip](https://www.7-zip.org) by Igor Pavlov (LGPL-2.1, unRAR restriction on RAR code), unmodified. Other archives use Apache Commons Compress and the runtime's bsdtar (libarchive).
- The Store uses [Flatpak](https://github.com/flatpak/flatpak) (LGPL-2.1) through DroidDeck's own bubblewrap shim. Chromium and Electron apps start directly, since [zypak](https://github.com/refi64/zypak) by [@refi64](https://github.com/refi64) (BSD-3-Clause) always uses Flatpak's spawn portal.
@@ -114,7 +112,6 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
- The DroidDeck HUD is [@The412Banner](https://github.com/The412Banner)'s [FusionHUD](https://github.com/The412Banner/FusionHUD) (GPL-3.0 with an attribution term). Its readings match Valve's [MangoHud](https://github.com/flightlessmango/MangoHud) build (MIT), with frame times from gamescope patch 0125.
- The HUD's CPU, GPU load, thermal and battery readers come from [@xXJSONDeruloXx](https://github.com/xXJSONDeruloXx)'s work.
- LSFG frame generation comes from Camille LaVey and the [Eden](https://eden-emu.dev) project, following [lsfg-vk](https://github.com/PancakeTAS/lsfg-vk), ported by [@maxjivi05](https://github.com/maxjivi05). It needs your own copy of [Lossless Scaling](https://store.steampowered.com/app/993090/) and ships none of its shaders.
- Black frame insertion follows the design of [@artzox](https://github.com/artzox)'s [BFI Presenter](https://github.com/artzox/BFI-Presenter) (GPL-3.0): the strobe runs on the display's refresh clock and the game is paced to the lit refresh. Both build on [Blur Busters](https://blurbusters.com)' research on MPRT and motion blur. No BFI Presenter code is used.
- Remote Play decodes through Android's MediaCodec or the [FFmpeg](https://ffmpeg.org) (LGPL-2.1-or-later) in Steam's runtime. Qualcomm low latency settings follow [Moonlight](https://github.com/moonlight-stream/moonlight-android) (GPL-3.0).
- [PipeWire](https://gitlab.freedesktop.org/pipewire/pipewire) (MIT) sockets use the settings in its `module-access.c`, and [WirePlumber](https://gitlab.freedesktop.org/pipewire/wireplumber) (MIT) keeps those clients at full permissions.
+16 -45
View File
@@ -93,7 +93,7 @@ def trackingPack = rootProject.file('tools/packs/tracking/release.env').readLine
def prootPackPin = rootProject.file('tools/packs/proot/release.env').readLines()
.findAll { it.contains('=') && !it.startsWith('#') }
.collectEntries { def kv = it.split('=', 2); [(kv[0].trim()): kv[1].trim()] }
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft', 'rockstar', 'dirt', 'epic'].collectEntries { name ->
def addonPacks = ['proot', 'directaudio', 'tracking', 'xbox', 'comet', 'butler', 'powervr', 'ubisoft'].collectEntries { name ->
def pack = file("build/packs/${name}.tar.zst")
if (!pack.isFile()) {
if (ciBuild) throw new GradleException("Add-on pack ${pack} is missing: run tools/packs/build.sh app/build/packs")
@@ -125,15 +125,14 @@ def variantSuffixes = rootProject.file('tools/release/variants.txt').readLines()
android {
namespace 'com.droiddeck.launcher'
compileSdk 34
ndkVersion project.findProperty('ndkVersion') ?: providers.fileContents(rootProject.layout.projectDirectory.file('tools/ci/toolchains.env'))
.asText.get().readLines().find { it.startsWith('CI_ANDROID_NDK_VERSION=') }.split('=', 2)[1].trim()
ndkVersion project.findProperty('ndkVersion') ?: '27.3.13750724'
defaultConfig {
applicationId "com.droiddeck.launcher"
minSdkVersion 26
targetSdkVersion 34
versionCode 20
versionName "0.7.11"
targetSdkVersion 28
versionCode 19
versionName "0.7.1"
buildConfigField "String", "BUILD_LABEL", "\"${escapedBuildLabel}\""
buildConfigField "String", "SOURCE_COMMIT", "\"${sourceCommit}\""
buildConfigField "int", "PR_NUMBER", "${prNumber}"
@@ -142,7 +141,6 @@ android {
buildConfigField "boolean", "CI_BUILD", "${ciBuild}"
buildConfigField "String", "RELEASE_SIGNER", "\"${releaseSigner}\""
buildConfigField "long", "COMMIT_TIME", "${commitTime}L * 1000L"
buildConfigField "String", "UPDATE_CATALOG_BRANCH", "\"${(System.getenv("DROIDDECK_UPDATE_CATALOG_BRANCH") ?: "main").with { it ==~ /[A-Za-z0-9._-]+/ ? it : "main" }}\""
buildConfigField "String", "VARIANT_SUFFIXES", "\"${variantSuffixes}\""
buildConfigField "String", "SGDB_API_KEY", "\"${System.getenv("SGDB_API_KEY") ?: project.findProperty("sgdbApiKey") ?: ""}\""
buildConfigField "String", "DESKTOP_KDE_TAG", "\"${desktopKde.DESKTOP_KDE_TAG}\""
@@ -202,8 +200,12 @@ android {
}
}
lint {
disable 'ExpiredTargetSdkVersion'
}
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>droiddeck-rockstar:<dir>droiddeck-dirt:<dir>droiddeck-epic:<dir>directaudio:<dir>hybris'
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~:<dir>droiddeck-xbox:<dir>droiddeck-comet:<dir>droiddeck-ubisoft:<dir>directaudio:<dir>hybris'
}
packagingOptions {
@@ -213,7 +215,7 @@ android {
jniLibs {
useLegacyPackaging = true
pickFirsts += ['**/libtermux.so']
excludes += ['**/libproot.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
excludes += ['**/libproot.so', '**/libproot-loader.so', '**/libopencv_java4.so', '**/libmediapipe_tasks_jni.so']
}
}
@@ -233,9 +235,6 @@ android {
}
maxHeapSize = '2g'
maxParallelForks = 2
def jvmTemp = new File(temporaryDir, 'jvm')
systemProperty 'java.io.tmpdir', jvmTemp.absolutePath
doFirst { jvmTemp.mkdirs() }
def logTarget = providers.systemProperty('robolectric.logging').orNull
if (logTarget != null) systemProperty 'robolectric.logging', logTarget
}
@@ -265,9 +264,11 @@ if (vitureSdkDir) {
tasks.named('preBuild').configure { dependsOn(stageVitureNotices) }
}
def stageSessionScripts = tasks.register('stageSessionScripts', Exec) {
workingDir rootProject.projectDir
commandLine pythonExecutable, 'tools/release/check_session_assets.py', '--stage'
def stageSessionScripts = tasks.register('stageSessionScripts', Copy) {
from(rootProject.file('tools/linuxfs/overlay')) {
include 'usr/local/bin/droiddeck-*', 'usr/local/bin/steam-compatibility', 'usr/bin/**'
}
into(layout.projectDirectory.dir('src/main/assets/linuxfs'))
}
tasks.named('preBuild').configure { dependsOn(stageSessionScripts) }
@@ -276,20 +277,10 @@ def stageRuntimeAssets = tasks.register('stageRuntimeAssets', Sync) {
dependsOn(stageSessionScripts)
from(layout.projectDirectory.dir('src/main/assets')) { exclude 'pulseaudio.tzst' }
from(rootProject.file('tools/linuxfs/innoextract'))
from(rootProject.file('tools')) { include 'droiddeckctl', 'droiddeck-scenario', 'adb_device.py', 'proot_profile.py'; into('agent/ctl') }
from(rootProject.file('tools/agent/AGENTS.md')) { into('agent/ctl') }
from(rootProject.file('docs/agent-control.md')) { into('agent/ctl') }
from(rootProject.file('tools/agent/skills')) { into('agent/skills') }
from(layout.buildDirectory.dir('prepared-assets'))
into(runtimeAssetsDir)
}
android.sourceSets.main.assets.setSrcDirs([runtimeAssetsDir])
def stageGraphicsNotices = tasks.register('stageGraphicsNotices', Copy) {
from(layout.projectDirectory.file('src/main/cpp/shaders/THIRD_PARTY_NOTICES.txt'))
into(layout.buildDirectory.dir('graphicsNotices/licenses/graphics'))
}
android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir('graphicsNotices'))
tasks.named('preBuild').configure { dependsOn(stageGraphicsNotices) }
if (vitureSdkDir) android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir('vitureAssets'))
if (uvcDir) {
def stageUvcNotices = tasks.register('stageUvcNotices', Copy) {
@@ -301,16 +292,6 @@ if (uvcDir) {
}
tasks.named('preBuild').configure { dependsOn(stageRuntimeAssets) }
android.sourceSets.main.java.srcDir(rootProject.file('shortcuts/src/protocol/java'))
def stageShortcuts = tasks.register('stageShortcuts', Copy) {
dependsOn(':shortcuts:assembleRelease')
from(project(':shortcuts').layout.buildDirectory.file('outputs/apk/release/shortcuts-release.apk'))
into(layout.buildDirectory.dir('shortcutsAssets'))
rename { 'shortcuts.apk' }
}
android.sourceSets.main.assets.srcDir(layout.buildDirectory.dir('shortcutsAssets'))
tasks.named('preBuild').configure { dependsOn(stageShortcuts) }
def stageGogNotices = tasks.register('stageGogNotices', Copy) {
from(layout.projectDirectory.dir('src/main/rust/stores/vendor/xdelta3')) { include 'LICENSE', 'README.droiddeck.md' }
into(layout.buildDirectory.dir('gogNotices/licenses/xdelta3'))
@@ -396,16 +377,9 @@ dependencies {
implementation 'androidx.compose.material3:material3'
implementation 'androidx.compose.ui:ui-tooling-preview'
debugImplementation 'androidx.compose.ui:ui-tooling'
// Declares the ComponentActivity that createComposeRule launches, for PreviewRenderTest.
debugImplementation 'androidx.compose.ui:ui-test-manifest'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'androidx.compose.material:material-icons-extended'
implementation 'io.coil-kt:coil-compose:2.6.0'
implementation 'io.noties.markwon:core:4.6.2'
implementation 'io.noties.markwon:ext-strikethrough:4.6.2'
implementation 'io.noties.markwon:ext-tables:4.6.2'
implementation 'io.noties.markwon:ext-tasklist:4.6.2'
implementation 'com.atlassian.commonmark:commonmark-ext-autolink:0.13.0'
implementation 'com.caverock:androidsvg-aar:1.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
implementation 'com.flyfishxu:kadb-android:1.2.1'
@@ -413,14 +387,11 @@ dependencies {
implementation 'androidx.camera:camera-camera2:1.4.2'
implementation 'androidx.camera:camera-lifecycle:1.4.2'
implementation 'androidx.webkit:webkit:1.12.1'
implementation 'androidx.palette:palette:1.0.0'
implementation 'io.github.webrtc-sdk:android:125.6422.07'
implementation("com.google.mediapipe:tasks-vision:${trackingPack.MEDIAPIPE_VERSION}") {
exclude group: 'com.google.auto.value', module: 'auto-value'
}
implementation 'com.google.zxing:core:3.5.3'
implementation 'androidx.media3:media3-exoplayer:1.3.1'
implementation 'androidx.media3:media3-session:1.3.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.16.1'
@@ -1,83 +0,0 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.ui.unit.dp
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import com.droiddeck.launcher.R
import com.droiddeck.launcher.input.SecondScreenMode
/** The launcher as a whole: rail and page, opened on each tab through FrontEndState.navigate. */
@Composable
private fun Launcher(tab: String, games: List<com.droiddeck.launcher.frontend.Library.SteamGame> = sampleGames, ready: Boolean = true) =
PreviewHost { FrontEndScreen(sampleState(games = games, navigate = tab, ready = ready), sampleActions) }
@DroidDeckPreviews @Composable private fun SteamTabPreview() = Launcher("steam")
@DroidDeckPreviews @Composable private fun SteamEmptyPreview() = Launcher("steam", games = emptyList())
@DroidDeckPreviews @Composable private fun LibraryPreview() = Launcher("games")
@DroidDeckPreviews @Composable private fun LibraryEmptyPreview() = Launcher("games", games = emptyList())
@DroidDeckPreviews @Composable private fun StoresPreview() = Launcher("stores")
@DroidDeckPreviews @Composable private fun DownloadsPreview() = Launcher("downloads")
@DroidDeckPreviews @Composable private fun SettingsPreview() = Launcher("setup")
@DroidDeckPreviews @Composable private fun RuntimeMissingPreview() = Launcher("setup", ready = false)
/** The in-game menu on one page, as a session shows it. */
@Composable
private fun SessionMenu(page: SessionDrawerPage, steam: Boolean = true, desktop: Boolean = false) = PreviewHost {
SessionDrawer(true, page, controllerActive = true, onPageChange = {}, a = sampleDrawerActions(steam, desktop))
}
@DroidDeckPreviews @Composable private fun SessionMenuControllerPreview() = SessionMenu(SessionDrawerPage.CONTROLLER)
@DroidDeckPreviews @Composable private fun SessionMenuDisplayPreview() = SessionMenu(SessionDrawerPage.DISPLAY)
@DroidDeckPreviews @Composable private fun SessionMenuHudPreview() = SessionMenu(SessionDrawerPage.HUD)
@DroidDeckPreviews @Composable private fun SessionMenuSessionPreview() = SessionMenu(SessionDrawerPage.SESSION)
@DroidDeckPreviews @Composable private fun SessionMenuDesktopPreview() = SessionMenu(SessionDrawerPage.CONTROLLER, steam = false, desktop = true)
/** The in-game menu docked on the bottom screen, with the screen picker in its header. */
@Composable
private fun DockedMenu(page: SessionDrawerPage) = PreviewHost {
SessionDrawer(true, page, controllerActive = false, onPageChange = {},
a = sampleDrawerActions(secondScreen = SecondScreenMode.KEYBOARD_TRACKPAD), docked = true)
}
/** The bottom screen's bar on a panel: the panel's name is the screen picker. */
@Composable
private fun BottomPanelBar() = PreviewHost {
val modes = secondScreenModes(false, deckPad = false, dashboard = true, desktop = false)
Column(Modifier.fillMaxSize().background(Color.Black)) {
BottomScreenBar(BottomBarModel("Keyboard + trackpad", {}, {}, {}, {},
listOf(BarExtra("Keyboard", icon = R.drawable.ic_bottom_keyboard) {}),
picker = ScreenPicker(modes, SecondScreenMode.KEYBOARD_TRACKPAD, {}, onMenu = {})))
}
}
@DroidDeckPreviews @Composable private fun SessionMenuDockedPreview() = DockedMenu(SessionDrawerPage.CONTROLLER)
@DroidDeckPreviews @Composable private fun SessionMenuDockedDisplayPreview() = DockedMenu(SessionDrawerPage.DISPLAY)
@DroidDeckPreviews @Composable private fun BottomPanelBarPreview() = BottomPanelBar()
/** The Library and Stores tabs read store accounts, which load on a background thread. */
private val storesLoaded = { com.droiddeck.launcher.stores.StoresState.accountsLoaded }
/** Every preview above, for the render test. Add a case when adding a preview. */
internal val previewCases: List<PreviewCase> = listOf(
PreviewCase("steam-tab") { Launcher("steam") },
PreviewCase("library", storesLoaded) { Launcher("games") },
PreviewCase("library-empty", storesLoaded) { Launcher("games", games = emptyList()) },
PreviewCase("stores", storesLoaded) { Launcher("stores") },
PreviewCase("downloads") { Launcher("downloads") },
PreviewCase("settings") { Launcher("setup") },
PreviewCase("runtime-missing") { Launcher("setup", ready = false) },
PreviewCase("session-menu-controller") { SessionMenu(SessionDrawerPage.CONTROLLER) },
PreviewCase("session-menu-display") { SessionMenu(SessionDrawerPage.DISPLAY) },
PreviewCase("session-menu-hud") { SessionMenu(SessionDrawerPage.HUD) },
PreviewCase("session-menu-session") { SessionMenu(SessionDrawerPage.SESSION) },
PreviewCase("session-menu-desktop") { SessionMenu(SessionDrawerPage.CONTROLLER, steam = false, desktop = true) },
PreviewCase("session-menu-docked") { DockedMenu(SessionDrawerPage.CONTROLLER) },
PreviewCase("session-menu-docked-display") { DockedMenu(SessionDrawerPage.DISPLAY) },
PreviewCase("bottom-panel-bar") { BottomPanelBar() },
)
@@ -1,88 +0,0 @@
package com.droiddeck.launcher.ui
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.gpu.FrameGen
import com.droiddeck.launcher.gpu.Lossless
import com.droiddeck.launcher.input.SecondScreenDisplay
import com.droiddeck.launcher.input.SecondScreenMode
import com.droiddeck.launcher.session.SessionPrefs
/**
* Debug-only support for Compose previews: the production theme around a screen, and sample state and no-op actions so
* production composables render without a device, a runtime or a network. See docs/compose-previews.md.
*/
/** The sizes the previews come in. The Duo's top screen is 1920x1080 at xhdpi, i.e. 960x540 dp. */
@Preview(name = "Handheld", widthDp = 960, heightDp = 540, device = "spec:width=960dp,height=540dp,dpi=320,orientation=landscape")
@Preview(name = "Portrait", widthDp = 540, heightDp = 960, device = "spec:width=540dp,height=960dp,dpi=320")
internal annotation class DroidDeckPreviews
@Composable
internal fun PreviewHost(content: @Composable () -> Unit) {
DroidDeckTheme {
Box(Modifier.fillMaxSize().background(MaterialTheme.colorScheme.background)) { content() }
}
}
/**
* A case the render test draws: a name for its PNG and the preview's content. [ready] is what the test waits for before
* drawing, for a screen that loads something off the main thread first.
*/
internal class PreviewCase(val name: String, val ready: () -> Boolean = { true }, val content: @Composable () -> Unit) {
override fun toString() = name
}
internal val sampleGames: List<Library.SteamGame> = listOf(
"Portal 2" to 620, "Hades" to 1145360, "Celeste" to 504230, "Stardew Valley" to 413150, "Hollow Knight" to 367520,
"Balatro" to 2379780, "Dead Cells" to 588650, "Terraria" to 105600, "Vampire Survivors" to 1794680, "Slay the Spire" to 646570,
).mapIndexed { i, (name, appId) ->
Library.SteamGame(appId, name, art = null, library = "steam", lastPlayed = 1_700_000_000_000L - i * 86_400_000L)
}
internal fun sampleState(
games: List<Library.SteamGame> = sampleGames,
navigate: String? = null,
ready: Boolean = true,
): FrontEndState = FrontEndState(
installed = "ubuntu-r1", ready = ready, available = "ubuntu-r1", busy = false, stage = "", percent = 0,
desktopInstalled = true, offlineAccount = null, offline = false, frameGenLabel = "Off", romsDir = null, logsEnabled = true,
steamGames = games, emulators = emptyList(), running = null, navigate = navigate,
)
internal val sampleActions: FrontEndActions = FrontEndActions(
onPlay = {}, onPlayDesktopUi = {}, onSteamGame = {}, onDesktop = {}, onEmulator = {}, onRom = {}, onResume = {},
onSteamSettings = {}, onDesktopSettings = {}, onInstallPackage = {}, onRemovePackage = {}, onRuntime = {},
onFrameGenPick = {}, onImportLossless = {}, onProtons = {}, onComponents = {}, onPerformance = {}, onRoms = {},
onFiles = {}, onLogs = {}, onOffline = {},
onSetPhantomProcessLimit = { _, _ -> },
)
/** The in-game menu's actions with settled sample values; its switches do nothing. */
internal fun sampleDrawerActions(
steam: Boolean = true, desktop: Boolean = false, secondScreen: SecondScreenMode? = null,
): DrawerActions = DrawerActions(
steam = steam, desktop = desktop, title = if (!steam && !desktop) "Hades" else null,
isHomeApp = false, androidApps = emptyList(),
hudOn = true, onHud = {},
frameGen = FrameGen.Mode.OFF, onFrameGenPick = {},
lossless = Lossless.State.NONE,
oscMode = SessionPrefs.OSC_AUTO, onOsc = {},
suspendPolicy = SessionPrefs.SUSPEND_MANUAL, onSuspendPolicy = {},
backActionsInverted = false, onBackActionsInverted = {},
touchMode = SessionPrefs.TOUCH_AUTO, onTouch = {}, touchAuto = "Auto (direct)",
fexPreset = "", onFexPreset = {},
secondScreenMode = secondScreen ?: SecondScreenMode.NONE, onSecondScreenMode = {}, secondScreenNone = secondScreen == null,
secondScreenDisplays = listOfNotNull(secondScreen?.let { SecondScreenDisplay(2, "Built-in · 1240×1080") }),
selectedSecondScreenDisplay = if (secondScreen != null) 2 else -1, onSecondScreenDisplay = {},
gameSwapAvailable = secondScreen != null, dashboardAvailable = secondScreen != null,
onImportLossless = {}, onKeyboard = {}, onHardwareKeyboard = {},
onSteamMenu = if (steam) ({}) else null, onQam = if (steam) ({}) else null,
onLaunchAndroidApp = { _, _ -> }, onBackground = {}, onShareLogs = {}, onStop = {}, onClose = {},
)
+17 -63
View File
@@ -4,9 +4,6 @@
<queries>
<package android:name="cn.nubia.gamelauncher" />
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
<intent>
<action android:name="android.content.pm.action.CONFIRM_INSTALL" />
</intent>
@@ -21,15 +18,8 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SECONDARY_HOME" />
</intent>
<intent>
<action android:name="org.adw.launcher.THEMES" />
</intent>
<intent>
<action android:name="com.novalauncher.THEME" />
</intent>
</queries>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
@@ -39,12 +29,7 @@
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.HIGH_SAMPLING_RATE_SENSORS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
@@ -56,8 +41,7 @@
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.vulkan.version" android:version="0x401000" android:required="true" />
@@ -79,7 +63,6 @@
android:hardwareAccelerated="true"
android:largeHeap="true"
android:extractNativeLibs="true"
android:requestLegacyExternalStorage="true"
android:appCategory="game"
android:isGame="true">
@@ -99,11 +82,21 @@
android:label="@string/steam_wall_label"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="true" />
<service android:name=".input.ShortcutsRelay" android:exported="true">
<service android:name=".input.HomeButtonService"
android:label="@string/integration_shortcuts_service"
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="com.droiddeck.shortcuts.RELAY" />
<action android:name="android.accessibilityservice.AccessibilityService" />
</intent-filter>
<meta-data android:name="android.accessibilityservice" android:resource="@xml/home_button_service" />
</service>
<receiver android:name=".core.ShortcutsListingReceiver" android:exported="false"
android:process=":shortcuts_sync">
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest2|quest3|quest3s" />
<activity android:name=".QuestXrActivity" android:exported="true" android:launchMode="singleTask"
android:permission="android.permission.DUMP"
@@ -118,17 +111,6 @@
</intent-filter>
</activity>
<activity
android:name=".DeviceCodeActivity"
android:exported="false"
android:launchMode="singleTask"
android:taskAffinity="${applicationId}.devicecode"
android:excludeFromRecents="true"
android:supportsPictureInPicture="true"
android:resizeableActivity="true"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density|keyboard|keyboardHidden|navigation"
android:theme="@style/AppTheme" />
<activity
android:name=".PairingGuideActivity"
android:exported="false"
@@ -152,8 +134,6 @@
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.CAR_LAUNCHER" />
<data android:scheme="droiddeck" android:host="game" />
<data android:scheme="droiddeck" android:host="soundtrack" />
<data android:scheme="droiddeck" android:host="settings" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
@@ -232,7 +212,6 @@
android:exported="false"
android:screenOrientation="user"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|density"
android:windowSoftInputMode="adjustResize"
android:theme="@style/AppTheme" />
<activity
@@ -324,23 +303,11 @@
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize|keyboard|keyboardHidden|navigation|uiMode|density"
android:theme="@style/SessionTheme" />
<service android:name=".agent.AgentHostService" android:exported="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Keeps the user's on-device assistant running between screens" />
</service>
<service
android:name=".update.UpdateWatch"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false" />
<service android:name=".agent.AgentHostService" android:exported="false" />
<service
android:name=".session.SessionService"
android:exported="false"
android:stopWithTask="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Runs the user's Linux gaming session while its window is in the background" />
</service>
android:stopWithTask="false" />
<!-- The compositor's native state is one per process, so the bottom-screen desktop's compositor runs in its own. -->
<service
android:name=".wayland.BottomDesktopCompositorService"
@@ -348,15 +315,10 @@
android:exported="false" />
<service
android:name=".runtime.RuntimeInstallService"
android:exported="false"
android:foregroundServiceType="dataSync" />
android:exported="false" />
<service
android:name=".core.WirelessAdbPairingService"
android:exported="false"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="Waits for the wireless debugging pairing code the user enters" />
</service>
android:exported="false" />
<service
android:name=".stores.download.StoreDownloadService"
android:exported="false"
@@ -365,14 +327,6 @@
android:name=".sync.SyncthingService"
android:exported="false"
android:foregroundServiceType="dataSync" />
<service
android:name=".playback.SoundtrackService"
android:exported="true"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="androidx.media3.session.MediaSessionService" />
</intent-filter>
</service>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.logs"
+19 -44
View File
@@ -1,52 +1,27 @@
#!/bin/bash
# Starts GitHub's device login, floats its code over Android's browser and opens the approval page.
url=https://github.com/login/device
inbox=${DD_AGENT_INBOX:-}
# DroidDeck takes $inbox/device-code within a few seconds when it can float the code.
float_code() {
[ -n "$inbox" ] && [ -d "$inbox" ] || return 1
rm -f "$inbox/device-code.result"
printf '%s %s\n' "$1" "$url" > "$inbox/device-code.part" && mv -f "$inbox/device-code.part" "$inbox/device-code" || return 1
i=0
while [ $i -lt 40 ] && [ -e "$inbox/device-code" ]; do
sleep 0.2
i=$((i + 1))
done
if [ -e "$inbox/device-code" ]; then
rm -f "$inbox/device-code"
return 1
fi
# DroidDeck writes "ok" or "failed" once it has tried to open the page; no answer counts as failed.
i=0
while [ $i -lt 50 ] && [ ! -e "$inbox/device-code.result" ]; do
sleep 0.2
i=$((i + 1))
done
result=$(cat "$inbox/device-code.result" 2>/dev/null)
rm -f "$inbox/device-code.result"
[ "$result" = ok ]
}
# GitHub sign-in through Android's browser, with the one-time code typed in for the person.
serial=${ADB_SERIAL:-127.0.0.1:5555}
display=${DD_BROWSER_DISPLAY:-0}
adb connect "$serial" >/dev/null 2>&1
coproc GH { BROWSER=true gh auth login --hostname github.com --git-protocol https --web 2>&1; }
gh_pid=$GH_PID
# bash drops GH and GH_PID once gh exits, which can be before the loop reads its last line.
ghpid=$GH_PID
exec {ghout}<&"${GH[0]}" {ghin}>&"${GH[1]}"
shown=
typed=
while IFS= read -r line <&"$ghout"; do
printf '%s\n' "$line"
code=$(grep -oE '[A-Z0-9]{4}-[A-Z0-9]{4}' <<<"$line" | head -1)
# gh's own prompts would push the code out of the one line the setup card shows.
case "$line" in
*"one-time code"* | *"Press Enter"* | *"Open this URL"*) ;;
*) printf '%s\n' "$line" ;;
esac
if [ -n "$code" ] && [ -z "$shown" ]; then
shown=1
if [ -n "$code" ] && [ -z "$typed" ]; then
typed=1
echo >&"$ghin"
printf 'GitHub device code: %s · github.com/login/device\n' "$code"
float_code "$code" || android-open "$url"
adb -s "$serial" shell "am start --display $display -a android.intent.action.VIEW -d https://github.com/login/device" >/dev/null 2>&1
# Chrome drops characters from `input text` and from fast key events on this page.
keys=
for ((i = 0; i < ${#code}; i++)); do
c=${code:i:1}
[ "$c" = - ] || keys+="input -d $display keyevent KEYCODE_$c; sleep 0.4; "
done
(sleep 7; adb -s "$serial" shell "$keys" >/dev/null 2>&1) &
fi
done
wait "$gh_pid"
status=$?
[ -n "$shown" ] && [ -n "$inbox" ] && [ -d "$inbox" ] && : > "$inbox/device-code"
exit $status
wait "$ghpid"
@@ -1,2 +0,0 @@
#!/bin/sh
exec python3 /root/.local/share/droiddeck/ctl/droiddeck-scenario "$@"
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
exec python3 /root/.local/share/droiddeck/ctl/droiddeckctl "$@"
Binary file not shown.
-6
View File
@@ -40,12 +40,6 @@ add_library(gpuclock SHARED gpuclock/kgsl_clock.c gpuclock/kgsl_busy.c)
add_library(termux SHARED termux/termux.c)
# An executable packaged as a library: the only place a targetSdk 29+ app may execute files from.
add_library(ddexec SHARED ddexec/ddexec.c)
target_compile_options(ddexec PRIVATE -O2 -ffreestanding -fno-builtin -fno-stack-protector -fno-asynchronous-unwind-tables)
target_link_options(ddexec PRIVATE -nostdlib -Wl,-e,_start -Wl,-z,noexecstack -Wl,--no-undefined -Wl,-Bsymbolic
-Wl,-z,max-page-size=16384)
add_library(ddvenc SHARED venc/venc_server.cpp)
target_compile_features(ddvenc PRIVATE cxx_std_17)
target_link_libraries(ddvenc mediandk log)
-378
View File
@@ -1,378 +0,0 @@
// libddexec.so: starts an ELF program from the app's data directory.
//
// usage: libddexec.so <file> <argv0> [args...]
//
// From targetSdk 29, Android refuses execve() of app data files, but still lets the app map them
// executable, and executes the APK's extracted libraries. This executable is one of those libraries:
// it maps <file> (and its PT_INTERP, if it names one) the way the kernel's ELF loader would, builds the
// stack the kernel would have built for "<argv0> [args...]", and jumps to the entry point.
// It is freestanding: no libc, no relocations, so the kernel can run it as a static PIE.
#include <elf.h>
#include <stddef.h>
#include <stdint.h>
#define SYS_faccessat 48
#define SYS_openat 56
#define SYS_close 57
#define SYS_pread64 67
#define SYS_write 64
#define SYS_exit_group 94
#define SYS_munmap 215
#define SYS_mmap 222
#define SYS_mprotect 226
#define SYS_getpid 172
#define AT_FDCWD_ (-100)
#define O_RDONLY_ 0
#define O_CLOEXEC_ 02000000
#define PROT_READ_ 1
#define PROT_WRITE_ 2
#define PROT_EXEC_ 4
#define MAP_PRIVATE_ 0x02
#define MAP_FIXED_ 0x10
#define MAP_ANONYMOUS_ 0x20
#define MAX_PHDRS 64
#define STACK_GAP 65536
static long sys6(long n, long a, long b, long c, long d, long e, long f) {
register long x8 __asm__("x8") = n;
register long x0 __asm__("x0") = a;
register long x1 __asm__("x1") = b;
register long x2 __asm__("x2") = c;
register long x3 __asm__("x3") = d;
register long x4 __asm__("x4") = e;
register long x5 __asm__("x5") = f;
__asm__ volatile("svc #0" : "+r"(x0) : "r"(x8), "r"(x1), "r"(x2), "r"(x3), "r"(x4), "r"(x5) : "memory", "cc");
return x0;
}
static size_t slen(const char *s) {
size_t n = 0;
while (s[n]) n++;
return n;
}
static int seq(const char *a, const char *b) {
while (*a && *a == *b) a++, b++;
return *a == *b;
}
static const char *env_get(char **envp, const char *name) {
size_t n = slen(name);
for (; *envp; envp++) {
size_t i = 0;
while (i < n && (*envp)[i] == name[i]) i++;
if (i == n && (*envp)[n] == '=') return *envp + n + 1;
}
return 0;
}
static void out(const char *s) { sys6(SYS_write, 2, (long)s, (long)slen(s), 0, 0, 0); }
static void out_num(long v) {
char buf[24];
int i = (int)sizeof(buf) - 1;
buf[i] = 0;
unsigned long u = v < 0 ? (unsigned long)-v : (unsigned long)v;
do {
buf[--i] = (char)('0' + u % 10);
u /= 10;
} while (u && i > 1);
if (v < 0) buf[--i] = '-';
out(buf + i);
}
__attribute__((noreturn)) static void die(const char *what, const char *path, long err) {
out("libddexec: ");
if (path) {
out(path);
out(": ");
}
out(what);
if (err) {
out(" (");
out_num(err);
out(")");
}
out("\n");
sys6(SYS_exit_group, 127, 0, 0, 0, 0, 0);
__builtin_unreachable();
}
static long xpread(int fd, void *buf, size_t len, long off) {
size_t done = 0;
while (done < len) {
long n = sys6(SYS_pread64, fd, (long)((char *)buf + done), (long)(len - done), off + (long)done, 0, 0);
if (n <= 0) return n < 0 ? n : -1;
done += (size_t)n;
}
return (long)done;
}
struct image {
uintptr_t base;
uintptr_t phdr;
uintptr_t entry;
unsigned long phnum;
unsigned long phent;
char interp[256];
};
static uintptr_t trunc_page(uintptr_t v, uintptr_t page) { return v & ~(page - 1); }
static uintptr_t round_page(uintptr_t v, uintptr_t page) { return (v + page - 1) & ~(page - 1); }
static int prot_of(uint32_t flags) {
return ((flags & PF_R) ? PROT_READ_ : 0) | ((flags & PF_W) ? PROT_WRITE_ : 0) | ((flags & PF_X) ? PROT_EXEC_ : 0);
}
static void map_failed(const char *path, long r) { die("cannot map a segment", path, r); }
static void read_interp(int fd, const Elf64_Phdr *ph, int phnum, char *interp, size_t size, const char *path) {
interp[0] = 0;
for (int i = 0; i < phnum; i++) {
if (ph[i].p_type != PT_INTERP) continue;
if (ph[i].p_filesz == 0 || ph[i].p_filesz >= size) die("bad PT_INTERP", path, 0);
if (xpread(fd, interp, ph[i].p_filesz, (long)ph[i].p_offset) != (long)ph[i].p_filesz)
die("truncated PT_INTERP", path, 0);
interp[ph[i].p_filesz] = 0;
}
}
static int read_headers(const char *path, Elf64_Ehdr *eh, Elf64_Phdr *ph) {
int fd = (int)sys6(SYS_openat, AT_FDCWD_, (long)path, O_RDONLY_ | O_CLOEXEC_, 0, 0, 0);
if (fd < 0) die("cannot open", path, fd);
if (xpread(fd, eh, sizeof(*eh), 0) != (long)sizeof(*eh)) die("not an ELF file", path, 0);
if (eh->e_ident[EI_MAG0] != ELFMAG0 || eh->e_ident[EI_MAG1] != ELFMAG1 || eh->e_ident[EI_MAG2] != ELFMAG2 ||
eh->e_ident[EI_MAG3] != ELFMAG3 || eh->e_ident[EI_CLASS] != ELFCLASS64 || eh->e_machine != EM_AARCH64 ||
(eh->e_type != ET_EXEC && eh->e_type != ET_DYN) || eh->e_phentsize != sizeof(Elf64_Phdr) ||
eh->e_phnum == 0 || eh->e_phnum > MAX_PHDRS)
die("not a 64-bit ARM ELF program", path, 0);
long size = (long)eh->e_phnum * (long)sizeof(Elf64_Phdr);
if (xpread(fd, ph, (size_t)size, (long)eh->e_phoff) != size) die("truncated program headers", path, 0);
return fd;
}
static void interp_of(const char *path, char *interp, size_t size) {
Elf64_Ehdr eh;
Elf64_Phdr ph[MAX_PHDRS];
int fd = read_headers(path, &eh, ph);
read_interp(fd, ph, eh.e_phnum, interp, size, path);
sys6(SYS_close, fd, 0, 0, 0, 0, 0);
}
static void load(const char *path, struct image *im, uintptr_t page) {
Elf64_Ehdr eh;
Elf64_Phdr ph[MAX_PHDRS];
int fd = read_headers(path, &eh, ph);
uintptr_t lo = UINTPTR_MAX, hi = 0;
for (int i = 0; i < eh.e_phnum; i++) {
if (ph[i].p_type != PT_LOAD) continue;
uintptr_t s = trunc_page(ph[i].p_vaddr, page), e = round_page(ph[i].p_vaddr + ph[i].p_memsz, page);
if (s < lo) lo = s;
if (e > hi) hi = e;
}
if (lo >= hi) die("no loadable segments", path, 0);
uintptr_t bias = 0;
if (eh.e_type == ET_DYN) {
long r = sys6(SYS_mmap, 0, (long)(hi - lo), 0, MAP_PRIVATE_ | MAP_ANONYMOUS_, -1, 0);
if (r < 0 && r > -4096) map_failed(path, r);
bias = (uintptr_t)r - lo;
}
for (int i = 0; i < eh.e_phnum; i++) {
Elf64_Phdr *p = &ph[i];
if (p->p_type != PT_LOAD || p->p_memsz == 0) continue;
int prot = prot_of(p->p_flags);
uintptr_t seg = bias + p->p_vaddr;
uintptr_t start = trunc_page(seg, page);
uintptr_t file_end = seg + p->p_filesz;
uintptr_t mem_end = round_page(seg + p->p_memsz, page);
int zero_tail = p->p_memsz > p->p_filesz && (file_end & (page - 1)) != 0;
if (p->p_filesz > 0) {
uintptr_t len = round_page(file_end, page) - start;
long r = sys6(SYS_mmap, (long)start, (long)len, prot | (zero_tail ? PROT_WRITE_ : 0),
MAP_PRIVATE_ | MAP_FIXED_, fd, (long)trunc_page(p->p_offset, page));
if (r < 0 && r > -4096) map_failed(path, r);
if (zero_tail) {
for (volatile char *z = (volatile char *)file_end; (uintptr_t)z < round_page(file_end, page); z++) *z = 0;
if (!(prot & PROT_WRITE_)) sys6(SYS_mprotect, (long)trunc_page(file_end, page), (long)page, prot, 0, 0, 0);
}
}
uintptr_t anon = p->p_filesz > 0 ? round_page(file_end, page) : start;
if (mem_end > anon) {
long r = sys6(SYS_mmap, (long)anon, (long)(mem_end - anon), prot, MAP_PRIVATE_ | MAP_FIXED_ | MAP_ANONYMOUS_, -1, 0);
if (r < 0 && r > -4096) map_failed(path, r);
}
}
im->base = bias;
im->entry = bias + eh.e_entry;
im->phnum = eh.e_phnum;
im->phent = eh.e_phentsize;
im->phdr = 0;
read_interp(fd, ph, eh.e_phnum, im->interp, sizeof(im->interp), path);
for (int i = 0; i < eh.e_phnum; i++)
if (ph[i].p_type == PT_PHDR) im->phdr = bias + ph[i].p_vaddr;
if (!im->phdr) {
for (int i = 0; i < eh.e_phnum; i++) {
Elf64_Phdr *p = &ph[i];
if (p->p_type == PT_LOAD && eh.e_phoff >= p->p_offset && eh.e_phoff < p->p_offset + p->p_filesz) {
im->phdr = bias + p->p_vaddr + (eh.e_phoff - p->p_offset);
break;
}
}
}
if (!im->phdr) die("program headers are not in a loaded segment", path, 0);
sys6(SYS_close, fd, 0, 0, 0, 0, 0);
}
static unsigned long auxv_get(const uintptr_t *auxv, unsigned long type, unsigned long fallback) {
for (; auxv[0] != AT_NULL; auxv += 2)
if (auxv[0] == type) return auxv[1];
return fallback;
}
static int is_self_exe(const char *execfn) {
if (!execfn) return 0;
if (seq(execfn, "/proc/self/exe") || seq(execfn, "/proc/thread-self/exe")) return 1;
const char *p = "/proc/";
while (*p && *p == *execfn) p++, execfn++;
if (*p) return 0;
char num[24];
int i = (int)sizeof(num) - 1;
num[i] = 0;
unsigned long pid = (unsigned long)sys6(SYS_getpid, 0, 0, 0, 0, 0, 0);
do {
num[--i] = (char)('0' + pid % 10);
pid /= 10;
} while (pid && i > 0);
const char *d = num + i;
while (*d && *d == *execfn) d++, execfn++;
return !*d && seq(execfn, "/exe");
}
static const char *guest_interp(char **envp, const char *interp, char *buf, size_t size) {
const char *root = env_get(envp, "DDNATV_ROOT");
if (!root || interp[0] != '/') return interp;
size_t a = slen(root), b = slen(interp);
if (a + b + 1 > size) return interp;
for (size_t i = 0; i < a; i++) buf[i] = root[i];
for (size_t i = 0; i <= b; i++) buf[a + i] = interp[i];
if (sys6(SYS_faccessat, AT_FDCWD_, (long)buf, 0, 0, 0, 0) != 0) return interp;
return buf;
}
__attribute__((used, noreturn)) void ddexec_main(uintptr_t *sp) {
long argc = (long)sp[0];
char **argv = (char **)(sp + 1);
char **envp = argv + argc + 1;
long nenv = 0;
while (envp[nenv]) nenv++;
uintptr_t *auxv = (uintptr_t *)(envp + nenv + 1);
long naux = 0;
while (auxv[naux * 2] != AT_NULL) naux++;
int reexec = is_self_exe((const char *)auxv_get(auxv, AT_EXECFN, 0));
const char *path;
char **args = argv + 2;
long nargs = argc - 2;
char interp_buf[4096];
char hook_buf[4096];
if (reexec) {
path = env_get(envp, "DDNATV_REAL_EXE");
if (!path || !path[0]) die("re-executed without DDNATV_REAL_EXE", 0, 0);
args = argv;
nargs = argc;
const char *lib_path = env_get(envp, "DDNATV_LIBRARY_PATH");
char prog_interp[256];
interp_of(path, prog_interp, sizeof(prog_interp));
if (prog_interp[0] && lib_path && lib_path[0]) {
const char *ld_so = guest_interp(envp, prog_interp, interp_buf, sizeof(interp_buf));
const char *hook = guest_interp(envp, "/usr/lib/libddnatv-hook.so", hook_buf, sizeof(hook_buf));
if (hook != (const char *)hook_buf) hook = guest_interp(envp, "/lib/libddnatv-hook.so", hook_buf, sizeof(hook_buf));
long n = argc > 1 ? argc - 1 : 0;
char **v = (char **)__builtin_alloca((size_t)(n + 9) * sizeof(char *));
long k = 0;
v[k++] = (char *)ld_so;
if (hook == (const char *)hook_buf) {
v[k++] = (char *)"--preload";
v[k++] = (char *)hook;
}
v[k++] = (char *)"--library-path";
v[k++] = (char *)lib_path;
v[k++] = (char *)"--argv0";
v[k++] = argc > 0 ? argv[0] : (char *)path;
v[k++] = (char *)path;
for (long i = 0; i < n; i++) v[k++] = argv[1 + i];
v[k] = 0;
args = v;
nargs = k;
path = ld_so;
}
} else if (argc < 3) {
die("usage: libddexec.so <file> <argv0> [args...]", 0, 0);
} else {
path = argv[1];
}
uintptr_t page = auxv_get(auxv, AT_PAGESZ, 4096);
struct image prog, interp;
load(path, &prog, page);
int has_interp = prog.interp[0] != 0;
if (has_interp) load(reexec ? guest_interp(envp, prog.interp, interp_buf, sizeof(interp_buf)) : prog.interp, &interp, page);
// The new stack: argc, argv, envp and auxv as the kernel lays them out, below the current one.
// The strings stay where the kernel put them.
static const unsigned long replaced[] = {AT_PHDR, AT_PHENT, AT_PHNUM, AT_BASE, AT_ENTRY, AT_EXECFN};
long nreplaced = (long)(sizeof(replaced) / sizeof(replaced[0]));
long new_argc = nargs;
long words = 1 + (new_argc + 1) + (nenv + 1) + (naux + nreplaced + 1) * 2;
uintptr_t top = (uintptr_t)args < (uintptr_t)sp ? (uintptr_t)args : (uintptr_t)sp;
uintptr_t *nsp = (uintptr_t *)((top - STACK_GAP - (uintptr_t)words * sizeof(uintptr_t)) & ~(uintptr_t)15);
uintptr_t *w = nsp;
*w++ = (uintptr_t)new_argc;
for (long i = 0; i < new_argc; i++) *w++ = (uintptr_t)args[i];
*w++ = 0;
for (long i = 0; i < nenv; i++) *w++ = (uintptr_t)envp[i];
*w++ = 0;
for (long i = 0; i < naux; i++) {
unsigned long type = auxv[i * 2];
int skip = 0;
for (long r = 0; r < nreplaced; r++)
if (type == replaced[r]) skip = 1;
if (skip) continue;
*w++ = type;
*w++ = auxv[i * 2 + 1];
}
*w++ = AT_PHDR;
*w++ = prog.phdr;
*w++ = AT_PHENT;
*w++ = prog.phent;
*w++ = AT_PHNUM;
*w++ = prog.phnum;
*w++ = AT_BASE;
*w++ = has_interp ? interp.base : 0;
*w++ = AT_ENTRY;
*w++ = prog.entry;
*w++ = AT_EXECFN;
*w++ = (uintptr_t)path;
*w++ = AT_NULL;
*w++ = 0;
uintptr_t entry = has_interp ? interp.entry : prog.entry;
__asm__ volatile("mov sp, %0\n"
"mov x0, #0\n"
"br %1\n"
:
: "r"(nsp), "r"(entry)
: "memory");
__builtin_unreachable();
}
__attribute__((naked, noreturn)) void _start(void) {
__asm__ volatile("mov x0, sp\n"
"and sp, x0, #~15\n"
"bl ddexec_main\n");
}
File diff suppressed because it is too large. Load diff
-106
View File
@@ -1,106 +0,0 @@
#pragma once
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_android.h>
struct VkTable {
PFN_vkCreateInstance CreateInstance;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
PFN_vkCreateDevice CreateDevice;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyDevice DestroyDevice;
PFN_vkGetDeviceQueue GetDeviceQueue;
PFN_vkDeviceWaitIdle DeviceWaitIdle;
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
PFN_vkQueuePresentKHR QueuePresentKHR;
PFN_vkQueueSubmit QueueSubmit;
PFN_vkCreateQueryPool CreateQueryPool;
PFN_vkDestroyQueryPool DestroyQueryPool;
PFN_vkCmdResetQueryPool CmdResetQueryPool;
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
PFN_vkGetQueryPoolResults GetQueryPoolResults;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
PFN_vkCreateBuffer CreateBuffer;
PFN_vkDestroyBuffer DestroyBuffer;
PFN_vkAllocateMemory AllocateMemory;
PFN_vkFreeMemory FreeMemory;
PFN_vkMapMemory MapMemory;
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
PFN_vkBindBufferMemory BindBufferMemory;
PFN_vkBindImageMemory BindImageMemory;
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool CreateDescriptorPool;
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
PFN_vkFreeDescriptorSets FreeDescriptorSets;
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreateCommandPool CreateCommandPool;
PFN_vkDestroyCommandPool DestroyCommandPool;
PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
PFN_vkFreeCommandBuffers FreeCommandBuffers;
PFN_vkBeginCommandBuffer BeginCommandBuffer;
PFN_vkEndCommandBuffer EndCommandBuffer;
PFN_vkResetCommandBuffer ResetCommandBuffer;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
PFN_vkCmdDraw CmdDraw;
PFN_vkCmdPushConstants CmdPushConstants;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
PFN_vkCmdCopyImage CmdCopyImage;
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdDispatch CmdDispatch;
PFN_vkCreateComputePipelines CreateComputePipelines;
PFN_vkUnmapMemory UnmapMemory;
PFN_vkCmdClearColorImage CmdClearColorImage;
PFN_vkResetDescriptorPool ResetDescriptorPool;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCreateSampler CreateSampler;
PFN_vkDestroySampler DestroySampler;
PFN_vkCreateSemaphore CreateSemaphore;
PFN_vkDestroySemaphore DestroySemaphore;
PFN_vkCreateFence CreateFence;
PFN_vkDestroyFence DestroyFence;
PFN_vkWaitForFences WaitForFences;
PFN_vkResetFences ResetFences;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkGetAndroidHardwareBufferPropertiesANDROID GetAndroidHardwareBufferPropertiesANDROID;
};
@@ -0,0 +1,680 @@
#pragma once
#include <vulkan/vulkan.h>
#include <list>
#include <vulkan/vulkan_android.h>
struct VkTable {
PFN_vkCreateInstance CreateInstance;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceFeatures2 GetPhysicalDeviceFeatures2;
PFN_vkCreateDevice CreateDevice;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyDevice DestroyDevice;
PFN_vkGetDeviceQueue GetDeviceQueue;
PFN_vkDeviceWaitIdle DeviceWaitIdle;
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
PFN_vkQueuePresentKHR QueuePresentKHR;
PFN_vkQueueSubmit QueueSubmit;
PFN_vkCreateQueryPool CreateQueryPool;
PFN_vkDestroyQueryPool DestroyQueryPool;
PFN_vkCmdResetQueryPool CmdResetQueryPool;
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
PFN_vkGetQueryPoolResults GetQueryPoolResults;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
PFN_vkCreateBuffer CreateBuffer;
PFN_vkDestroyBuffer DestroyBuffer;
PFN_vkAllocateMemory AllocateMemory;
PFN_vkFreeMemory FreeMemory;
PFN_vkMapMemory MapMemory;
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
PFN_vkBindBufferMemory BindBufferMemory;
PFN_vkBindImageMemory BindImageMemory;
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool CreateDescriptorPool;
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
PFN_vkFreeDescriptorSets FreeDescriptorSets;
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreateCommandPool CreateCommandPool;
PFN_vkDestroyCommandPool DestroyCommandPool;
PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
PFN_vkFreeCommandBuffers FreeCommandBuffers;
PFN_vkBeginCommandBuffer BeginCommandBuffer;
PFN_vkEndCommandBuffer EndCommandBuffer;
PFN_vkResetCommandBuffer ResetCommandBuffer;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
PFN_vkCmdDraw CmdDraw;
PFN_vkCmdPushConstants CmdPushConstants;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
PFN_vkCmdCopyImage CmdCopyImage;
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdDispatch CmdDispatch;
PFN_vkCreateComputePipelines CreateComputePipelines;
PFN_vkUnmapMemory UnmapMemory;
PFN_vkCmdClearColorImage CmdClearColorImage;
PFN_vkResetDescriptorPool ResetDescriptorPool;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCreateSampler CreateSampler;
PFN_vkDestroySampler DestroySampler;
PFN_vkCreateSemaphore CreateSemaphore;
PFN_vkDestroySemaphore DestroySemaphore;
PFN_vkCreateFence CreateFence;
PFN_vkDestroyFence DestroyFence;
PFN_vkWaitForFences WaitForFences;
PFN_vkResetFences ResetFences;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkGetAndroidHardwareBufferPropertiesANDROID GetAndroidHardwareBufferPropertiesANDROID;
};
#include <android/log.h>
#include <string>
#define WLOG_TAG "DroidDeck_Renderer"
#define RLOG(...) if(verboseLog) __android_log_print(ANDROID_LOG_DEBUG,WLOG_TAG,__VA_ARGS__)
#define RLOG_E(...) __android_log_print(ANDROID_LOG_ERROR,WLOG_TAG,__VA_ARGS__)
#define SCANOUT_LOG(...) __android_log_print(ANDROID_LOG_DEBUG,"DroidDeck_Scanout",__VA_ARGS__)
#include <vulkan/vulkan_android.h>
#include <android/hardware_buffer.h>
#include <android/native_window.h>
#include <vector>
#include <unordered_map>
#include <thread>
#include <atomic>
#include <mutex>
#include <shared_mutex>
#include <condition_variable>
#include <chrono>
#include "../scanout/ScanoutContext.h"
#include "lsfg/lsfg_probe.h"
#include <memory>
#include <string>
namespace lsfg { class Engine; }
namespace ddfg { class Engine; }
static constexpr uint32_t MAX_FRAMES_IN_FLIGHT = 2;
struct SgsrPushConstants {
float ndc[4];
float viewportInfo[4];
float edgeSharpness;
};
struct NisPushConstants {
float ndc[4];
float viewportInfo[4];
float sharpness;
};
struct EasuPushConstants {
float ndc[4];
uint32_t con0[4], con1[4], con2[4], con3[4];
float outW, outH;
};
struct RcasPushConstants {
float ndc[4];
uint32_t con[4];
float outW, outH;
};
struct CasPushConstants {
float ndc[4];
float resolution[2];
float sharpness;
float _pad;
};
struct HdrPushConstants {
float ndc[4];
float resolution[2];
};
struct FxaaPushConstants {
float ndc[4];
float resolution[2];
};
struct ToonPushConstants {
float ndc[4];
float resolution[2];
};
struct ColorPushConstants {
float ndc[4];
float brightness;
float contrast;
float gamma;
float saturation;
};
struct NtscPushConstants {
float ndc[4];
float resolution[2];
float frameCount;
};
struct CrtPushConstants {
float ndc[4];
float resolution[2];
};
struct DebandPushConstants {
float ndc[4];
float resolution[2];
float strength;
};
class VulkanRendererContext {
public:
VulkanRendererContext(ANativeWindow* window, int cWidth, int cHeight, void* adrenotoolsHandle = nullptr,
bool lsfgVk11Compat = false);
~VulkanRendererContext();
void onSurfaceResized(int width, int height);
void setTransform(float ox, float oy, float sx, float sy);
void setClipRegion(int x, int y, int w, int h);
void updatePointerPosition(short x, short y);
void updateWindowContent(int64_t id, void* pixels, short w, short h, short stride, int x, int y);
void updateWindowContentAHB(int64_t id, AHardwareBuffer* ahb, short w, short h, int x, int y);
void updateCursorImage(void* pixels, short w, short h, short hotX, short hotY);
void setCursorVisible(bool visible);
void setRenderList(const int64_t* ids, const int* xs, const int* ys, int count);
void removeWindow(int64_t id);
void clearBackbuffer() {}
void beginBatch() {}
void endBatch() {}
void initScanout();
void destroyScanout();
void applyScanoutBuffer();
void initScanoutFromWindows(ANativeWindow* gameWin, ANativeWindow* cursorWin);
void scanoutSetDst(int x, int y, int w, int h);
void scanoutSetBuffer(AHardwareBuffer* ahb, int x, int y, int w, int h, int fenceFd = -1);
void scanoutSetCursorImage(void* pixels, short w, short h, short stride);
void scanoutSetCursorPos(short x, short y, short hotX, short hotY);
ScanoutContext scanout;
std::atomic<bool>& scanoutActive = scanout.scanoutActive;
std::atomic<bool>& gameFrameDelivered = scanout.gameFrameDelivered;
std::atomic<bool> surfaceDetached{false};
void detachSurface();
bool reattachSurface(ANativeWindow* newWindow);
bool verboseLog = true;
void setVerboseLog(bool v) { verboseLog = v; scanout.setVerboseLog(v); }
void dumpRendererInfo();
std::string adrenoDriverPath;
std::string adrenoDriverName;
std::string adrenoNativeLibDir;
void* vulkanHandle = nullptr;
std::atomic<bool> scanoutBlackFrameDone{false};
PFN_vkGetInstanceProcAddr gipa = nullptr;
VkTable vk_ = {};
void loadCustomDriver();
void loadInstanceDispatch();
void loadDeviceDispatch();
void setFilterMode(int mode);
void setUpscaler(int mode);
void setHqDownscale(bool enabled);
void setCas(bool enabled, int sharpness);
void setHdr(bool enabled);
void setDeband(bool enabled, int strength);
void setUpscaleSharpness(int sharpness);
void setFxaa(bool enabled);
void setToon(bool enabled);
void setCrt(bool enabled);
void setNtsc(bool enabled);
void setColorGrade(float brightness, float contrast, float gamma, float saturation);
void setSwapRB(bool enabled);
void setPresentMode(VkPresentModeKHR mode);
std::vector<int> getSupportedPresentModes() const;
const lsfg::Caps& lsfgCaps() const { return lsfgCaps_; }
void setFrameGenArmed(bool armed, int multiplier);
bool frameGenArmed() const { return fgArmed_.load(std::memory_order_relaxed); }
void frameGenStats(float out[6]) const;
int frameGenProblem() const;
void setLsfgCachePath(const char* path);
static constexpr int32_t kFgCaptureGame = -1;
void setFrameGenTuning(float flowScale, float refreshHz, int32_t captureHeight = 0);
void setFrameGenEngine(int kind);
void setDdFgTuning(int model, int perfPreset);
private:
struct WinTex {
VkImage img = VK_NULL_HANDLE;
VkDeviceMemory mem = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkDescriptorSet ds = VK_NULL_HANDLE;
VkBuffer stg = VK_NULL_HANDLE;
VkDeviceMemory stgMem = VK_NULL_HANDLE;
void* mapped = nullptr;
VkDeviceSize cap = 0;
int w = 0;
int h = 0;
bool dirty = false;
bool isAHB = false;
bool needsTransition = false;
AHardwareBuffer* ahb = nullptr;
};
struct RenderEntry { int64_t id; int x, y; };
struct DrawEntry {
VkImage img = VK_NULL_HANDLE;
VkDescriptorSet ds = VK_NULL_HANDLE;
VkBuffer upload = VK_NULL_HANDLE;
int x=0, y=0, w=0, h=0;
bool needsTransition = false;
bool isAHB = false;
};
ANativeWindow* window;
int surfaceWidth, surfaceHeight, containerWidth, containerHeight;
std::atomic<int> clipRegionX{0}, clipRegionY{0}, clipRegionW{0}, clipRegionH{0};
void* adrenotoolsHandle = nullptr;
bool lsfgVk11Compat_ = false;
int filterMode = 0;
bool swapRB = false;
float maxAnisotropy = 1.0f;
bool cubicSupported = false;
VkPhysicalDeviceMemoryProperties memProperties{};
VkPresentModeKHR requestedPresentMode = VK_PRESENT_MODE_FIFO_KHR;
uint32_t graphicsQueueFamilyIndex = 0;
std::vector<VkPresentModeKHR> availablePresentModes;
std::unordered_map<int64_t, WinTex> texMap;
std::unordered_map<AHardwareBuffer*, WinTex> ahbImportCache;
std::unordered_map<int64_t, std::vector<AHardwareBuffer*>> windowAhbs;
std::vector<WinTex> deleteQueue;
std::vector<RenderEntry> renderList;
std::vector<DrawEntry> frameDraws;
std::vector<VkImageMemoryBarrier> frameAhbTransitions;
std::vector<VkImageMemoryBarrier> framePreUpload;
std::vector<VkImageMemoryBarrier> framePostUpload;
std::atomic<int> pointerX{0}, pointerY{0};
float sceneOffsetX=0.f, sceneOffsetY=0.f, sceneScaleX=1.f, sceneScaleY=1.f;
std::atomic<bool> cursorVisible{false};
short cursorHotX=0, cursorHotY=0, cursorTexW=0, cursorTexH=0;
std::vector<uint32_t> cursorPixels;
std::atomic<bool> isCursorImageDirty{false};
std::atomic<bool> cursorMoved{false};
VkImage cursorImg = VK_NULL_HANDLE;
VkDeviceMemory cursorMem = VK_NULL_HANDLE;
VkImageView cursorView = VK_NULL_HANDLE;
VkDescriptorSet cursorDS = VK_NULL_HANDLE;
VkBuffer cursorStg = VK_NULL_HANDLE;
VkDeviceMemory cursorStgM = VK_NULL_HANDLE;
void* cursorStgP = nullptr;
VkDeviceSize cursorStgC = 0;
VkDeviceSize cursorUploadSize = 0;
VkInstance instance;
VkSurfaceKHR surface;
VkPhysicalDevice physicalDevice;
VkDevice device;
VkQueue graphicsQueue;
VkSwapchainKHR swapchain = VK_NULL_HANDLE;
VkFormat swapchainFmt;
VkExtent2D swapchainExt;
std::vector<VkImage> swapchainImages;
std::vector<VkImageView> swapchainViews;
std::vector<VkFramebuffer> swapchainFBs;
VkRenderPass renderPass = VK_NULL_HANDLE;
VkDescriptorSetLayout dsLayout = VK_NULL_HANDLE;
VkPipelineLayout pipeLayout = VK_NULL_HANDLE;
VkPipeline pipeline = VK_NULL_HANDLE;
int upscalerMode = 0;
bool hqDownscale = false;
bool casEnabled = false;
int casSharpness = 60;
bool hdrEnabled = false;
float upscaleSharpness01 = 0.75f;
bool debandEnabled = false;
int debandStrength = 100;
bool fxaaEnabled = false;
bool toonEnabled = false;
bool crtEnabled = false;
bool ntscEnabled = false;
bool colorEnabled = false;
float colorBrightness = 0.0f;
float colorContrast = 0.0f;
float colorGamma = 1.0f;
float colorSaturation = 1.0f;
uint32_t ntscFrameCounter = 0;
VkSampler upscaleSampler = VK_NULL_HANDLE;
struct CompositeTarget {
VkImage img = VK_NULL_HANDLE;
VkDeviceMemory mem = VK_NULL_HANDLE;
VkImageView view = VK_NULL_HANDLE;
VkImageView storageView = VK_NULL_HANDLE;
VkFramebuffer fb = VK_NULL_HANDLE;
VkDescriptorSet ds = VK_NULL_HANDLE;
};
static constexpr uint32_t kMaxCompositeTargets = 7;
std::vector<CompositeTarget> compositeTargets;
VkRenderPass compositeRenderPass = VK_NULL_HANDLE;
uint32_t compositeW = 0, compositeH = 0;
uint32_t compositeIndex = 0;
bool compositeArmed = false;
bool swapchainTransferDst = false;
std::atomic<bool> fgArmed_{false};
std::atomic<int> fgMultiplier_{0};
std::atomic<float> fgFlowScale_{1.0f};
std::atomic<float> fgRefreshHz_{0.0f};
std::atomic<bool> fgConfigDirty_{true};
std::atomic<int32_t> fgCaptureHeight_{0};
void compositeExtentFor(uint32_t& w, uint32_t& h) const;
VkExtent2D renderExtent() const {
if (compositeActive() && (compositeW != swapchainExt.width || compositeH != swapchainExt.height))
return VkExtent2D{compositeW, compositeH};
return swapchainExt;
}
void recordCompositeToSwapchainTransfer(VkCommandBuffer cb, VkImage src, uint32_t imgIdx);
bool createCompositeRenderPass();
bool ensureCompositeTargets(uint32_t w, uint32_t h, uint32_t count);
void destroyCompositeTargets();
bool compositeActive() const;
VkRenderPass targetRenderPass() const;
VkFramebuffer targetFramebuffer(uint32_t imgIdx) const;
void copyCompositeToSwapchain(VkCommandBuffer cb, uint32_t imgIdx);
VkRenderPass cursorOverlayRenderPass = VK_NULL_HANDLE;
struct CursorOverlay {
bool draw = false;
float ox = 0, oy = 0, sx = 0, sy = 0, cw = 0, ch = 0;
short ptrX = 0, ptrY = 0, hotX = 0, hotY = 0, w = 0, h = 0;
};
CursorOverlay cursorOverlay_{};
bool createCursorOverlayRenderPass();
void recordCursorOverlay(VkCommandBuffer cb, uint32_t imgIdx);
bool cursorDrawnPerPresent() const;
static constexpr uint32_t kMaxPresentsPerFrame = 4;
struct FrameGenPlan {
uint32_t generations = 0;
uint32_t presents = 1;
uint32_t imgIdx[kMaxPresentsPerFrame] = {};
};
FrameGenPlan fgPlan_{};
std::unique_ptr<lsfg::Engine> lsfgEngine_;
uint64_t fgSourceFrames_ = 0;
std::string lsfgCachePath_;
bool lsfgEngineTried_ = false;
std::unique_ptr<ddfg::Engine> ddfgEngine_;
bool ddfgEngineTried_ = false;
std::atomic<int> fgEngineKind_{0};
std::atomic<int> fgModel_{4};
std::atomic<int> fgPerfPreset_{1};
bool ensureDdFgEngine();
bool fgCapsOk() const;
uint32_t syncSlot(uint32_t k) const { return currentFrame * kMaxPresentsPerFrame + k; }
void recreateSyncObjects();
uint32_t fgAcquireFailLog_ = 0;
float fgPresentedRate_ = 0.0f;
float fgSourceRate_ = 0.0f;
uint32_t fgSourceAccum_ = 0;
uint32_t fgPresentAccum_ = 0;
std::chrono::steady_clock::time_point fgRateWindowStart_{};
bool fgRateWindowOpen_ = false;
void trackPresentedRate(uint32_t presents);
bool ensureLsfgEngine();
uint32_t cmdSlot(uint32_t k) const { return currentFrame * kMaxPresentsPerFrame + k; }
void recordFrameGenProcess(VkCommandBuffer cb);
void recordFrameGenGeneration(VkCommandBuffer cb, uint32_t g);
VkQueryPool fgQueryPool_ = VK_NULL_HANDLE;
bool fgTimestampsOk_ = false;
float fgTimestampPeriodNs_ = 0.0f;
bool fgQueryPending_[MAX_FRAMES_IN_FLIGHT] = {};
uint32_t fgQueryGens_[MAX_FRAMES_IN_FLIGHT] = {};
float fgChainMsPerGen_ = -1.0f;
uint32_t fgChainLogCount_ = 0;
void ensureFgQueryPool();
void destroyFgQueryPool();
void readFgQueryResult();
VkFormat offscreenFmt = VK_FORMAT_R8G8B8A8_UNORM;
VkRenderPass offscreenRenderPass = VK_NULL_HANDLE;
VkPipelineLayout postPipeLayout = VK_NULL_HANDLE;
VkPipeline sgsrPipeline = VK_NULL_HANDLE;
VkPipeline nisPipeline = VK_NULL_HANDLE;
VkPipeline sgsrQualityPipeline = VK_NULL_HANDLE;
VkPipeline easuPipeline = VK_NULL_HANDLE;
VkPipeline rcasPipeline = VK_NULL_HANDLE;
VkPipeline downscalePipeline = VK_NULL_HANDLE;
VkPipeline casPipelineOff = VK_NULL_HANDLE;
VkPipeline casPipelineSwap = VK_NULL_HANDLE;
VkPipeline hdrPipelineOff = VK_NULL_HANDLE;
VkPipeline hdrPipelineSwap = VK_NULL_HANDLE;
VkPipeline fxaaPipelineOff = VK_NULL_HANDLE;
VkPipeline fxaaPipelineSwap = VK_NULL_HANDLE;
VkPipeline toonPipelineOff = VK_NULL_HANDLE;
VkPipeline toonPipelineSwap = VK_NULL_HANDLE;
VkPipeline colorPipelineOff = VK_NULL_HANDLE;
VkPipeline colorPipelineSwap = VK_NULL_HANDLE;
VkPipeline ntscPipelineOff = VK_NULL_HANDLE;
VkPipeline ntscPipelineSwap = VK_NULL_HANDLE;
VkPipeline crtPipelineOff = VK_NULL_HANDLE;
VkPipeline crtPipelineSwap = VK_NULL_HANDLE;
VkPipeline debandPipelineSwap = VK_NULL_HANDLE;
VkImage offscreenImg = VK_NULL_HANDLE;
VkDeviceMemory offscreenMem = VK_NULL_HANDLE;
VkImageView offscreenView = VK_NULL_HANDLE;
VkFramebuffer offscreenFB = VK_NULL_HANDLE;
VkDescriptorSet offscreenDS = VK_NULL_HANDLE;
int offscreenW = 0, offscreenH = 0;
VkImage midImg = VK_NULL_HANDLE;
VkDeviceMemory midMem = VK_NULL_HANDLE;
VkImageView midView = VK_NULL_HANDLE;
VkFramebuffer midFB = VK_NULL_HANDLE;
VkDescriptorSet midDS = VK_NULL_HANDLE;
int midW = 0, midH = 0;
VkImage fx1Img = VK_NULL_HANDLE;
VkDeviceMemory fx1Mem = VK_NULL_HANDLE;
VkImageView fx1View = VK_NULL_HANDLE;
VkFramebuffer fx1FB = VK_NULL_HANDLE;
VkDescriptorSet fx1DS = VK_NULL_HANDLE;
int fx1W = 0, fx1H = 0;
VkImage fx2Img = VK_NULL_HANDLE;
VkDeviceMemory fx2Mem = VK_NULL_HANDLE;
VkImageView fx2View = VK_NULL_HANDLE;
VkFramebuffer fx2FB = VK_NULL_HANDLE;
VkDescriptorSet fx2DS = VK_NULL_HANDLE;
int fx2W = 0, fx2H = 0;
struct UpscaleFrame {
bool active = false;
int mode = 0;
int outX = 0, outY = 0, outW = 0, outH = 0;
bool cas = false;
bool hdr = false;
bool fxaa = false;
bool toon = false;
bool color = false;
bool ntsc = false;
bool crt = false;
bool deband = false;
SgsrPushConstants sgsrPC{};
NisPushConstants nisPC{};
EasuPushConstants easuPC{};
RcasPushConstants rcasPC{};
CasPushConstants casPC{};
HdrPushConstants hdrPC{};
FxaaPushConstants fxaaPC{};
ToonPushConstants toonPC{};
ColorPushConstants colorPC{};
NtscPushConstants ntscPC{};
CrtPushConstants crtPC{};
DebandPushConstants debandPC{};
} upFrame;
VkCommandPool cmdPool = VK_NULL_HANDLE;
std::vector<VkCommandBuffer> cmdBufs;
std::vector<VkSemaphore> imgAvailSems;
std::vector<VkSemaphore> renderDoneSems;
std::vector<VkFence> inFlightFences;
std::vector<VkFence> imgInFlight;
uint32_t currentFrame = 0;
VkSampler sampler = VK_NULL_HANDLE;
VkDescriptorPool winTexPool = VK_NULL_HANDLE;
std::atomic<bool> needsRender{false};
std::thread renderThread;
std::atomic<bool> isRunning{false};
std::atomic<bool> fbResized{false};
std::mutex renderMutex;
std::mutex dirtyMutex;
std::condition_variable dirtyCV;
std::shared_mutex frameMutex;
void createInstance();
void createSurface();
void pickPhysicalDevice();
lsfg::Caps lsfgCaps_{};
void createLogicalDevice();
void createSwapchain();
void createRenderPass();
void createDSLayout();
void createPipeline(bool blend, VkPipeline& out);
void createFramebuffers();
void createCmdPool();
void createSampler();
void createUpscaleSampler();
void createOffscreenRenderPass();
void createPostPipelines();
VkPipeline createPostPipeline(const uint32_t* fragCode, size_t fragSz, VkRenderPass rp);
bool createColorTarget(int w, int h, VkImage& img, VkDeviceMemory& mem,
VkImageView& view, VkFramebuffer& fb, VkDescriptorSet& ds);
void destroyColorTarget(VkImage& img, VkDeviceMemory& mem, VkImageView& view,
VkFramebuffer& fb, VkDescriptorSet& ds);
bool ensureOffscreen(int w, int h);
bool ensureMid(int w, int h);
bool ensureFx1(int w, int h);
bool ensureFx2(int w, int h);
void recordUpscalePasses(VkCommandBuffer cb, uint32_t imgIdx,
const std::vector<DrawEntry>& draws, bool cursorDrawn,
short ptrX, short ptrY, short curHotX, short curHotY,
short curW, short curH,
float ox, float oy, float sx, float sy,
float cw, float ch);
void planUpscaleFrame();
void createWinTexPool();
void createCursorPipeline();
void createCursorDS();
void createCmdBufs();
void createSyncObjects();
void cleanupSwapchain();
bool createWinTexResources(WinTex& wt, int w, int h);
bool importAHBToWinTex(WinTex& wt, AHardwareBuffer* ahb);
void cleanupAllAHBCache();
void flushDeleteQueue();
void destroyWinTex(WinTex& wt);
void ensureCursorTex(short w, short h);
void cleanupCursorTex();
void ensureCursorStaging(VkDeviceSize sz);
void recordCmdBuf(VkCommandBuffer cb, uint32_t imgIdx,
const std::vector<DrawEntry>& draws,
std::vector<VkImageMemoryBarrier>& ahbTransitions,
std::vector<VkImageMemoryBarrier>& preUpload,
std::vector<VkImageMemoryBarrier>& postUpload,
VkBuffer cursorUpload, bool hasCursorUpload,
float ox, float oy, float sx, float sy, float cw, float ch,
short ptrX, short ptrY, short curHotX, short curHotY,
short curW, short curH, bool curVis);
void renderLoop();
void renderFrame();
uint32_t findMemType(uint32_t filter, VkMemoryPropertyFlags props);
void createBuffer(VkDeviceSize sz, VkBufferUsageFlags usage,
VkMemoryPropertyFlags props, VkBuffer& buf, VkDeviceMemory& mem);
VkCommandBuffer beginOneTime();
void endOneTime(VkCommandBuffer cmd);
void transition(VkCommandBuffer cmd, VkImage img,
VkImageLayout oldL, VkImageLayout newL,
VkAccessFlags srcA, VkAccessFlags dstA,
VkPipelineStageFlags srcS, VkPipelineStageFlags dstS);
VkShaderModule makeShader(const uint32_t* code, size_t sz);
};
+1 -1
View File
@@ -1,5 +1,5 @@
#include "ddfg_vkd.h"
#include "../VkDispatchTable.h"
#include "../VulkanRendererContext.h"
#include <android/log.h>
bool ddfgVkdInit(const VkTable& table, ddfg::DeviceDispatch& dd, ddfg::InstanceDispatch& id) {
@@ -1,6 +1,6 @@
#include "lsfg_probe.h"
#include "../VkDispatchTable.h"
#include "../VulkanRendererContext.h"
#include <cstdio>
#include <cstring>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "lsfg_vkd.h"
#include "../VkDispatchTable.h"
#include "../VulkanRendererContext.h"
#include <android/log.h>
+82
View File
@@ -0,0 +1,82 @@
#pragma once
#include <android/hardware_buffer.h>
#include <android/native_window.h>
#include <android/rect.h>
#include <android/log.h>
#include <atomic>
#include <mutex>
#include <cstdint>
#ifndef SCANOUT_LOG
#define SCANOUT_LOG(...) __android_log_print(ANDROID_LOG_DEBUG,"DroidDeck_Scanout",__VA_ARGS__)
#endif
class ScanoutContext {
public:
bool loadApi();
void initFromWindow(ANativeWindow* win = nullptr);
void initFromWindows(ANativeWindow* gameWin, ANativeWindow* cursorWin);
void destroy();
void setBuffer(AHardwareBuffer* ahb, int x, int y, int w, int h, int fenceFd = -1);
bool setCursorImage(void* pixels, short w, short h, short stride);
bool setCursorPos(short x, short y, short hotX, short hotY);
void applyPendingCursor();
void setDst(int x, int y, int w, int h);
void setContainerSize(int w, int h) { containerWidth = w; containerHeight = h; }
void setSurfaceSize(int w, int h) { surfaceWidth = w; surfaceHeight = h; }
void setFallbackWindow(ANativeWindow* win) { window = win; }
void setVerboseLog(bool v) { verboseLog = v; }
bool isActive() const { return scanoutActive.load(); }
bool isGameFrameDelivered() const {
return gameFrameDelivered.load(std::memory_order_acquire);
}
void* debugGameSC() const { return scanoutGameSC; }
std::atomic<bool> scanoutActive{false};
std::atomic<bool> gameFrameDelivered{false};
private:
ANativeWindow* window = nullptr;
bool verboseLog = true;
int surfaceWidth = 0, surfaceHeight = 0, containerWidth = 0, containerHeight = 0;
void* scanoutGameSC = nullptr;
void* scanoutCursorSC = nullptr;
void* scanoutCursorBuf = nullptr;
int32_t scanoutCursorBufW = 0;
int32_t scanoutCursorBufH = 0;
void* scanoutTx = nullptr;
void* scanoutGameTx = nullptr;
ARect scanoutLastSrc{}, scanoutLastDst{};
bool scanoutGeoDirty = true;
bool scanoutVisShown = false;
bool scanoutApiLoaded = false;
void* fnSCCreateFromWin = nullptr;
void* fnSCRelease = nullptr;
void* fnSTCreate = nullptr;
void* fnSTDelete = nullptr;
void* fnSTApply = nullptr;
void* fnSTSetBuffer = nullptr;
void* fnSTSetZOrder = nullptr;
void* fnSTSetVisibility = nullptr;
void* fnSTSetGeometry = nullptr;
int32_t scanoutDstX = 0, scanoutDstY = 0, scanoutDstW = 0, scanoutDstH = 0;
bool gameScVisible = false;
std::mutex scanoutMutex;
short pendingCursorX = 0, pendingCursorY = 0, pendingCursorHotX = 0, pendingCursorHotY = 0;
bool cursorPosDirty = false;
bool cursorImageDirty = false;
};
-10
View File
@@ -1,9 +1,6 @@
#include <errno.h>
#include <jni.h>
#include <limits.h>
#include <linux/futex.h>
#include <stdatomic.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -14,13 +11,6 @@ Java_com_droiddeck_launcher_input_FakeInputWriter_nativeStoreFence(JNIEnv *env,
atomic_thread_fence(memory_order_release);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_input_FakeInputWriter_nativeWake(JNIEnv *env, jclass clazz, jobject buffer, jint offset) {
(void)clazz;
uint8_t *base = (*env)->GetDirectBufferAddress(env, buffer);
if (base) syscall(SYS_futex, base + offset, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
}
JNIEXPORT jint JNICALL
Java_com_droiddeck_launcher_session_ThreadSignals_tgkill(JNIEnv *env, jclass clazz, jint tgid, jint tid, jint signal) {
(void)env;
@@ -1,113 +0,0 @@
Third-Party Notices — Graphics Shaders
======================================
AMD FidelityFX Super Resolution 1.0 (FSR 1.0)
----------------------------------------------
The EASU (Edge-Adaptive Spatial Upsampling) and RCAS
(Robust Contrast-Adaptive Sharpening) shader implementations
are adapted from AMD's FidelityFX FSR 1.0 reference code.
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: MIT
MIT License
-----------
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
NVIDIA Image Scaling (NIS)
--------------------------
The NIS fragment shader is adapted from NVIDIA's NVIDIA Image Scaling
reference implementation, including NVScaler and NIS configuration code.
Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: MIT
The MIT License text above applies to both AMD FidelityFX FSR 1.0 and NVIDIA Image Scaling (NIS).
Snapdragon Game Super Resolution 1 (SGSR1)
------------------------------------------
The SGSR fragment shaders are adapted from Qualcomm's reference GLSL
shaders, including the mobile and edge-direction variants.
Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
BSD 3-Clause License (SGSR1)
----------------------------
Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Upstream SGSR1 BSD 3-Clause License (2023)
----------------------------
Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-68
View File
@@ -1,68 +0,0 @@
#version 450
// =============================================================================
// AMD FidelityFX CAS (Contrast-Adaptive Sharpening) - pure-CAS path.
//
// Ported from the OpenGL FSREffect.java MODE_SUPER_RESOLUTION shader so the
// Vulkan compositor's post-process pipeline applies the SAME sharpen the GL
// renderer's "Sharpen (CAS)" toggle does. Composable: layers on top of any
// scaling mode and runs even at native resolution (no upscale).
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
//
// Slider -> SHARPNESS mapping is done CPU-side (planUpscaleFrame):
// SHARPNESS = slider / 100 (clamped 0..1, default slider 60 -> 0.60)
// Higher slider = stronger sharpen. This is the genuine AMD CAS sharpness term
// (peak = lerp(8,5,SHARPNESS)); note the GL source's level->value comments were
// inverted, so we map directly to the AMD term instead of copying that table.
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in pixels
float sharpness; // CAS SHARPNESS term [0..1]
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
void main() {
vec2 uv = fragTexCoord;
vec2 px = 1.0 / pc.resolution;
float SHARPNESS = pc.sharpness;
// 3x3 neighbourhood
vec3 a = texture(InputTexture, uv + vec2(-px.x, -px.y)).rgb;
vec3 b = texture(InputTexture, uv + vec2( 0.0, -px.y)).rgb;
vec3 c = texture(InputTexture, uv + vec2( px.x, -px.y)).rgb;
vec3 d = texture(InputTexture, uv + vec2(-px.x, 0.0)).rgb;
vec3 e = texture(InputTexture, uv).rgb;
vec3 f = texture(InputTexture, uv + vec2( px.x, 0.0)).rgb;
vec3 g = texture(InputTexture, uv + vec2(-px.x, px.y)).rgb;
vec3 h = texture(InputTexture, uv + vec2( 0.0, px.y)).rgb;
vec3 i = texture(InputTexture, uv + vec2( px.x, px.y)).rgb;
// CAS
vec3 mnRGB = min(min(min(d, e), min(f, b)), h);
vec3 mnRGB2 = min(min(min(mnRGB, a), min(g, c)), i);
mnRGB += mnRGB2;
vec3 mxRGB = max(max(max(d, e), max(f, b)), h);
vec3 mxRGB2 = max(max(max(mxRGB, a), max(g, c)), i);
mxRGB += mxRGB2;
vec3 rcpMxRGB = vec3(1.0) / max(mxRGB, vec3(1e-6));
vec3 ampRGB = clamp(min(mnRGB, 2.0 - mxRGB) * rcpMxRGB, 0.0, 1.0);
float peak = 8.0 - 3.0 * SHARPNESS;
vec3 wRGB = -sqrt(ampRGB) / peak;
vec3 rcpWeightRGB = vec3(1.0) / (1.0 + 4.0 * wRGB);
vec3 window = (b + d) + (f + h);
vec3 col = clamp((window * wRGB + e) * rcpWeightRGB, 0.0, 1.0);
outColor = vec4(col, 1.0);
}
+51 -53
View File
@@ -1,9 +1,8 @@
// 1116.3.0
#pragma once
const uint32_t cas_code[] = {
0x07230203,0x00010000,0x0008000b,0x000000f4,0x00000000,0x00020011,0x00000001,0x0006000b,
0x07230203,0x00010000,0x0008000b,0x000000f3,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x000000ee,0x00030010,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x000000ed,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00007675,0x00060005,0x0000000b,0x67617266,0x43786554,
0x64726f6f,0x00000000,0x00030005,0x0000000d,0x00007870,0x00030005,0x00000010,0x00004350,
@@ -16,15 +15,15 @@ const uint32_t cas_code[] = {
0x00030005,0x00000065,0x00000067,0x00030005,0x00000071,0x00000068,0x00030005,0x0000007a,
0x00000069,0x00040005,0x00000085,0x47526e6d,0x00000042,0x00040005,0x0000008f,0x47526e6d,
0x00003242,0x00040005,0x0000009c,0x4752786d,0x00000042,0x00040005,0x000000a6,0x4752786d,
0x00003242,0x00050005,0x000000b3,0x4d706372,0x42475278,0x00000000,0x00040005,0x000000ba,
0x52706d61,0x00004247,0x00040005,0x000000c6,0x6b616570,0x00000000,0x00040005,0x000000cc,
0x42475277,0x00000000,0x00060005,0x000000d3,0x57706372,0x68676965,0x42475274,0x00000000,
0x00040005,0x000000da,0x646e6977,0x0000776f,0x00030005,0x000000e2,0x006c6f63,0x00050005,
0x000000ee,0x4374756f,0x726f6c6f,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,
0x00003242,0x00050005,0x000000b3,0x4d706372,0x42475278,0x00000000,0x00040005,0x000000b7,
0x52706d61,0x00004247,0x00040005,0x000000c5,0x6b616570,0x00000000,0x00040005,0x000000cb,
0x42475277,0x00000000,0x00060005,0x000000d2,0x57706372,0x68676965,0x42475274,0x00000000,
0x00040005,0x000000d9,0x646e6977,0x0000776f,0x00030005,0x000000e1,0x006c6f63,0x00050005,
0x000000ed,0x4374756f,0x726f6c6f,0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,
0x00030047,0x00000010,0x00000002,0x00050048,0x00000010,0x00000000,0x00000023,0x00000000,
0x00050048,0x00000010,0x00000001,0x00000023,0x00000010,0x00050048,0x00000010,0x00000002,
0x00000023,0x00000018,0x00040047,0x00000026,0x00000021,0x00000000,0x00040047,0x00000026,
0x00000022,0x00000000,0x00040047,0x000000ee,0x0000001e,0x00000000,0x00020013,0x00000002,
0x00000022,0x00000000,0x00040047,0x000000ed,0x0000001e,0x00000000,0x00020013,0x00000002,
0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,
0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040020,0x0000000a,
0x00000001,0x00000007,0x0004003b,0x0000000a,0x0000000b,0x00000001,0x0004002b,0x00000006,
@@ -39,11 +38,11 @@ const uint32_t cas_code[] = {
0x00000025,0x00000000,0x00000024,0x0004003b,0x00000025,0x00000026,0x00000000,0x00040015,
0x00000029,0x00000020,0x00000000,0x0004002b,0x00000029,0x0000002a,0x00000000,0x0004002b,
0x00000029,0x0000002e,0x00000001,0x0004002b,0x00000006,0x00000039,0x00000000,0x0006002c,
0x00000020,0x000000b4,0x0000000e,0x0000000e,0x0000000e,0x0004002b,0x00000006,0x000000b6,
0x358637bd,0x0006002c,0x00000020,0x000000b7,0x000000b6,0x000000b6,0x000000b6,0x0004002b,
0x00000006,0x000000bc,0x40000000,0x0004002b,0x00000006,0x000000c7,0x41000000,0x0004002b,
0x00000006,0x000000c8,0x40400000,0x0004002b,0x00000006,0x000000d4,0x40800000,0x00040020,
0x000000ed,0x00000003,0x0000000f,0x0004003b,0x000000ed,0x000000ee,0x00000003,0x00050036,
0x00000020,0x000000b4,0x0000000e,0x0000000e,0x0000000e,0x0004002b,0x00000006,0x000000b9,
0x40000000,0x0004002b,0x00000006,0x000000c6,0x41000000,0x0004002b,0x00000006,0x000000c7,
0x40400000,0x0004002b,0x00000006,0x000000cc,0xbf800000,0x0006002c,0x00000020,0x000000cd,
0x000000cc,0x000000cc,0x000000cc,0x0004002b,0x00000006,0x000000d3,0x40800000,0x00040020,
0x000000ec,0x00000003,0x0000000f,0x0004003b,0x000000ec,0x000000ed,0x00000003,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000008,0x0000000d,0x00000007,0x0004003b,0x0000001a,
0x0000001b,0x00000007,0x0004003b,0x00000021,0x00000022,0x00000007,0x0004003b,0x00000021,
@@ -53,10 +52,10 @@ const uint32_t cas_code[] = {
0x00000071,0x00000007,0x0004003b,0x00000021,0x0000007a,0x00000007,0x0004003b,0x00000021,
0x00000085,0x00000007,0x0004003b,0x00000021,0x0000008f,0x00000007,0x0004003b,0x00000021,
0x0000009c,0x00000007,0x0004003b,0x00000021,0x000000a6,0x00000007,0x0004003b,0x00000021,
0x000000b3,0x00000007,0x0004003b,0x00000021,0x000000ba,0x00000007,0x0004003b,0x0000001a,
0x000000c6,0x00000007,0x0004003b,0x00000021,0x000000cc,0x00000007,0x0004003b,0x00000021,
0x000000d3,0x00000007,0x0004003b,0x00000021,0x000000da,0x00000007,0x0004003b,0x00000021,
0x000000e2,0x00000007,0x0004003d,0x00000007,0x0000000c,0x0000000b,0x0003003e,0x00000009,
0x000000b3,0x00000007,0x0004003b,0x00000021,0x000000b7,0x00000007,0x0004003b,0x0000001a,
0x000000c5,0x00000007,0x0004003b,0x00000021,0x000000cb,0x00000007,0x0004003b,0x00000021,
0x000000d2,0x00000007,0x0004003b,0x00000021,0x000000d9,0x00000007,0x0004003b,0x00000021,
0x000000e1,0x00000007,0x0004003d,0x00000007,0x0000000c,0x0000000b,0x0003003e,0x00000009,
0x0000000c,0x00050041,0x00000015,0x00000016,0x00000012,0x00000014,0x0004003d,0x00000007,
0x00000017,0x00000016,0x00050050,0x00000007,0x00000018,0x0000000e,0x0000000e,0x00050088,
0x00000007,0x00000019,0x00000018,0x00000017,0x0003003e,0x0000000d,0x00000019,0x00050041,
@@ -144,39 +143,38 @@ const uint32_t cas_code[] = {
0x0000007a,0x0007000c,0x00000020,0x000000af,0x00000001,0x00000028,0x000000ad,0x000000ae,
0x0003003e,0x000000a6,0x000000af,0x0004003d,0x00000020,0x000000b0,0x000000a6,0x0004003d,
0x00000020,0x000000b1,0x0000009c,0x00050081,0x00000020,0x000000b2,0x000000b1,0x000000b0,
0x0003003e,0x0000009c,0x000000b2,0x0004003d,0x00000020,0x000000b5,0x0000009c,0x0007000c,
0x00000020,0x000000b8,0x00000001,0x00000028,0x000000b5,0x000000b7,0x00050088,0x00000020,
0x000000b9,0x000000b4,0x000000b8,0x0003003e,0x000000b3,0x000000b9,0x0004003d,0x00000020,
0x000000bb,0x00000085,0x0004003d,0x00000020,0x000000bd,0x0000009c,0x00060050,0x00000020,
0x000000be,0x000000bc,0x000000bc,0x000000bc,0x00050083,0x00000020,0x000000bf,0x000000be,
0x000000bd,0x0007000c,0x00000020,0x000000c0,0x00000001,0x00000025,0x000000bb,0x000000bf,
0x0004003d,0x00000020,0x000000c1,0x000000b3,0x00050085,0x00000020,0x000000c2,0x000000c0,
0x000000c1,0x00060050,0x00000020,0x000000c3,0x00000039,0x00000039,0x00000039,0x00060050,
0x00000020,0x000000c4,0x0000000e,0x0000000e,0x0000000e,0x0008000c,0x00000020,0x000000c5,
0x00000001,0x0000002b,0x000000c2,0x000000c3,0x000000c4,0x0003003e,0x000000ba,0x000000c5,
0x0004003d,0x00000006,0x000000c9,0x0000001b,0x00050085,0x00000006,0x000000ca,0x000000c8,
0x000000c9,0x00050083,0x00000006,0x000000cb,0x000000c7,0x000000ca,0x0003003e,0x000000c6,
0x000000cb,0x0004003d,0x00000020,0x000000cd,0x000000ba,0x0006000c,0x00000020,0x000000ce,
0x00000001,0x0000001f,0x000000cd,0x0004007f,0x00000020,0x000000cf,0x000000ce,0x0004003d,
0x00000006,0x000000d0,0x000000c6,0x00060050,0x00000020,0x000000d1,0x000000d0,0x000000d0,
0x000000d0,0x00050088,0x00000020,0x000000d2,0x000000cf,0x000000d1,0x0003003e,0x000000cc,
0x000000d2,0x0004003d,0x00000020,0x000000d5,0x000000cc,0x0005008e,0x00000020,0x000000d6,
0x000000d5,0x000000d4,0x00060050,0x00000020,0x000000d7,0x0000000e,0x0000000e,0x0000000e,
0x00050081,0x00000020,0x000000d8,0x000000d7,0x000000d6,0x00050088,0x00000020,0x000000d9,
0x000000b4,0x000000d8,0x0003003e,0x000000d3,0x000000d9,0x0004003d,0x00000020,0x000000db,
0x00000036,0x0004003d,0x00000020,0x000000dc,0x0000004d,0x00050081,0x00000020,0x000000dd,
0x000000db,0x000000dc,0x0004003d,0x00000020,0x000000de,0x0000005c,0x0004003d,0x00000020,
0x000000df,0x00000071,0x00050081,0x00000020,0x000000e0,0x000000de,0x000000df,0x00050081,
0x00000020,0x000000e1,0x000000dd,0x000000e0,0x0003003e,0x000000da,0x000000e1,0x0004003d,
0x00000020,0x000000e3,0x000000da,0x0004003d,0x00000020,0x000000e4,0x000000cc,0x00050085,
0x00000020,0x000000e5,0x000000e3,0x000000e4,0x0004003d,0x00000020,0x000000e6,0x00000057,
0x00050081,0x00000020,0x000000e7,0x000000e5,0x000000e6,0x0004003d,0x00000020,0x000000e8,
0x000000d3,0x00050085,0x00000020,0x000000e9,0x000000e7,0x000000e8,0x00060050,0x00000020,
0x000000ea,0x00000039,0x00000039,0x00000039,0x00060050,0x00000020,0x000000eb,0x0000000e,
0x0000000e,0x0000000e,0x0008000c,0x00000020,0x000000ec,0x00000001,0x0000002b,0x000000e9,
0x000000ea,0x000000eb,0x0003003e,0x000000e2,0x000000ec,0x0004003d,0x00000020,0x000000ef,
0x000000e2,0x00050051,0x00000006,0x000000f0,0x000000ef,0x00000000,0x00050051,0x00000006,
0x000000f1,0x000000ef,0x00000001,0x00050051,0x00000006,0x000000f2,0x000000ef,0x00000002,
0x00070050,0x0000000f,0x000000f3,0x000000f0,0x000000f1,0x000000f2,0x0000000e,0x0003003e,
0x000000ee,0x000000f3,0x000100fd,0x00010038
0x0003003e,0x0000009c,0x000000b2,0x0004003d,0x00000020,0x000000b5,0x0000009c,0x00050088,
0x00000020,0x000000b6,0x000000b4,0x000000b5,0x0003003e,0x000000b3,0x000000b6,0x0004003d,
0x00000020,0x000000b8,0x00000085,0x0004003d,0x00000020,0x000000ba,0x0000009c,0x00060050,
0x00000020,0x000000bb,0x000000b9,0x000000b9,0x000000b9,0x00050083,0x00000020,0x000000bc,
0x000000bb,0x000000ba,0x0007000c,0x00000020,0x000000bd,0x00000001,0x00000025,0x000000b8,
0x000000bc,0x0004003d,0x00000020,0x000000be,0x000000b3,0x00050085,0x00000020,0x000000bf,
0x000000bd,0x000000be,0x00060050,0x00000020,0x000000c0,0x00000039,0x00000039,0x00000039,
0x00060050,0x00000020,0x000000c1,0x0000000e,0x0000000e,0x0000000e,0x0008000c,0x00000020,
0x000000c2,0x00000001,0x0000002b,0x000000bf,0x000000c0,0x000000c1,0x0003003e,0x000000b7,
0x000000c2,0x0004003d,0x00000020,0x000000c3,0x000000b7,0x0006000c,0x00000020,0x000000c4,
0x00000001,0x00000020,0x000000c3,0x0003003e,0x000000b7,0x000000c4,0x0004003d,0x00000006,
0x000000c8,0x0000001b,0x00050085,0x00000006,0x000000c9,0x000000c7,0x000000c8,0x00050083,
0x00000006,0x000000ca,0x000000c6,0x000000c9,0x0003003e,0x000000c5,0x000000ca,0x0004003d,
0x00000020,0x000000ce,0x000000b7,0x0004003d,0x00000006,0x000000cf,0x000000c5,0x0005008e,
0x00000020,0x000000d0,0x000000ce,0x000000cf,0x00050088,0x00000020,0x000000d1,0x000000cd,
0x000000d0,0x0003003e,0x000000cb,0x000000d1,0x0004003d,0x00000020,0x000000d4,0x000000cb,
0x0005008e,0x00000020,0x000000d5,0x000000d4,0x000000d3,0x00060050,0x00000020,0x000000d6,
0x0000000e,0x0000000e,0x0000000e,0x00050081,0x00000020,0x000000d7,0x000000d6,0x000000d5,
0x00050088,0x00000020,0x000000d8,0x000000b4,0x000000d7,0x0003003e,0x000000d2,0x000000d8,
0x0004003d,0x00000020,0x000000da,0x00000036,0x0004003d,0x00000020,0x000000db,0x0000004d,
0x00050081,0x00000020,0x000000dc,0x000000da,0x000000db,0x0004003d,0x00000020,0x000000dd,
0x0000005c,0x0004003d,0x00000020,0x000000de,0x00000071,0x00050081,0x00000020,0x000000df,
0x000000dd,0x000000de,0x00050081,0x00000020,0x000000e0,0x000000dc,0x000000df,0x0003003e,
0x000000d9,0x000000e0,0x0004003d,0x00000020,0x000000e2,0x000000d9,0x0004003d,0x00000020,
0x000000e3,0x000000cb,0x00050085,0x00000020,0x000000e4,0x000000e2,0x000000e3,0x0004003d,
0x00000020,0x000000e5,0x00000057,0x00050081,0x00000020,0x000000e6,0x000000e4,0x000000e5,
0x0004003d,0x00000020,0x000000e7,0x000000d2,0x00050085,0x00000020,0x000000e8,0x000000e6,
0x000000e7,0x00060050,0x00000020,0x000000e9,0x00000039,0x00000039,0x00000039,0x00060050,
0x00000020,0x000000ea,0x0000000e,0x0000000e,0x0000000e,0x0008000c,0x00000020,0x000000eb,
0x00000001,0x0000002b,0x000000e8,0x000000e9,0x000000ea,0x0003003e,0x000000e1,0x000000eb,
0x0004003d,0x00000020,0x000000ee,0x000000e1,0x00050051,0x00000006,0x000000ef,0x000000ee,
0x00000000,0x00050051,0x00000006,0x000000f0,0x000000ee,0x00000001,0x00050051,0x00000006,
0x000000f1,0x000000ee,0x00000002,0x00070050,0x0000000f,0x000000f2,0x000000ef,0x000000f0,
0x000000f1,0x0000000e,0x0003003e,0x000000ed,0x000000f2,0x000100fd,0x00010038
};
-52
View File
@@ -1,52 +0,0 @@
#version 450
// =============================================================================
// Color grade (brightness / contrast / saturation / gamma) post effect.
//
// Ported verbatim from the OpenGL ColorEffect.java shader. The four terms are
// prepared CPU-side (planUpscaleFrame) exactly as the GL path does:
// brightness = brightnessSlider / 100 clamped to [-1, 1]
// contrast = contrastSlider / 100 clamped to [ 0, 2]
// saturation = saturationSlider / 100 clamped to [ 0, 2]
// gamma = gammaSlider clamped to [0.1, 5]
// (the clamps replicate ColorEffectMaterial.use()). Neutral = (0,0,1,1) -> no-op,
// matching the GL "remove the effect" check; the chain skips Color when neutral.
//
// Term ORDER inside this shader is brightness -> contrast -> saturation -> gamma.
// Saturation sits after contrast and before gamma deliberately: it mixes towards
// Rec.709 luma of the already-graded linear-ish signal, so the greyscale it blends
// against is the one the viewer sees, and the gamma curve is still applied last to
// the finished colour. ColorEffect.java applies its terms in the same order, so a
// Screen Effect "Look" grades identically on the OpenGL and Vulkan renderers.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// `saturation` is APPENDED at the end of the block so the offsets of the three
// original terms are unchanged.
// Runs after Toon, before CAS in the canonical chain (grade the clean image).
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
float brightness; // additive, [-1, 1]
float contrast; // [0, 2]; effective multiplier = clamp(contrast+1, 0.5, 2)
float gamma; // [0.1, 5]
float saturation; // [0, 2]; 1 = unchanged, 0 = greyscale
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
void main() {
vec4 texelColor = texture(InputTexture, fragTexCoord);
vec3 color = texelColor.rgb;
color = clamp(color + pc.brightness, 0.0, 1.0);
color = (color - 0.5) * clamp(pc.contrast + 1.0, 0.5, 2.0) + 0.5;
vec3 grey = vec3(dot(color, vec3(0.2126, 0.7152, 0.0722)));
color = mix(grey, color, clamp(pc.saturation, 0.0, 2.0));
color = max(color, vec3(0.0));
color = pow(color, vec3(1.0 / pc.gamma));
outColor = vec4(color, texelColor.a);
}
+43 -47
View File
@@ -1,9 +1,8 @@
// 1116.3.0
#pragma once
const uint32_t color_code[] = {
0x07230203,0x00010000,0x0008000b,0x0000005c,0x00000000,0x00020011,0x00000001,0x0006000b,
0x07230203,0x00010000,0x0008000b,0x00000059,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000011,0x00000051,0x00030010,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000011,0x0000004e,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00050005,0x00000009,0x65786574,0x6c6f436c,0x0000726f,0x00060005,0x0000000d,
0x75706e49,0x78655474,0x65727574,0x00000000,0x00060005,0x00000011,0x67617266,0x43786554,
@@ -12,13 +11,13 @@ const uint32_t color_code[] = {
0x67697262,0x656e7468,0x00007373,0x00060006,0x0000001a,0x00000002,0x746e6f63,0x74736172,
0x00000000,0x00050006,0x0000001a,0x00000003,0x6d6d6167,0x00000061,0x00060006,0x0000001a,
0x00000004,0x75746173,0x69746172,0x00006e6f,0x00030005,0x0000001c,0x00006370,0x00040005,
0x00000036,0x79657267,0x00000000,0x00050005,0x00000051,0x4374756f,0x726f6c6f,0x00000000,
0x00000036,0x79657267,0x00000000,0x00050005,0x0000004e,0x4374756f,0x726f6c6f,0x00000000,
0x00040047,0x0000000d,0x00000021,0x00000000,0x00040047,0x0000000d,0x00000022,0x00000000,
0x00040047,0x00000011,0x0000001e,0x00000000,0x00030047,0x0000001a,0x00000002,0x00050048,
0x0000001a,0x00000000,0x00000023,0x00000000,0x00050048,0x0000001a,0x00000001,0x00000023,
0x00000010,0x00050048,0x0000001a,0x00000002,0x00000023,0x00000014,0x00050048,0x0000001a,
0x00000003,0x00000023,0x00000018,0x00050048,0x0000001a,0x00000004,0x00000023,0x0000001c,
0x00040047,0x00000051,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,
0x00040047,0x0000004e,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,
0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000004,
0x00040020,0x00000008,0x00000007,0x00000007,0x00090019,0x0000000a,0x00000006,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000000b,0x0000000a,
@@ -34,46 +33,43 @@ const uint32_t color_code[] = {
0x00000006,0x00000031,0x40000000,0x0004002b,0x00000006,0x00000038,0x3e59b3d0,0x0004002b,
0x00000006,0x00000039,0x3f371759,0x0004002b,0x00000006,0x0000003a,0x3d93dd98,0x0006002c,
0x00000014,0x0000003b,0x00000038,0x00000039,0x0000003a,0x0004002b,0x0000001d,0x00000040,
0x00000004,0x0006002c,0x00000014,0x00000047,0x00000024,0x00000024,0x00000024,0x0004002b,
0x0000001d,0x0000004a,0x00000003,0x00040020,0x00000050,0x00000003,0x00000007,0x0004003b,
0x00000050,0x00000051,0x00000003,0x00040015,0x00000053,0x00000020,0x00000000,0x0004002b,
0x00000053,0x00000054,0x00000003,0x00040020,0x00000055,0x00000007,0x00000006,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000015,0x00000016,0x00000007,0x0004003b,0x00000015,
0x00000036,0x00000007,0x0004003d,0x0000000b,0x0000000e,0x0000000d,0x0004003d,0x0000000f,
0x00000012,0x00000011,0x00050057,0x00000007,0x00000013,0x0000000e,0x00000012,0x0003003e,
0x00000009,0x00000013,0x0004003d,0x00000007,0x00000017,0x00000009,0x0008004f,0x00000014,
0x00000018,0x00000017,0x00000017,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000016,
0x00000018,0x0004003d,0x00000014,0x00000019,0x00000016,0x00050041,0x0000001f,0x00000020,
0x0000001c,0x0000001e,0x0004003d,0x00000006,0x00000021,0x00000020,0x00060050,0x00000014,
0x00000022,0x00000021,0x00000021,0x00000021,0x00050081,0x00000014,0x00000023,0x00000019,
0x00000022,0x00060050,0x00000014,0x00000026,0x00000024,0x00000024,0x00000024,0x00060050,
0x00000014,0x00000027,0x00000025,0x00000025,0x00000025,0x0008000c,0x00000014,0x00000028,
0x00000001,0x0000002b,0x00000023,0x00000026,0x00000027,0x0003003e,0x00000016,0x00000028,
0x0004003d,0x00000014,0x00000029,0x00000016,0x00060050,0x00000014,0x0000002b,0x0000002a,
0x0000002a,0x0000002a,0x00050083,0x00000014,0x0000002c,0x00000029,0x0000002b,0x00050041,
0x0000001f,0x0000002e,0x0000001c,0x0000002d,0x0004003d,0x00000006,0x0000002f,0x0000002e,
0x00050081,0x00000006,0x00000030,0x0000002f,0x00000025,0x0008000c,0x00000006,0x00000032,
0x00000001,0x0000002b,0x00000030,0x0000002a,0x00000031,0x0005008e,0x00000014,0x00000033,
0x0000002c,0x00000032,0x00060050,0x00000014,0x00000034,0x0000002a,0x0000002a,0x0000002a,
0x00050081,0x00000014,0x00000035,0x00000033,0x00000034,0x0003003e,0x00000016,0x00000035,
0x0004003d,0x00000014,0x00000037,0x00000016,0x00050094,0x00000006,0x0000003c,0x00000037,
0x0000003b,0x00060050,0x00000014,0x0000003d,0x0000003c,0x0000003c,0x0000003c,0x0003003e,
0x00000036,0x0000003d,0x0004003d,0x00000014,0x0000003e,0x00000036,0x0004003d,0x00000014,
0x0000003f,0x00000016,0x00050041,0x0000001f,0x00000041,0x0000001c,0x00000040,0x0004003d,
0x00000006,0x00000042,0x00000041,0x0008000c,0x00000006,0x00000043,0x00000001,0x0000002b,
0x00000042,0x00000024,0x00000031,0x00060050,0x00000014,0x00000044,0x00000043,0x00000043,
0x00000043,0x0008000c,0x00000014,0x00000045,0x00000001,0x0000002e,0x0000003e,0x0000003f,
0x00000044,0x0003003e,0x00000016,0x00000045,0x0004003d,0x00000014,0x00000046,0x00000016,
0x0007000c,0x00000014,0x00000048,0x00000001,0x00000028,0x00000046,0x00000047,0x0003003e,
0x00000016,0x00000048,0x0004003d,0x00000014,0x00000049,0x00000016,0x00050041,0x0000001f,
0x0000004b,0x0000001c,0x0000004a,0x0004003d,0x00000006,0x0000004c,0x0000004b,0x00050088,
0x00000006,0x0000004d,0x00000025,0x0000004c,0x00060050,0x00000014,0x0000004e,0x0000004d,
0x0000004d,0x0000004d,0x0007000c,0x00000014,0x0000004f,0x00000001,0x0000001a,0x00000049,
0x0000004e,0x0003003e,0x00000016,0x0000004f,0x0004003d,0x00000014,0x00000052,0x00000016,
0x00050041,0x00000055,0x00000056,0x00000009,0x00000054,0x0004003d,0x00000006,0x00000057,
0x00000056,0x00050051,0x00000006,0x00000058,0x00000052,0x00000000,0x00050051,0x00000006,
0x00000059,0x00000052,0x00000001,0x00050051,0x00000006,0x0000005a,0x00000052,0x00000002,
0x00070050,0x00000007,0x0000005b,0x00000058,0x00000059,0x0000005a,0x00000057,0x0003003e,
0x00000051,0x0000005b,0x000100fd,0x00010038
0x00000004,0x0004002b,0x0000001d,0x00000047,0x00000003,0x00040020,0x0000004d,0x00000003,
0x00000007,0x0004003b,0x0000004d,0x0000004e,0x00000003,0x00040015,0x00000050,0x00000020,
0x00000000,0x0004002b,0x00000050,0x00000051,0x00000003,0x00040020,0x00000052,0x00000007,
0x00000006,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003b,0x00000015,0x00000016,0x00000007,
0x0004003b,0x00000015,0x00000036,0x00000007,0x0004003d,0x0000000b,0x0000000e,0x0000000d,
0x0004003d,0x0000000f,0x00000012,0x00000011,0x00050057,0x00000007,0x00000013,0x0000000e,
0x00000012,0x0003003e,0x00000009,0x00000013,0x0004003d,0x00000007,0x00000017,0x00000009,
0x0008004f,0x00000014,0x00000018,0x00000017,0x00000017,0x00000000,0x00000001,0x00000002,
0x0003003e,0x00000016,0x00000018,0x0004003d,0x00000014,0x00000019,0x00000016,0x00050041,
0x0000001f,0x00000020,0x0000001c,0x0000001e,0x0004003d,0x00000006,0x00000021,0x00000020,
0x00060050,0x00000014,0x00000022,0x00000021,0x00000021,0x00000021,0x00050081,0x00000014,
0x00000023,0x00000019,0x00000022,0x00060050,0x00000014,0x00000026,0x00000024,0x00000024,
0x00000024,0x00060050,0x00000014,0x00000027,0x00000025,0x00000025,0x00000025,0x0008000c,
0x00000014,0x00000028,0x00000001,0x0000002b,0x00000023,0x00000026,0x00000027,0x0003003e,
0x00000016,0x00000028,0x0004003d,0x00000014,0x00000029,0x00000016,0x00060050,0x00000014,
0x0000002b,0x0000002a,0x0000002a,0x0000002a,0x00050083,0x00000014,0x0000002c,0x00000029,
0x0000002b,0x00050041,0x0000001f,0x0000002e,0x0000001c,0x0000002d,0x0004003d,0x00000006,
0x0000002f,0x0000002e,0x00050081,0x00000006,0x00000030,0x0000002f,0x00000025,0x0008000c,
0x00000006,0x00000032,0x00000001,0x0000002b,0x00000030,0x0000002a,0x00000031,0x0005008e,
0x00000014,0x00000033,0x0000002c,0x00000032,0x00060050,0x00000014,0x00000034,0x0000002a,
0x0000002a,0x0000002a,0x00050081,0x00000014,0x00000035,0x00000033,0x00000034,0x0003003e,
0x00000016,0x00000035,0x0004003d,0x00000014,0x00000037,0x00000016,0x00050094,0x00000006,
0x0000003c,0x00000037,0x0000003b,0x00060050,0x00000014,0x0000003d,0x0000003c,0x0000003c,
0x0000003c,0x0003003e,0x00000036,0x0000003d,0x0004003d,0x00000014,0x0000003e,0x00000036,
0x0004003d,0x00000014,0x0000003f,0x00000016,0x00050041,0x0000001f,0x00000041,0x0000001c,
0x00000040,0x0004003d,0x00000006,0x00000042,0x00000041,0x0008000c,0x00000006,0x00000043,
0x00000001,0x0000002b,0x00000042,0x00000024,0x00000031,0x00060050,0x00000014,0x00000044,
0x00000043,0x00000043,0x00000043,0x0008000c,0x00000014,0x00000045,0x00000001,0x0000002e,
0x0000003e,0x0000003f,0x00000044,0x0003003e,0x00000016,0x00000045,0x0004003d,0x00000014,
0x00000046,0x00000016,0x00050041,0x0000001f,0x00000048,0x0000001c,0x00000047,0x0004003d,
0x00000006,0x00000049,0x00000048,0x00050088,0x00000006,0x0000004a,0x00000025,0x00000049,
0x00060050,0x00000014,0x0000004b,0x0000004a,0x0000004a,0x0000004a,0x0007000c,0x00000014,
0x0000004c,0x00000001,0x0000001a,0x00000046,0x0000004b,0x0003003e,0x00000016,0x0000004c,
0x0004003d,0x00000014,0x0000004f,0x00000016,0x00050041,0x00000052,0x00000053,0x00000009,
0x00000051,0x0004003d,0x00000006,0x00000054,0x00000053,0x00050051,0x00000006,0x00000055,
0x0000004f,0x00000000,0x00050051,0x00000006,0x00000056,0x0000004f,0x00000001,0x00050051,
0x00000006,0x00000057,0x0000004f,0x00000002,0x00070050,0x00000007,0x00000058,0x00000055,
0x00000056,0x00000057,0x00000054,0x0003003e,0x0000004e,0x00000058,0x000100fd,0x00010038
};
-42
View File
@@ -1,42 +0,0 @@
#version 450
// =============================================================================
// CRT (chromatic aberration + scanlines) post effect.
//
// Ported verbatim from the OpenGL CRTEffect.java shader. GL sampled with the
// varying vUV; here fragTexCoord IS that uv. All constants unchanged. Runs LAST
// in the canonical chain (the physical tube emulation, after NTSC's analog
// signal). Does not need the resolution, but the PC carries it for a uniform
// effect-PC layout.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in px (unused; layout uniformity)
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
#define CA_AMOUNT 1.0025
#define SCANLINE_INTENSITY_X 0.125
#define SCANLINE_INTENSITY_Y 0.375
#define SCANLINE_SIZE 1024.0
void main() {
vec2 vUV = fragTexCoord;
vec4 finalColor = texture(InputTexture, vUV);
finalColor.rgb = vec3(
texture(InputTexture, (vUV - 0.5) * CA_AMOUNT + 0.5).r,
finalColor.g,
texture(InputTexture, (vUV - 0.5) / CA_AMOUNT + 0.5).b
);
float scanlineX = abs(sin(vUV.x * SCANLINE_SIZE) * 0.5 * SCANLINE_INTENSITY_X);
float scanlineY = abs(sin(vUV.y * SCANLINE_SIZE) * 0.5 * SCANLINE_INTENSITY_Y);
outColor = vec4(mix(finalColor.rgb, vec3(0.0), scanlineX + scanlineY), finalColor.a);
}
-56
View File
@@ -1,56 +0,0 @@
#version 450
// =============================================================================
// Debanding / dither - terminal post pass.
//
// Adds sub-LSB triangular-PDF (TPDF) noise just before the final 8-bit
// swapchain quantization, so smooth gradients (dark skies, fog, bloom
// falloff, vignettes) stop showing 8-bit "stair-step" banding. Especially
// visible on AMOLED panels in dark scenes.
//
// This is the LAST pass in the effect chain and always writes the swapchain,
// so the dither matches the display quantizer. The whole compositor chain is
// R8G8B8A8_UNORM and the swapchain has no _SRGB view, i.e. values are already
// display(gamma)-encoded here - so we dither in display space, ~1 LSB = 1/255,
// which is where AMOLED banding is worst (the darks).
//
// Noise = interleaved gradient noise (Jimenez 2014, public technique), two
// screen-locked samples summed for a triangular PDF (flat noise spectrum, no
// DC bias). Screen-locked (gl_FragCoord) so the pattern is static = no shimmer.
// Float-only hash (no floatBitsToInt / bvec / bitwise) = Adreno-compile-safe.
//
// Conventions match upscale.vert / cas.frag: combined-image-sampler at binding
// 0, push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
//
// CPU side (planUpscaleFrame) maps the UI strength slider to LSB units:
// strength = slider / 100 (slider 100 -> 1.0 LSB, the default)
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in pixels (unused here, kept for layout parity)
float strength; // dither amplitude in LSBs (1.0 = +/-1/255 triangular)
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
// Interleaved gradient noise - returns [0,1), float-only, Adreno-safe.
float ign(vec2 p) {
return fract(52.9829189 * fract(dot(p, vec2(0.06711056, 0.00583715))));
}
void main() {
vec3 col = texture(InputTexture, fragTexCoord).rgb;
// Two decorrelated samples -> triangular PDF in (-1, 1).
float n1 = ign(gl_FragCoord.xy);
float n2 = ign(gl_FragCoord.xy + vec2(11.0, 17.0));
float tri = (n1 + n2) - 1.0;
col += vec3(tri * (pc.strength / 255.0));
outColor = vec4(col, 1.0);
}
-204
View File
@@ -1,204 +0,0 @@
#version 450
// =============================================================================
// AMD FidelityFX Super Resolution 1.0 - EASU (Edge-Adaptive Spatial Upsampling).
//
// Algorithm (FsrEasuF / FsrEasuTapF / FsrEasuSetF) ported verbatim from AMD's
// reference header: GPUOpen-Effects/FidelityFX-FSR ffx-fsr/ffx_fsr1.h
//
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: MIT
//
// Full license text is included in THIRD_PARTY_NOTICES.txt and packaged
// in the APK at assets/licenses/graphics/THIRD_PARTY_NOTICES.txt.
//
// Adapted for the Winlator native Vulkan compositor:
// - fp32-only path (the AF1/AU1 portability macros below replace ffx_a.h)
// - con0..con3 are computed CPU-side (FsrEasuCon) and delivered via push const
// - output pixel position comes from window.vert's fragTexCoord * outputSize
// - input sampled via textureGather on a CLAMP_TO_EDGE / linear sampler
// =============================================================================
// ---- minimal ffx_a.h fp32 portability layer -------------------------------
#define AF1 float
#define AF2 vec2
#define AF3 vec3
#define AF4 vec4
#define AU1 uint
#define AU2 uvec2
#define AU4 uvec4
#define ASU2 ivec2
#define AP1 bool
#define AF1_(a) float(a)
#define AF2_(a) vec2(AF1_(a))
#define AF3_(a) vec3(AF1_(a))
#define AF4_(a) vec4(AF1_(a))
#define AF2_AU2(x) uintBitsToFloat(uvec2(x))
#define AF1_AU1(x) uintBitsToFloat(uint(x))
float ARcpF1(float x) { return 1.0 / x; }
float APrxLoRcpF1(float x) { return 1.0 / x; }
float APrxMedRcpF1(float x){ return 1.0 / x; }
float APrxLoRsqF1(float x) { return inversesqrt(x); }
float ASatF1(float x) { return clamp(x, 0.0, 1.0); }
vec3 AMin3F3(vec3 a, vec3 b, vec3 c) { return min(a, min(b, c)); }
vec3 AMax3F3(vec3 a, vec3 b, vec3 c) { return max(a, max(b, c)); }
// ---------------------------------------------------------------------------
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0)
uvec4 con0;
uvec4 con1;
uvec4 con2;
uvec4 con3;
vec2 outputSize; // EASU output (this pass's render-target) size in pixels
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
AF4 FsrEasuRF(AF2 p) { return textureGather(InputTexture, p, 0); }
AF4 FsrEasuGF(AF2 p) { return textureGather(InputTexture, p, 1); }
AF4 FsrEasuBF(AF2 p) { return textureGather(InputTexture, p, 2); }
void FsrEasuTapF(
inout AF3 aC,
inout AF1 aW,
AF2 off,
AF2 dir,
AF2 len,
AF1 lob,
AF1 clp,
AF3 c){
AF2 v;
v.x=(off.x*( dir.x))+(off.y*dir.y);
v.y=(off.x*(-dir.y))+(off.y*dir.x);
v*=len;
AF1 d2=v.x*v.x+v.y*v.y;
d2=min(d2,clp);
AF1 wB=AF1_(2.0/5.0)*d2+AF1_(-1.0);
AF1 wA=lob*d2+AF1_(-1.0);
wB*=wB;
wA*=wA;
wB=AF1_(25.0/16.0)*wB+AF1_(-(25.0/16.0-1.0));
AF1 w=wB*wA;
aC+=c*w;aW+=w;}
void FsrEasuSetF(
inout AF2 dir,
inout AF1 len,
AF2 pp,
AP1 biS,AP1 biT,AP1 biU,AP1 biV,
AF1 lA,AF1 lB,AF1 lC,AF1 lD,AF1 lE){
AF1 w = AF1_(0.0);
if(biS)w=(AF1_(1.0)-pp.x)*(AF1_(1.0)-pp.y);
if(biT)w= pp.x *(AF1_(1.0)-pp.y);
if(biU)w=(AF1_(1.0)-pp.x)* pp.y ;
if(biV)w= pp.x * pp.y ;
AF1 dc=lD-lC;
AF1 cb=lC-lB;
AF1 lenX=max(abs(dc),abs(cb));
lenX=lenX>0.0?APrxLoRcpF1(lenX):AF1_(0.0);
AF1 dirX=lD-lB;
dir.x+=dirX*w;
lenX=ASatF1(abs(dirX)*lenX);
lenX*=lenX;
len+=lenX*w;
AF1 ec=lE-lC;
AF1 ca=lC-lA;
AF1 lenY=max(abs(ec),abs(ca));
lenY=lenY>0.0?APrxLoRcpF1(lenY):AF1_(0.0);
AF1 dirY=lE-lA;
dir.y+=dirY*w;
lenY=ASatF1(abs(dirY)*lenY);
lenY*=lenY;
len+=lenY*w;}
void FsrEasuF(
out AF3 pix,
AU2 ip,
AU4 con0,
AU4 con1,
AU4 con2,
AU4 con3){
AF2 pp=AF2(ip)*AF2_AU2(con0.xy)+AF2_AU2(con0.zw);
AF2 fp=floor(pp);
pp-=fp;
AF2 p0=fp*AF2_AU2(con1.xy)+AF2_AU2(con1.zw);
AF2 p1=p0+AF2_AU2(con2.xy);
AF2 p2=p0+AF2_AU2(con2.zw);
AF2 p3=p0+AF2_AU2(con3.xy);
AF4 bczzR=FsrEasuRF(p0);
AF4 bczzG=FsrEasuGF(p0);
AF4 bczzB=FsrEasuBF(p0);
AF4 ijfeR=FsrEasuRF(p1);
AF4 ijfeG=FsrEasuGF(p1);
AF4 ijfeB=FsrEasuBF(p1);
AF4 klhgR=FsrEasuRF(p2);
AF4 klhgG=FsrEasuGF(p2);
AF4 klhgB=FsrEasuBF(p2);
AF4 zzonR=FsrEasuRF(p3);
AF4 zzonG=FsrEasuGF(p3);
AF4 zzonB=FsrEasuBF(p3);
AF4 bczzL=bczzB*AF4_(0.5)+(bczzR*AF4_(0.5)+bczzG);
AF4 ijfeL=ijfeB*AF4_(0.5)+(ijfeR*AF4_(0.5)+ijfeG);
AF4 klhgL=klhgB*AF4_(0.5)+(klhgR*AF4_(0.5)+klhgG);
AF4 zzonL=zzonB*AF4_(0.5)+(zzonR*AF4_(0.5)+zzonG);
AF1 bL=bczzL.x;
AF1 cL=bczzL.y;
AF1 iL=ijfeL.x;
AF1 jL=ijfeL.y;
AF1 fL=ijfeL.z;
AF1 eL=ijfeL.w;
AF1 kL=klhgL.x;
AF1 lL=klhgL.y;
AF1 hL=klhgL.z;
AF1 gL=klhgL.w;
AF1 oL=zzonL.z;
AF1 nL=zzonL.w;
AF2 dir=AF2_(0.0);
AF1 len=AF1_(0.0);
FsrEasuSetF(dir,len,pp,true, false,false,false,bL,eL,fL,gL,jL);
FsrEasuSetF(dir,len,pp,false,true ,false,false,cL,fL,gL,hL,kL);
FsrEasuSetF(dir,len,pp,false,false,true ,false,fL,iL,jL,kL,nL);
FsrEasuSetF(dir,len,pp,false,false,false,true ,gL,jL,kL,lL,oL);
AF2 dir2=dir*dir;
AF1 dirR=dir2.x+dir2.y;
AP1 zro=dirR<AF1_(1.0/32768.0);
dirR=APrxLoRsqF1(dirR);
dirR=zro?AF1_(1.0):dirR;
dir.x=zro?AF1_(1.0):dir.x;
dir*=AF2_(dirR);
len=len*AF1_(0.5);
len*=len;
AF1 stretch=(dir.x*dir.x+dir.y*dir.y)*APrxLoRcpF1(max(abs(dir.x),abs(dir.y)));
AF2 len2=AF2(AF1_(1.0)+(stretch-AF1_(1.0))*len,AF1_(1.0)+AF1_(-0.5)*len);
AF1 lob=AF1_(0.5)+AF1_((1.0/4.0-0.04)-0.5)*len;
AF1 clp=APrxLoRcpF1(lob);
AF3 min4=min(AMin3F3(AF3(ijfeR.z,ijfeG.z,ijfeB.z),AF3(klhgR.w,klhgG.w,klhgB.w),AF3(ijfeR.y,ijfeG.y,ijfeB.y)),
AF3(klhgR.x,klhgG.x,klhgB.x));
AF3 max4=max(AMax3F3(AF3(ijfeR.z,ijfeG.z,ijfeB.z),AF3(klhgR.w,klhgG.w,klhgB.w),AF3(ijfeR.y,ijfeG.y,ijfeB.y)),
AF3(klhgR.x,klhgG.x,klhgB.x));
AF3 aC=AF3_(0.0);
AF1 aW=AF1_(0.0);
FsrEasuTapF(aC,aW,AF2( 0.0,-1.0)-pp,dir,len2,lob,clp,AF3(bczzR.x,bczzG.x,bczzB.x));
FsrEasuTapF(aC,aW,AF2( 1.0,-1.0)-pp,dir,len2,lob,clp,AF3(bczzR.y,bczzG.y,bczzB.y));
FsrEasuTapF(aC,aW,AF2(-1.0, 1.0)-pp,dir,len2,lob,clp,AF3(ijfeR.x,ijfeG.x,ijfeB.x));
FsrEasuTapF(aC,aW,AF2( 0.0, 1.0)-pp,dir,len2,lob,clp,AF3(ijfeR.y,ijfeG.y,ijfeB.y));
FsrEasuTapF(aC,aW,AF2( 0.0, 0.0)-pp,dir,len2,lob,clp,AF3(ijfeR.z,ijfeG.z,ijfeB.z));
FsrEasuTapF(aC,aW,AF2(-1.0, 0.0)-pp,dir,len2,lob,clp,AF3(ijfeR.w,ijfeG.w,ijfeB.w));
FsrEasuTapF(aC,aW,AF2( 1.0, 1.0)-pp,dir,len2,lob,clp,AF3(klhgR.x,klhgG.x,klhgB.x));
FsrEasuTapF(aC,aW,AF2( 2.0, 1.0)-pp,dir,len2,lob,clp,AF3(klhgR.y,klhgG.y,klhgB.y));
FsrEasuTapF(aC,aW,AF2( 2.0, 0.0)-pp,dir,len2,lob,clp,AF3(klhgR.z,klhgG.z,klhgB.z));
FsrEasuTapF(aC,aW,AF2( 1.0, 0.0)-pp,dir,len2,lob,clp,AF3(klhgR.w,klhgG.w,klhgB.w));
FsrEasuTapF(aC,aW,AF2( 1.0, 2.0)-pp,dir,len2,lob,clp,AF3(zzonR.z,zzonG.z,zzonB.z));
FsrEasuTapF(aC,aW,AF2( 0.0, 2.0)-pp,dir,len2,lob,clp,AF3(zzonR.w,zzonG.w,zzonB.w));
pix=min(max4,max(min4,aC*AF3_(ARcpF1(aW))));}
void main() {
uvec2 ip = uvec2(fragTexCoord * pc.outputSize);
vec3 c;
FsrEasuF(c, ip, pc.con0, pc.con1, pc.con2, pc.con3);
outColor = vec4(c, 1.0);
}
File diff suppressed because it is too large. Load diff
-134
View File
@@ -1,134 +0,0 @@
#version 450
// =============================================================================
// AMD FidelityFX Super Resolution 1.0 - RCAS (Robust Contrast-Adaptive Sharpen).
//
// Algorithm (FsrRcasF) ported verbatim from AMD's reference header:
// GPUOpen-Effects/FidelityFX-FSR ffx-fsr/ffx_fsr1.h
//
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
// SPDX-License-Identifier: MIT
//
// Full license text is included in THIRD_PARTY_NOTICES.txt and packaged
// in the APK at assets/licenses/graphics/THIRD_PARTY_NOTICES.txt.
//
// Adapted for the Winlator native Vulkan compositor:
// - fp32-only path (the AF1/AU1 portability macros below replace ffx_a.h)
// - the sharpness constant is computed CPU-side (FsrRcasCon) -> push const con
// - input is the EASU output (already at output resolution), read 1:1 via
// texelFetch with edge clamping for robustness
// =============================================================================
// ---- minimal ffx_a.h fp32 portability layer -------------------------------
#define AF1 float
#define AF2 vec2
#define AF3 vec3
#define AF4 vec4
#define AU2 uvec2
#define AU4 uvec4
#define ASU2 ivec2
#define AF1_(a) float(a)
#define AF1_AU1(x) uintBitsToFloat(uint(x))
float ARcpF1(float x) { return 1.0 / x; }
float APrxMedRcpF1(float x){ return 1.0 / x; }
float ASatF1(float x) { return clamp(x, 0.0, 1.0); }
float AMin3F1(float a, float b, float c) { return min(a, min(b, c)); }
float AMax3F1(float a, float b, float c) { return max(a, max(b, c)); }
#define FSR_RCAS_LIMIT (0.25 - (1.0 / 16.0))
// ---------------------------------------------------------------------------
layout(binding = 0) uniform sampler2D InputTexture; // EASU output, output res
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0)
uvec4 con; // con.x = bit-packed sharpness (FsrRcasCon)
vec2 outputSize; // pass output size in pixels
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
AF4 FsrRcasLoadF(ASU2 p) {
ivec2 sz = textureSize(InputTexture, 0);
return texelFetch(InputTexture, clamp(p, ivec2(0), sz - ivec2(1)), 0);
}
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
void FsrRcasF(
out AF1 pixR,
out AF1 pixG,
out AF1 pixB,
AU2 ip,
AU4 con){
ASU2 sp=ASU2(ip);
AF3 b=FsrRcasLoadF(sp+ASU2( 0,-1)).rgb;
AF3 d=FsrRcasLoadF(sp+ASU2(-1, 0)).rgb;
AF3 e=FsrRcasLoadF(sp).rgb;
AF3 f=FsrRcasLoadF(sp+ASU2( 1, 0)).rgb;
AF3 h=FsrRcasLoadF(sp+ASU2( 0, 1)).rgb;
AF1 bR=b.r;
AF1 bG=b.g;
AF1 bB=b.b;
AF1 dR=d.r;
AF1 dG=d.g;
AF1 dB=d.b;
AF1 eR=e.r;
AF1 eG=e.g;
AF1 eB=e.b;
AF1 fR=f.r;
AF1 fG=f.g;
AF1 fB=f.b;
AF1 hR=h.r;
AF1 hG=h.g;
AF1 hB=h.b;
FsrRcasInputF(bR,bG,bB);
FsrRcasInputF(dR,dG,dB);
FsrRcasInputF(eR,eG,eB);
FsrRcasInputF(fR,fG,fB);
FsrRcasInputF(hR,hG,hB);
AF1 bL=bB*AF1_(0.5)+(bR*AF1_(0.5)+bG);
AF1 dL=dB*AF1_(0.5)+(dR*AF1_(0.5)+dG);
AF1 eL=eB*AF1_(0.5)+(eR*AF1_(0.5)+eG);
AF1 fL=fB*AF1_(0.5)+(fR*AF1_(0.5)+fG);
AF1 hL=hB*AF1_(0.5)+(hR*AF1_(0.5)+hG);
AF1 nz=AF1_(0.25)*bL+AF1_(0.25)*dL+AF1_(0.25)*fL+AF1_(0.25)*hL-eL;
nz=ASatF1(abs(nz)*APrxMedRcpF1(AMax3F1(AMax3F1(bL,dL,eL),fL,hL)-AMin3F1(AMin3F1(bL,dL,eL),fL,hL)));
nz=AF1_(-0.5)*nz+AF1_(1.0);
AF1 mn4R=min(AMin3F1(bR,dR,fR),hR);
AF1 mn4G=min(AMin3F1(bG,dG,fG),hG);
AF1 mn4B=min(AMin3F1(bB,dB,fB),hB);
AF1 mx4R=max(AMax3F1(bR,dR,fR),hR);
AF1 mx4G=max(AMax3F1(bG,dG,fG),hG);
AF1 mx4B=max(AMax3F1(bB,dB,fB),hB);
AF2 peakC=AF2(1.0,-1.0*4.0);
AF1 denMinR=AF1_(4.0)*mx4R;
AF1 denMinG=AF1_(4.0)*mx4G;
AF1 denMinB=AF1_(4.0)*mx4B;
AF1 denMaxR=AF1_(4.0)*mn4R+peakC.y;
AF1 denMaxG=AF1_(4.0)*mn4G+peakC.y;
AF1 denMaxB=AF1_(4.0)*mn4B+peakC.y;
AF1 hitMinR=denMinR>0.0?min(mn4R,eR)/denMinR:AF1_(0.0);
AF1 hitMinG=denMinG>0.0?min(mn4G,eG)/denMinG:AF1_(0.0);
AF1 hitMinB=denMinB>0.0?min(mn4B,eB)/denMinB:AF1_(0.0);
AF1 numMaxR=peakC.x-max(mx4R,eR);
AF1 numMaxG=peakC.x-max(mx4G,eG);
AF1 numMaxB=peakC.x-max(mx4B,eB);
AF1 hitMaxR=abs(denMaxR)>1e-6?numMaxR/denMaxR:AF1_(0.0);
AF1 hitMaxG=abs(denMaxG)>1e-6?numMaxG/denMaxG:AF1_(0.0);
AF1 hitMaxB=abs(denMaxB)>1e-6?numMaxB/denMaxB:AF1_(0.0);
AF1 lobeR=max(-hitMinR,hitMaxR);
AF1 lobeG=max(-hitMinG,hitMaxG);
AF1 lobeB=max(-hitMinB,hitMaxB);
AF1 lobe=max(AF1_(-FSR_RCAS_LIMIT),min(AMax3F1(lobeR,lobeG,lobeB),AF1_(0.0)))*AF1_AU1(con.x);
AF1 rcpL=APrxMedRcpF1(AF1_(4.0)*lobe+AF1_(1.0));
pixR=(lobe*bR+lobe*dR+lobe*hR+lobe*fR+eR)*rcpL;
pixG=(lobe*bG+lobe*dG+lobe*hG+lobe*fG+eG)*rcpL;
pixB=(lobe*bB+lobe*dB+lobe*hB+lobe*fB+eB)*rcpL;
return;}
void main() {
uvec2 ip = uvec2(fragTexCoord * pc.outputSize);
vec3 c;
FsrRcasF(c.r, c.g, c.b, ip, pc.con);
outColor = vec4(c, 1.0);
}
+463 -498
View File
@@ -1,503 +1,468 @@
// 1116.3.0
#pragma once
const uint32_t fsr_rcas_code[] = {
0x07230203,0x00010000,0x0008000b,0x0000028c,0x00000000,0x00020011,0x00000001,0x00020011,
0x07230203,0x00010000,0x0008000b,0x0000025e,0x00000000,0x00020011,0x00000001,0x00020011,
0x00000032,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,
0x00000000,0x00000001,0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000269,
0x00000286,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00070005,0x0000000a,0x78725041,0x5264654d,0x31467063,
0x3b316628,0x00000000,0x00030005,0x00000009,0x00000078,0x00050005,0x0000000d,0x74615341,
0x66283146,0x00003b31,0x00030005,0x0000000c,0x00000078,0x00070005,0x00000013,0x6e694d41,
0x28314633,0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000010,0x00000061,0x00030005,
0x00000011,0x00000062,0x00030005,0x00000012,0x00000063,0x00070005,0x00000018,0x78614d41,
0x28314633,0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000015,0x00000061,0x00030005,
0x00000016,0x00000062,0x00030005,0x00000017,0x00000063,0x00070005,0x00000020,0x52727346,
0x4c736163,0x4664616f,0x32697628,0x0000003b,0x00030005,0x0000001f,0x00000070,0x00080005,
0x00000026,0x52727346,0x49736163,0x7475706e,0x31662846,0x3b31663b,0x003b3166,0x00030005,
0x00000023,0x00000072,0x00030005,0x00000024,0x00000067,0x00030005,0x00000025,0x00000062,
0x00090005,0x00000033,0x52727346,0x46736163,0x3b316628,0x663b3166,0x75763b31,0x75763b32,
0x00003b34,0x00040005,0x0000002e,0x52786970,0x00000000,0x00040005,0x0000002f,0x47786970,
0x00000000,0x00040005,0x00000030,0x42786970,0x00000000,0x00030005,0x00000031,0x00007069,
0x00030005,0x00000032,0x006e6f63,0x00030005,0x0000004d,0x00007a73,0x00060005,0x00000051,
0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x00000062,0x00007073,0x00030005,
0x00000067,0x00000062,0x00040005,0x0000006c,0x61726170,0x0000006d,0x00030005,0x0000006f,
0x00000064,0x00040005,0x00000073,0x61726170,0x0000006d,0x00030005,0x00000076,0x00000065,
0x00040005,0x00000077,0x61726170,0x0000006d,0x00030005,0x0000007b,0x00000066,0x00040005,
0x0000007f,0x61726170,0x0000006d,0x00030005,0x00000082,0x00000068,0x00040005,0x00000086,
0x61726170,0x0000006d,0x00030005,0x00000089,0x00005262,0x00030005,0x0000008d,0x00004762,
0x00030005,0x00000091,0x00004262,0x00030005,0x00000095,0x00005264,0x00030005,0x00000098,
0x00004764,0x00030005,0x0000009b,0x00004264,0x00030005,0x0000009e,0x00005265,0x00030005,
0x000000a1,0x00004765,0x00030005,0x000000a4,0x00004265,0x00030005,0x000000a7,0x00005266,
0x00030005,0x000000aa,0x00004766,0x00030005,0x000000ad,0x00004266,0x00030005,0x000000b0,
0x00005268,0x00030005,0x000000b3,0x00004768,0x00030005,0x000000b6,0x00004268,0x00040005,
0x000000b9,0x61726170,0x0000006d,0x00040005,0x000000bb,0x61726170,0x0000006d,0x00040005,
0x000000bd,0x61726170,0x0000006d,0x00040005,0x000000c3,0x61726170,0x0000006d,0x00040005,
0x000000c5,0x61726170,0x0000006d,0x00040005,0x000000c7,0x61726170,0x0000006d,0x00040005,
0x000000cd,0x61726170,0x0000006d,0x00040005,0x000000cf,0x61726170,0x0000006d,0x00040005,
0x000000d1,0x61726170,0x0000006d,0x00040005,0x000000d7,0x61726170,0x0000006d,0x00040005,
0x000000d9,0x61726170,0x0000006d,0x00040005,0x000000db,0x61726170,0x0000006d,0x00040005,
0x000000e1,0x61726170,0x0000006d,0x00040005,0x000000e3,0x61726170,0x0000006d,0x00040005,
0x000000e5,0x61726170,0x0000006d,0x00030005,0x000000eb,0x00004c62,0x00030005,0x000000f4,
0x00004c64,0x00030005,0x000000fc,0x00004c65,0x00030005,0x00000104,0x00004c66,0x00030005,
0x0000010c,0x00004c68,0x00030005,0x00000114,0x00007a6e,0x00040005,0x00000125,0x61726170,
0x0000006d,0x00040005,0x00000127,0x61726170,0x0000006d,0x00040005,0x00000129,0x61726170,
0x0000006d,0x00040005,0x0000012c,0x61726170,0x0000006d,0x00040005,0x0000012d,0x61726170,
0x0000006d,0x00040005,0x0000012f,0x61726170,0x0000006d,0x00040005,0x00000132,0x61726170,
0x0000006d,0x00040005,0x00000134,0x61726170,0x0000006d,0x00040005,0x00000136,0x61726170,
0x0000006d,0x00040005,0x00000139,0x61726170,0x0000006d,0x00040005,0x0000013a,0x61726170,
0x0000006d,0x00040005,0x0000013c,0x61726170,0x0000006d,0x00040005,0x00000140,0x61726170,
0x0000006d,0x00040005,0x00000143,0x61726170,0x0000006d,0x00040005,0x00000149,0x52346e6d,
0x00000000,0x00040005,0x0000014a,0x61726170,0x0000006d,0x00040005,0x0000014c,0x61726170,
0x0000006d,0x00040005,0x0000014e,0x61726170,0x0000006d,0x00040005,0x00000153,0x47346e6d,
0x00000000,0x00040005,0x00000154,0x61726170,0x0000006d,0x00040005,0x00000156,0x61726170,
0x0000006d,0x00040005,0x00000158,0x61726170,0x0000006d,0x00040005,0x0000015d,0x42346e6d,
0x00000000,0x00040005,0x0000015e,0x61726170,0x0000006d,0x00040005,0x00000160,0x61726170,
0x0000006d,0x00040005,0x00000162,0x61726170,0x0000006d,0x00040005,0x00000167,0x5234786d,
0x00000000,0x00040005,0x00000168,0x61726170,0x0000006d,0x00040005,0x0000016a,0x61726170,
0x0000006d,0x00040005,0x0000016c,0x61726170,0x0000006d,0x00040005,0x00000171,0x4734786d,
0x00000000,0x00040005,0x00000172,0x61726170,0x0000006d,0x00040005,0x00000174,0x61726170,
0x0000006d,0x00040005,0x00000176,0x61726170,0x0000006d,0x00040005,0x0000017b,0x4234786d,
0x00000000,0x00040005,0x0000017c,0x61726170,0x0000006d,0x00040005,0x0000017e,0x61726170,
0x0000006d,0x00040005,0x00000180,0x61726170,0x0000006d,0x00040005,0x00000187,0x6b616570,
0x00000043,0x00040005,0x0000018a,0x4d6e6564,0x00526e69,0x00040005,0x0000018e,0x4d6e6564,
0x00476e69,0x00040005,0x00000191,0x4d6e6564,0x00426e69,0x00040005,0x00000194,0x4d6e6564,
0x00527861,0x00040005,0x0000019a,0x4d6e6564,0x00477861,0x00040005,0x000001a0,0x4d6e6564,
0x00427861,0x00040005,0x000001a6,0x4d746968,0x00526e69,0x00040005,0x000001b4,0x4d746968,
0x00476e69,0x00040005,0x000001c1,0x4d746968,0x00426e69,0x00040005,0x000001ce,0x4d6d756e,
0x00527861,0x00040005,0x000001d5,0x4d6d756e,0x00477861,0x00040005,0x000001dc,0x4d6d756e,
0x00427861,0x00040005,0x000001e3,0x4d746968,0x00527861,0x00040005,0x000001f0,0x4d746968,
0x00477861,0x00040005,0x000001fc,0x4d746968,0x00427861,0x00040005,0x00000208,0x65626f6c,
0x00000052,0x00040005,0x0000020d,0x65626f6c,0x00000047,0x00040005,0x00000212,0x65626f6c,
0x00000042,0x00040005,0x00000217,0x65626f6c,0x00000000,0x00040005,0x00000219,0x61726170,
0x0000006d,0x00040005,0x0000021b,0x61726170,0x0000006d,0x00040005,0x0000021d,0x61726170,
0x0000006d,0x00040005,0x00000227,0x4c706372,0x00000000,0x00040005,0x0000022b,0x61726170,
0x0000006d,0x00030005,0x00000267,0x00007069,0x00060005,0x00000269,0x67617266,0x43786554,
0x64726f6f,0x00000000,0x00030005,0x0000026b,0x00004350,0x00040006,0x0000026b,0x00000000,
0x0063646e,0x00040006,0x0000026b,0x00000001,0x006e6f63,0x00060006,0x0000026b,0x00000002,
0x7074756f,0x69537475,0x0000657a,0x00030005,0x0000026d,0x00006370,0x00030005,0x00000274,
0x00000063,0x00040005,0x00000275,0x61726170,0x0000006d,0x00040005,0x00000276,0x61726170,
0x0000006d,0x00040005,0x00000277,0x61726170,0x0000006d,0x00040005,0x00000278,0x61726170,
0x0000006d,0x00040005,0x0000027a,0x61726170,0x0000006d,0x00050005,0x00000286,0x4374756f,
0x726f6c6f,0x00000000,0x00040047,0x00000051,0x00000021,0x00000000,0x00040047,0x00000051,
0x00000022,0x00000000,0x00040047,0x00000269,0x0000001e,0x00000000,0x00030047,0x0000026b,
0x00000002,0x00050048,0x0000026b,0x00000000,0x00000023,0x00000000,0x00050048,0x0000026b,
0x00000001,0x00000023,0x00000010,0x00050048,0x0000026b,0x00000002,0x00000023,0x00000020,
0x00040047,0x00000286,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,
0x00000002,0x00030016,0x00000006,0x00000020,0x00040020,0x00000007,0x00000007,0x00000006,
0x00040021,0x00000008,0x00000006,0x00000007,0x00060021,0x0000000f,0x00000006,0x00000007,
0x00000007,0x00000007,0x00040015,0x0000001a,0x00000020,0x00000001,0x00040017,0x0000001b,
0x0000001a,0x00000002,0x00040020,0x0000001c,0x00000007,0x0000001b,0x00040017,0x0000001d,
0x00000006,0x00000004,0x00040021,0x0000001e,0x0000001d,0x0000001c,0x00060021,0x00000022,
0x00000002,0x00000007,0x00000007,0x00000007,0x00040015,0x00000028,0x00000020,0x00000000,
0x00040017,0x00000029,0x00000028,0x00000002,0x00040020,0x0000002a,0x00000007,0x00000029,
0x00040017,0x0000002b,0x00000028,0x00000004,0x00040020,0x0000002c,0x00000007,0x0000002b,
0x00080021,0x0000002d,0x00000002,0x00000007,0x00000007,0x00000007,0x0000002a,0x0000002c,
0x0004002b,0x00000006,0x00000035,0x3f800000,0x0004002b,0x00000006,0x0000003b,0x00000000,
0x00090019,0x0000004e,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x0003001b,0x0000004f,0x0000004e,0x00040020,0x00000050,0x00000000,0x0000004f,
0x0004003b,0x00000050,0x00000051,0x00000000,0x0004002b,0x0000001a,0x00000053,0x00000000,
0x0005002c,0x0000001b,0x00000058,0x00000053,0x00000053,0x0004002b,0x0000001a,0x0000005a,
0x00000001,0x0005002c,0x0000001b,0x0000005b,0x0000005a,0x0000005a,0x00040017,0x00000065,
0x00000006,0x00000003,0x00040020,0x00000066,0x00000007,0x00000065,0x0004002b,0x0000001a,
0x00000069,0xffffffff,0x0005002c,0x0000001b,0x0000006a,0x00000053,0x00000069,0x0005002c,
0x0000001b,0x00000071,0x00000069,0x00000053,0x0005002c,0x0000001b,0x0000007d,0x0000005a,
0x00000053,0x0005002c,0x0000001b,0x00000084,0x00000053,0x0000005a,0x0004002b,0x00000028,
0x0000008a,0x00000000,0x0004002b,0x00000028,0x0000008e,0x00000001,0x0004002b,0x00000028,
0x00000092,0x00000002,0x0004002b,0x00000006,0x000000ed,0x3f000000,0x0004002b,0x00000006,
0x00000115,0x3e800000,0x0004002b,0x00000006,0x00000145,0xbf000000,0x00040017,0x00000185,
0x00000006,0x00000002,0x00040020,0x00000186,0x00000007,0x00000185,0x0004002b,0x00000006,
0x00000188,0xc0800000,0x0005002c,0x00000185,0x00000189,0x00000035,0x00000188,0x0004002b,
0x00000006,0x0000018b,0x40800000,0x00020014,0x000001a8,0x0004002b,0x00000006,0x000001e6,
0x358637bd,0x0004002b,0x00000006,0x00000218,0xbe400000,0x00040020,0x00000222,0x00000007,
0x00000028,0x00040020,0x00000268,0x00000001,0x00000185,0x0004003b,0x00000268,0x00000269,
0x00000001,0x0005001e,0x0000026b,0x0000001d,0x0000002b,0x00000185,0x00040020,0x0000026c,
0x00000009,0x0000026b,0x0004003b,0x0000026c,0x0000026d,0x00000009,0x0004002b,0x0000001a,
0x0000026e,0x00000002,0x00040020,0x0000026f,0x00000009,0x00000185,0x00040020,0x0000027b,
0x00000009,0x0000002b,0x00040020,0x00000285,0x00000003,0x0000001d,0x0004003b,0x00000285,
0x00000286,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x0004003b,0x0000002a,0x00000267,0x00000007,0x0004003b,0x00000066,0x00000274,
0x00000007,0x0004003b,0x00000007,0x00000275,0x00000007,0x0004003b,0x00000007,0x00000276,
0x00000007,0x0004003b,0x00000007,0x00000277,0x00000007,0x0004003b,0x0000002a,0x00000278,
0x00000007,0x0004003b,0x0000002c,0x0000027a,0x00000007,0x0004003d,0x00000185,0x0000026a,
0x00000269,0x00050041,0x0000026f,0x00000270,0x0000026d,0x0000026e,0x0004003d,0x00000185,
0x00000271,0x00000270,0x00050085,0x00000185,0x00000272,0x0000026a,0x00000271,0x0004006d,
0x00000029,0x00000273,0x00000272,0x0003003e,0x00000267,0x00000273,0x0004003d,0x00000029,
0x00000279,0x00000267,0x0003003e,0x00000278,0x00000279,0x00050041,0x0000027b,0x0000027c,
0x0000026d,0x0000005a,0x0004003d,0x0000002b,0x0000027d,0x0000027c,0x0003003e,0x0000027a,
0x0000027d,0x00090039,0x00000002,0x0000027e,0x00000033,0x00000275,0x00000276,0x00000277,
0x00000278,0x0000027a,0x0004003d,0x00000006,0x0000027f,0x00000275,0x00050041,0x00000007,
0x00000280,0x00000274,0x0000008a,0x0003003e,0x00000280,0x0000027f,0x0004003d,0x00000006,
0x00000281,0x00000276,0x00050041,0x00000007,0x00000282,0x00000274,0x0000008e,0x0003003e,
0x00000282,0x00000281,0x0004003d,0x00000006,0x00000283,0x00000277,0x00050041,0x00000007,
0x00000284,0x00000274,0x00000092,0x0003003e,0x00000284,0x00000283,0x0004003d,0x00000065,
0x00000287,0x00000274,0x00050051,0x00000006,0x00000288,0x00000287,0x00000000,0x00050051,
0x00000006,0x00000289,0x00000287,0x00000001,0x00050051,0x00000006,0x0000028a,0x00000287,
0x00000002,0x00070050,0x0000001d,0x0000028b,0x00000288,0x00000289,0x0000028a,0x00000035,
0x0003003e,0x00000286,0x0000028b,0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000a,
0x00000000,0x00000008,0x00030037,0x00000007,0x00000009,0x000200f8,0x0000000b,0x0004003d,
0x00000006,0x00000036,0x00000009,0x00050088,0x00000006,0x00000037,0x00000035,0x00000036,
0x000200fe,0x00000037,0x00010038,0x00050036,0x00000006,0x0000000d,0x00000000,0x00000008,
0x00030037,0x00000007,0x0000000c,0x000200f8,0x0000000e,0x0004003d,0x00000006,0x0000003a,
0x0000000c,0x0008000c,0x00000006,0x0000003c,0x00000001,0x0000002b,0x0000003a,0x0000003b,
0x00000035,0x000200fe,0x0000003c,0x00010038,0x00050036,0x00000006,0x00000013,0x00000000,
0x0000000f,0x00030037,0x00000007,0x00000010,0x00030037,0x00000007,0x00000011,0x00030037,
0x00000007,0x00000012,0x000200f8,0x00000014,0x0004003d,0x00000006,0x0000003f,0x00000010,
0x0004003d,0x00000006,0x00000040,0x00000011,0x0004003d,0x00000006,0x00000041,0x00000012,
0x0007000c,0x00000006,0x00000042,0x00000001,0x00000025,0x00000040,0x00000041,0x0007000c,
0x00000006,0x00000043,0x00000001,0x00000025,0x0000003f,0x00000042,0x000200fe,0x00000043,
0x00010038,0x00050036,0x00000006,0x00000018,0x00000000,0x0000000f,0x00030037,0x00000007,
0x00000015,0x00030037,0x00000007,0x00000016,0x00030037,0x00000007,0x00000017,0x000200f8,
0x00000019,0x0004003d,0x00000006,0x00000046,0x00000015,0x0004003d,0x00000006,0x00000047,
0x00000016,0x0004003d,0x00000006,0x00000048,0x00000017,0x0007000c,0x00000006,0x00000049,
0x00000001,0x00000028,0x00000047,0x00000048,0x0007000c,0x00000006,0x0000004a,0x00000001,
0x00000028,0x00000046,0x00000049,0x000200fe,0x0000004a,0x00010038,0x00050036,0x0000001d,
0x00000020,0x00000000,0x0000001e,0x00030037,0x0000001c,0x0000001f,0x000200f8,0x00000021,
0x0004003b,0x0000001c,0x0000004d,0x00000007,0x0004003d,0x0000004f,0x00000052,0x00000051,
0x00040064,0x0000004e,0x00000054,0x00000052,0x00050067,0x0000001b,0x00000055,0x00000054,
0x00000053,0x0003003e,0x0000004d,0x00000055,0x0004003d,0x0000004f,0x00000056,0x00000051,
0x0004003d,0x0000001b,0x00000057,0x0000001f,0x0004003d,0x0000001b,0x00000059,0x0000004d,
0x00050082,0x0000001b,0x0000005c,0x00000059,0x0000005b,0x0008000c,0x0000001b,0x0000005d,
0x00000001,0x0000002d,0x00000057,0x00000058,0x0000005c,0x00040064,0x0000004e,0x0000005e,
0x00000056,0x0007005f,0x0000001d,0x0000005f,0x0000005e,0x0000005d,0x00000002,0x00000053,
0x000200fe,0x0000005f,0x00010038,0x00050036,0x00000002,0x00000026,0x00000000,0x00000022,
0x00030037,0x00000007,0x00000023,0x00030037,0x00000007,0x00000024,0x00030037,0x00000007,
0x00000025,0x000200f8,0x00000027,0x000100fd,0x00010038,0x00050036,0x00000002,0x00000033,
0x00000000,0x0000002d,0x00030037,0x00000007,0x0000002e,0x00030037,0x00000007,0x0000002f,
0x00030037,0x00000007,0x00000030,0x00030037,0x0000002a,0x00000031,0x00030037,0x0000002c,
0x00000032,0x000200f8,0x00000034,0x0004003b,0x0000001c,0x00000062,0x00000007,0x0004003b,
0x00000066,0x00000067,0x00000007,0x0004003b,0x0000001c,0x0000006c,0x00000007,0x0004003b,
0x00000066,0x0000006f,0x00000007,0x0004003b,0x0000001c,0x00000073,0x00000007,0x0004003b,
0x00000066,0x00000076,0x00000007,0x0004003b,0x0000001c,0x00000077,0x00000007,0x0004003b,
0x00000066,0x0000007b,0x00000007,0x0004003b,0x0000001c,0x0000007f,0x00000007,0x0004003b,
0x00000066,0x00000082,0x00000007,0x0004003b,0x0000001c,0x00000086,0x00000007,0x0004003b,
0x00000007,0x00000089,0x00000007,0x0004003b,0x00000007,0x0000008d,0x00000007,0x0004003b,
0x00000007,0x00000091,0x00000007,0x0004003b,0x00000007,0x00000095,0x00000007,0x0004003b,
0x00000007,0x00000098,0x00000007,0x0004003b,0x00000007,0x0000009b,0x00000007,0x0004003b,
0x00000007,0x0000009e,0x00000007,0x0004003b,0x00000007,0x000000a1,0x00000007,0x0004003b,
0x00000007,0x000000a4,0x00000007,0x0004003b,0x00000007,0x000000a7,0x00000007,0x0004003b,
0x00000007,0x000000aa,0x00000007,0x0004003b,0x00000007,0x000000ad,0x00000007,0x0004003b,
0x00000007,0x000000b0,0x00000007,0x0004003b,0x00000007,0x000000b3,0x00000007,0x0004003b,
0x00000007,0x000000b6,0x00000007,0x0004003b,0x00000007,0x000000b9,0x00000007,0x0004003b,
0x00000007,0x000000bb,0x00000007,0x0004003b,0x00000007,0x000000bd,0x00000007,0x0004003b,
0x00000007,0x000000c3,0x00000007,0x0004003b,0x00000007,0x000000c5,0x00000007,0x0004003b,
0x00000007,0x000000c7,0x00000007,0x0004003b,0x00000007,0x000000cd,0x00000007,0x0004003b,
0x00000007,0x000000cf,0x00000007,0x0004003b,0x00000007,0x000000d1,0x00000007,0x0004003b,
0x00000007,0x000000d7,0x00000007,0x0004003b,0x00000007,0x000000d9,0x00000007,0x0004003b,
0x00000007,0x000000db,0x00000007,0x0004003b,0x00000007,0x000000e1,0x00000007,0x0004003b,
0x00000007,0x000000e3,0x00000007,0x0004003b,0x00000007,0x000000e5,0x00000007,0x0004003b,
0x00000007,0x000000eb,0x00000007,0x0004003b,0x00000007,0x000000f4,0x00000007,0x0004003b,
0x00000007,0x000000fc,0x00000007,0x0004003b,0x00000007,0x00000104,0x00000007,0x0004003b,
0x00000007,0x0000010c,0x00000007,0x0004003b,0x00000007,0x00000114,0x00000007,0x0004003b,
0x00000007,0x00000125,0x00000007,0x0004003b,0x00000007,0x00000127,0x00000007,0x0004003b,
0x00000007,0x00000129,0x00000007,0x0004003b,0x00000007,0x0000012c,0x00000007,0x0004003b,
0x00000007,0x0000012d,0x00000007,0x0004003b,0x00000007,0x0000012f,0x00000007,0x0004003b,
0x00000007,0x00000132,0x00000007,0x0004003b,0x00000007,0x00000134,0x00000007,0x0004003b,
0x00000000,0x00000001,0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000023b,
0x00000258,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00050005,0x0000000a,0x70635241,0x66283146,0x00003b31,
0x00030005,0x00000009,0x00000078,0x00070005,0x0000000d,0x78725041,0x5264654d,0x31467063,
0x3b316628,0x00000000,0x00030005,0x0000000c,0x00000078,0x00050005,0x00000010,0x74615341,
0x66283146,0x00003b31,0x00030005,0x0000000f,0x00000078,0x00070005,0x00000016,0x6e694d41,
0x28314633,0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000013,0x00000061,0x00030005,
0x00000014,0x00000062,0x00030005,0x00000015,0x00000063,0x00070005,0x0000001b,0x78614d41,
0x28314633,0x663b3166,0x31663b31,0x0000003b,0x00030005,0x00000018,0x00000061,0x00030005,
0x00000019,0x00000062,0x00030005,0x0000001a,0x00000063,0x00070005,0x00000023,0x52727346,
0x4c736163,0x4664616f,0x32697628,0x0000003b,0x00030005,0x00000022,0x00000070,0x00080005,
0x00000029,0x52727346,0x49736163,0x7475706e,0x31662846,0x3b31663b,0x003b3166,0x00030005,
0x00000026,0x00000072,0x00030005,0x00000027,0x00000067,0x00030005,0x00000028,0x00000062,
0x00090005,0x00000036,0x52727346,0x46736163,0x3b316628,0x663b3166,0x75763b31,0x75763b32,
0x00003b34,0x00040005,0x00000031,0x52786970,0x00000000,0x00040005,0x00000032,0x47786970,
0x00000000,0x00040005,0x00000033,0x42786970,0x00000000,0x00030005,0x00000034,0x00007069,
0x00030005,0x00000035,0x006e6f63,0x00030005,0x00000054,0x00007a73,0x00060005,0x00000058,
0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x00000069,0x00007073,0x00030005,
0x0000006e,0x00000062,0x00040005,0x00000073,0x61726170,0x0000006d,0x00030005,0x00000076,
0x00000064,0x00040005,0x0000007a,0x61726170,0x0000006d,0x00030005,0x0000007d,0x00000065,
0x00040005,0x0000007e,0x61726170,0x0000006d,0x00030005,0x00000082,0x00000066,0x00040005,
0x00000086,0x61726170,0x0000006d,0x00030005,0x00000089,0x00000068,0x00040005,0x0000008d,
0x61726170,0x0000006d,0x00030005,0x00000090,0x00005262,0x00030005,0x00000094,0x00004762,
0x00030005,0x00000098,0x00004262,0x00030005,0x0000009c,0x00005264,0x00030005,0x0000009f,
0x00004764,0x00030005,0x000000a2,0x00004264,0x00030005,0x000000a5,0x00005265,0x00030005,
0x000000a8,0x00004765,0x00030005,0x000000ab,0x00004265,0x00030005,0x000000ae,0x00005266,
0x00030005,0x000000b1,0x00004766,0x00030005,0x000000b4,0x00004266,0x00030005,0x000000b7,
0x00005268,0x00030005,0x000000ba,0x00004768,0x00030005,0x000000bd,0x00004268,0x00040005,
0x000000c0,0x61726170,0x0000006d,0x00040005,0x000000c2,0x61726170,0x0000006d,0x00040005,
0x000000c4,0x61726170,0x0000006d,0x00040005,0x000000ca,0x61726170,0x0000006d,0x00040005,
0x000000cc,0x61726170,0x0000006d,0x00040005,0x000000ce,0x61726170,0x0000006d,0x00040005,
0x000000d4,0x61726170,0x0000006d,0x00040005,0x000000d6,0x61726170,0x0000006d,0x00040005,
0x000000d8,0x61726170,0x0000006d,0x00040005,0x000000de,0x61726170,0x0000006d,0x00040005,
0x000000e0,0x61726170,0x0000006d,0x00040005,0x000000e2,0x61726170,0x0000006d,0x00040005,
0x000000e8,0x61726170,0x0000006d,0x00040005,0x000000ea,0x61726170,0x0000006d,0x00040005,
0x000000ec,0x61726170,0x0000006d,0x00030005,0x000000f2,0x00004c62,0x00030005,0x000000fb,
0x00004c64,0x00030005,0x00000103,0x00004c65,0x00030005,0x0000010b,0x00004c66,0x00030005,
0x00000113,0x00004c68,0x00030005,0x0000011b,0x00007a6e,0x00040005,0x0000012c,0x61726170,
0x0000006d,0x00040005,0x0000012e,0x61726170,0x0000006d,0x00040005,0x00000130,0x61726170,
0x0000006d,0x00040005,0x00000133,0x61726170,0x0000006d,0x00040005,0x00000134,0x61726170,
0x0000006d,0x00040005,0x00000136,0x61726170,0x0000006d,0x00040005,0x00000139,0x61726170,
0x0000006d,0x00040005,0x0000013b,0x61726170,0x0000006d,0x00040005,0x0000013d,0x61726170,
0x0000006d,0x00040005,0x00000140,0x61726170,0x0000006d,0x00040005,0x00000141,0x61726170,
0x0000006d,0x00040005,0x00000143,0x61726170,0x0000006d,0x00040005,0x00000147,0x61726170,
0x0000006d,0x00040005,0x0000014a,0x61726170,0x0000006d,0x00040005,0x00000150,0x52346e6d,
0x00000000,0x00040005,0x00000151,0x61726170,0x0000006d,0x00040005,0x00000153,0x61726170,
0x0000006d,0x00040005,0x00000155,0x61726170,0x0000006d,0x00040005,0x0000015a,0x47346e6d,
0x00000000,0x00040005,0x0000015b,0x61726170,0x0000006d,0x00040005,0x0000015d,0x61726170,
0x0000006d,0x00040005,0x0000015f,0x61726170,0x0000006d,0x00040005,0x00000164,0x42346e6d,
0x00000000,0x00040005,0x00000165,0x61726170,0x0000006d,0x00040005,0x00000167,0x61726170,
0x0000006d,0x00040005,0x00000169,0x61726170,0x0000006d,0x00040005,0x0000016e,0x5234786d,
0x00000000,0x00040005,0x0000016f,0x61726170,0x0000006d,0x00040005,0x00000171,0x61726170,
0x0000006d,0x00040005,0x00000173,0x61726170,0x0000006d,0x00040005,0x00000178,0x4734786d,
0x00000000,0x00040005,0x00000179,0x61726170,0x0000006d,0x00040005,0x0000017b,0x61726170,
0x0000006d,0x00040005,0x0000017d,0x61726170,0x0000006d,0x00040005,0x00000182,0x4234786d,
0x00000000,0x00040005,0x00000183,0x61726170,0x0000006d,0x00040005,0x00000185,0x61726170,
0x0000006d,0x00040005,0x00000187,0x61726170,0x0000006d,0x00040005,0x0000018e,0x6b616570,
0x00000043,0x00040005,0x00000191,0x4d746968,0x00526e69,0x00040005,0x00000198,0x61726170,
0x0000006d,0x00040005,0x0000019b,0x4d746968,0x00476e69,0x00040005,0x000001a1,0x61726170,
0x0000006d,0x00040005,0x000001a4,0x4d746968,0x00426e69,0x00040005,0x000001aa,0x61726170,
0x0000006d,0x00040005,0x000001ad,0x4d746968,0x00527861,0x00040005,0x000001b9,0x61726170,
0x0000006d,0x00040005,0x000001bc,0x4d746968,0x00477861,0x00040005,0x000001c8,0x61726170,
0x0000006d,0x00040005,0x000001cb,0x4d746968,0x00427861,0x00040005,0x000001d7,0x61726170,
0x0000006d,0x00040005,0x000001da,0x65626f6c,0x00000052,0x00040005,0x000001df,0x65626f6c,
0x00000047,0x00040005,0x000001e4,0x65626f6c,0x00000042,0x00040005,0x000001e9,0x65626f6c,
0x00000000,0x00040005,0x000001eb,0x61726170,0x0000006d,0x00040005,0x000001ed,0x61726170,
0x0000006d,0x00040005,0x000001ef,0x61726170,0x0000006d,0x00040005,0x000001f9,0x4c706372,
0x00000000,0x00040005,0x000001fd,0x61726170,0x0000006d,0x00030005,0x00000239,0x00007069,
0x00060005,0x0000023b,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00030005,0x0000023d,
0x00004350,0x00040006,0x0000023d,0x00000000,0x0063646e,0x00040006,0x0000023d,0x00000001,
0x006e6f63,0x00060006,0x0000023d,0x00000002,0x7074756f,0x69537475,0x0000657a,0x00030005,
0x0000023f,0x00006370,0x00030005,0x00000246,0x00000063,0x00040005,0x00000247,0x61726170,
0x0000006d,0x00040005,0x00000248,0x61726170,0x0000006d,0x00040005,0x00000249,0x61726170,
0x0000006d,0x00040005,0x0000024a,0x61726170,0x0000006d,0x00040005,0x0000024c,0x61726170,
0x0000006d,0x00050005,0x00000258,0x4374756f,0x726f6c6f,0x00000000,0x00040047,0x00000058,
0x00000021,0x00000000,0x00040047,0x00000058,0x00000022,0x00000000,0x00040047,0x0000023b,
0x0000001e,0x00000000,0x00030047,0x0000023d,0x00000002,0x00050048,0x0000023d,0x00000000,
0x00000023,0x00000000,0x00050048,0x0000023d,0x00000001,0x00000023,0x00000010,0x00050048,
0x0000023d,0x00000002,0x00000023,0x00000020,0x00040047,0x00000258,0x0000001e,0x00000000,
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x00040020,0x00000007,0x00000007,0x00000006,0x00040021,0x00000008,0x00000006,0x00000007,
0x00060021,0x00000012,0x00000006,0x00000007,0x00000007,0x00000007,0x00040015,0x0000001d,
0x00000020,0x00000001,0x00040017,0x0000001e,0x0000001d,0x00000002,0x00040020,0x0000001f,
0x00000007,0x0000001e,0x00040017,0x00000020,0x00000006,0x00000004,0x00040021,0x00000021,
0x00000020,0x0000001f,0x00060021,0x00000025,0x00000002,0x00000007,0x00000007,0x00000007,
0x00040015,0x0000002b,0x00000020,0x00000000,0x00040017,0x0000002c,0x0000002b,0x00000002,
0x00040020,0x0000002d,0x00000007,0x0000002c,0x00040017,0x0000002e,0x0000002b,0x00000004,
0x00040020,0x0000002f,0x00000007,0x0000002e,0x00080021,0x00000030,0x00000002,0x00000007,
0x00000007,0x00000007,0x0000002d,0x0000002f,0x0004002b,0x00000006,0x00000038,0x3f800000,
0x0004002b,0x00000006,0x00000042,0x00000000,0x00090019,0x00000055,0x00000006,0x00000001,
0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000056,0x00000055,
0x00040020,0x00000057,0x00000000,0x00000056,0x0004003b,0x00000057,0x00000058,0x00000000,
0x0004002b,0x0000001d,0x0000005a,0x00000000,0x0005002c,0x0000001e,0x0000005f,0x0000005a,
0x0000005a,0x0004002b,0x0000001d,0x00000061,0x00000001,0x0005002c,0x0000001e,0x00000062,
0x00000061,0x00000061,0x00040017,0x0000006c,0x00000006,0x00000003,0x00040020,0x0000006d,
0x00000007,0x0000006c,0x0004002b,0x0000001d,0x00000070,0xffffffff,0x0005002c,0x0000001e,
0x00000071,0x0000005a,0x00000070,0x0005002c,0x0000001e,0x00000078,0x00000070,0x0000005a,
0x0005002c,0x0000001e,0x00000084,0x00000061,0x0000005a,0x0005002c,0x0000001e,0x0000008b,
0x0000005a,0x00000061,0x0004002b,0x0000002b,0x00000091,0x00000000,0x0004002b,0x0000002b,
0x00000095,0x00000001,0x0004002b,0x0000002b,0x00000099,0x00000002,0x0004002b,0x00000006,
0x000000f4,0x3f000000,0x0004002b,0x00000006,0x0000011c,0x3e800000,0x0004002b,0x00000006,
0x0000014c,0xbf000000,0x00040017,0x0000018c,0x00000006,0x00000002,0x00040020,0x0000018d,
0x00000007,0x0000018c,0x0004002b,0x00000006,0x0000018f,0xc0800000,0x0005002c,0x0000018c,
0x00000190,0x00000038,0x0000018f,0x0004002b,0x00000006,0x00000195,0x40800000,0x0004002b,
0x00000006,0x000001ea,0xbe400000,0x00040020,0x000001f4,0x00000007,0x0000002b,0x00040020,
0x0000023a,0x00000001,0x0000018c,0x0004003b,0x0000023a,0x0000023b,0x00000001,0x0005001e,
0x0000023d,0x00000020,0x0000002e,0x0000018c,0x00040020,0x0000023e,0x00000009,0x0000023d,
0x0004003b,0x0000023e,0x0000023f,0x00000009,0x0004002b,0x0000001d,0x00000240,0x00000002,
0x00040020,0x00000241,0x00000009,0x0000018c,0x00040020,0x0000024d,0x00000009,0x0000002e,
0x00040020,0x00000257,0x00000003,0x00000020,0x0004003b,0x00000257,0x00000258,0x00000003,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,
0x0000002d,0x00000239,0x00000007,0x0004003b,0x0000006d,0x00000246,0x00000007,0x0004003b,
0x00000007,0x00000247,0x00000007,0x0004003b,0x00000007,0x00000248,0x00000007,0x0004003b,
0x00000007,0x00000249,0x00000007,0x0004003b,0x0000002d,0x0000024a,0x00000007,0x0004003b,
0x0000002f,0x0000024c,0x00000007,0x0004003d,0x0000018c,0x0000023c,0x0000023b,0x00050041,
0x00000241,0x00000242,0x0000023f,0x00000240,0x0004003d,0x0000018c,0x00000243,0x00000242,
0x00050085,0x0000018c,0x00000244,0x0000023c,0x00000243,0x0004006d,0x0000002c,0x00000245,
0x00000244,0x0003003e,0x00000239,0x00000245,0x0004003d,0x0000002c,0x0000024b,0x00000239,
0x0003003e,0x0000024a,0x0000024b,0x00050041,0x0000024d,0x0000024e,0x0000023f,0x00000061,
0x0004003d,0x0000002e,0x0000024f,0x0000024e,0x0003003e,0x0000024c,0x0000024f,0x00090039,
0x00000002,0x00000250,0x00000036,0x00000247,0x00000248,0x00000249,0x0000024a,0x0000024c,
0x0004003d,0x00000006,0x00000251,0x00000247,0x00050041,0x00000007,0x00000252,0x00000246,
0x00000091,0x0003003e,0x00000252,0x00000251,0x0004003d,0x00000006,0x00000253,0x00000248,
0x00050041,0x00000007,0x00000254,0x00000246,0x00000095,0x0003003e,0x00000254,0x00000253,
0x0004003d,0x00000006,0x00000255,0x00000249,0x00050041,0x00000007,0x00000256,0x00000246,
0x00000099,0x0003003e,0x00000256,0x00000255,0x0004003d,0x0000006c,0x00000259,0x00000246,
0x00050051,0x00000006,0x0000025a,0x00000259,0x00000000,0x00050051,0x00000006,0x0000025b,
0x00000259,0x00000001,0x00050051,0x00000006,0x0000025c,0x00000259,0x00000002,0x00070050,
0x00000020,0x0000025d,0x0000025a,0x0000025b,0x0000025c,0x00000038,0x0003003e,0x00000258,
0x0000025d,0x000100fd,0x00010038,0x00050036,0x00000006,0x0000000a,0x00000000,0x00000008,
0x00030037,0x00000007,0x00000009,0x000200f8,0x0000000b,0x0004003d,0x00000006,0x00000039,
0x00000009,0x00050088,0x00000006,0x0000003a,0x00000038,0x00000039,0x000200fe,0x0000003a,
0x00010038,0x00050036,0x00000006,0x0000000d,0x00000000,0x00000008,0x00030037,0x00000007,
0x0000000c,0x000200f8,0x0000000e,0x0004003d,0x00000006,0x0000003d,0x0000000c,0x00050088,
0x00000006,0x0000003e,0x00000038,0x0000003d,0x000200fe,0x0000003e,0x00010038,0x00050036,
0x00000006,0x00000010,0x00000000,0x00000008,0x00030037,0x00000007,0x0000000f,0x000200f8,
0x00000011,0x0004003d,0x00000006,0x00000041,0x0000000f,0x0008000c,0x00000006,0x00000043,
0x00000001,0x0000002b,0x00000041,0x00000042,0x00000038,0x000200fe,0x00000043,0x00010038,
0x00050036,0x00000006,0x00000016,0x00000000,0x00000012,0x00030037,0x00000007,0x00000013,
0x00030037,0x00000007,0x00000014,0x00030037,0x00000007,0x00000015,0x000200f8,0x00000017,
0x0004003d,0x00000006,0x00000046,0x00000013,0x0004003d,0x00000006,0x00000047,0x00000014,
0x0004003d,0x00000006,0x00000048,0x00000015,0x0007000c,0x00000006,0x00000049,0x00000001,
0x00000025,0x00000047,0x00000048,0x0007000c,0x00000006,0x0000004a,0x00000001,0x00000025,
0x00000046,0x00000049,0x000200fe,0x0000004a,0x00010038,0x00050036,0x00000006,0x0000001b,
0x00000000,0x00000012,0x00030037,0x00000007,0x00000018,0x00030037,0x00000007,0x00000019,
0x00030037,0x00000007,0x0000001a,0x000200f8,0x0000001c,0x0004003d,0x00000006,0x0000004d,
0x00000018,0x0004003d,0x00000006,0x0000004e,0x00000019,0x0004003d,0x00000006,0x0000004f,
0x0000001a,0x0007000c,0x00000006,0x00000050,0x00000001,0x00000028,0x0000004e,0x0000004f,
0x0007000c,0x00000006,0x00000051,0x00000001,0x00000028,0x0000004d,0x00000050,0x000200fe,
0x00000051,0x00010038,0x00050036,0x00000020,0x00000023,0x00000000,0x00000021,0x00030037,
0x0000001f,0x00000022,0x000200f8,0x00000024,0x0004003b,0x0000001f,0x00000054,0x00000007,
0x0004003d,0x00000056,0x00000059,0x00000058,0x00040064,0x00000055,0x0000005b,0x00000059,
0x00050067,0x0000001e,0x0000005c,0x0000005b,0x0000005a,0x0003003e,0x00000054,0x0000005c,
0x0004003d,0x00000056,0x0000005d,0x00000058,0x0004003d,0x0000001e,0x0000005e,0x00000022,
0x0004003d,0x0000001e,0x00000060,0x00000054,0x00050082,0x0000001e,0x00000063,0x00000060,
0x00000062,0x0008000c,0x0000001e,0x00000064,0x00000001,0x0000002d,0x0000005e,0x0000005f,
0x00000063,0x00040064,0x00000055,0x00000065,0x0000005d,0x0007005f,0x00000020,0x00000066,
0x00000065,0x00000064,0x00000002,0x0000005a,0x000200fe,0x00000066,0x00010038,0x00050036,
0x00000002,0x00000029,0x00000000,0x00000025,0x00030037,0x00000007,0x00000026,0x00030037,
0x00000007,0x00000027,0x00030037,0x00000007,0x00000028,0x000200f8,0x0000002a,0x000100fd,
0x00010038,0x00050036,0x00000002,0x00000036,0x00000000,0x00000030,0x00030037,0x00000007,
0x00000031,0x00030037,0x00000007,0x00000032,0x00030037,0x00000007,0x00000033,0x00030037,
0x0000002d,0x00000034,0x00030037,0x0000002f,0x00000035,0x000200f8,0x00000037,0x0004003b,
0x0000001f,0x00000069,0x00000007,0x0004003b,0x0000006d,0x0000006e,0x00000007,0x0004003b,
0x0000001f,0x00000073,0x00000007,0x0004003b,0x0000006d,0x00000076,0x00000007,0x0004003b,
0x0000001f,0x0000007a,0x00000007,0x0004003b,0x0000006d,0x0000007d,0x00000007,0x0004003b,
0x0000001f,0x0000007e,0x00000007,0x0004003b,0x0000006d,0x00000082,0x00000007,0x0004003b,
0x0000001f,0x00000086,0x00000007,0x0004003b,0x0000006d,0x00000089,0x00000007,0x0004003b,
0x0000001f,0x0000008d,0x00000007,0x0004003b,0x00000007,0x00000090,0x00000007,0x0004003b,
0x00000007,0x00000094,0x00000007,0x0004003b,0x00000007,0x00000098,0x00000007,0x0004003b,
0x00000007,0x0000009c,0x00000007,0x0004003b,0x00000007,0x0000009f,0x00000007,0x0004003b,
0x00000007,0x000000a2,0x00000007,0x0004003b,0x00000007,0x000000a5,0x00000007,0x0004003b,
0x00000007,0x000000a8,0x00000007,0x0004003b,0x00000007,0x000000ab,0x00000007,0x0004003b,
0x00000007,0x000000ae,0x00000007,0x0004003b,0x00000007,0x000000b1,0x00000007,0x0004003b,
0x00000007,0x000000b4,0x00000007,0x0004003b,0x00000007,0x000000b7,0x00000007,0x0004003b,
0x00000007,0x000000ba,0x00000007,0x0004003b,0x00000007,0x000000bd,0x00000007,0x0004003b,
0x00000007,0x000000c0,0x00000007,0x0004003b,0x00000007,0x000000c2,0x00000007,0x0004003b,
0x00000007,0x000000c4,0x00000007,0x0004003b,0x00000007,0x000000ca,0x00000007,0x0004003b,
0x00000007,0x000000cc,0x00000007,0x0004003b,0x00000007,0x000000ce,0x00000007,0x0004003b,
0x00000007,0x000000d4,0x00000007,0x0004003b,0x00000007,0x000000d6,0x00000007,0x0004003b,
0x00000007,0x000000d8,0x00000007,0x0004003b,0x00000007,0x000000de,0x00000007,0x0004003b,
0x00000007,0x000000e0,0x00000007,0x0004003b,0x00000007,0x000000e2,0x00000007,0x0004003b,
0x00000007,0x000000e8,0x00000007,0x0004003b,0x00000007,0x000000ea,0x00000007,0x0004003b,
0x00000007,0x000000ec,0x00000007,0x0004003b,0x00000007,0x000000f2,0x00000007,0x0004003b,
0x00000007,0x000000fb,0x00000007,0x0004003b,0x00000007,0x00000103,0x00000007,0x0004003b,
0x00000007,0x0000010b,0x00000007,0x0004003b,0x00000007,0x00000113,0x00000007,0x0004003b,
0x00000007,0x0000011b,0x00000007,0x0004003b,0x00000007,0x0000012c,0x00000007,0x0004003b,
0x00000007,0x0000012e,0x00000007,0x0004003b,0x00000007,0x00000130,0x00000007,0x0004003b,
0x00000007,0x00000133,0x00000007,0x0004003b,0x00000007,0x00000134,0x00000007,0x0004003b,
0x00000007,0x00000136,0x00000007,0x0004003b,0x00000007,0x00000139,0x00000007,0x0004003b,
0x00000007,0x0000013a,0x00000007,0x0004003b,0x00000007,0x0000013c,0x00000007,0x0004003b,
0x00000007,0x00000140,0x00000007,0x0004003b,0x00000007,0x00000143,0x00000007,0x0004003b,
0x00000007,0x00000149,0x00000007,0x0004003b,0x00000007,0x0000014a,0x00000007,0x0004003b,
0x00000007,0x0000014c,0x00000007,0x0004003b,0x00000007,0x0000014e,0x00000007,0x0004003b,
0x00000007,0x00000153,0x00000007,0x0004003b,0x00000007,0x00000154,0x00000007,0x0004003b,
0x00000007,0x00000156,0x00000007,0x0004003b,0x00000007,0x00000158,0x00000007,0x0004003b,
0x00000007,0x0000015d,0x00000007,0x0004003b,0x00000007,0x0000015e,0x00000007,0x0004003b,
0x00000007,0x00000160,0x00000007,0x0004003b,0x00000007,0x00000162,0x00000007,0x0004003b,
0x00000007,0x00000167,0x00000007,0x0004003b,0x00000007,0x00000168,0x00000007,0x0004003b,
0x00000007,0x0000016a,0x00000007,0x0004003b,0x00000007,0x0000016c,0x00000007,0x0004003b,
0x00000007,0x00000171,0x00000007,0x0004003b,0x00000007,0x00000172,0x00000007,0x0004003b,
0x00000007,0x00000174,0x00000007,0x0004003b,0x00000007,0x00000176,0x00000007,0x0004003b,
0x00000007,0x0000017b,0x00000007,0x0004003b,0x00000007,0x0000017c,0x00000007,0x0004003b,
0x00000007,0x0000017e,0x00000007,0x0004003b,0x00000007,0x00000180,0x00000007,0x0004003b,
0x00000186,0x00000187,0x00000007,0x0004003b,0x00000007,0x0000018a,0x00000007,0x0004003b,
0x00000007,0x0000018e,0x00000007,0x0004003b,0x00000007,0x00000191,0x00000007,0x0004003b,
0x00000007,0x00000194,0x00000007,0x0004003b,0x00000007,0x0000019a,0x00000007,0x0004003b,
0x00000007,0x000001a0,0x00000007,0x0004003b,0x00000007,0x000001a6,0x00000007,0x0004003b,
0x00000007,0x000001aa,0x00000007,0x0004003b,0x00000007,0x000001b4,0x00000007,0x0004003b,
0x00000007,0x000001b7,0x00000007,0x0004003b,0x00000007,0x000001c1,0x00000007,0x0004003b,
0x00000007,0x000001c4,0x00000007,0x0004003b,0x00000007,0x000001ce,0x00000007,0x0004003b,
0x00000007,0x000001d5,0x00000007,0x0004003b,0x00000007,0x000001dc,0x00000007,0x0004003b,
0x00000007,0x000001e3,0x00000007,0x0004003b,0x00000007,0x000001e8,0x00000007,0x0004003b,
0x00000007,0x000001f0,0x00000007,0x0004003b,0x00000007,0x000001f4,0x00000007,0x0004003b,
0x00000007,0x000001fc,0x00000007,0x0004003b,0x00000007,0x00000200,0x00000007,0x0004003b,
0x00000007,0x00000208,0x00000007,0x0004003b,0x00000007,0x0000020d,0x00000007,0x0004003b,
0x00000007,0x00000212,0x00000007,0x0004003b,0x00000007,0x00000217,0x00000007,0x0004003b,
0x00000007,0x00000219,0x00000007,0x0004003b,0x00000007,0x0000021b,0x00000007,0x0004003b,
0x00000007,0x0000021d,0x00000007,0x0004003b,0x00000007,0x00000227,0x00000007,0x0004003b,
0x00000007,0x0000022b,0x00000007,0x0004003d,0x00000029,0x00000063,0x00000031,0x0004007c,
0x0000001b,0x00000064,0x00000063,0x0003003e,0x00000062,0x00000064,0x0004003d,0x0000001b,
0x00000068,0x00000062,0x00050080,0x0000001b,0x0000006b,0x00000068,0x0000006a,0x0003003e,
0x0000006c,0x0000006b,0x00050039,0x0000001d,0x0000006d,0x00000020,0x0000006c,0x0008004f,
0x00000065,0x0000006e,0x0000006d,0x0000006d,0x00000000,0x00000001,0x00000002,0x0003003e,
0x00000067,0x0000006e,0x0004003d,0x0000001b,0x00000070,0x00000062,0x00050080,0x0000001b,
0x00000072,0x00000070,0x00000071,0x0003003e,0x00000073,0x00000072,0x00050039,0x0000001d,
0x00000074,0x00000020,0x00000073,0x0008004f,0x00000065,0x00000075,0x00000074,0x00000074,
0x00000000,0x00000001,0x00000002,0x0003003e,0x0000006f,0x00000075,0x0004003d,0x0000001b,
0x00000078,0x00000062,0x0003003e,0x00000077,0x00000078,0x00050039,0x0000001d,0x00000079,
0x00000020,0x00000077,0x0008004f,0x00000065,0x0000007a,0x00000079,0x00000079,0x00000000,
0x00000001,0x00000002,0x0003003e,0x00000076,0x0000007a,0x0004003d,0x0000001b,0x0000007c,
0x00000062,0x00050080,0x0000001b,0x0000007e,0x0000007c,0x0000007d,0x0003003e,0x0000007f,
0x0000007e,0x00050039,0x0000001d,0x00000080,0x00000020,0x0000007f,0x0008004f,0x00000065,
0x00000081,0x00000080,0x00000080,0x00000000,0x00000001,0x00000002,0x0003003e,0x0000007b,
0x00000081,0x0004003d,0x0000001b,0x00000083,0x00000062,0x00050080,0x0000001b,0x00000085,
0x00000083,0x00000084,0x0003003e,0x00000086,0x00000085,0x00050039,0x0000001d,0x00000087,
0x00000020,0x00000086,0x0008004f,0x00000065,0x00000088,0x00000087,0x00000087,0x00000000,
0x00000001,0x00000002,0x0003003e,0x00000082,0x00000088,0x00050041,0x00000007,0x0000008b,
0x00000067,0x0000008a,0x0004003d,0x00000006,0x0000008c,0x0000008b,0x0003003e,0x00000089,
0x0000008c,0x00050041,0x00000007,0x0000008f,0x00000067,0x0000008e,0x0004003d,0x00000006,
0x00000090,0x0000008f,0x0003003e,0x0000008d,0x00000090,0x00050041,0x00000007,0x00000093,
0x00000067,0x00000092,0x0004003d,0x00000006,0x00000094,0x00000093,0x0003003e,0x00000091,
0x00000094,0x00050041,0x00000007,0x00000096,0x0000006f,0x0000008a,0x0004003d,0x00000006,
0x00000097,0x00000096,0x0003003e,0x00000095,0x00000097,0x00050041,0x00000007,0x00000099,
0x0000006f,0x0000008e,0x0004003d,0x00000006,0x0000009a,0x00000099,0x0003003e,0x00000098,
0x0000009a,0x00050041,0x00000007,0x0000009c,0x0000006f,0x00000092,0x0004003d,0x00000006,
0x0000009d,0x0000009c,0x0003003e,0x0000009b,0x0000009d,0x00050041,0x00000007,0x0000009f,
0x00000076,0x0000008a,0x0004003d,0x00000006,0x000000a0,0x0000009f,0x0003003e,0x0000009e,
0x000000a0,0x00050041,0x00000007,0x000000a2,0x00000076,0x0000008e,0x0004003d,0x00000006,
0x000000a3,0x000000a2,0x0003003e,0x000000a1,0x000000a3,0x00050041,0x00000007,0x000000a5,
0x00000076,0x00000092,0x0004003d,0x00000006,0x000000a6,0x000000a5,0x0003003e,0x000000a4,
0x000000a6,0x00050041,0x00000007,0x000000a8,0x0000007b,0x0000008a,0x0004003d,0x00000006,
0x000000a9,0x000000a8,0x0003003e,0x000000a7,0x000000a9,0x00050041,0x00000007,0x000000ab,
0x0000007b,0x0000008e,0x0004003d,0x00000006,0x000000ac,0x000000ab,0x0003003e,0x000000aa,
0x000000ac,0x00050041,0x00000007,0x000000ae,0x0000007b,0x00000092,0x0004003d,0x00000006,
0x000000af,0x000000ae,0x0003003e,0x000000ad,0x000000af,0x00050041,0x00000007,0x000000b1,
0x00000082,0x0000008a,0x0004003d,0x00000006,0x000000b2,0x000000b1,0x0003003e,0x000000b0,
0x000000b2,0x00050041,0x00000007,0x000000b4,0x00000082,0x0000008e,0x0004003d,0x00000006,
0x000000b5,0x000000b4,0x0003003e,0x000000b3,0x000000b5,0x00050041,0x00000007,0x000000b7,
0x00000082,0x00000092,0x0004003d,0x00000006,0x000000b8,0x000000b7,0x0003003e,0x000000b6,
0x000000b8,0x0004003d,0x00000006,0x000000ba,0x00000089,0x0003003e,0x000000b9,0x000000ba,
0x0004003d,0x00000006,0x000000bc,0x0000008d,0x0003003e,0x000000bb,0x000000bc,0x0004003d,
0x00000006,0x000000be,0x00000091,0x0003003e,0x000000bd,0x000000be,0x00070039,0x00000002,
0x000000bf,0x00000026,0x000000b9,0x000000bb,0x000000bd,0x0004003d,0x00000006,0x000000c0,
0x000000b9,0x0003003e,0x00000089,0x000000c0,0x0004003d,0x00000006,0x000000c1,0x000000bb,
0x0003003e,0x0000008d,0x000000c1,0x0004003d,0x00000006,0x000000c2,0x000000bd,0x0003003e,
0x00000091,0x000000c2,0x0004003d,0x00000006,0x000000c4,0x00000095,0x0003003e,0x000000c3,
0x000000c4,0x0004003d,0x00000006,0x000000c6,0x00000098,0x0003003e,0x000000c5,0x000000c6,
0x0004003d,0x00000006,0x000000c8,0x0000009b,0x0003003e,0x000000c7,0x000000c8,0x00070039,
0x00000002,0x000000c9,0x00000026,0x000000c3,0x000000c5,0x000000c7,0x0004003d,0x00000006,
0x000000ca,0x000000c3,0x0003003e,0x00000095,0x000000ca,0x0004003d,0x00000006,0x000000cb,
0x000000c5,0x0003003e,0x00000098,0x000000cb,0x0004003d,0x00000006,0x000000cc,0x000000c7,
0x0003003e,0x0000009b,0x000000cc,0x0004003d,0x00000006,0x000000ce,0x0000009e,0x0003003e,
0x000000cd,0x000000ce,0x0004003d,0x00000006,0x000000d0,0x000000a1,0x0003003e,0x000000cf,
0x000000d0,0x0004003d,0x00000006,0x000000d2,0x000000a4,0x0003003e,0x000000d1,0x000000d2,
0x00070039,0x00000002,0x000000d3,0x00000026,0x000000cd,0x000000cf,0x000000d1,0x0004003d,
0x00000006,0x000000d4,0x000000cd,0x0003003e,0x0000009e,0x000000d4,0x0004003d,0x00000006,
0x000000d5,0x000000cf,0x0003003e,0x000000a1,0x000000d5,0x0004003d,0x00000006,0x000000d6,
0x000000d1,0x0003003e,0x000000a4,0x000000d6,0x0004003d,0x00000006,0x000000d8,0x000000a7,
0x0003003e,0x000000d7,0x000000d8,0x0004003d,0x00000006,0x000000da,0x000000aa,0x0003003e,
0x000000d9,0x000000da,0x0004003d,0x00000006,0x000000dc,0x000000ad,0x0003003e,0x000000db,
0x000000dc,0x00070039,0x00000002,0x000000dd,0x00000026,0x000000d7,0x000000d9,0x000000db,
0x0004003d,0x00000006,0x000000de,0x000000d7,0x0003003e,0x000000a7,0x000000de,0x0004003d,
0x00000006,0x000000df,0x000000d9,0x0003003e,0x000000aa,0x000000df,0x0004003d,0x00000006,
0x000000e0,0x000000db,0x0003003e,0x000000ad,0x000000e0,0x0004003d,0x00000006,0x000000e2,
0x000000b0,0x0003003e,0x000000e1,0x000000e2,0x0004003d,0x00000006,0x000000e4,0x000000b3,
0x0003003e,0x000000e3,0x000000e4,0x0004003d,0x00000006,0x000000e6,0x000000b6,0x0003003e,
0x000000e5,0x000000e6,0x00070039,0x00000002,0x000000e7,0x00000026,0x000000e1,0x000000e3,
0x000000e5,0x0004003d,0x00000006,0x000000e8,0x000000e1,0x0003003e,0x000000b0,0x000000e8,
0x0004003d,0x00000006,0x000000e9,0x000000e3,0x0003003e,0x000000b3,0x000000e9,0x0004003d,
0x00000006,0x000000ea,0x000000e5,0x0003003e,0x000000b6,0x000000ea,0x0004003d,0x00000006,
0x000000ec,0x00000091,0x00050085,0x00000006,0x000000ee,0x000000ec,0x000000ed,0x0004003d,
0x00000006,0x000000ef,0x00000089,0x00050085,0x00000006,0x000000f0,0x000000ef,0x000000ed,
0x0004003d,0x00000006,0x000000f1,0x0000008d,0x00050081,0x00000006,0x000000f2,0x000000f0,
0x000000f1,0x00050081,0x00000006,0x000000f3,0x000000ee,0x000000f2,0x0003003e,0x000000eb,
0x000000f3,0x0004003d,0x00000006,0x000000f5,0x0000009b,0x00050085,0x00000006,0x000000f6,
0x000000f5,0x000000ed,0x0004003d,0x00000006,0x000000f7,0x00000095,0x00050085,0x00000006,
0x000000f8,0x000000f7,0x000000ed,0x0004003d,0x00000006,0x000000f9,0x00000098,0x00050081,
0x00000006,0x000000fa,0x000000f8,0x000000f9,0x00050081,0x00000006,0x000000fb,0x000000f6,
0x000000fa,0x0003003e,0x000000f4,0x000000fb,0x0004003d,0x00000006,0x000000fd,0x000000a4,
0x00050085,0x00000006,0x000000fe,0x000000fd,0x000000ed,0x0004003d,0x00000006,0x000000ff,
0x0000009e,0x00050085,0x00000006,0x00000100,0x000000ff,0x000000ed,0x0004003d,0x00000006,
0x00000101,0x000000a1,0x00050081,0x00000006,0x00000102,0x00000100,0x00000101,0x00050081,
0x00000006,0x00000103,0x000000fe,0x00000102,0x0003003e,0x000000fc,0x00000103,0x0004003d,
0x00000006,0x00000105,0x000000ad,0x00050085,0x00000006,0x00000106,0x00000105,0x000000ed,
0x0004003d,0x00000006,0x00000107,0x000000a7,0x00050085,0x00000006,0x00000108,0x00000107,
0x000000ed,0x0004003d,0x00000006,0x00000109,0x000000aa,0x00050081,0x00000006,0x0000010a,
0x00000108,0x00000109,0x00050081,0x00000006,0x0000010b,0x00000106,0x0000010a,0x0003003e,
0x00000104,0x0000010b,0x0004003d,0x00000006,0x0000010d,0x000000b6,0x00050085,0x00000006,
0x0000010e,0x0000010d,0x000000ed,0x0004003d,0x00000006,0x0000010f,0x000000b0,0x00050085,
0x00000006,0x00000110,0x0000010f,0x000000ed,0x0004003d,0x00000006,0x00000111,0x000000b3,
0x00050081,0x00000006,0x00000112,0x00000110,0x00000111,0x00050081,0x00000006,0x00000113,
0x0000010e,0x00000112,0x0003003e,0x0000010c,0x00000113,0x0004003d,0x00000006,0x00000116,
0x000000eb,0x00050085,0x00000006,0x00000117,0x00000115,0x00000116,0x0004003d,0x00000006,
0x00000118,0x000000f4,0x00050085,0x00000006,0x00000119,0x00000115,0x00000118,0x00050081,
0x00000006,0x0000011a,0x00000117,0x00000119,0x0004003d,0x00000006,0x0000011b,0x00000104,
0x00050085,0x00000006,0x0000011c,0x00000115,0x0000011b,0x00050081,0x00000006,0x0000011d,
0x0000011a,0x0000011c,0x0004003d,0x00000006,0x0000011e,0x0000010c,0x00050085,0x00000006,
0x0000011f,0x00000115,0x0000011e,0x00050081,0x00000006,0x00000120,0x0000011d,0x0000011f,
0x0004003d,0x00000006,0x00000121,0x000000fc,0x00050083,0x00000006,0x00000122,0x00000120,
0x00000121,0x0003003e,0x00000114,0x00000122,0x0004003d,0x00000006,0x00000123,0x00000114,
0x0006000c,0x00000006,0x00000124,0x00000001,0x00000004,0x00000123,0x0004003d,0x00000006,
0x00000126,0x000000eb,0x0003003e,0x00000125,0x00000126,0x0004003d,0x00000006,0x00000128,
0x000000f4,0x0003003e,0x00000127,0x00000128,0x0004003d,0x00000006,0x0000012a,0x000000fc,
0x0003003e,0x00000129,0x0000012a,0x00070039,0x00000006,0x0000012b,0x00000018,0x00000125,
0x00000127,0x00000129,0x0003003e,0x0000012c,0x0000012b,0x0004003d,0x00000006,0x0000012e,
0x00000104,0x0003003e,0x0000012d,0x0000012e,0x0004003d,0x00000006,0x00000130,0x0000010c,
0x0003003e,0x0000012f,0x00000130,0x00070039,0x00000006,0x00000131,0x00000018,0x0000012c,
0x0000012d,0x0000012f,0x0004003d,0x00000006,0x00000133,0x000000eb,0x0003003e,0x00000132,
0x00000133,0x0004003d,0x00000006,0x00000135,0x000000f4,0x0003003e,0x00000134,0x00000135,
0x0004003d,0x00000006,0x00000137,0x000000fc,0x0003003e,0x00000136,0x00000137,0x00070039,
0x00000006,0x00000138,0x00000013,0x00000132,0x00000134,0x00000136,0x0003003e,0x00000139,
0x00000138,0x0004003d,0x00000006,0x0000013b,0x00000104,0x0003003e,0x0000013a,0x0000013b,
0x0004003d,0x00000006,0x0000013d,0x0000010c,0x0003003e,0x0000013c,0x0000013d,0x00070039,
0x00000006,0x0000013e,0x00000013,0x00000139,0x0000013a,0x0000013c,0x00050083,0x00000006,
0x0000013f,0x00000131,0x0000013e,0x0003003e,0x00000140,0x0000013f,0x00050039,0x00000006,
0x00000141,0x0000000a,0x00000140,0x00050085,0x00000006,0x00000142,0x00000124,0x00000141,
0x0003003e,0x00000143,0x00000142,0x00050039,0x00000006,0x00000144,0x0000000d,0x00000143,
0x0003003e,0x00000114,0x00000144,0x0004003d,0x00000006,0x00000146,0x00000114,0x00050085,
0x00000006,0x00000147,0x00000145,0x00000146,0x00050081,0x00000006,0x00000148,0x00000147,
0x00000035,0x0003003e,0x00000114,0x00000148,0x0004003d,0x00000006,0x0000014b,0x00000089,
0x0003003e,0x0000014a,0x0000014b,0x0004003d,0x00000006,0x0000014d,0x00000095,0x0003003e,
0x0000014c,0x0000014d,0x0004003d,0x00000006,0x0000014f,0x000000a7,0x0003003e,0x0000014e,
0x0000014f,0x00070039,0x00000006,0x00000150,0x00000013,0x0000014a,0x0000014c,0x0000014e,
0x0004003d,0x00000006,0x00000151,0x000000b0,0x0007000c,0x00000006,0x00000152,0x00000001,
0x00000025,0x00000150,0x00000151,0x0003003e,0x00000149,0x00000152,0x0004003d,0x00000006,
0x00000155,0x0000008d,0x0003003e,0x00000154,0x00000155,0x0004003d,0x00000006,0x00000157,
0x00000098,0x0003003e,0x00000156,0x00000157,0x0004003d,0x00000006,0x00000159,0x000000aa,
0x0003003e,0x00000158,0x00000159,0x00070039,0x00000006,0x0000015a,0x00000013,0x00000154,
0x00000156,0x00000158,0x0004003d,0x00000006,0x0000015b,0x000000b3,0x0007000c,0x00000006,
0x0000015c,0x00000001,0x00000025,0x0000015a,0x0000015b,0x0003003e,0x00000153,0x0000015c,
0x0004003d,0x00000006,0x0000015f,0x00000091,0x0003003e,0x0000015e,0x0000015f,0x0004003d,
0x00000006,0x00000161,0x0000009b,0x0003003e,0x00000160,0x00000161,0x0004003d,0x00000006,
0x00000163,0x000000ad,0x0003003e,0x00000162,0x00000163,0x00070039,0x00000006,0x00000164,
0x00000013,0x0000015e,0x00000160,0x00000162,0x0004003d,0x00000006,0x00000165,0x000000b6,
0x0007000c,0x00000006,0x00000166,0x00000001,0x00000025,0x00000164,0x00000165,0x0003003e,
0x0000015d,0x00000166,0x0004003d,0x00000006,0x00000169,0x00000089,0x0003003e,0x00000168,
0x00000169,0x0004003d,0x00000006,0x0000016b,0x00000095,0x0003003e,0x0000016a,0x0000016b,
0x0004003d,0x00000006,0x0000016d,0x000000a7,0x0003003e,0x0000016c,0x0000016d,0x00070039,
0x00000006,0x0000016e,0x00000018,0x00000168,0x0000016a,0x0000016c,0x0004003d,0x00000006,
0x0000016f,0x000000b0,0x0007000c,0x00000006,0x00000170,0x00000001,0x00000028,0x0000016e,
0x0000016f,0x0003003e,0x00000167,0x00000170,0x0004003d,0x00000006,0x00000173,0x0000008d,
0x0003003e,0x00000172,0x00000173,0x0004003d,0x00000006,0x00000175,0x00000098,0x0003003e,
0x00000174,0x00000175,0x0004003d,0x00000006,0x00000177,0x000000aa,0x0003003e,0x00000176,
0x00000177,0x00070039,0x00000006,0x00000178,0x00000018,0x00000172,0x00000174,0x00000176,
0x0004003d,0x00000006,0x00000179,0x000000b3,0x0007000c,0x00000006,0x0000017a,0x00000001,
0x00000028,0x00000178,0x00000179,0x0003003e,0x00000171,0x0000017a,0x0004003d,0x00000006,
0x0000017d,0x00000091,0x0003003e,0x0000017c,0x0000017d,0x0004003d,0x00000006,0x0000017f,
0x0000009b,0x0003003e,0x0000017e,0x0000017f,0x0004003d,0x00000006,0x00000181,0x000000ad,
0x0003003e,0x00000180,0x00000181,0x00070039,0x00000006,0x00000182,0x00000018,0x0000017c,
0x0000017e,0x00000180,0x0004003d,0x00000006,0x00000183,0x000000b6,0x0007000c,0x00000006,
0x00000184,0x00000001,0x00000028,0x00000182,0x00000183,0x0003003e,0x0000017b,0x00000184,
0x0003003e,0x00000187,0x00000189,0x0004003d,0x00000006,0x0000018c,0x00000167,0x00050085,
0x00000006,0x0000018d,0x0000018b,0x0000018c,0x0003003e,0x0000018a,0x0000018d,0x0004003d,
0x00000006,0x0000018f,0x00000171,0x00050085,0x00000006,0x00000190,0x0000018b,0x0000018f,
0x0003003e,0x0000018e,0x00000190,0x0004003d,0x00000006,0x00000192,0x0000017b,0x00050085,
0x00000006,0x00000193,0x0000018b,0x00000192,0x0003003e,0x00000191,0x00000193,0x0004003d,
0x00000006,0x00000195,0x00000149,0x00050085,0x00000006,0x00000196,0x0000018b,0x00000195,
0x00050041,0x00000007,0x00000197,0x00000187,0x0000008e,0x0004003d,0x00000006,0x00000198,
0x00000197,0x00050081,0x00000006,0x00000199,0x00000196,0x00000198,0x0003003e,0x00000194,
0x00000199,0x0004003d,0x00000006,0x0000019b,0x00000153,0x00050085,0x00000006,0x0000019c,
0x0000018b,0x0000019b,0x00050041,0x00000007,0x0000019d,0x00000187,0x0000008e,0x0004003d,
0x00000006,0x0000019e,0x0000019d,0x00050081,0x00000006,0x0000019f,0x0000019c,0x0000019e,
0x0003003e,0x0000019a,0x0000019f,0x0004003d,0x00000006,0x000001a1,0x0000015d,0x00050085,
0x00000006,0x000001a2,0x0000018b,0x000001a1,0x00050041,0x00000007,0x000001a3,0x00000187,
0x0000008e,0x0004003d,0x00000006,0x000001a4,0x000001a3,0x00050081,0x00000006,0x000001a5,
0x000001a2,0x000001a4,0x0003003e,0x000001a0,0x000001a5,0x0004003d,0x00000006,0x000001a7,
0x0000018a,0x000500ba,0x000001a8,0x000001a9,0x000001a7,0x0000003b,0x000300f7,0x000001ac,
0x00000000,0x000400fa,0x000001a9,0x000001ab,0x000001b2,0x000200f8,0x000001ab,0x0004003d,
0x00000006,0x000001ad,0x00000149,0x0004003d,0x00000006,0x000001ae,0x0000009e,0x0007000c,
0x00000006,0x000001af,0x00000001,0x00000025,0x000001ad,0x000001ae,0x0004003d,0x00000006,
0x000001b0,0x0000018a,0x00050088,0x00000006,0x000001b1,0x000001af,0x000001b0,0x0003003e,
0x000001aa,0x000001b1,0x000200f9,0x000001ac,0x000200f8,0x000001b2,0x0003003e,0x000001aa,
0x0000003b,0x000200f9,0x000001ac,0x000200f8,0x000001ac,0x0004003d,0x00000006,0x000001b3,
0x000001aa,0x0003003e,0x000001a6,0x000001b3,0x0004003d,0x00000006,0x000001b5,0x0000018e,
0x000500ba,0x000001a8,0x000001b6,0x000001b5,0x0000003b,0x000300f7,0x000001b9,0x00000000,
0x000400fa,0x000001b6,0x000001b8,0x000001bf,0x000200f8,0x000001b8,0x0004003d,0x00000006,
0x000001ba,0x00000153,0x0004003d,0x00000006,0x000001bb,0x000000a1,0x0007000c,0x00000006,
0x000001bc,0x00000001,0x00000025,0x000001ba,0x000001bb,0x0004003d,0x00000006,0x000001bd,
0x0000018e,0x00050088,0x00000006,0x000001be,0x000001bc,0x000001bd,0x0003003e,0x000001b7,
0x000001be,0x000200f9,0x000001b9,0x000200f8,0x000001bf,0x0003003e,0x000001b7,0x0000003b,
0x000200f9,0x000001b9,0x000200f8,0x000001b9,0x0004003d,0x00000006,0x000001c0,0x000001b7,
0x0003003e,0x000001b4,0x000001c0,0x0004003d,0x00000006,0x000001c2,0x00000191,0x000500ba,
0x000001a8,0x000001c3,0x000001c2,0x0000003b,0x000300f7,0x000001c6,0x00000000,0x000400fa,
0x000001c3,0x000001c5,0x000001cc,0x000200f8,0x000001c5,0x0004003d,0x00000006,0x000001c7,
0x0000015d,0x0004003d,0x00000006,0x000001c8,0x000000a4,0x0007000c,0x00000006,0x000001c9,
0x00000001,0x00000025,0x000001c7,0x000001c8,0x0004003d,0x00000006,0x000001ca,0x00000191,
0x00050088,0x00000006,0x000001cb,0x000001c9,0x000001ca,0x0003003e,0x000001c4,0x000001cb,
0x000200f9,0x000001c6,0x000200f8,0x000001cc,0x0003003e,0x000001c4,0x0000003b,0x000200f9,
0x000001c6,0x000200f8,0x000001c6,0x0004003d,0x00000006,0x000001cd,0x000001c4,0x0003003e,
0x000001c1,0x000001cd,0x00050041,0x00000007,0x000001cf,0x00000187,0x0000008a,0x0004003d,
0x00000006,0x000001d0,0x000001cf,0x0004003d,0x00000006,0x000001d1,0x00000167,0x0004003d,
0x00000006,0x000001d2,0x0000009e,0x0007000c,0x00000006,0x000001d3,0x00000001,0x00000028,
0x000001d1,0x000001d2,0x00050083,0x00000006,0x000001d4,0x000001d0,0x000001d3,0x0003003e,
0x000001ce,0x000001d4,0x00050041,0x00000007,0x000001d6,0x00000187,0x0000008a,0x0004003d,
0x00000006,0x000001d7,0x000001d6,0x0004003d,0x00000006,0x000001d8,0x00000171,0x0004003d,
0x00000006,0x000001d9,0x000000a1,0x0007000c,0x00000006,0x000001da,0x00000001,0x00000028,
0x000001d8,0x000001d9,0x00050083,0x00000006,0x000001db,0x000001d7,0x000001da,0x0003003e,
0x000001d5,0x000001db,0x00050041,0x00000007,0x000001dd,0x00000187,0x0000008a,0x0004003d,
0x00000006,0x000001de,0x000001dd,0x0004003d,0x00000006,0x000001df,0x0000017b,0x0004003d,
0x00000006,0x000001e0,0x000000a4,0x0007000c,0x00000006,0x000001e1,0x00000001,0x00000028,
0x000001df,0x000001e0,0x00050083,0x00000006,0x000001e2,0x000001de,0x000001e1,0x0003003e,
0x000001dc,0x000001e2,0x0004003d,0x00000006,0x000001e4,0x00000194,0x0006000c,0x00000006,
0x000001e5,0x00000001,0x00000004,0x000001e4,0x000500ba,0x000001a8,0x000001e7,0x000001e5,
0x000001e6,0x000300f7,0x000001ea,0x00000000,0x000400fa,0x000001e7,0x000001e9,0x000001ee,
0x000200f8,0x000001e9,0x0004003d,0x00000006,0x000001eb,0x000001ce,0x0004003d,0x00000006,
0x000001ec,0x00000194,0x00050088,0x00000006,0x000001ed,0x000001eb,0x000001ec,0x0003003e,
0x000001e8,0x000001ed,0x000200f9,0x000001ea,0x000200f8,0x000001ee,0x0003003e,0x000001e8,
0x0000003b,0x000200f9,0x000001ea,0x000200f8,0x000001ea,0x0004003d,0x00000006,0x000001ef,
0x000001e8,0x0003003e,0x000001e3,0x000001ef,0x0004003d,0x00000006,0x000001f1,0x0000019a,
0x0006000c,0x00000006,0x000001f2,0x00000001,0x00000004,0x000001f1,0x000500ba,0x000001a8,
0x000001f3,0x000001f2,0x000001e6,0x000300f7,0x000001f6,0x00000000,0x000400fa,0x000001f3,
0x000001f5,0x000001fa,0x000200f8,0x000001f5,0x0004003d,0x00000006,0x000001f7,0x000001d5,
0x0004003d,0x00000006,0x000001f8,0x0000019a,0x00050088,0x00000006,0x000001f9,0x000001f7,
0x000001f8,0x0003003e,0x000001f4,0x000001f9,0x000200f9,0x000001f6,0x000200f8,0x000001fa,
0x0003003e,0x000001f4,0x0000003b,0x000200f9,0x000001f6,0x000200f8,0x000001f6,0x0004003d,
0x00000006,0x000001fb,0x000001f4,0x0003003e,0x000001f0,0x000001fb,0x0004003d,0x00000006,
0x000001fd,0x000001a0,0x0006000c,0x00000006,0x000001fe,0x00000001,0x00000004,0x000001fd,
0x000500ba,0x000001a8,0x000001ff,0x000001fe,0x000001e6,0x000300f7,0x00000202,0x00000000,
0x000400fa,0x000001ff,0x00000201,0x00000206,0x000200f8,0x00000201,0x0004003d,0x00000006,
0x00000203,0x000001dc,0x0004003d,0x00000006,0x00000204,0x000001a0,0x00050088,0x00000006,
0x00000205,0x00000203,0x00000204,0x0003003e,0x00000200,0x00000205,0x000200f9,0x00000202,
0x000200f8,0x00000206,0x0003003e,0x00000200,0x0000003b,0x000200f9,0x00000202,0x000200f8,
0x00000202,0x0004003d,0x00000006,0x00000207,0x00000200,0x0003003e,0x000001fc,0x00000207,
0x0004003d,0x00000006,0x00000209,0x000001a6,0x0004007f,0x00000006,0x0000020a,0x00000209,
0x0004003d,0x00000006,0x0000020b,0x000001e3,0x0007000c,0x00000006,0x0000020c,0x00000001,
0x00000028,0x0000020a,0x0000020b,0x0003003e,0x00000208,0x0000020c,0x0004003d,0x00000006,
0x0000020e,0x000001b4,0x0004007f,0x00000006,0x0000020f,0x0000020e,0x0004003d,0x00000006,
0x00000210,0x000001f0,0x0007000c,0x00000006,0x00000211,0x00000001,0x00000028,0x0000020f,
0x00000210,0x0003003e,0x0000020d,0x00000211,0x0004003d,0x00000006,0x00000213,0x000001c1,
0x0004007f,0x00000006,0x00000214,0x00000213,0x0004003d,0x00000006,0x00000215,0x000001fc,
0x0007000c,0x00000006,0x00000216,0x00000001,0x00000028,0x00000214,0x00000215,0x0003003e,
0x00000212,0x00000216,0x0004003d,0x00000006,0x0000021a,0x00000208,0x0003003e,0x00000219,
0x0000021a,0x0004003d,0x00000006,0x0000021c,0x0000020d,0x0003003e,0x0000021b,0x0000021c,
0x0004003d,0x00000006,0x0000021e,0x00000212,0x0003003e,0x0000021d,0x0000021e,0x00070039,
0x00000006,0x0000021f,0x00000018,0x00000219,0x0000021b,0x0000021d,0x0007000c,0x00000006,
0x00000220,0x00000001,0x00000025,0x0000021f,0x0000003b,0x0007000c,0x00000006,0x00000221,
0x00000001,0x00000028,0x00000218,0x00000220,0x00050041,0x00000222,0x00000223,0x00000032,
0x0000008a,0x0004003d,0x00000028,0x00000224,0x00000223,0x0004007c,0x00000006,0x00000225,
0x00000224,0x00050085,0x00000006,0x00000226,0x00000221,0x00000225,0x0003003e,0x00000217,
0x00000226,0x0004003d,0x00000006,0x00000228,0x00000217,0x00050085,0x00000006,0x00000229,
0x0000018b,0x00000228,0x00050081,0x00000006,0x0000022a,0x00000229,0x00000035,0x0003003e,
0x0000022b,0x0000022a,0x00050039,0x00000006,0x0000022c,0x0000000a,0x0000022b,0x0003003e,
0x00000227,0x0000022c,0x0004003d,0x00000006,0x0000022d,0x00000217,0x0004003d,0x00000006,
0x0000022e,0x00000089,0x00050085,0x00000006,0x0000022f,0x0000022d,0x0000022e,0x0004003d,
0x00000006,0x00000230,0x00000217,0x0004003d,0x00000006,0x00000231,0x00000095,0x00050085,
0x00000006,0x00000232,0x00000230,0x00000231,0x00050081,0x00000006,0x00000233,0x0000022f,
0x00000232,0x0004003d,0x00000006,0x00000234,0x00000217,0x0004003d,0x00000006,0x00000235,
0x000000b0,0x00050085,0x00000006,0x00000236,0x00000234,0x00000235,0x00050081,0x00000006,
0x00000237,0x00000233,0x00000236,0x0004003d,0x00000006,0x00000238,0x00000217,0x0004003d,
0x00000006,0x00000239,0x000000a7,0x00050085,0x00000006,0x0000023a,0x00000238,0x00000239,
0x00050081,0x00000006,0x0000023b,0x00000237,0x0000023a,0x0004003d,0x00000006,0x0000023c,
0x0000009e,0x00050081,0x00000006,0x0000023d,0x0000023b,0x0000023c,0x0004003d,0x00000006,
0x0000023e,0x00000227,0x00050085,0x00000006,0x0000023f,0x0000023d,0x0000023e,0x0003003e,
0x0000002e,0x0000023f,0x0004003d,0x00000006,0x00000240,0x00000217,0x0004003d,0x00000006,
0x00000241,0x0000008d,0x00050085,0x00000006,0x00000242,0x00000240,0x00000241,0x0004003d,
0x00000006,0x00000243,0x00000217,0x0004003d,0x00000006,0x00000244,0x00000098,0x00050085,
0x00000006,0x00000245,0x00000243,0x00000244,0x00050081,0x00000006,0x00000246,0x00000242,
0x00000245,0x0004003d,0x00000006,0x00000247,0x00000217,0x0004003d,0x00000006,0x00000248,
0x000000b3,0x00050085,0x00000006,0x00000249,0x00000247,0x00000248,0x00050081,0x00000006,
0x0000024a,0x00000246,0x00000249,0x0004003d,0x00000006,0x0000024b,0x00000217,0x0004003d,
0x00000006,0x0000024c,0x000000aa,0x00050085,0x00000006,0x0000024d,0x0000024b,0x0000024c,
0x00050081,0x00000006,0x0000024e,0x0000024a,0x0000024d,0x0004003d,0x00000006,0x0000024f,
0x000000a1,0x00050081,0x00000006,0x00000250,0x0000024e,0x0000024f,0x0004003d,0x00000006,
0x00000251,0x00000227,0x00050085,0x00000006,0x00000252,0x00000250,0x00000251,0x0003003e,
0x0000002f,0x00000252,0x0004003d,0x00000006,0x00000253,0x00000217,0x0004003d,0x00000006,
0x00000254,0x00000091,0x00050085,0x00000006,0x00000255,0x00000253,0x00000254,0x0004003d,
0x00000006,0x00000256,0x00000217,0x0004003d,0x00000006,0x00000257,0x0000009b,0x00050085,
0x00000006,0x00000258,0x00000256,0x00000257,0x00050081,0x00000006,0x00000259,0x00000255,
0x00000258,0x0004003d,0x00000006,0x0000025a,0x00000217,0x0004003d,0x00000006,0x0000025b,
0x000000b6,0x00050085,0x00000006,0x0000025c,0x0000025a,0x0000025b,0x00050081,0x00000006,
0x0000025d,0x00000259,0x0000025c,0x0004003d,0x00000006,0x0000025e,0x00000217,0x0004003d,
0x00000006,0x0000025f,0x000000ad,0x00050085,0x00000006,0x00000260,0x0000025e,0x0000025f,
0x00050081,0x00000006,0x00000261,0x0000025d,0x00000260,0x0004003d,0x00000006,0x00000262,
0x000000a4,0x00050081,0x00000006,0x00000263,0x00000261,0x00000262,0x0004003d,0x00000006,
0x00000264,0x00000227,0x00050085,0x00000006,0x00000265,0x00000263,0x00000264,0x0003003e,
0x00000030,0x00000265,0x000100fd,0x00010038
0x00000007,0x0000013b,0x00000007,0x0004003b,0x00000007,0x0000013d,0x00000007,0x0004003b,
0x00000007,0x00000140,0x00000007,0x0004003b,0x00000007,0x00000141,0x00000007,0x0004003b,
0x00000007,0x00000143,0x00000007,0x0004003b,0x00000007,0x00000147,0x00000007,0x0004003b,
0x00000007,0x0000014a,0x00000007,0x0004003b,0x00000007,0x00000150,0x00000007,0x0004003b,
0x00000007,0x00000151,0x00000007,0x0004003b,0x00000007,0x00000153,0x00000007,0x0004003b,
0x00000007,0x00000155,0x00000007,0x0004003b,0x00000007,0x0000015a,0x00000007,0x0004003b,
0x00000007,0x0000015b,0x00000007,0x0004003b,0x00000007,0x0000015d,0x00000007,0x0004003b,
0x00000007,0x0000015f,0x00000007,0x0004003b,0x00000007,0x00000164,0x00000007,0x0004003b,
0x00000007,0x00000165,0x00000007,0x0004003b,0x00000007,0x00000167,0x00000007,0x0004003b,
0x00000007,0x00000169,0x00000007,0x0004003b,0x00000007,0x0000016e,0x00000007,0x0004003b,
0x00000007,0x0000016f,0x00000007,0x0004003b,0x00000007,0x00000171,0x00000007,0x0004003b,
0x00000007,0x00000173,0x00000007,0x0004003b,0x00000007,0x00000178,0x00000007,0x0004003b,
0x00000007,0x00000179,0x00000007,0x0004003b,0x00000007,0x0000017b,0x00000007,0x0004003b,
0x00000007,0x0000017d,0x00000007,0x0004003b,0x00000007,0x00000182,0x00000007,0x0004003b,
0x00000007,0x00000183,0x00000007,0x0004003b,0x00000007,0x00000185,0x00000007,0x0004003b,
0x00000007,0x00000187,0x00000007,0x0004003b,0x0000018d,0x0000018e,0x00000007,0x0004003b,
0x00000007,0x00000191,0x00000007,0x0004003b,0x00000007,0x00000198,0x00000007,0x0004003b,
0x00000007,0x0000019b,0x00000007,0x0004003b,0x00000007,0x000001a1,0x00000007,0x0004003b,
0x00000007,0x000001a4,0x00000007,0x0004003b,0x00000007,0x000001aa,0x00000007,0x0004003b,
0x00000007,0x000001ad,0x00000007,0x0004003b,0x00000007,0x000001b9,0x00000007,0x0004003b,
0x00000007,0x000001bc,0x00000007,0x0004003b,0x00000007,0x000001c8,0x00000007,0x0004003b,
0x00000007,0x000001cb,0x00000007,0x0004003b,0x00000007,0x000001d7,0x00000007,0x0004003b,
0x00000007,0x000001da,0x00000007,0x0004003b,0x00000007,0x000001df,0x00000007,0x0004003b,
0x00000007,0x000001e4,0x00000007,0x0004003b,0x00000007,0x000001e9,0x00000007,0x0004003b,
0x00000007,0x000001eb,0x00000007,0x0004003b,0x00000007,0x000001ed,0x00000007,0x0004003b,
0x00000007,0x000001ef,0x00000007,0x0004003b,0x00000007,0x000001f9,0x00000007,0x0004003b,
0x00000007,0x000001fd,0x00000007,0x0004003d,0x0000002c,0x0000006a,0x00000034,0x0004007c,
0x0000001e,0x0000006b,0x0000006a,0x0003003e,0x00000069,0x0000006b,0x0004003d,0x0000001e,
0x0000006f,0x00000069,0x00050080,0x0000001e,0x00000072,0x0000006f,0x00000071,0x0003003e,
0x00000073,0x00000072,0x00050039,0x00000020,0x00000074,0x00000023,0x00000073,0x0008004f,
0x0000006c,0x00000075,0x00000074,0x00000074,0x00000000,0x00000001,0x00000002,0x0003003e,
0x0000006e,0x00000075,0x0004003d,0x0000001e,0x00000077,0x00000069,0x00050080,0x0000001e,
0x00000079,0x00000077,0x00000078,0x0003003e,0x0000007a,0x00000079,0x00050039,0x00000020,
0x0000007b,0x00000023,0x0000007a,0x0008004f,0x0000006c,0x0000007c,0x0000007b,0x0000007b,
0x00000000,0x00000001,0x00000002,0x0003003e,0x00000076,0x0000007c,0x0004003d,0x0000001e,
0x0000007f,0x00000069,0x0003003e,0x0000007e,0x0000007f,0x00050039,0x00000020,0x00000080,
0x00000023,0x0000007e,0x0008004f,0x0000006c,0x00000081,0x00000080,0x00000080,0x00000000,
0x00000001,0x00000002,0x0003003e,0x0000007d,0x00000081,0x0004003d,0x0000001e,0x00000083,
0x00000069,0x00050080,0x0000001e,0x00000085,0x00000083,0x00000084,0x0003003e,0x00000086,
0x00000085,0x00050039,0x00000020,0x00000087,0x00000023,0x00000086,0x0008004f,0x0000006c,
0x00000088,0x00000087,0x00000087,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000082,
0x00000088,0x0004003d,0x0000001e,0x0000008a,0x00000069,0x00050080,0x0000001e,0x0000008c,
0x0000008a,0x0000008b,0x0003003e,0x0000008d,0x0000008c,0x00050039,0x00000020,0x0000008e,
0x00000023,0x0000008d,0x0008004f,0x0000006c,0x0000008f,0x0000008e,0x0000008e,0x00000000,
0x00000001,0x00000002,0x0003003e,0x00000089,0x0000008f,0x00050041,0x00000007,0x00000092,
0x0000006e,0x00000091,0x0004003d,0x00000006,0x00000093,0x00000092,0x0003003e,0x00000090,
0x00000093,0x00050041,0x00000007,0x00000096,0x0000006e,0x00000095,0x0004003d,0x00000006,
0x00000097,0x00000096,0x0003003e,0x00000094,0x00000097,0x00050041,0x00000007,0x0000009a,
0x0000006e,0x00000099,0x0004003d,0x00000006,0x0000009b,0x0000009a,0x0003003e,0x00000098,
0x0000009b,0x00050041,0x00000007,0x0000009d,0x00000076,0x00000091,0x0004003d,0x00000006,
0x0000009e,0x0000009d,0x0003003e,0x0000009c,0x0000009e,0x00050041,0x00000007,0x000000a0,
0x00000076,0x00000095,0x0004003d,0x00000006,0x000000a1,0x000000a0,0x0003003e,0x0000009f,
0x000000a1,0x00050041,0x00000007,0x000000a3,0x00000076,0x00000099,0x0004003d,0x00000006,
0x000000a4,0x000000a3,0x0003003e,0x000000a2,0x000000a4,0x00050041,0x00000007,0x000000a6,
0x0000007d,0x00000091,0x0004003d,0x00000006,0x000000a7,0x000000a6,0x0003003e,0x000000a5,
0x000000a7,0x00050041,0x00000007,0x000000a9,0x0000007d,0x00000095,0x0004003d,0x00000006,
0x000000aa,0x000000a9,0x0003003e,0x000000a8,0x000000aa,0x00050041,0x00000007,0x000000ac,
0x0000007d,0x00000099,0x0004003d,0x00000006,0x000000ad,0x000000ac,0x0003003e,0x000000ab,
0x000000ad,0x00050041,0x00000007,0x000000af,0x00000082,0x00000091,0x0004003d,0x00000006,
0x000000b0,0x000000af,0x0003003e,0x000000ae,0x000000b0,0x00050041,0x00000007,0x000000b2,
0x00000082,0x00000095,0x0004003d,0x00000006,0x000000b3,0x000000b2,0x0003003e,0x000000b1,
0x000000b3,0x00050041,0x00000007,0x000000b5,0x00000082,0x00000099,0x0004003d,0x00000006,
0x000000b6,0x000000b5,0x0003003e,0x000000b4,0x000000b6,0x00050041,0x00000007,0x000000b8,
0x00000089,0x00000091,0x0004003d,0x00000006,0x000000b9,0x000000b8,0x0003003e,0x000000b7,
0x000000b9,0x00050041,0x00000007,0x000000bb,0x00000089,0x00000095,0x0004003d,0x00000006,
0x000000bc,0x000000bb,0x0003003e,0x000000ba,0x000000bc,0x00050041,0x00000007,0x000000be,
0x00000089,0x00000099,0x0004003d,0x00000006,0x000000bf,0x000000be,0x0003003e,0x000000bd,
0x000000bf,0x0004003d,0x00000006,0x000000c1,0x00000090,0x0003003e,0x000000c0,0x000000c1,
0x0004003d,0x00000006,0x000000c3,0x00000094,0x0003003e,0x000000c2,0x000000c3,0x0004003d,
0x00000006,0x000000c5,0x00000098,0x0003003e,0x000000c4,0x000000c5,0x00070039,0x00000002,
0x000000c6,0x00000029,0x000000c0,0x000000c2,0x000000c4,0x0004003d,0x00000006,0x000000c7,
0x000000c0,0x0003003e,0x00000090,0x000000c7,0x0004003d,0x00000006,0x000000c8,0x000000c2,
0x0003003e,0x00000094,0x000000c8,0x0004003d,0x00000006,0x000000c9,0x000000c4,0x0003003e,
0x00000098,0x000000c9,0x0004003d,0x00000006,0x000000cb,0x0000009c,0x0003003e,0x000000ca,
0x000000cb,0x0004003d,0x00000006,0x000000cd,0x0000009f,0x0003003e,0x000000cc,0x000000cd,
0x0004003d,0x00000006,0x000000cf,0x000000a2,0x0003003e,0x000000ce,0x000000cf,0x00070039,
0x00000002,0x000000d0,0x00000029,0x000000ca,0x000000cc,0x000000ce,0x0004003d,0x00000006,
0x000000d1,0x000000ca,0x0003003e,0x0000009c,0x000000d1,0x0004003d,0x00000006,0x000000d2,
0x000000cc,0x0003003e,0x0000009f,0x000000d2,0x0004003d,0x00000006,0x000000d3,0x000000ce,
0x0003003e,0x000000a2,0x000000d3,0x0004003d,0x00000006,0x000000d5,0x000000a5,0x0003003e,
0x000000d4,0x000000d5,0x0004003d,0x00000006,0x000000d7,0x000000a8,0x0003003e,0x000000d6,
0x000000d7,0x0004003d,0x00000006,0x000000d9,0x000000ab,0x0003003e,0x000000d8,0x000000d9,
0x00070039,0x00000002,0x000000da,0x00000029,0x000000d4,0x000000d6,0x000000d8,0x0004003d,
0x00000006,0x000000db,0x000000d4,0x0003003e,0x000000a5,0x000000db,0x0004003d,0x00000006,
0x000000dc,0x000000d6,0x0003003e,0x000000a8,0x000000dc,0x0004003d,0x00000006,0x000000dd,
0x000000d8,0x0003003e,0x000000ab,0x000000dd,0x0004003d,0x00000006,0x000000df,0x000000ae,
0x0003003e,0x000000de,0x000000df,0x0004003d,0x00000006,0x000000e1,0x000000b1,0x0003003e,
0x000000e0,0x000000e1,0x0004003d,0x00000006,0x000000e3,0x000000b4,0x0003003e,0x000000e2,
0x000000e3,0x00070039,0x00000002,0x000000e4,0x00000029,0x000000de,0x000000e0,0x000000e2,
0x0004003d,0x00000006,0x000000e5,0x000000de,0x0003003e,0x000000ae,0x000000e5,0x0004003d,
0x00000006,0x000000e6,0x000000e0,0x0003003e,0x000000b1,0x000000e6,0x0004003d,0x00000006,
0x000000e7,0x000000e2,0x0003003e,0x000000b4,0x000000e7,0x0004003d,0x00000006,0x000000e9,
0x000000b7,0x0003003e,0x000000e8,0x000000e9,0x0004003d,0x00000006,0x000000eb,0x000000ba,
0x0003003e,0x000000ea,0x000000eb,0x0004003d,0x00000006,0x000000ed,0x000000bd,0x0003003e,
0x000000ec,0x000000ed,0x00070039,0x00000002,0x000000ee,0x00000029,0x000000e8,0x000000ea,
0x000000ec,0x0004003d,0x00000006,0x000000ef,0x000000e8,0x0003003e,0x000000b7,0x000000ef,
0x0004003d,0x00000006,0x000000f0,0x000000ea,0x0003003e,0x000000ba,0x000000f0,0x0004003d,
0x00000006,0x000000f1,0x000000ec,0x0003003e,0x000000bd,0x000000f1,0x0004003d,0x00000006,
0x000000f3,0x00000098,0x00050085,0x00000006,0x000000f5,0x000000f3,0x000000f4,0x0004003d,
0x00000006,0x000000f6,0x00000090,0x00050085,0x00000006,0x000000f7,0x000000f6,0x000000f4,
0x0004003d,0x00000006,0x000000f8,0x00000094,0x00050081,0x00000006,0x000000f9,0x000000f7,
0x000000f8,0x00050081,0x00000006,0x000000fa,0x000000f5,0x000000f9,0x0003003e,0x000000f2,
0x000000fa,0x0004003d,0x00000006,0x000000fc,0x000000a2,0x00050085,0x00000006,0x000000fd,
0x000000fc,0x000000f4,0x0004003d,0x00000006,0x000000fe,0x0000009c,0x00050085,0x00000006,
0x000000ff,0x000000fe,0x000000f4,0x0004003d,0x00000006,0x00000100,0x0000009f,0x00050081,
0x00000006,0x00000101,0x000000ff,0x00000100,0x00050081,0x00000006,0x00000102,0x000000fd,
0x00000101,0x0003003e,0x000000fb,0x00000102,0x0004003d,0x00000006,0x00000104,0x000000ab,
0x00050085,0x00000006,0x00000105,0x00000104,0x000000f4,0x0004003d,0x00000006,0x00000106,
0x000000a5,0x00050085,0x00000006,0x00000107,0x00000106,0x000000f4,0x0004003d,0x00000006,
0x00000108,0x000000a8,0x00050081,0x00000006,0x00000109,0x00000107,0x00000108,0x00050081,
0x00000006,0x0000010a,0x00000105,0x00000109,0x0003003e,0x00000103,0x0000010a,0x0004003d,
0x00000006,0x0000010c,0x000000b4,0x00050085,0x00000006,0x0000010d,0x0000010c,0x000000f4,
0x0004003d,0x00000006,0x0000010e,0x000000ae,0x00050085,0x00000006,0x0000010f,0x0000010e,
0x000000f4,0x0004003d,0x00000006,0x00000110,0x000000b1,0x00050081,0x00000006,0x00000111,
0x0000010f,0x00000110,0x00050081,0x00000006,0x00000112,0x0000010d,0x00000111,0x0003003e,
0x0000010b,0x00000112,0x0004003d,0x00000006,0x00000114,0x000000bd,0x00050085,0x00000006,
0x00000115,0x00000114,0x000000f4,0x0004003d,0x00000006,0x00000116,0x000000b7,0x00050085,
0x00000006,0x00000117,0x00000116,0x000000f4,0x0004003d,0x00000006,0x00000118,0x000000ba,
0x00050081,0x00000006,0x00000119,0x00000117,0x00000118,0x00050081,0x00000006,0x0000011a,
0x00000115,0x00000119,0x0003003e,0x00000113,0x0000011a,0x0004003d,0x00000006,0x0000011d,
0x000000f2,0x00050085,0x00000006,0x0000011e,0x0000011c,0x0000011d,0x0004003d,0x00000006,
0x0000011f,0x000000fb,0x00050085,0x00000006,0x00000120,0x0000011c,0x0000011f,0x00050081,
0x00000006,0x00000121,0x0000011e,0x00000120,0x0004003d,0x00000006,0x00000122,0x0000010b,
0x00050085,0x00000006,0x00000123,0x0000011c,0x00000122,0x00050081,0x00000006,0x00000124,
0x00000121,0x00000123,0x0004003d,0x00000006,0x00000125,0x00000113,0x00050085,0x00000006,
0x00000126,0x0000011c,0x00000125,0x00050081,0x00000006,0x00000127,0x00000124,0x00000126,
0x0004003d,0x00000006,0x00000128,0x00000103,0x00050083,0x00000006,0x00000129,0x00000127,
0x00000128,0x0003003e,0x0000011b,0x00000129,0x0004003d,0x00000006,0x0000012a,0x0000011b,
0x0006000c,0x00000006,0x0000012b,0x00000001,0x00000004,0x0000012a,0x0004003d,0x00000006,
0x0000012d,0x000000f2,0x0003003e,0x0000012c,0x0000012d,0x0004003d,0x00000006,0x0000012f,
0x000000fb,0x0003003e,0x0000012e,0x0000012f,0x0004003d,0x00000006,0x00000131,0x00000103,
0x0003003e,0x00000130,0x00000131,0x00070039,0x00000006,0x00000132,0x0000001b,0x0000012c,
0x0000012e,0x00000130,0x0003003e,0x00000133,0x00000132,0x0004003d,0x00000006,0x00000135,
0x0000010b,0x0003003e,0x00000134,0x00000135,0x0004003d,0x00000006,0x00000137,0x00000113,
0x0003003e,0x00000136,0x00000137,0x00070039,0x00000006,0x00000138,0x0000001b,0x00000133,
0x00000134,0x00000136,0x0004003d,0x00000006,0x0000013a,0x000000f2,0x0003003e,0x00000139,
0x0000013a,0x0004003d,0x00000006,0x0000013c,0x000000fb,0x0003003e,0x0000013b,0x0000013c,
0x0004003d,0x00000006,0x0000013e,0x00000103,0x0003003e,0x0000013d,0x0000013e,0x00070039,
0x00000006,0x0000013f,0x00000016,0x00000139,0x0000013b,0x0000013d,0x0003003e,0x00000140,
0x0000013f,0x0004003d,0x00000006,0x00000142,0x0000010b,0x0003003e,0x00000141,0x00000142,
0x0004003d,0x00000006,0x00000144,0x00000113,0x0003003e,0x00000143,0x00000144,0x00070039,
0x00000006,0x00000145,0x00000016,0x00000140,0x00000141,0x00000143,0x00050083,0x00000006,
0x00000146,0x00000138,0x00000145,0x0003003e,0x00000147,0x00000146,0x00050039,0x00000006,
0x00000148,0x0000000d,0x00000147,0x00050085,0x00000006,0x00000149,0x0000012b,0x00000148,
0x0003003e,0x0000014a,0x00000149,0x00050039,0x00000006,0x0000014b,0x00000010,0x0000014a,
0x0003003e,0x0000011b,0x0000014b,0x0004003d,0x00000006,0x0000014d,0x0000011b,0x00050085,
0x00000006,0x0000014e,0x0000014c,0x0000014d,0x00050081,0x00000006,0x0000014f,0x0000014e,
0x00000038,0x0003003e,0x0000011b,0x0000014f,0x0004003d,0x00000006,0x00000152,0x00000090,
0x0003003e,0x00000151,0x00000152,0x0004003d,0x00000006,0x00000154,0x0000009c,0x0003003e,
0x00000153,0x00000154,0x0004003d,0x00000006,0x00000156,0x000000ae,0x0003003e,0x00000155,
0x00000156,0x00070039,0x00000006,0x00000157,0x00000016,0x00000151,0x00000153,0x00000155,
0x0004003d,0x00000006,0x00000158,0x000000b7,0x0007000c,0x00000006,0x00000159,0x00000001,
0x00000025,0x00000157,0x00000158,0x0003003e,0x00000150,0x00000159,0x0004003d,0x00000006,
0x0000015c,0x00000094,0x0003003e,0x0000015b,0x0000015c,0x0004003d,0x00000006,0x0000015e,
0x0000009f,0x0003003e,0x0000015d,0x0000015e,0x0004003d,0x00000006,0x00000160,0x000000b1,
0x0003003e,0x0000015f,0x00000160,0x00070039,0x00000006,0x00000161,0x00000016,0x0000015b,
0x0000015d,0x0000015f,0x0004003d,0x00000006,0x00000162,0x000000ba,0x0007000c,0x00000006,
0x00000163,0x00000001,0x00000025,0x00000161,0x00000162,0x0003003e,0x0000015a,0x00000163,
0x0004003d,0x00000006,0x00000166,0x00000098,0x0003003e,0x00000165,0x00000166,0x0004003d,
0x00000006,0x00000168,0x000000a2,0x0003003e,0x00000167,0x00000168,0x0004003d,0x00000006,
0x0000016a,0x000000b4,0x0003003e,0x00000169,0x0000016a,0x00070039,0x00000006,0x0000016b,
0x00000016,0x00000165,0x00000167,0x00000169,0x0004003d,0x00000006,0x0000016c,0x000000bd,
0x0007000c,0x00000006,0x0000016d,0x00000001,0x00000025,0x0000016b,0x0000016c,0x0003003e,
0x00000164,0x0000016d,0x0004003d,0x00000006,0x00000170,0x00000090,0x0003003e,0x0000016f,
0x00000170,0x0004003d,0x00000006,0x00000172,0x0000009c,0x0003003e,0x00000171,0x00000172,
0x0004003d,0x00000006,0x00000174,0x000000ae,0x0003003e,0x00000173,0x00000174,0x00070039,
0x00000006,0x00000175,0x0000001b,0x0000016f,0x00000171,0x00000173,0x0004003d,0x00000006,
0x00000176,0x000000b7,0x0007000c,0x00000006,0x00000177,0x00000001,0x00000028,0x00000175,
0x00000176,0x0003003e,0x0000016e,0x00000177,0x0004003d,0x00000006,0x0000017a,0x00000094,
0x0003003e,0x00000179,0x0000017a,0x0004003d,0x00000006,0x0000017c,0x0000009f,0x0003003e,
0x0000017b,0x0000017c,0x0004003d,0x00000006,0x0000017e,0x000000b1,0x0003003e,0x0000017d,
0x0000017e,0x00070039,0x00000006,0x0000017f,0x0000001b,0x00000179,0x0000017b,0x0000017d,
0x0004003d,0x00000006,0x00000180,0x000000ba,0x0007000c,0x00000006,0x00000181,0x00000001,
0x00000028,0x0000017f,0x00000180,0x0003003e,0x00000178,0x00000181,0x0004003d,0x00000006,
0x00000184,0x00000098,0x0003003e,0x00000183,0x00000184,0x0004003d,0x00000006,0x00000186,
0x000000a2,0x0003003e,0x00000185,0x00000186,0x0004003d,0x00000006,0x00000188,0x000000b4,
0x0003003e,0x00000187,0x00000188,0x00070039,0x00000006,0x00000189,0x0000001b,0x00000183,
0x00000185,0x00000187,0x0004003d,0x00000006,0x0000018a,0x000000bd,0x0007000c,0x00000006,
0x0000018b,0x00000001,0x00000028,0x00000189,0x0000018a,0x0003003e,0x00000182,0x0000018b,
0x0003003e,0x0000018e,0x00000190,0x0004003d,0x00000006,0x00000192,0x00000150,0x0004003d,
0x00000006,0x00000193,0x000000a5,0x0007000c,0x00000006,0x00000194,0x00000001,0x00000025,
0x00000192,0x00000193,0x0004003d,0x00000006,0x00000196,0x0000016e,0x00050085,0x00000006,
0x00000197,0x00000195,0x00000196,0x0003003e,0x00000198,0x00000197,0x00050039,0x00000006,
0x00000199,0x0000000a,0x00000198,0x00050085,0x00000006,0x0000019a,0x00000194,0x00000199,
0x0003003e,0x00000191,0x0000019a,0x0004003d,0x00000006,0x0000019c,0x0000015a,0x0004003d,
0x00000006,0x0000019d,0x000000a8,0x0007000c,0x00000006,0x0000019e,0x00000001,0x00000025,
0x0000019c,0x0000019d,0x0004003d,0x00000006,0x0000019f,0x00000178,0x00050085,0x00000006,
0x000001a0,0x00000195,0x0000019f,0x0003003e,0x000001a1,0x000001a0,0x00050039,0x00000006,
0x000001a2,0x0000000a,0x000001a1,0x00050085,0x00000006,0x000001a3,0x0000019e,0x000001a2,
0x0003003e,0x0000019b,0x000001a3,0x0004003d,0x00000006,0x000001a5,0x00000164,0x0004003d,
0x00000006,0x000001a6,0x000000ab,0x0007000c,0x00000006,0x000001a7,0x00000001,0x00000025,
0x000001a5,0x000001a6,0x0004003d,0x00000006,0x000001a8,0x00000182,0x00050085,0x00000006,
0x000001a9,0x00000195,0x000001a8,0x0003003e,0x000001aa,0x000001a9,0x00050039,0x00000006,
0x000001ab,0x0000000a,0x000001aa,0x00050085,0x00000006,0x000001ac,0x000001a7,0x000001ab,
0x0003003e,0x000001a4,0x000001ac,0x00050041,0x00000007,0x000001ae,0x0000018e,0x00000091,
0x0004003d,0x00000006,0x000001af,0x000001ae,0x0004003d,0x00000006,0x000001b0,0x0000016e,
0x0004003d,0x00000006,0x000001b1,0x000000a5,0x0007000c,0x00000006,0x000001b2,0x00000001,
0x00000028,0x000001b0,0x000001b1,0x00050083,0x00000006,0x000001b3,0x000001af,0x000001b2,
0x0004003d,0x00000006,0x000001b4,0x00000150,0x00050085,0x00000006,0x000001b5,0x00000195,
0x000001b4,0x00050041,0x00000007,0x000001b6,0x0000018e,0x00000095,0x0004003d,0x00000006,
0x000001b7,0x000001b6,0x00050081,0x00000006,0x000001b8,0x000001b5,0x000001b7,0x0003003e,
0x000001b9,0x000001b8,0x00050039,0x00000006,0x000001ba,0x0000000a,0x000001b9,0x00050085,
0x00000006,0x000001bb,0x000001b3,0x000001ba,0x0003003e,0x000001ad,0x000001bb,0x00050041,
0x00000007,0x000001bd,0x0000018e,0x00000091,0x0004003d,0x00000006,0x000001be,0x000001bd,
0x0004003d,0x00000006,0x000001bf,0x00000178,0x0004003d,0x00000006,0x000001c0,0x000000a8,
0x0007000c,0x00000006,0x000001c1,0x00000001,0x00000028,0x000001bf,0x000001c0,0x00050083,
0x00000006,0x000001c2,0x000001be,0x000001c1,0x0004003d,0x00000006,0x000001c3,0x0000015a,
0x00050085,0x00000006,0x000001c4,0x00000195,0x000001c3,0x00050041,0x00000007,0x000001c5,
0x0000018e,0x00000095,0x0004003d,0x00000006,0x000001c6,0x000001c5,0x00050081,0x00000006,
0x000001c7,0x000001c4,0x000001c6,0x0003003e,0x000001c8,0x000001c7,0x00050039,0x00000006,
0x000001c9,0x0000000a,0x000001c8,0x00050085,0x00000006,0x000001ca,0x000001c2,0x000001c9,
0x0003003e,0x000001bc,0x000001ca,0x00050041,0x00000007,0x000001cc,0x0000018e,0x00000091,
0x0004003d,0x00000006,0x000001cd,0x000001cc,0x0004003d,0x00000006,0x000001ce,0x00000182,
0x0004003d,0x00000006,0x000001cf,0x000000ab,0x0007000c,0x00000006,0x000001d0,0x00000001,
0x00000028,0x000001ce,0x000001cf,0x00050083,0x00000006,0x000001d1,0x000001cd,0x000001d0,
0x0004003d,0x00000006,0x000001d2,0x00000164,0x00050085,0x00000006,0x000001d3,0x00000195,
0x000001d2,0x00050041,0x00000007,0x000001d4,0x0000018e,0x00000095,0x0004003d,0x00000006,
0x000001d5,0x000001d4,0x00050081,0x00000006,0x000001d6,0x000001d3,0x000001d5,0x0003003e,
0x000001d7,0x000001d6,0x00050039,0x00000006,0x000001d8,0x0000000a,0x000001d7,0x00050085,
0x00000006,0x000001d9,0x000001d1,0x000001d8,0x0003003e,0x000001cb,0x000001d9,0x0004003d,
0x00000006,0x000001db,0x00000191,0x0004007f,0x00000006,0x000001dc,0x000001db,0x0004003d,
0x00000006,0x000001dd,0x000001ad,0x0007000c,0x00000006,0x000001de,0x00000001,0x00000028,
0x000001dc,0x000001dd,0x0003003e,0x000001da,0x000001de,0x0004003d,0x00000006,0x000001e0,
0x0000019b,0x0004007f,0x00000006,0x000001e1,0x000001e0,0x0004003d,0x00000006,0x000001e2,
0x000001bc,0x0007000c,0x00000006,0x000001e3,0x00000001,0x00000028,0x000001e1,0x000001e2,
0x0003003e,0x000001df,0x000001e3,0x0004003d,0x00000006,0x000001e5,0x000001a4,0x0004007f,
0x00000006,0x000001e6,0x000001e5,0x0004003d,0x00000006,0x000001e7,0x000001cb,0x0007000c,
0x00000006,0x000001e8,0x00000001,0x00000028,0x000001e6,0x000001e7,0x0003003e,0x000001e4,
0x000001e8,0x0004003d,0x00000006,0x000001ec,0x000001da,0x0003003e,0x000001eb,0x000001ec,
0x0004003d,0x00000006,0x000001ee,0x000001df,0x0003003e,0x000001ed,0x000001ee,0x0004003d,
0x00000006,0x000001f0,0x000001e4,0x0003003e,0x000001ef,0x000001f0,0x00070039,0x00000006,
0x000001f1,0x0000001b,0x000001eb,0x000001ed,0x000001ef,0x0007000c,0x00000006,0x000001f2,
0x00000001,0x00000025,0x000001f1,0x00000042,0x0007000c,0x00000006,0x000001f3,0x00000001,
0x00000028,0x000001ea,0x000001f2,0x00050041,0x000001f4,0x000001f5,0x00000035,0x00000091,
0x0004003d,0x0000002b,0x000001f6,0x000001f5,0x0004007c,0x00000006,0x000001f7,0x000001f6,
0x00050085,0x00000006,0x000001f8,0x000001f3,0x000001f7,0x0003003e,0x000001e9,0x000001f8,
0x0004003d,0x00000006,0x000001fa,0x000001e9,0x00050085,0x00000006,0x000001fb,0x00000195,
0x000001fa,0x00050081,0x00000006,0x000001fc,0x000001fb,0x00000038,0x0003003e,0x000001fd,
0x000001fc,0x00050039,0x00000006,0x000001fe,0x0000000d,0x000001fd,0x0003003e,0x000001f9,
0x000001fe,0x0004003d,0x00000006,0x000001ff,0x000001e9,0x0004003d,0x00000006,0x00000200,
0x00000090,0x00050085,0x00000006,0x00000201,0x000001ff,0x00000200,0x0004003d,0x00000006,
0x00000202,0x000001e9,0x0004003d,0x00000006,0x00000203,0x0000009c,0x00050085,0x00000006,
0x00000204,0x00000202,0x00000203,0x00050081,0x00000006,0x00000205,0x00000201,0x00000204,
0x0004003d,0x00000006,0x00000206,0x000001e9,0x0004003d,0x00000006,0x00000207,0x000000b7,
0x00050085,0x00000006,0x00000208,0x00000206,0x00000207,0x00050081,0x00000006,0x00000209,
0x00000205,0x00000208,0x0004003d,0x00000006,0x0000020a,0x000001e9,0x0004003d,0x00000006,
0x0000020b,0x000000ae,0x00050085,0x00000006,0x0000020c,0x0000020a,0x0000020b,0x00050081,
0x00000006,0x0000020d,0x00000209,0x0000020c,0x0004003d,0x00000006,0x0000020e,0x000000a5,
0x00050081,0x00000006,0x0000020f,0x0000020d,0x0000020e,0x0004003d,0x00000006,0x00000210,
0x000001f9,0x00050085,0x00000006,0x00000211,0x0000020f,0x00000210,0x0003003e,0x00000031,
0x00000211,0x0004003d,0x00000006,0x00000212,0x000001e9,0x0004003d,0x00000006,0x00000213,
0x00000094,0x00050085,0x00000006,0x00000214,0x00000212,0x00000213,0x0004003d,0x00000006,
0x00000215,0x000001e9,0x0004003d,0x00000006,0x00000216,0x0000009f,0x00050085,0x00000006,
0x00000217,0x00000215,0x00000216,0x00050081,0x00000006,0x00000218,0x00000214,0x00000217,
0x0004003d,0x00000006,0x00000219,0x000001e9,0x0004003d,0x00000006,0x0000021a,0x000000ba,
0x00050085,0x00000006,0x0000021b,0x00000219,0x0000021a,0x00050081,0x00000006,0x0000021c,
0x00000218,0x0000021b,0x0004003d,0x00000006,0x0000021d,0x000001e9,0x0004003d,0x00000006,
0x0000021e,0x000000b1,0x00050085,0x00000006,0x0000021f,0x0000021d,0x0000021e,0x00050081,
0x00000006,0x00000220,0x0000021c,0x0000021f,0x0004003d,0x00000006,0x00000221,0x000000a8,
0x00050081,0x00000006,0x00000222,0x00000220,0x00000221,0x0004003d,0x00000006,0x00000223,
0x000001f9,0x00050085,0x00000006,0x00000224,0x00000222,0x00000223,0x0003003e,0x00000032,
0x00000224,0x0004003d,0x00000006,0x00000225,0x000001e9,0x0004003d,0x00000006,0x00000226,
0x00000098,0x00050085,0x00000006,0x00000227,0x00000225,0x00000226,0x0004003d,0x00000006,
0x00000228,0x000001e9,0x0004003d,0x00000006,0x00000229,0x000000a2,0x00050085,0x00000006,
0x0000022a,0x00000228,0x00000229,0x00050081,0x00000006,0x0000022b,0x00000227,0x0000022a,
0x0004003d,0x00000006,0x0000022c,0x000001e9,0x0004003d,0x00000006,0x0000022d,0x000000bd,
0x00050085,0x00000006,0x0000022e,0x0000022c,0x0000022d,0x00050081,0x00000006,0x0000022f,
0x0000022b,0x0000022e,0x0004003d,0x00000006,0x00000230,0x000001e9,0x0004003d,0x00000006,
0x00000231,0x000000b4,0x00050085,0x00000006,0x00000232,0x00000230,0x00000231,0x00050081,
0x00000006,0x00000233,0x0000022f,0x00000232,0x0004003d,0x00000006,0x00000234,0x000000ab,
0x00050081,0x00000006,0x00000235,0x00000233,0x00000234,0x0004003d,0x00000006,0x00000236,
0x000001f9,0x00050085,0x00000006,0x00000237,0x00000235,0x00000236,0x0003003e,0x00000033,
0x00000237,0x000100fd,0x00010038
};
-67
View File
@@ -1,67 +0,0 @@
#version 450
// =============================================================================
// FXAA (Fast Approximate Anti-Aliasing) post effect.
//
// Ported verbatim from the OpenGL FXAAEffect.java shader so the Vulkan
// compositor's post-process pipeline applies the SAME anti-aliasing the GL
// renderer's "FXAA" toggle does. GL sampled with gl_FragCoord.xy*invResolution;
// here fragTexCoord already spans [0,1] across the output, so it IS that uv.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// Runs FIRST in the canonical post chain (AA on the clean composited image).
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in px
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
#define FXAA_MIN_REDUCE (1.0 / 128.0)
#define FXAA_MUL_REDUCE (1.0 / 8.0)
#define MAX_SPAN 8.0
const vec3 luma = vec3(0.299, 0.587, 0.114);
void main() {
vec2 invResolution = 1.0 / pc.resolution;
vec2 uv = fragTexCoord;
vec3 rgbNW = texture(InputTexture, uv + vec2(-1.0, -1.0) * invResolution).rgb;
vec3 rgbNE = texture(InputTexture, uv + vec2( 1.0, -1.0) * invResolution).rgb;
vec3 rgbSW = texture(InputTexture, uv + vec2(-1.0, 1.0) * invResolution).rgb;
vec3 rgbSE = texture(InputTexture, uv + vec2( 1.0, 1.0) * invResolution).rgb;
vec3 rgbM = texture(InputTexture, uv).rgb;
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * 0.25 * FXAA_MUL_REDUCE, FXAA_MIN_REDUCE);
float minDirFactor = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = clamp(dir * minDirFactor, vec2(-MAX_SPAN), vec2(MAX_SPAN)) * invResolution;
vec4 rgbA = 0.5 * (
texture(InputTexture, uv + dir * (1.0 / 3.0 - 0.5)) +
texture(InputTexture, uv + dir * (2.0 / 3.0 - 0.5)));
vec4 rgbB = rgbA * 0.5 + 0.25 * (
texture(InputTexture, uv + dir * -0.5) +
texture(InputTexture, uv + dir * 0.5));
float lumaB = dot(rgbB, vec4(luma, 0.0));
outColor = (lumaB < lumaMin || lumaB > lumaMax) ? rgbA : rgbB;
}
-69
View File
@@ -1,69 +0,0 @@
#version 450
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc;
vec2 resolution;
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
#define FXAA_MIN_REDUCE (1.0 / 128.0)
#define FXAA_MUL_REDUCE (1.0 / 8.0)
#define MAX_SPAN 8.0
const vec3 luma = vec3(0.299, 0.587, 0.114);
void main() {
vec2 invResolution = 1.0 / pc.resolution;
vec2 uv = fragTexCoord;
vec3 rgbNW = texture(InputTexture, uv + vec2(-1.0, -1.0) * invResolution).rgb;
vec3 rgbNE = texture(InputTexture, uv + vec2( 1.0, -1.0) * invResolution).rgb;
vec3 rgbSW = texture(InputTexture, uv + vec2(-1.0, 1.0) * invResolution).rgb;
vec3 rgbSE = texture(InputTexture, uv + vec2( 1.0, 1.0) * invResolution).rgb;
vec3 rgbM = texture(InputTexture, uv).rgb;
float lumaNW = dot(rgbNW, luma);
float lumaNE = dot(rgbNE, luma);
float lumaSW = dot(rgbSW, luma);
float lumaSE = dot(rgbSE, luma);
float lumaM = dot(rgbM, luma);
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
vec2 dir;
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
float dirReduce = max(
(lumaNW + lumaNE + lumaSW + lumaSE) * 0.25 * FXAA_MUL_REDUCE,
FXAA_MIN_REDUCE);
float minDirFactor = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
dir = clamp(dir * minDirFactor, vec2(-MAX_SPAN), vec2(MAX_SPAN)) * invResolution;
vec4 rgbA = 0.5 * (
texture(InputTexture, uv + dir * (1.0 / 3.0 - 0.5)) +
texture(InputTexture, uv + dir * (2.0 / 3.0 - 0.5)));
vec4 rgbB = rgbA * 0.5 + 0.25 * (
texture(InputTexture, uv + dir * -0.5) +
texture(InputTexture, uv + dir * 0.5));
vec4 fxaaColor = dot(rgbB, vec4(luma, 0.0)) < lumaMin ||
dot(rgbB, vec4(luma, 0.0)) > lumaMax ? rgbA : rgbB;
// Approximate Toon edges using only FXAA's existing five samples.
vec3 colorLeft = 0.5 * (rgbNW + rgbSW);
vec3 colorRight = 0.5 * (rgbNE + rgbSE);
vec3 colorUp = 0.5 * (rgbNW + rgbNE);
vec3 colorDown = 0.5 * (rgbSW + rgbSE);
float diffHorizontal = length(colorRight - colorLeft);
float diffVertical = length(colorUp - colorDown);
float edgeFactor = step(0.2, diffHorizontal + diffVertical);
outColor = vec4(mix(fxaaColor.rgb, vec3(0.0), edgeFactor), 1.0);
}
-202
View File
@@ -1,202 +0,0 @@
// 1116.3.0
#pragma once
const uint32_t fxaa_toon_code[] = {
0x07230203,0x00010000,0x0008000b,0x00000115,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000018,0x0000010a,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x00000009,0x52766e69,0x6c6f7365,0x6f697475,0x0000006e,0x00030005,
0x0000000c,0x00004350,0x00040006,0x0000000c,0x00000000,0x0063646e,0x00060006,0x0000000c,
0x00000001,0x6f736572,0x6974756c,0x00006e6f,0x00030005,0x0000000e,0x00006370,0x00030005,
0x00000016,0x00007675,0x00060005,0x00000018,0x67617266,0x43786554,0x64726f6f,0x00000000,
0x00040005,0x0000001c,0x4e626772,0x00000057,0x00060005,0x00000020,0x75706e49,0x78655474,
0x65727574,0x00000000,0x00040005,0x0000002a,0x4e626772,0x00000045,0x00040005,0x00000033,
0x53626772,0x00000057,0x00040005,0x0000003c,0x53626772,0x00000045,0x00040005,0x00000045,
0x4d626772,0x00000000,0x00040005,0x0000004b,0x616d756c,0x0000574e,0x00040005,0x00000052,
0x616d756c,0x0000454e,0x00040005,0x00000055,0x616d756c,0x00005753,0x00040005,0x00000058,
0x616d756c,0x00004553,0x00040005,0x0000005b,0x616d756c,0x0000004d,0x00040005,0x0000005e,
0x616d756c,0x006e694d,0x00040005,0x00000068,0x616d756c,0x0078614d,0x00030005,0x00000072,
0x00726964,0x00050005,0x00000087,0x52726964,0x63756465,0x00000065,0x00060005,0x00000095,
0x446e696d,0x61467269,0x726f7463,0x00000000,0x00040005,0x000000ab,0x41626772,0x00000000,
0x00040005,0x000000bd,0x42626772,0x00000000,0x00050005,0x000000d0,0x61617866,0x6f6c6f43,
0x00000072,0x00050005,0x000000e5,0x6f6c6f63,0x66654c72,0x00000074,0x00050005,0x000000ea,
0x6f6c6f63,0x67695272,0x00007468,0x00040005,0x000000ef,0x6f6c6f63,0x00705572,0x00050005,
0x000000f4,0x6f6c6f63,0x776f4472,0x0000006e,0x00060005,0x000000f9,0x66666964,0x69726f48,
0x746e6f7a,0x00006c61,0x00060005,0x000000fe,0x66666964,0x74726556,0x6c616369,0x00000000,
0x00050005,0x00000103,0x65676465,0x74636146,0x0000726f,0x00050005,0x0000010a,0x4374756f,
0x726f6c6f,0x00000000,0x00030047,0x0000000c,0x00000002,0x00050048,0x0000000c,0x00000000,
0x00000023,0x00000000,0x00050048,0x0000000c,0x00000001,0x00000023,0x00000010,0x00040047,
0x00000018,0x0000001e,0x00000000,0x00040047,0x00000020,0x00000021,0x00000000,0x00040047,
0x00000020,0x00000022,0x00000000,0x00040047,0x0000010a,0x0000001e,0x00000000,0x00020013,
0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,
0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x0004002b,
0x00000006,0x0000000a,0x3f800000,0x00040017,0x0000000b,0x00000006,0x00000004,0x0004001e,
0x0000000c,0x0000000b,0x00000007,0x00040020,0x0000000d,0x00000009,0x0000000c,0x0004003b,
0x0000000d,0x0000000e,0x00000009,0x00040015,0x0000000f,0x00000020,0x00000001,0x0004002b,
0x0000000f,0x00000010,0x00000001,0x00040020,0x00000011,0x00000009,0x00000007,0x00040020,
0x00000017,0x00000001,0x00000007,0x0004003b,0x00000017,0x00000018,0x00000001,0x00040017,
0x0000001a,0x00000006,0x00000003,0x00040020,0x0000001b,0x00000007,0x0000001a,0x00090019,
0x0000001d,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,
0x0003001b,0x0000001e,0x0000001d,0x00040020,0x0000001f,0x00000000,0x0000001e,0x0004003b,
0x0000001f,0x00000020,0x00000000,0x0004002b,0x00000006,0x00000023,0xbf800000,0x0005002c,
0x00000007,0x00000024,0x00000023,0x00000023,0x0005002c,0x00000007,0x0000002d,0x0000000a,
0x00000023,0x0005002c,0x00000007,0x00000036,0x00000023,0x0000000a,0x0005002c,0x00000007,
0x0000003f,0x0000000a,0x0000000a,0x00040020,0x0000004a,0x00000007,0x00000006,0x0004002b,
0x00000006,0x0000004d,0x3e991687,0x0004002b,0x00000006,0x0000004e,0x3f1645a2,0x0004002b,
0x00000006,0x0000004f,0x3de978d5,0x0006002c,0x0000001a,0x00000050,0x0000004d,0x0000004e,
0x0000004f,0x00040015,0x0000007b,0x00000020,0x00000000,0x0004002b,0x0000007b,0x0000007c,
0x00000000,0x0004002b,0x0000007b,0x00000085,0x00000001,0x0004002b,0x00000006,0x0000008f,
0x3e800000,0x0004002b,0x00000006,0x00000091,0x3e000000,0x0004002b,0x00000006,0x00000093,
0x3c000000,0x0004002b,0x00000006,0x000000a3,0xc1000000,0x0005002c,0x00000007,0x000000a4,
0x000000a3,0x000000a3,0x0004002b,0x00000006,0x000000a5,0x41000000,0x0005002c,0x00000007,
0x000000a6,0x000000a5,0x000000a5,0x00040020,0x000000aa,0x00000007,0x0000000b,0x0004002b,
0x00000006,0x000000ac,0x3f000000,0x0004002b,0x00000006,0x000000b0,0xbe2aaaab,0x0004002b,
0x00000006,0x000000b7,0x3e2aaaab,0x0004002b,0x00000006,0x000000c3,0xbf000000,0x00020014,
0x000000d1,0x0004002b,0x00000006,0x000000d3,0x00000000,0x0007002c,0x0000000b,0x000000d4,
0x0000004d,0x0000004e,0x0000004f,0x000000d3,0x00040017,0x000000e2,0x000000d1,0x00000004,
0x0004002b,0x00000006,0x00000104,0x3e4ccccd,0x00040020,0x00000109,0x00000003,0x0000000b,
0x0004003b,0x00000109,0x0000010a,0x00000003,0x0006002c,0x0000001a,0x0000010d,0x000000d3,
0x000000d3,0x000000d3,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000016,
0x00000007,0x0004003b,0x0000001b,0x0000001c,0x00000007,0x0004003b,0x0000001b,0x0000002a,
0x00000007,0x0004003b,0x0000001b,0x00000033,0x00000007,0x0004003b,0x0000001b,0x0000003c,
0x00000007,0x0004003b,0x0000001b,0x00000045,0x00000007,0x0004003b,0x0000004a,0x0000004b,
0x00000007,0x0004003b,0x0000004a,0x00000052,0x00000007,0x0004003b,0x0000004a,0x00000055,
0x00000007,0x0004003b,0x0000004a,0x00000058,0x00000007,0x0004003b,0x0000004a,0x0000005b,
0x00000007,0x0004003b,0x0000004a,0x0000005e,0x00000007,0x0004003b,0x0000004a,0x00000068,
0x00000007,0x0004003b,0x00000008,0x00000072,0x00000007,0x0004003b,0x0000004a,0x00000087,
0x00000007,0x0004003b,0x0000004a,0x00000095,0x00000007,0x0004003b,0x000000aa,0x000000ab,
0x00000007,0x0004003b,0x000000aa,0x000000bd,0x00000007,0x0004003b,0x000000aa,0x000000d0,
0x00000007,0x0004003b,0x0000001b,0x000000e5,0x00000007,0x0004003b,0x0000001b,0x000000ea,
0x00000007,0x0004003b,0x0000001b,0x000000ef,0x00000007,0x0004003b,0x0000001b,0x000000f4,
0x00000007,0x0004003b,0x0000004a,0x000000f9,0x00000007,0x0004003b,0x0000004a,0x000000fe,
0x00000007,0x0004003b,0x0000004a,0x00000103,0x00000007,0x00050041,0x00000011,0x00000012,
0x0000000e,0x00000010,0x0004003d,0x00000007,0x00000013,0x00000012,0x00050050,0x00000007,
0x00000014,0x0000000a,0x0000000a,0x00050088,0x00000007,0x00000015,0x00000014,0x00000013,
0x0003003e,0x00000009,0x00000015,0x0004003d,0x00000007,0x00000019,0x00000018,0x0003003e,
0x00000016,0x00000019,0x0004003d,0x0000001e,0x00000021,0x00000020,0x0004003d,0x00000007,
0x00000022,0x00000016,0x0004003d,0x00000007,0x00000025,0x00000009,0x00050085,0x00000007,
0x00000026,0x00000024,0x00000025,0x00050081,0x00000007,0x00000027,0x00000022,0x00000026,
0x00050057,0x0000000b,0x00000028,0x00000021,0x00000027,0x0008004f,0x0000001a,0x00000029,
0x00000028,0x00000028,0x00000000,0x00000001,0x00000002,0x0003003e,0x0000001c,0x00000029,
0x0004003d,0x0000001e,0x0000002b,0x00000020,0x0004003d,0x00000007,0x0000002c,0x00000016,
0x0004003d,0x00000007,0x0000002e,0x00000009,0x00050085,0x00000007,0x0000002f,0x0000002d,
0x0000002e,0x00050081,0x00000007,0x00000030,0x0000002c,0x0000002f,0x00050057,0x0000000b,
0x00000031,0x0000002b,0x00000030,0x0008004f,0x0000001a,0x00000032,0x00000031,0x00000031,
0x00000000,0x00000001,0x00000002,0x0003003e,0x0000002a,0x00000032,0x0004003d,0x0000001e,
0x00000034,0x00000020,0x0004003d,0x00000007,0x00000035,0x00000016,0x0004003d,0x00000007,
0x00000037,0x00000009,0x00050085,0x00000007,0x00000038,0x00000036,0x00000037,0x00050081,
0x00000007,0x00000039,0x00000035,0x00000038,0x00050057,0x0000000b,0x0000003a,0x00000034,
0x00000039,0x0008004f,0x0000001a,0x0000003b,0x0000003a,0x0000003a,0x00000000,0x00000001,
0x00000002,0x0003003e,0x00000033,0x0000003b,0x0004003d,0x0000001e,0x0000003d,0x00000020,
0x0004003d,0x00000007,0x0000003e,0x00000016,0x0004003d,0x00000007,0x00000040,0x00000009,
0x00050085,0x00000007,0x00000041,0x0000003f,0x00000040,0x00050081,0x00000007,0x00000042,
0x0000003e,0x00000041,0x00050057,0x0000000b,0x00000043,0x0000003d,0x00000042,0x0008004f,
0x0000001a,0x00000044,0x00000043,0x00000043,0x00000000,0x00000001,0x00000002,0x0003003e,
0x0000003c,0x00000044,0x0004003d,0x0000001e,0x00000046,0x00000020,0x0004003d,0x00000007,
0x00000047,0x00000016,0x00050057,0x0000000b,0x00000048,0x00000046,0x00000047,0x0008004f,
0x0000001a,0x00000049,0x00000048,0x00000048,0x00000000,0x00000001,0x00000002,0x0003003e,
0x00000045,0x00000049,0x0004003d,0x0000001a,0x0000004c,0x0000001c,0x00050094,0x00000006,
0x00000051,0x0000004c,0x00000050,0x0003003e,0x0000004b,0x00000051,0x0004003d,0x0000001a,
0x00000053,0x0000002a,0x00050094,0x00000006,0x00000054,0x00000053,0x00000050,0x0003003e,
0x00000052,0x00000054,0x0004003d,0x0000001a,0x00000056,0x00000033,0x00050094,0x00000006,
0x00000057,0x00000056,0x00000050,0x0003003e,0x00000055,0x00000057,0x0004003d,0x0000001a,
0x00000059,0x0000003c,0x00050094,0x00000006,0x0000005a,0x00000059,0x00000050,0x0003003e,
0x00000058,0x0000005a,0x0004003d,0x0000001a,0x0000005c,0x00000045,0x00050094,0x00000006,
0x0000005d,0x0000005c,0x00000050,0x0003003e,0x0000005b,0x0000005d,0x0004003d,0x00000006,
0x0000005f,0x0000005b,0x0004003d,0x00000006,0x00000060,0x0000004b,0x0004003d,0x00000006,
0x00000061,0x00000052,0x0007000c,0x00000006,0x00000062,0x00000001,0x00000025,0x00000060,
0x00000061,0x0004003d,0x00000006,0x00000063,0x00000055,0x0004003d,0x00000006,0x00000064,
0x00000058,0x0007000c,0x00000006,0x00000065,0x00000001,0x00000025,0x00000063,0x00000064,
0x0007000c,0x00000006,0x00000066,0x00000001,0x00000025,0x00000062,0x00000065,0x0007000c,
0x00000006,0x00000067,0x00000001,0x00000025,0x0000005f,0x00000066,0x0003003e,0x0000005e,
0x00000067,0x0004003d,0x00000006,0x00000069,0x0000005b,0x0004003d,0x00000006,0x0000006a,
0x0000004b,0x0004003d,0x00000006,0x0000006b,0x00000052,0x0007000c,0x00000006,0x0000006c,
0x00000001,0x00000028,0x0000006a,0x0000006b,0x0004003d,0x00000006,0x0000006d,0x00000055,
0x0004003d,0x00000006,0x0000006e,0x00000058,0x0007000c,0x00000006,0x0000006f,0x00000001,
0x00000028,0x0000006d,0x0000006e,0x0007000c,0x00000006,0x00000070,0x00000001,0x00000028,
0x0000006c,0x0000006f,0x0007000c,0x00000006,0x00000071,0x00000001,0x00000028,0x00000069,
0x00000070,0x0003003e,0x00000068,0x00000071,0x0004003d,0x00000006,0x00000073,0x0000004b,
0x0004003d,0x00000006,0x00000074,0x00000052,0x00050081,0x00000006,0x00000075,0x00000073,
0x00000074,0x0004003d,0x00000006,0x00000076,0x00000055,0x0004003d,0x00000006,0x00000077,
0x00000058,0x00050081,0x00000006,0x00000078,0x00000076,0x00000077,0x00050083,0x00000006,
0x00000079,0x00000075,0x00000078,0x0004007f,0x00000006,0x0000007a,0x00000079,0x00050041,
0x0000004a,0x0000007d,0x00000072,0x0000007c,0x0003003e,0x0000007d,0x0000007a,0x0004003d,
0x00000006,0x0000007e,0x0000004b,0x0004003d,0x00000006,0x0000007f,0x00000055,0x00050081,
0x00000006,0x00000080,0x0000007e,0x0000007f,0x0004003d,0x00000006,0x00000081,0x00000052,
0x0004003d,0x00000006,0x00000082,0x00000058,0x00050081,0x00000006,0x00000083,0x00000081,
0x00000082,0x00050083,0x00000006,0x00000084,0x00000080,0x00000083,0x00050041,0x0000004a,
0x00000086,0x00000072,0x00000085,0x0003003e,0x00000086,0x00000084,0x0004003d,0x00000006,
0x00000088,0x0000004b,0x0004003d,0x00000006,0x00000089,0x00000052,0x00050081,0x00000006,
0x0000008a,0x00000088,0x00000089,0x0004003d,0x00000006,0x0000008b,0x00000055,0x00050081,
0x00000006,0x0000008c,0x0000008a,0x0000008b,0x0004003d,0x00000006,0x0000008d,0x00000058,
0x00050081,0x00000006,0x0000008e,0x0000008c,0x0000008d,0x00050085,0x00000006,0x00000090,
0x0000008e,0x0000008f,0x00050085,0x00000006,0x00000092,0x00000090,0x00000091,0x0007000c,
0x00000006,0x00000094,0x00000001,0x00000028,0x00000092,0x00000093,0x0003003e,0x00000087,
0x00000094,0x00050041,0x0000004a,0x00000096,0x00000072,0x0000007c,0x0004003d,0x00000006,
0x00000097,0x00000096,0x0006000c,0x00000006,0x00000098,0x00000001,0x00000004,0x00000097,
0x00050041,0x0000004a,0x00000099,0x00000072,0x00000085,0x0004003d,0x00000006,0x0000009a,
0x00000099,0x0006000c,0x00000006,0x0000009b,0x00000001,0x00000004,0x0000009a,0x0007000c,
0x00000006,0x0000009c,0x00000001,0x00000025,0x00000098,0x0000009b,0x0004003d,0x00000006,
0x0000009d,0x00000087,0x00050081,0x00000006,0x0000009e,0x0000009c,0x0000009d,0x00050088,
0x00000006,0x0000009f,0x0000000a,0x0000009e,0x0003003e,0x00000095,0x0000009f,0x0004003d,
0x00000007,0x000000a0,0x00000072,0x0004003d,0x00000006,0x000000a1,0x00000095,0x0005008e,
0x00000007,0x000000a2,0x000000a0,0x000000a1,0x0008000c,0x00000007,0x000000a7,0x00000001,
0x0000002b,0x000000a2,0x000000a4,0x000000a6,0x0004003d,0x00000007,0x000000a8,0x00000009,
0x00050085,0x00000007,0x000000a9,0x000000a7,0x000000a8,0x0003003e,0x00000072,0x000000a9,
0x0004003d,0x0000001e,0x000000ad,0x00000020,0x0004003d,0x00000007,0x000000ae,0x00000016,
0x0004003d,0x00000007,0x000000af,0x00000072,0x0005008e,0x00000007,0x000000b1,0x000000af,
0x000000b0,0x00050081,0x00000007,0x000000b2,0x000000ae,0x000000b1,0x00050057,0x0000000b,
0x000000b3,0x000000ad,0x000000b2,0x0004003d,0x0000001e,0x000000b4,0x00000020,0x0004003d,
0x00000007,0x000000b5,0x00000016,0x0004003d,0x00000007,0x000000b6,0x00000072,0x0005008e,
0x00000007,0x000000b8,0x000000b6,0x000000b7,0x00050081,0x00000007,0x000000b9,0x000000b5,
0x000000b8,0x00050057,0x0000000b,0x000000ba,0x000000b4,0x000000b9,0x00050081,0x0000000b,
0x000000bb,0x000000b3,0x000000ba,0x0005008e,0x0000000b,0x000000bc,0x000000bb,0x000000ac,
0x0003003e,0x000000ab,0x000000bc,0x0004003d,0x0000000b,0x000000be,0x000000ab,0x0005008e,
0x0000000b,0x000000bf,0x000000be,0x000000ac,0x0004003d,0x0000001e,0x000000c0,0x00000020,
0x0004003d,0x00000007,0x000000c1,0x00000016,0x0004003d,0x00000007,0x000000c2,0x00000072,
0x0005008e,0x00000007,0x000000c4,0x000000c2,0x000000c3,0x00050081,0x00000007,0x000000c5,
0x000000c1,0x000000c4,0x00050057,0x0000000b,0x000000c6,0x000000c0,0x000000c5,0x0004003d,
0x0000001e,0x000000c7,0x00000020,0x0004003d,0x00000007,0x000000c8,0x00000016,0x0004003d,
0x00000007,0x000000c9,0x00000072,0x0005008e,0x00000007,0x000000ca,0x000000c9,0x000000ac,
0x00050081,0x00000007,0x000000cb,0x000000c8,0x000000ca,0x00050057,0x0000000b,0x000000cc,
0x000000c7,0x000000cb,0x00050081,0x0000000b,0x000000cd,0x000000c6,0x000000cc,0x0005008e,
0x0000000b,0x000000ce,0x000000cd,0x0000008f,0x00050081,0x0000000b,0x000000cf,0x000000bf,
0x000000ce,0x0003003e,0x000000bd,0x000000cf,0x0004003d,0x0000000b,0x000000d2,0x000000bd,
0x00050094,0x00000006,0x000000d5,0x000000d2,0x000000d4,0x0004003d,0x00000006,0x000000d6,
0x0000005e,0x000500b8,0x000000d1,0x000000d7,0x000000d5,0x000000d6,0x000400a8,0x000000d1,
0x000000d8,0x000000d7,0x000300f7,0x000000da,0x00000000,0x000400fa,0x000000d8,0x000000d9,
0x000000da,0x000200f8,0x000000d9,0x0004003d,0x0000000b,0x000000db,0x000000bd,0x00050094,
0x00000006,0x000000dc,0x000000db,0x000000d4,0x0004003d,0x00000006,0x000000dd,0x00000068,
0x000500ba,0x000000d1,0x000000de,0x000000dc,0x000000dd,0x000200f9,0x000000da,0x000200f8,
0x000000da,0x000700f5,0x000000d1,0x000000df,0x000000d7,0x00000005,0x000000de,0x000000d9,
0x0004003d,0x0000000b,0x000000e0,0x000000ab,0x0004003d,0x0000000b,0x000000e1,0x000000bd,
0x00070050,0x000000e2,0x000000e3,0x000000df,0x000000df,0x000000df,0x000000df,0x000600a9,
0x0000000b,0x000000e4,0x000000e3,0x000000e0,0x000000e1,0x0003003e,0x000000d0,0x000000e4,
0x0004003d,0x0000001a,0x000000e6,0x0000001c,0x0004003d,0x0000001a,0x000000e7,0x00000033,
0x00050081,0x0000001a,0x000000e8,0x000000e6,0x000000e7,0x0005008e,0x0000001a,0x000000e9,
0x000000e8,0x000000ac,0x0003003e,0x000000e5,0x000000e9,0x0004003d,0x0000001a,0x000000eb,
0x0000002a,0x0004003d,0x0000001a,0x000000ec,0x0000003c,0x00050081,0x0000001a,0x000000ed,
0x000000eb,0x000000ec,0x0005008e,0x0000001a,0x000000ee,0x000000ed,0x000000ac,0x0003003e,
0x000000ea,0x000000ee,0x0004003d,0x0000001a,0x000000f0,0x0000001c,0x0004003d,0x0000001a,
0x000000f1,0x0000002a,0x00050081,0x0000001a,0x000000f2,0x000000f0,0x000000f1,0x0005008e,
0x0000001a,0x000000f3,0x000000f2,0x000000ac,0x0003003e,0x000000ef,0x000000f3,0x0004003d,
0x0000001a,0x000000f5,0x00000033,0x0004003d,0x0000001a,0x000000f6,0x0000003c,0x00050081,
0x0000001a,0x000000f7,0x000000f5,0x000000f6,0x0005008e,0x0000001a,0x000000f8,0x000000f7,
0x000000ac,0x0003003e,0x000000f4,0x000000f8,0x0004003d,0x0000001a,0x000000fa,0x000000ea,
0x0004003d,0x0000001a,0x000000fb,0x000000e5,0x00050083,0x0000001a,0x000000fc,0x000000fa,
0x000000fb,0x0006000c,0x00000006,0x000000fd,0x00000001,0x00000042,0x000000fc,0x0003003e,
0x000000f9,0x000000fd,0x0004003d,0x0000001a,0x000000ff,0x000000ef,0x0004003d,0x0000001a,
0x00000100,0x000000f4,0x00050083,0x0000001a,0x00000101,0x000000ff,0x00000100,0x0006000c,
0x00000006,0x00000102,0x00000001,0x00000042,0x00000101,0x0003003e,0x000000fe,0x00000102,
0x0004003d,0x00000006,0x00000105,0x000000f9,0x0004003d,0x00000006,0x00000106,0x000000fe,
0x00050081,0x00000006,0x00000107,0x00000105,0x00000106,0x0007000c,0x00000006,0x00000108,
0x00000001,0x00000030,0x00000104,0x00000107,0x0003003e,0x00000103,0x00000108,0x0004003d,
0x0000000b,0x0000010b,0x000000d0,0x0008004f,0x0000001a,0x0000010c,0x0000010b,0x0000010b,
0x00000000,0x00000001,0x00000002,0x0004003d,0x00000006,0x0000010e,0x00000103,0x00060050,
0x0000001a,0x0000010f,0x0000010e,0x0000010e,0x0000010e,0x0008000c,0x0000001a,0x00000110,
0x00000001,0x0000002e,0x0000010c,0x0000010d,0x0000010f,0x00050051,0x00000006,0x00000111,
0x00000110,0x00000000,0x00050051,0x00000006,0x00000112,0x00000110,0x00000001,0x00050051,
0x00000006,0x00000113,0x00000110,0x00000002,0x00070050,0x0000000b,0x00000114,0x00000111,
0x00000112,0x00000113,0x0000000a,0x0003003e,0x0000010a,0x00000114,0x000100fd,0x00010038
};
-55
View File
@@ -1,55 +0,0 @@
#!/usr/bin/env bash
# =============================================================================
# Regenerate the committed SPIR-V headers (*_frag.h / *_vert.h) for the native
# Vulkan compositor's post-process shaders.
#
# The Android NDK build does NOT compile GLSL; instead every *.frag / *.vert in
# this directory is pre-compiled to a SPIR-V uint32 array header that is #included
# by VulkanRendererContext.cpp. Run this whenever you edit a shader, then commit
# the regenerated *.h alongside the *.frag/*.vert source.
#
# Requires glslangValidator on PATH (e.g. the Vulkan SDK or the termux package).
#
# Usage: ./gen_shaders.sh # regenerate all shaders
# ./gen_shaders.sh nis crt # regenerate only the named shaders
# =============================================================================
set -euo pipefail
cd "$(dirname "$0")"
if ! command -v glslangValidator >/dev/null 2>&1; then
echo "error: glslangValidator not found on PATH" >&2
exit 1
fi
gen() {
local src="$1" # e.g. nis.frag
local base="${src%.*}" # nis
local ext="${src##*.}" # frag | vert
local vn="${base}_code"
if [ "$ext" = "vert" ]; then
vn="${base}_vert_code"
fi
local out="${base}_${ext}.h"
echo " ${src} -> ${out} (--vn ${vn})"
glslangValidator -V "${src}" --vn "${vn}" -o "${out}"
}
shaders=()
if [ "$#" -gt 0 ]; then
for name in "$@"; do
for f in "${name}.frag" "${name}.vert"; do
[ -f "$f" ] && shaders+=("$f")
done
done
else
for f in *.frag *.vert; do
[ -f "$f" ] && shaders+=("$f")
done
fi
for s in "${shaders[@]}"; do
gen "$s"
done
echo "done."
-64
View File
@@ -1,64 +0,0 @@
#version 450
// =============================================================================
// Fake-HDR (dual-radius bloom + contrast lift) post effect.
//
// Ported from the OpenGL HDREffect.java shader so the Vulkan compositor's
// post-process pipeline applies the SAME fake-HDR the GL renderer's "HDR"
// toggle does. Binary on/off; HDRPower fixed at 1.30. Composable: runs at any
// resolution, after the optional scaling and CAS passes.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in pixels
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
const float HDRPower = 1.30;
const float radius1 = 0.793;
const float radius2 = 0.870;
void main() {
vec2 texcoord = fragTexCoord;
vec2 px = 1.0 / pc.resolution;
vec3 color = texture(InputTexture, texcoord).rgb;
// --- BLOOM PASS 1 (radius1) ---
vec3 bloom_sum1 = texture(InputTexture, texcoord + vec2( 1.5, -1.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2(-1.5, -1.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2( 1.5, 1.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2(-1.5, 1.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2( 0.0, -2.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2( 0.0, 2.5) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2(-2.5, 0.0) * radius1 * px).rgb;
bloom_sum1 += texture(InputTexture, texcoord + vec2( 2.5, 0.0) * radius1 * px).rgb;
bloom_sum1 *= 0.005;
// --- BLOOM PASS 2 (radius2) ---
vec3 bloom_sum2 = texture(InputTexture, texcoord + vec2( 1.5, -1.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2(-1.5, -1.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2( 1.5, 1.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2(-1.5, 1.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2( 0.0, -2.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2( 0.0, 2.5) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2(-2.5, 0.0) * radius2 * px).rgb;
bloom_sum2 += texture(InputTexture, texcoord + vec2( 2.5, 0.0) * radius2 * px).rgb;
bloom_sum2 *= 0.010;
// --- FAKE HDR ---
float dist = radius2 - radius1;
vec3 HDR = (color + (bloom_sum2 - bloom_sum1)) * dist;
vec3 blend = HDR + color;
color = pow(abs(blend), vec3(abs(HDRPower))) + HDR;
outColor = vec4(clamp(color, 0.0, 1.0), 1.0);
}
-448
View File
@@ -1,448 +0,0 @@
#version 450
// =============================================================================
// NVIDIA Image Scaling (NIS) - NVScaler spatial upscaler + adaptive sharpen.
//
// Ported from NVIDIA's reference NVScaler:
// NVIDIAGameWorks/NVIDIAImageScaling NIS/NIS_Scaler.h (+ NIS_Config.h)
//
// The MIT License (MIT)
// Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: MIT
//
// Adapted for the Winlator native Vulkan compositor:
// - #version 450 (Vulkan GLSL), single-pass FRAGMENT shader (the reference is
// an LDS-tiled compute shader). The block/LDS cooperative tile loads are
// replaced with direct per-fragment texture() fetches of the 6x6 luma
// support, and the edge map is computed inline from that support. The math
// (edge detection + 6-tap directional scale/USM blend) is the reference's.
// - The kPhaseCount x 6 scaler/USM coefficient banks (coef_scale, coef_usm,
// fp32 path) are BAKED below as const arrays - no second descriptor binding
// (the post dsLayout has ONE sampler at binding 0 shared by all pipelines).
// - Config-UBO reads are replaced by push constants + baked SDR constants; the
// sharpness-derived params are recomputed in-shader exactly as
// NVScalerUpdateConfig does, driven by the existing "Sharpness" slider.
// - fp32 only (NOT the fp16/bit-packed NIS_USE_HALF_PRECISION path) so there
// are no bitwise/bvec ops - Adreno-compile-safe.
// - HDR mode = None (SDR). The whole compositor chain is R8G8B8A8_UNORM and
// values are display(gamma)-encoded here, matching NIS LDR expectations.
// - Reuses upscale.vert: fragTexCoord spans [0,1] across the destination rect
// (= normalised output position). With kScaleX = inputW/outputW, the source
// sample position reduces to srcX = fragTexCoord.x*inputW - 0.5 (so the
// output viewport origin/size cancel out and are never needed here).
//
// Conventions match sgsr.frag / cas.frag: combined-image-sampler at binding 0,
// push-constant block leads with vec4 ndc (offset 0, consumed by upscale.vert),
// then ViewportInfo (xy = 1/inputSize texel size, zw = inputSize px) + sharpness.
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels
float sharpness; // "Sharpness" slider mapped to [0..1] (NIS sharpness)
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
// ---- SDR (HDR mode None) constants, from NVScalerUpdateConfig -----------------
const float kDetectRatio = 2.0 * 1127.0 / 1024.0; // 2.201171875
const float kDetectThres = 64.0 / 1024.0; // 0.0625
const float kMinContrastRatio = 2.0;
const float kMaxContrastRatio = 10.0;
const float kRatioNorm = 1.0 / (kMaxContrastRatio - kMinContrastRatio); // 0.125
const float kContrastBoost = 1.0;
const float kEps = 1.0 / 255.0;
const float kSharpStartY = 0.45;
const float kSharpEndY = 0.9;
const float kSharpScaleY = 1.0 / (kSharpEndY - kSharpStartY); // 2.222...
const int kPhaseCount = 64;
// Sharpness-derived params (recomputed in main from pc.sharpness, read here).
float gSharpStrengthMin;
float gSharpStrengthScale;
float gSharpLimitMin;
float gSharpLimitScale;
const float coefScale[384] = float[384](
0.0, 0.0, 1.0000, 0.0, 0.0, 0.0, // phase 0
0.0029, -0.0127, 1.0000, 0.0132, -0.0034, 0.0, // phase 1
0.0063, -0.0249, 0.9985, 0.0269, -0.0068, 0.0, // phase 2
0.0088, -0.0361, 0.9956, 0.0415, -0.0103, 0.0005, // phase 3
0.0117, -0.0474, 0.9932, 0.0562, -0.0142, 0.0005, // phase 4
0.0142, -0.0576, 0.9897, 0.0713, -0.0181, 0.0005, // phase 5
0.0166, -0.0674, 0.9844, 0.0874, -0.0220, 0.0010, // phase 6
0.0186, -0.0762, 0.9785, 0.1040, -0.0264, 0.0015, // phase 7
0.0205, -0.0850, 0.9727, 0.1206, -0.0308, 0.0020, // phase 8
0.0225, -0.0928, 0.9648, 0.1382, -0.0352, 0.0024, // phase 9
0.0239, -0.1006, 0.9575, 0.1558, -0.0396, 0.0029, // phase 10
0.0254, -0.1074, 0.9487, 0.1738, -0.0439, 0.0034, // phase 11
0.0264, -0.1138, 0.9390, 0.1929, -0.0488, 0.0044, // phase 12
0.0278, -0.1191, 0.9282, 0.2119, -0.0537, 0.0049, // phase 13
0.0288, -0.1245, 0.9170, 0.2310, -0.0581, 0.0059, // phase 14
0.0293, -0.1294, 0.9058, 0.2510, -0.0630, 0.0063, // phase 15
0.0303, -0.1333, 0.8926, 0.2710, -0.0679, 0.0073, // phase 16
0.0308, -0.1367, 0.8789, 0.2915, -0.0728, 0.0083, // phase 17
0.0308, -0.1401, 0.8657, 0.3120, -0.0776, 0.0093, // phase 18
0.0313, -0.1426, 0.8506, 0.3330, -0.0825, 0.0103, // phase 19
0.0313, -0.1445, 0.8354, 0.3540, -0.0874, 0.0112, // phase 20
0.0313, -0.1460, 0.8193, 0.3755, -0.0923, 0.0122, // phase 21
0.0313, -0.1470, 0.8022, 0.3965, -0.0967, 0.0137, // phase 22
0.0308, -0.1479, 0.7856, 0.4185, -0.1016, 0.0146, // phase 23
0.0303, -0.1479, 0.7681, 0.4399, -0.1060, 0.0156, // phase 24
0.0298, -0.1479, 0.7505, 0.4614, -0.1104, 0.0166, // phase 25
0.0293, -0.1470, 0.7314, 0.4829, -0.1147, 0.0181, // phase 26
0.0288, -0.1460, 0.7119, 0.5049, -0.1187, 0.0190, // phase 27
0.0278, -0.1445, 0.6929, 0.5264, -0.1226, 0.0200, // phase 28
0.0273, -0.1431, 0.6724, 0.5479, -0.1260, 0.0215, // phase 29
0.0264, -0.1411, 0.6528, 0.5693, -0.1299, 0.0225, // phase 30
0.0254, -0.1387, 0.6323, 0.5903, -0.1328, 0.0234, // phase 31
0.0244, -0.1357, 0.6113, 0.6113, -0.1357, 0.0244, // phase 32
0.0234, -0.1328, 0.5903, 0.6323, -0.1387, 0.0254, // phase 33
0.0225, -0.1299, 0.5693, 0.6528, -0.1411, 0.0264, // phase 34
0.0215, -0.1260, 0.5479, 0.6724, -0.1431, 0.0273, // phase 35
0.0200, -0.1226, 0.5264, 0.6929, -0.1445, 0.0278, // phase 36
0.0190, -0.1187, 0.5049, 0.7119, -0.1460, 0.0288, // phase 37
0.0181, -0.1147, 0.4829, 0.7314, -0.1470, 0.0293, // phase 38
0.0166, -0.1104, 0.4614, 0.7505, -0.1479, 0.0298, // phase 39
0.0156, -0.1060, 0.4399, 0.7681, -0.1479, 0.0303, // phase 40
0.0146, -0.1016, 0.4185, 0.7856, -0.1479, 0.0308, // phase 41
0.0137, -0.0967, 0.3965, 0.8022, -0.1470, 0.0313, // phase 42
0.0122, -0.0923, 0.3755, 0.8193, -0.1460, 0.0313, // phase 43
0.0112, -0.0874, 0.3540, 0.8354, -0.1445, 0.0313, // phase 44
0.0103, -0.0825, 0.3330, 0.8506, -0.1426, 0.0313, // phase 45
0.0093, -0.0776, 0.3120, 0.8657, -0.1401, 0.0308, // phase 46
0.0083, -0.0728, 0.2915, 0.8789, -0.1367, 0.0308, // phase 47
0.0073, -0.0679, 0.2710, 0.8926, -0.1333, 0.0303, // phase 48
0.0063, -0.0630, 0.2510, 0.9058, -0.1294, 0.0293, // phase 49
0.0059, -0.0581, 0.2310, 0.9170, -0.1245, 0.0288, // phase 50
0.0049, -0.0537, 0.2119, 0.9282, -0.1191, 0.0278, // phase 51
0.0044, -0.0488, 0.1929, 0.9390, -0.1138, 0.0264, // phase 52
0.0034, -0.0439, 0.1738, 0.9487, -0.1074, 0.0254, // phase 53
0.0029, -0.0396, 0.1558, 0.9575, -0.1006, 0.0239, // phase 54
0.0024, -0.0352, 0.1382, 0.9648, -0.0928, 0.0225, // phase 55
0.0020, -0.0308, 0.1206, 0.9727, -0.0850, 0.0205, // phase 56
0.0015, -0.0264, 0.1040, 0.9785, -0.0762, 0.0186, // phase 57
0.0010, -0.0220, 0.0874, 0.9844, -0.0674, 0.0166, // phase 58
0.0005, -0.0181, 0.0713, 0.9897, -0.0576, 0.0142, // phase 59
0.0005, -0.0142, 0.0562, 0.9932, -0.0474, 0.0117, // phase 60
0.0005, -0.0103, 0.0415, 0.9956, -0.0361, 0.0088, // phase 61
0.0, -0.0068, 0.0269, 0.9985, -0.0249, 0.0063, // phase 62
0.0, -0.0034, 0.0132, 1.0000, -0.0127, 0.0029 // phase 63
);
const float coefUsm[384] = float[384](
0.0, -0.6001, 1.2002, -0.6001, 0.0, 0.0, // phase 0
0.0029, -0.6084, 1.1987, -0.5903, -0.0029, 0.0, // phase 1
0.0049, -0.6147, 1.1958, -0.5791, -0.0068, 0.0005, // phase 2
0.0073, -0.6196, 1.1890, -0.5659, -0.0103, 0.0, // phase 3
0.0093, -0.6235, 1.1802, -0.5513, -0.0151, 0.0, // phase 4
0.0112, -0.6265, 1.1699, -0.5352, -0.0195, 0.0005, // phase 5
0.0122, -0.6270, 1.1582, -0.5181, -0.0259, 0.0005, // phase 6
0.0142, -0.6284, 1.1455, -0.5005, -0.0317, 0.0005, // phase 7
0.0156, -0.6265, 1.1274, -0.4790, -0.0386, 0.0005, // phase 8
0.0166, -0.6235, 1.1089, -0.4570, -0.0454, 0.0010, // phase 9
0.0176, -0.6187, 1.0879, -0.4346, -0.0532, 0.0010, // phase 10
0.0181, -0.6138, 1.0659, -0.4102, -0.0615, 0.0015, // phase 11
0.0190, -0.6069, 1.0405, -0.3843, -0.0698, 0.0015, // phase 12
0.0195, -0.6006, 1.0161, -0.3574, -0.0796, 0.0020, // phase 13
0.0200, -0.5928, 0.9893, -0.3286, -0.0898, 0.0024, // phase 14
0.0200, -0.5820, 0.9580, -0.2988, -0.1001, 0.0029, // phase 15
0.0200, -0.5728, 0.9292, -0.2690, -0.1104, 0.0034, // phase 16
0.0200, -0.5620, 0.8975, -0.2368, -0.1226, 0.0039, // phase 17
0.0205, -0.5498, 0.8643, -0.2046, -0.1343, 0.0044, // phase 18
0.0200, -0.5371, 0.8301, -0.1709, -0.1465, 0.0049, // phase 19
0.0195, -0.5239, 0.7944, -0.1367, -0.1587, 0.0054, // phase 20
0.0195, -0.5107, 0.7598, -0.1021, -0.1724, 0.0059, // phase 21
0.0190, -0.4966, 0.7231, -0.0649, -0.1865, 0.0063, // phase 22
0.0186, -0.4819, 0.6846, -0.0288, -0.1997, 0.0068, // phase 23
0.0186, -0.4668, 0.6460, 0.0093, -0.2144, 0.0073, // phase 24
0.0176, -0.4507, 0.6055, 0.0479, -0.2290, 0.0083, // phase 25
0.0171, -0.4370, 0.5693, 0.0859, -0.2446, 0.0088, // phase 26
0.0161, -0.4199, 0.5283, 0.1255, -0.2598, 0.0098, // phase 27
0.0161, -0.4048, 0.4883, 0.1655, -0.2754, 0.0103, // phase 28
0.0151, -0.3887, 0.4497, 0.2041, -0.2910, 0.0107, // phase 29
0.0142, -0.3711, 0.4072, 0.2446, -0.3066, 0.0117, // phase 30
0.0137, -0.3555, 0.3672, 0.2852, -0.3228, 0.0122, // phase 31
0.0132, -0.3394, 0.3262, 0.3262, -0.3394, 0.0132, // phase 32
0.0122, -0.3228, 0.2852, 0.3672, -0.3555, 0.0137, // phase 33
0.0117, -0.3066, 0.2446, 0.4072, -0.3711, 0.0142, // phase 34
0.0107, -0.2910, 0.2041, 0.4497, -0.3887, 0.0151, // phase 35
0.0103, -0.2754, 0.1655, 0.4883, -0.4048, 0.0161, // phase 36
0.0098, -0.2598, 0.1255, 0.5283, -0.4199, 0.0161, // phase 37
0.0088, -0.2446, 0.0859, 0.5693, -0.4370, 0.0171, // phase 38
0.0083, -0.2290, 0.0479, 0.6055, -0.4507, 0.0176, // phase 39
0.0073, -0.2144, 0.0093, 0.6460, -0.4668, 0.0186, // phase 40
0.0068, -0.1997, -0.0288, 0.6846, -0.4819, 0.0186, // phase 41
0.0063, -0.1865, -0.0649, 0.7231, -0.4966, 0.0190, // phase 42
0.0059, -0.1724, -0.1021, 0.7598, -0.5107, 0.0195, // phase 43
0.0054, -0.1587, -0.1367, 0.7944, -0.5239, 0.0195, // phase 44
0.0049, -0.1465, -0.1709, 0.8301, -0.5371, 0.0200, // phase 45
0.0044, -0.1343, -0.2046, 0.8643, -0.5498, 0.0205, // phase 46
0.0039, -0.1226, -0.2368, 0.8975, -0.5620, 0.0200, // phase 47
0.0034, -0.1104, -0.2690, 0.9292, -0.5728, 0.0200, // phase 48
0.0029, -0.1001, -0.2988, 0.9580, -0.5820, 0.0200, // phase 49
0.0024, -0.0898, -0.3286, 0.9893, -0.5928, 0.0200, // phase 50
0.0020, -0.0796, -0.3574, 1.0161, -0.6006, 0.0195, // phase 51
0.0015, -0.0698, -0.3843, 1.0405, -0.6069, 0.0190, // phase 52
0.0015, -0.0615, -0.4102, 1.0659, -0.6138, 0.0181, // phase 53
0.0010, -0.0532, -0.4346, 1.0879, -0.6187, 0.0176, // phase 54
0.0010, -0.0454, -0.4570, 1.1089, -0.6235, 0.0166, // phase 55
0.0005, -0.0386, -0.4790, 1.1274, -0.6265, 0.0156, // phase 56
0.0005, -0.0317, -0.5005, 1.1455, -0.6284, 0.0142, // phase 57
0.0005, -0.0259, -0.5181, 1.1582, -0.6270, 0.0122, // phase 58
0.0005, -0.0195, -0.5352, 1.1699, -0.6265, 0.0112, // phase 59
0.0, -0.0151, -0.5513, 1.1802, -0.6235, 0.0093, // phase 60
0.0, -0.0103, -0.5659, 1.1890, -0.6196, 0.0073, // phase 61
0.0005, -0.0068, -0.5791, 1.1958, -0.6147, 0.0049, // phase 62
0.0, -0.0029, -0.5903, 1.1987, -0.6084, 0.0029 // phase 63
);
float getY(vec3 rgb) {
return dot(rgb, vec3(0.2126, 0.7152, 0.0722));
}
// GetEdgeMap on a 3x3 luma window (pRC: R=row 0=top, C=col 0=left).
vec4 edgeAt(float p00, float p01, float p02,
float p10, float p11, float p12,
float p20, float p21, float p22) {
float g_0 = abs(p00 + p01 + p02 - p20 - p21 - p22);
float g_45 = abs(p10 + p00 + p01 - p21 - p22 - p12);
float g_90 = abs(p00 + p10 + p20 - p02 - p12 - p22);
float g_135 = abs(p10 + p20 + p21 - p01 - p02 - p12);
float g_0_90_max = max(g_0, g_90);
float g_0_90_min = min(g_0, g_90);
float g_45_135_max = max(g_45, g_135);
float g_45_135_min = min(g_45, g_135);
if (g_0_90_max + g_45_135_max == 0.0) {
return vec4(0.0);
}
float e_0_90 = g_0_90_max / (g_0_90_max + g_45_135_max);
float e_45_135 = 1.0 - e_0_90;
bool c_0_90 = (g_0_90_max > (g_0_90_min * kDetectRatio)) && (g_0_90_max > kDetectThres) && (g_0_90_max > g_45_135_min);
bool c_45_135 = (g_45_135_max > (g_45_135_min * kDetectRatio)) && (g_45_135_max > kDetectThres) && (g_45_135_max > g_0_90_min);
bool c_g_0_90 = (g_0_90_max == g_0);
bool c_g_45_135= (g_45_135_max == g_45);
float f_e_0_90 = (c_0_90 && c_45_135) ? e_0_90 : 1.0;
float f_e_45_135 = (c_0_90 && c_45_135) ? e_45_135 : 1.0;
float w0 = (c_0_90 && c_g_0_90) ? f_e_0_90 : 0.0;
float w90 = (c_0_90 && !c_g_0_90) ? f_e_0_90 : 0.0;
float w45 = (c_45_135 && c_g_45_135) ? f_e_45_135 : 0.0;
float w135 = (c_45_135 && !c_g_45_135)? f_e_45_135 : 0.0;
return vec4(w0, w90, w45, w135);
}
vec4 getInterpEdgeMap(vec4 e00, vec4 e01, vec4 e10, vec4 e11, float fx, float fy) {
vec4 h0 = mix(e00, e01, fx);
vec4 h1 = mix(e10, e11, fx);
return mix(h0, h1, fy);
}
float calcLTI(float p0, float p1, float p2, float p3, float p4, float p5, int phase_index) {
bool selector = (phase_index <= kPhaseCount / 2);
float sel = selector ? p0 : p3;
float a_min = min(min(p1, p2), sel);
float a_max = max(max(p1, p2), sel);
sel = selector ? p2 : p5;
float b_min = min(min(p3, p4), sel);
float b_max = max(max(p3, p4), sel);
float a_cont = a_max - a_min;
float b_cont = b_max - b_min;
float cont_ratio = max(a_cont, b_cont) / (min(a_cont, b_cont) + kEps);
return (1.0 - clamp((cont_ratio - kMinContrastRatio) * kRatioNorm, 0.0, 1.0)) * kContrastBoost;
}
float evalPoly6(float pxl[6], int phase_int) {
phase_int = clamp(phase_int, 0, 63);
float y = 0.0;
float y_usm = 0.0;
for (int i = 0; i < 6; ++i) {
y += coefScale[phase_int * 6 + i] * pxl[i];
y_usm += coefUsm[phase_int * 6 + i] * pxl[i];
}
// piece-wise ramp based on luma (NIS_SCALE_FLOAT == 1)
float y_scale = 1.0 - clamp((y - kSharpStartY) * kSharpScaleY, 0.0, 1.0);
float y_sharpness = y_scale * gSharpStrengthScale + gSharpStrengthMin;
y_usm *= y_sharpness;
float y_sharpness_limit = (y_scale * gSharpLimitScale + gSharpLimitMin) * y;
y_usm = min(y_sharpness_limit, max(-y_sharpness_limit, y_usm));
y_usm *= calcLTI(pxl[0], pxl[1], pxl[2], pxl[3], pxl[4], pxl[5], phase_int);
return y + y_usm;
}
float filterNormal(float p[6][6], int phase_x_int, int phase_y_int) {
phase_x_int = clamp(phase_x_int, 0, 63);
phase_y_int = clamp(phase_y_int, 0, 63);
float h_acc = 0.0;
for (int j = 0; j < 6; ++j) {
float v_acc = 0.0;
for (int i = 0; i < 6; ++i) {
v_acc += p[i][j] * coefScale[phase_y_int * 6 + i];
}
h_acc += v_acc * coefScale[phase_x_int * 6 + j];
}
return h_acc;
}
float addDirFilters(float p[6][6], float phase_x_frac, float phase_y_frac,
int phase_x_frac_int, int phase_y_frac_int, vec4 w) {
float f = 0.0;
if (w.x > 0.0) {
// 0 deg filter
float interp0Deg[6];
for (int i = 0; i < 6; ++i) {
interp0Deg[i] = mix(p[i][2], p[i][3], phase_x_frac);
}
f += evalPoly6(interp0Deg, phase_y_frac_int) * w.x;
}
if (w.y > 0.0) {
// 90 deg filter
float interp90Deg[6];
for (int i = 0; i < 6; ++i) {
interp90Deg[i] = mix(p[2][i], p[3][i], phase_y_frac);
}
f += evalPoly6(interp90Deg, phase_x_frac_int) * w.y;
}
if (w.z > 0.0) {
// 45 deg filter
float pphase_b45 = 0.5 + 0.5 * (phase_x_frac - phase_y_frac);
float temp_interp45Deg[7];
temp_interp45Deg[1] = mix(p[2][1], p[1][2], pphase_b45);
temp_interp45Deg[3] = mix(p[3][2], p[2][3], pphase_b45);
temp_interp45Deg[5] = mix(p[4][3], p[3][4], pphase_b45);
{
pphase_b45 = pphase_b45 - 0.5;
float a = (pphase_b45 >= 0.0) ? p[0][2] : p[2][0];
float b = (pphase_b45 >= 0.0) ? p[1][3] : p[3][1];
float c = (pphase_b45 >= 0.0) ? p[2][4] : p[4][2];
float d = (pphase_b45 >= 0.0) ? p[3][5] : p[5][3];
temp_interp45Deg[0] = mix(p[1][1], a, abs(pphase_b45));
temp_interp45Deg[2] = mix(p[2][2], b, abs(pphase_b45));
temp_interp45Deg[4] = mix(p[3][3], c, abs(pphase_b45));
temp_interp45Deg[6] = mix(p[4][4], d, abs(pphase_b45));
}
float interp45Deg[6];
float pphase_p45 = phase_x_frac + phase_y_frac;
if (pphase_p45 >= 1.0) {
for (int i = 0; i < 6; ++i) {
interp45Deg[i] = temp_interp45Deg[i + 1];
}
pphase_p45 = pphase_p45 - 1.0;
} else {
for (int i = 0; i < 6; ++i) {
interp45Deg[i] = temp_interp45Deg[i];
}
}
f += evalPoly6(interp45Deg, int(pphase_p45 * 64.0)) * w.z;
}
if (w.w > 0.0) {
// 135 deg filter
float pphase_b135 = 0.5 * (phase_x_frac + phase_y_frac);
float temp_interp135Deg[7];
temp_interp135Deg[1] = mix(p[3][1], p[4][2], pphase_b135);
temp_interp135Deg[3] = mix(p[2][2], p[3][3], pphase_b135);
temp_interp135Deg[5] = mix(p[1][3], p[2][4], pphase_b135);
{
pphase_b135 = pphase_b135 - 0.5;
float a = (pphase_b135 >= 0.0) ? p[5][2] : p[3][0];
float b = (pphase_b135 >= 0.0) ? p[4][3] : p[2][1];
float c = (pphase_b135 >= 0.0) ? p[3][4] : p[1][2];
float d = (pphase_b135 >= 0.0) ? p[2][5] : p[0][3];
temp_interp135Deg[0] = mix(p[4][1], a, abs(pphase_b135));
temp_interp135Deg[2] = mix(p[3][2], b, abs(pphase_b135));
temp_interp135Deg[4] = mix(p[2][3], c, abs(pphase_b135));
temp_interp135Deg[6] = mix(p[1][4], d, abs(pphase_b135));
}
float interp135Deg[6];
float pphase_p135 = 1.0 + (phase_x_frac - phase_y_frac);
if (pphase_p135 >= 1.0) {
for (int i = 0; i < 6; ++i) {
interp135Deg[i] = temp_interp135Deg[i + 1];
}
pphase_p135 = pphase_p135 - 1.0;
} else {
for (int i = 0; i < 6; ++i) {
interp135Deg[i] = temp_interp135Deg[i];
}
}
f += evalPoly6(interp135Deg, int(pphase_p135 * 64.0)) * w.w;
}
return f;
}
void main() {
// Sharpness-derived params - mirror NVScalerUpdateConfig (SDR path).
float sharpness = clamp(pc.sharpness, 0.0, 1.0);
float sharpen_slider = sharpness - 0.5;
float MaxScale = (sharpen_slider >= 0.0) ? 1.25 : 1.75;
float MinScale = (sharpen_slider >= 0.0) ? 1.25 : 1.0;
float LimitScale = MinScale;
gSharpStrengthMin = max(0.0, 0.4 + sharpen_slider * MinScale * 1.2);
float sharpStrengthMax = 1.6 + sharpen_slider * MaxScale * 1.8;
gSharpStrengthScale = sharpStrengthMax - gSharpStrengthMin;
gSharpLimitMin = max(0.1, 0.14 + sharpen_slider * LimitScale * 0.32);
float sharpLimitMax = 0.5 + sharpen_slider * LimitScale * 0.6;
gSharpLimitScale = sharpLimitMax - gSharpLimitMin;
vec2 inSize = pc.ViewportInfo.zw;
vec2 invIn = pc.ViewportInfo.xy;
// Source sample position in input-pixel space (output viewport cancels out).
float srcX = fragTexCoord.x * inSize.x - 0.5;
float srcY = fragTexCoord.y * inSize.y - 0.5;
float fsx = floor(srcX);
float fsy = floor(srcY);
float fx = srcX - fsx;
float fy = srcY - fsy;
int fx_int = int(fx * float(kPhaseCount));
int fy_int = int(fy * float(kPhaseCount));
// 6x6 luma support: p[i][j] = luma at source texel (fsx + j - 2, fsy + i - 2).
float p[6][6];
for (int i = 0; i < 6; ++i) {
for (int j = 0; j < 6; ++j) {
vec2 tc = (vec2(fsx + float(j) - 2.0, fsy + float(i) - 2.0) + 0.5) * invIn;
p[i][j] = getY(textureLod(InputTexture, tc, 0.0).rgb);
}
}
// 2x2 edge map around the source pixel (3x3 luma window per corner).
vec4 e00 = edgeAt(p[1][1], p[1][2], p[1][3], p[2][1], p[2][2], p[2][3], p[3][1], p[3][2], p[3][3]);
vec4 e01 = edgeAt(p[1][2], p[1][3], p[1][4], p[2][2], p[2][3], p[2][4], p[3][2], p[3][3], p[3][4]);
vec4 e10 = edgeAt(p[2][1], p[2][2], p[2][3], p[3][1], p[3][2], p[3][3], p[4][1], p[4][2], p[4][3]);
vec4 e11 = edgeAt(p[2][2], p[2][3], p[2][4], p[3][2], p[3][3], p[3][4], p[4][2], p[4][3], p[4][4]);
vec4 w = getInterpEdgeMap(e00, e01, e10, e11, fx, fy); // * NIS_SCALE_INT (==1)
float baseWeight = 1.0 - w.x - w.y - w.z - w.w; // NIS_SCALE_FLOAT - sum
float opY = filterNormal(p, fx_int, fy_int) * baseWeight;
opY += addDirFilters(p, fx, fy, fx_int, fy_int, w);
// Bilinear color tap (coord reduces to fragTexCoord) + luma correction.
vec4 op = texture(InputTexture, fragTexCoord);
float y = getY(op.rgb);
float corr = opY - y; // * (1/NIS_SCALE_FLOAT) == 1
op.rgb += vec3(corr);
outColor = vec4(clamp(op.rgb, 0.0, 1.0), 1.0);
}
File diff suppressed because it is too large. Load diff
-73
View File
@@ -1,73 +0,0 @@
#version 450
// =============================================================================
// NTSC composite-signal artifacts (YIQ chroma modulation + chromatic
// aberration + scanlines + subtle barrel warp) post effect.
//
// Ported verbatim from the OpenGL NTSCCombinedEffect.java shader. GL sampled
// with the varying vUV; here fragTexCoord IS that uv. GL's TextureSize and
// resolution uniforms were both the screen size -> we feed both from pc.resolution.
// Chroma offsets are fixed; this effect does not animate its color phase.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// Runs after HDR, before CRT in the canonical chain (analog signal, then tube).
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // screen size in px (= TextureSize = resolution in GL)
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
#define PI 3.14159265
#define SCANLINE_INTENSITY 0.35
#define CHROMA_OFFSET 0.005
#define BLUR_RADIUS 0.002
#define WARP_AMOUNT 0.01
#define SCANLINE_DARKEN 0.5
const mat3 yiq_mat = mat3(
0.299, 0.587, 0.114,
0.596, -0.275, -0.321,
0.212, -0.523, 0.311
);
const mat3 yiq2rgb_mat = mat3(
1.0, 0.956, 0.621,
1.0, -0.272, -0.647,
1.0, -1.106, 1.705
);
vec3 applyNTSC(vec2 uv) {
return vec3(
texture(InputTexture, uv + vec2(CHROMA_OFFSET, 0.0)).r,
texture(InputTexture, uv + vec2(0.0, BLUR_RADIUS)).g,
texture(InputTexture, uv - vec2(CHROMA_OFFSET, 0.0)).b
);
}
vec3 applyScanlines(vec2 uv, vec3 col) {
float scanline = abs(sin(uv.y * pc.resolution.y * 2.0)) * SCANLINE_INTENSITY;
col *= 1.0 - (scanline * SCANLINE_DARKEN);
return col;
}
vec2 applyWarp(vec2 uv) {
uv = uv * 2.0 - 1.0;
float r = sqrt(uv.x * uv.x + uv.y * uv.y);
uv += uv * (r * r) * WARP_AMOUNT;
return uv * 0.5 + 0.5;
}
void main() {
vec2 warpedUV = applyWarp(fragTexCoord);
vec3 centerColor = texture(InputTexture, warpedUV).rgb;
vec3 ntscColor = applyNTSC(warpedUV);
vec3 scanlineColor = applyScanlines(warpedUV, centerColor);
vec3 finalColor = mix(ntscColor, scanlineColor, 0.7);
outColor = vec4(finalColor, 1.0);
}
+145 -118
View File
@@ -1,126 +1,153 @@
// 1116.3.0
#pragma once
const uint32_t ntsc_code[] = {
0x07230203,0x00010000,0x0008000b,0x000000af,0x00000000,0x00020011,0x00000001,0x0006000b,
0x07230203,0x00010000,0x0008000b,0x000000d5,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000077,0x00000091,0x00030010,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x000000bc,0x000000cf,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x0000000c,0x6c707061,0x53544e79,0x66762843,0x00003b32,0x00030005,
0x0000000b,0x00007675,0x00080005,0x00000012,0x6c707061,0x61635379,0x6e696c6e,0x76287365,
0x763b3266,0x003b3366,0x00030005,0x00000010,0x00007675,0x00030005,0x00000011,0x006c6f63,
0x00060005,0x00000016,0x6c707061,0x72615779,0x66762870,0x00003b32,0x00030005,0x00000015,
0x00007675,0x00060005,0x0000001b,0x75706e49,0x78655474,0x65727574,0x00000000,0x00050005,
0x00000039,0x6e616373,0x656e696c,0x00000000,0x00030005,0x0000003c,0x00004350,0x00040006,
0x0000003c,0x00000000,0x0063646e,0x00060006,0x0000003c,0x00000001,0x6f736572,0x6974756c,
0x00006e6f,0x00030005,0x0000003e,0x00006370,0x00030005,0x00000059,0x00000072,0x00050005,
0x00000075,0x70726177,0x56556465,0x00000000,0x00060005,0x00000077,0x67617266,0x43786554,
0x64726f6f,0x00000000,0x00040005,0x00000078,0x61726170,0x0000006d,0x00050005,0x0000007b,
0x746e6563,0x6f437265,0x00726f6c,0x00050005,0x00000080,0x6373746e,0x6f6c6f43,0x00000072,
0x00040005,0x00000081,0x61726170,0x0000006d,0x00060005,0x00000084,0x6e616373,0x656e696c,
0x6f6c6f43,0x00000072,0x00040005,0x00000085,0x61726170,0x0000006d,0x00040005,0x00000087,
0x61726170,0x0000006d,0x00050005,0x0000008a,0x616e6966,0x6c6f436c,0x0000726f,0x00050005,
0x00000091,0x4374756f,0x726f6c6f,0x00000000,0x00040047,0x0000001b,0x00000021,0x00000000,
0x00040047,0x0000001b,0x00000022,0x00000000,0x00030047,0x0000003c,0x00000002,0x00050048,
0x0000003c,0x00000000,0x00000023,0x00000000,0x00050048,0x0000003c,0x00000001,0x00000023,
0x00000010,0x00040047,0x00000077,0x0000001e,0x00000000,0x00040047,0x00000091,0x0000001e,
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
0x00000007,0x00040017,0x00000009,0x00000006,0x00000003,0x00040021,0x0000000a,0x00000009,
0x00000008,0x00040020,0x0000000e,0x00000007,0x00000009,0x00050021,0x0000000f,0x00000009,
0x00000008,0x0000000e,0x00040021,0x00000014,0x00000007,0x00000008,0x00090019,0x00000018,
0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,
0x00000019,0x00000018,0x00040020,0x0000001a,0x00000000,0x00000019,0x0004003b,0x0000001a,
0x0000001b,0x00000000,0x0004002b,0x00000006,0x0000001e,0x3ba3d70a,0x0004002b,0x00000006,
0x0000001f,0x00000000,0x0005002c,0x00000007,0x00000020,0x0000001e,0x0000001f,0x00040017,
0x00000022,0x00000006,0x00000004,0x00040015,0x00000024,0x00000020,0x00000000,0x0004002b,
0x00000024,0x00000025,0x00000000,0x0004002b,0x00000006,0x00000029,0x3b03126f,0x0005002c,
0x00000007,0x0000002a,0x0000001f,0x00000029,0x0004002b,0x00000024,0x0000002d,0x00000001,
0x0004002b,0x00000024,0x00000033,0x00000002,0x00040020,0x00000038,0x00000007,0x00000006,
0x0004001e,0x0000003c,0x00000022,0x00000007,0x00040020,0x0000003d,0x00000009,0x0000003c,
0x0004003b,0x0000003d,0x0000003e,0x00000009,0x00040015,0x0000003f,0x00000020,0x00000001,
0x0004002b,0x0000003f,0x00000040,0x00000001,0x00040020,0x00000041,0x00000009,0x00000006,
0x0004002b,0x00000006,0x00000045,0x40000000,0x0004002b,0x00000006,0x00000049,0x3eb33333,
0x0004002b,0x00000006,0x0000004b,0x3f800000,0x0004002b,0x00000006,0x0000004d,0x3f000000,
0x0004002b,0x00000006,0x0000006b,0x3c23d70a,0x00040020,0x00000076,0x00000001,0x00000007,
0x0004003b,0x00000076,0x00000077,0x00000001,0x0004002b,0x00000006,0x0000008d,0x3f333333,
0x00040020,0x00000090,0x00000003,0x00000022,0x0004003b,0x00000090,0x00000091,0x00000003,
0x00040018,0x00000097,0x00000009,0x00000003,0x0004002b,0x00000006,0x00000098,0x3e991687,
0x0004002b,0x00000006,0x00000099,0x3f1645a2,0x0004002b,0x00000006,0x0000009a,0x3de978d5,
0x0006002c,0x00000009,0x0000009b,0x00000098,0x00000099,0x0000009a,0x0004002b,0x00000006,
0x0000009c,0x3f189375,0x0004002b,0x00000006,0x0000009d,0xbe8ccccd,0x0004002b,0x00000006,
0x0000009e,0xbea45a1d,0x0006002c,0x00000009,0x0000009f,0x0000009c,0x0000009d,0x0000009e,
0x0004002b,0x00000006,0x000000a0,0x3e591687,0x0004002b,0x00000006,0x000000a1,0xbf05e354,
0x0004002b,0x00000006,0x000000a2,0x3e9f3b64,0x0006002c,0x00000009,0x000000a3,0x000000a0,
0x000000a1,0x000000a2,0x0006002c,0x00000097,0x000000a4,0x0000009b,0x0000009f,0x000000a3,
0x0004002b,0x00000006,0x000000a5,0x3f74bc6a,0x0004002b,0x00000006,0x000000a6,0x3f1ef9db,
0x0006002c,0x00000009,0x000000a7,0x0000004b,0x000000a5,0x000000a6,0x0004002b,0x00000006,
0x000000a8,0xbe8b4396,0x0004002b,0x00000006,0x000000a9,0xbf25a1cb,0x0006002c,0x00000009,
0x000000aa,0x0000004b,0x000000a8,0x000000a9,0x0004002b,0x00000006,0x000000ab,0xbf8d9168,
0x0004002b,0x00000006,0x000000ac,0x3fda3d71,0x0006002c,0x00000009,0x000000ad,0x0000004b,
0x000000ab,0x000000ac,0x0006002c,0x00000097,0x000000ae,0x000000a7,0x000000aa,0x000000ad,
0x0000000b,0x00007675,0x00070005,0x0000000f,0x6c707061,0x61635379,0x6e696c6e,0x76287365,
0x003b3266,0x00030005,0x0000000e,0x00007675,0x00060005,0x00000013,0x6c707061,0x72615779,
0x66762870,0x00003b32,0x00030005,0x00000012,0x00007675,0x00030005,0x00000016,0x006c6f63,
0x00060005,0x0000001a,0x75706e49,0x78655474,0x65727574,0x00000000,0x00030005,0x00000020,
0x00716979,0x00050005,0x00000032,0x6f726863,0x6850616d,0x00657361,0x00030005,0x00000038,
0x00004350,0x00040006,0x00000038,0x00000000,0x0063646e,0x00060006,0x00000038,0x00000001,
0x6f736572,0x6974756c,0x00006e6f,0x00060006,0x00000038,0x00000002,0x6d617266,0x756f4365,
0x0000746e,0x00030005,0x0000003a,0x00006370,0x00030005,0x00000058,0x00626772,0x00050005,
0x00000066,0x616e6966,0x6c6f436c,0x0000726f,0x00030005,0x00000082,0x006c6f63,0x00050005,
0x00000087,0x6e616373,0x656e696c,0x00000000,0x00030005,0x0000009e,0x00000072,0x00050005,
0x000000ba,0x70726177,0x56556465,0x00000000,0x00060005,0x000000bc,0x67617266,0x43786554,
0x64726f6f,0x00000000,0x00040005,0x000000bd,0x61726170,0x0000006d,0x00050005,0x000000c0,
0x6373746e,0x6f6c6f43,0x00000072,0x00040005,0x000000c1,0x61726170,0x0000006d,0x00060005,
0x000000c4,0x6e616373,0x656e696c,0x6f6c6f43,0x00000072,0x00040005,0x000000c5,0x61726170,
0x0000006d,0x00050005,0x000000c8,0x616e6966,0x6c6f436c,0x0000726f,0x00050005,0x000000cf,
0x4374756f,0x726f6c6f,0x00000000,0x00040047,0x0000001a,0x00000021,0x00000000,0x00040047,
0x0000001a,0x00000022,0x00000000,0x00030047,0x00000038,0x00000002,0x00050048,0x00000038,
0x00000000,0x00000023,0x00000000,0x00050048,0x00000038,0x00000001,0x00000023,0x00000010,
0x00050048,0x00000038,0x00000002,0x00000023,0x00000018,0x00040047,0x000000bc,0x0000001e,
0x00000000,0x00040047,0x000000cf,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,
0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,
0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040017,0x00000009,0x00000006,
0x00000003,0x00040021,0x0000000a,0x00000009,0x00000008,0x00040021,0x00000011,0x00000007,
0x00000008,0x00040020,0x00000015,0x00000007,0x00000009,0x00090019,0x00000017,0x00000006,
0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000018,
0x00000017,0x00040020,0x00000019,0x00000000,0x00000018,0x0004003b,0x00000019,0x0000001a,
0x00000000,0x00040017,0x0000001d,0x00000006,0x00000004,0x00040018,0x00000022,0x00000009,
0x00000003,0x0004002b,0x00000006,0x00000023,0x3e991687,0x0004002b,0x00000006,0x00000024,
0x3f1645a2,0x0004002b,0x00000006,0x00000025,0x3de978d5,0x0006002c,0x00000009,0x00000026,
0x00000023,0x00000024,0x00000025,0x0004002b,0x00000006,0x00000027,0x3f189375,0x0004002b,
0x00000006,0x00000028,0xbe8ccccd,0x0004002b,0x00000006,0x00000029,0xbea45a1d,0x0006002c,
0x00000009,0x0000002a,0x00000027,0x00000028,0x00000029,0x0004002b,0x00000006,0x0000002b,
0x3e591687,0x0004002b,0x00000006,0x0000002c,0xbf05e354,0x0004002b,0x00000006,0x0000002d,
0x3e9f3b64,0x0006002c,0x00000009,0x0000002e,0x0000002b,0x0000002c,0x0000002d,0x0006002c,
0x00000022,0x0000002f,0x00000026,0x0000002a,0x0000002e,0x00040020,0x00000031,0x00000007,
0x00000006,0x0004002b,0x00000006,0x00000033,0x40490fdb,0x00040015,0x00000034,0x00000020,
0x00000000,0x0004002b,0x00000034,0x00000035,0x00000001,0x0005001e,0x00000038,0x0000001d,
0x00000007,0x00000006,0x00040020,0x00000039,0x00000009,0x00000038,0x0004003b,0x00000039,
0x0000003a,0x00000009,0x00040015,0x0000003b,0x00000020,0x00000001,0x0004002b,0x0000003b,
0x0000003c,0x00000001,0x00040020,0x0000003d,0x00000009,0x00000006,0x0004002b,0x00000006,
0x00000041,0x40000000,0x0004002b,0x0000003b,0x00000043,0x00000002,0x0004002b,0x00000006,
0x00000049,0x3f000000,0x0004002b,0x00000034,0x00000053,0x00000002,0x0004002b,0x00000006,
0x0000005a,0x3f800000,0x0004002b,0x00000006,0x0000005b,0x3f74bc6a,0x0004002b,0x00000006,
0x0000005c,0x3f1ef9db,0x0006002c,0x00000009,0x0000005d,0x0000005a,0x0000005b,0x0000005c,
0x0004002b,0x00000006,0x0000005e,0xbe8b4396,0x0004002b,0x00000006,0x0000005f,0xbf25a1cb,
0x0006002c,0x00000009,0x00000060,0x0000005a,0x0000005e,0x0000005f,0x0004002b,0x00000006,
0x00000061,0xbf8d9168,0x0004002b,0x00000006,0x00000062,0x3fda3d71,0x0006002c,0x00000009,
0x00000063,0x0000005a,0x00000061,0x00000062,0x0006002c,0x00000022,0x00000064,0x0000005d,
0x00000060,0x00000063,0x0004002b,0x00000006,0x00000069,0x3ba3d70a,0x0004002b,0x00000006,
0x0000006a,0x00000000,0x0005002c,0x00000007,0x0000006b,0x00000069,0x0000006a,0x0004002b,
0x00000034,0x0000006e,0x00000000,0x0004002b,0x00000006,0x00000073,0x3b03126f,0x0005002c,
0x00000007,0x00000074,0x0000006a,0x00000073,0x0004002b,0x00000006,0x00000090,0x3eb33333,
0x0004002b,0x00000006,0x000000b0,0x3c23d70a,0x00040020,0x000000bb,0x00000001,0x00000007,
0x0004003b,0x000000bb,0x000000bc,0x00000001,0x0004002b,0x00000006,0x000000cb,0x3f333333,
0x00040020,0x000000ce,0x00000003,0x0000001d,0x0004003b,0x000000ce,0x000000cf,0x00000003,
0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,
0x00000008,0x00000075,0x00000007,0x0004003b,0x00000008,0x00000078,0x00000007,0x0004003b,
0x0000000e,0x0000007b,0x00000007,0x0004003b,0x0000000e,0x00000080,0x00000007,0x0004003b,
0x00000008,0x00000081,0x00000007,0x0004003b,0x0000000e,0x00000084,0x00000007,0x0004003b,
0x00000008,0x00000085,0x00000007,0x0004003b,0x0000000e,0x00000087,0x00000007,0x0004003b,
0x0000000e,0x0000008a,0x00000007,0x0004003d,0x00000007,0x00000079,0x00000077,0x0003003e,
0x00000078,0x00000079,0x00050039,0x00000007,0x0000007a,0x00000016,0x00000078,0x0003003e,
0x00000075,0x0000007a,0x0004003d,0x00000019,0x0000007c,0x0000001b,0x0004003d,0x00000007,
0x0000007d,0x00000075,0x00050057,0x00000022,0x0000007e,0x0000007c,0x0000007d,0x0008004f,
0x00000009,0x0000007f,0x0000007e,0x0000007e,0x00000000,0x00000001,0x00000002,0x0003003e,
0x0000007b,0x0000007f,0x0004003d,0x00000007,0x00000082,0x00000075,0x0003003e,0x00000081,
0x00000082,0x00050039,0x00000009,0x00000083,0x0000000c,0x00000081,0x0003003e,0x00000080,
0x00000083,0x0004003d,0x00000007,0x00000086,0x00000075,0x0003003e,0x00000085,0x00000086,
0x0004003d,0x00000009,0x00000088,0x0000007b,0x0003003e,0x00000087,0x00000088,0x00060039,
0x00000009,0x00000089,0x00000012,0x00000085,0x00000087,0x0003003e,0x00000084,0x00000089,
0x0004003d,0x00000009,0x0000008b,0x00000080,0x0004003d,0x00000009,0x0000008c,0x00000084,
0x00060050,0x00000009,0x0000008e,0x0000008d,0x0000008d,0x0000008d,0x0008000c,0x00000009,
0x0000008f,0x00000001,0x0000002e,0x0000008b,0x0000008c,0x0000008e,0x0003003e,0x0000008a,
0x0000008f,0x0004003d,0x00000009,0x00000092,0x0000008a,0x00050051,0x00000006,0x00000093,
0x00000092,0x00000000,0x00050051,0x00000006,0x00000094,0x00000092,0x00000001,0x00050051,
0x00000006,0x00000095,0x00000092,0x00000002,0x00070050,0x00000022,0x00000096,0x00000093,
0x00000094,0x00000095,0x0000004b,0x0003003e,0x00000091,0x00000096,0x000100fd,0x00010038,
0x00000008,0x000000ba,0x00000007,0x0004003b,0x00000008,0x000000bd,0x00000007,0x0004003b,
0x00000015,0x000000c0,0x00000007,0x0004003b,0x00000008,0x000000c1,0x00000007,0x0004003b,
0x00000015,0x000000c4,0x00000007,0x0004003b,0x00000008,0x000000c5,0x00000007,0x0004003b,
0x00000015,0x000000c8,0x00000007,0x0004003d,0x00000007,0x000000be,0x000000bc,0x0003003e,
0x000000bd,0x000000be,0x00050039,0x00000007,0x000000bf,0x00000013,0x000000bd,0x0003003e,
0x000000ba,0x000000bf,0x0004003d,0x00000007,0x000000c2,0x000000ba,0x0003003e,0x000000c1,
0x000000c2,0x00050039,0x00000009,0x000000c3,0x0000000c,0x000000c1,0x0003003e,0x000000c0,
0x000000c3,0x0004003d,0x00000007,0x000000c6,0x000000ba,0x0003003e,0x000000c5,0x000000c6,
0x00050039,0x00000009,0x000000c7,0x0000000f,0x000000c5,0x0003003e,0x000000c4,0x000000c7,
0x0004003d,0x00000009,0x000000c9,0x000000c0,0x0004003d,0x00000009,0x000000ca,0x000000c4,
0x00060050,0x00000009,0x000000cc,0x000000cb,0x000000cb,0x000000cb,0x0008000c,0x00000009,
0x000000cd,0x00000001,0x0000002e,0x000000c9,0x000000ca,0x000000cc,0x0003003e,0x000000c8,
0x000000cd,0x0004003d,0x00000009,0x000000d0,0x000000c8,0x00050051,0x00000006,0x000000d1,
0x000000d0,0x00000000,0x00050051,0x00000006,0x000000d2,0x000000d0,0x00000001,0x00050051,
0x00000006,0x000000d3,0x000000d0,0x00000002,0x00070050,0x0000001d,0x000000d4,0x000000d1,
0x000000d2,0x000000d3,0x0000005a,0x0003003e,0x000000cf,0x000000d4,0x000100fd,0x00010038,
0x00050036,0x00000009,0x0000000c,0x00000000,0x0000000a,0x00030037,0x00000008,0x0000000b,
0x000200f8,0x0000000d,0x0004003d,0x00000019,0x0000001c,0x0000001b,0x0004003d,0x00000007,
0x0000001d,0x0000000b,0x00050081,0x00000007,0x00000021,0x0000001d,0x00000020,0x00050057,
0x00000022,0x00000023,0x0000001c,0x00000021,0x00050051,0x00000006,0x00000026,0x00000023,
0x00000000,0x0004003d,0x00000019,0x00000027,0x0000001b,0x0004003d,0x00000007,0x00000028,
0x0000000b,0x00050081,0x00000007,0x0000002b,0x00000028,0x0000002a,0x00050057,0x00000022,
0x0000002c,0x00000027,0x0000002b,0x00050051,0x00000006,0x0000002e,0x0000002c,0x00000001,
0x0004003d,0x00000019,0x0000002f,0x0000001b,0x0004003d,0x00000007,0x00000030,0x0000000b,
0x00050083,0x00000007,0x00000031,0x00000030,0x00000020,0x00050057,0x00000022,0x00000032,
0x0000002f,0x00000031,0x00050051,0x00000006,0x00000034,0x00000032,0x00000002,0x00060050,
0x00000009,0x00000035,0x00000026,0x0000002e,0x00000034,0x000200fe,0x00000035,0x00010038,
0x00050036,0x00000009,0x00000012,0x00000000,0x0000000f,0x00030037,0x00000008,0x00000010,
0x00030037,0x0000000e,0x00000011,0x000200f8,0x00000013,0x0004003b,0x00000038,0x00000039,
0x00000007,0x00050041,0x00000038,0x0000003a,0x00000010,0x0000002d,0x0004003d,0x00000006,
0x0000003b,0x0000003a,0x00060041,0x00000041,0x00000042,0x0000003e,0x00000040,0x0000002d,
0x0004003d,0x00000006,0x00000043,0x00000042,0x00050085,0x00000006,0x00000044,0x0000003b,
0x00000043,0x00050085,0x00000006,0x00000046,0x00000044,0x00000045,0x0006000c,0x00000006,
0x00000047,0x00000001,0x0000000d,0x00000046,0x0006000c,0x00000006,0x00000048,0x00000001,
0x00000004,0x00000047,0x00050085,0x00000006,0x0000004a,0x00000048,0x00000049,0x0003003e,
0x00000039,0x0000004a,0x0004003d,0x00000006,0x0000004c,0x00000039,0x00050085,0x00000006,
0x0000004e,0x0000004c,0x0000004d,0x00050083,0x00000006,0x0000004f,0x0000004b,0x0000004e,
0x0004003d,0x00000009,0x00000050,0x00000011,0x0005008e,0x00000009,0x00000051,0x00000050,
0x0000004f,0x0003003e,0x00000011,0x00000051,0x0004003d,0x00000009,0x00000052,0x00000011,
0x000200fe,0x00000052,0x00010038,0x00050036,0x00000007,0x00000016,0x00000000,0x00000014,
0x00030037,0x00000008,0x00000015,0x000200f8,0x00000017,0x0004003b,0x00000038,0x00000059,
0x00000007,0x0004003d,0x00000007,0x00000055,0x00000015,0x0005008e,0x00000007,0x00000056,
0x00000055,0x00000045,0x00050050,0x00000007,0x00000057,0x0000004b,0x0000004b,0x00050083,
0x00000007,0x00000058,0x00000056,0x00000057,0x0003003e,0x00000015,0x00000058,0x00050041,
0x00000038,0x0000005a,0x00000015,0x00000025,0x0004003d,0x00000006,0x0000005b,0x0000005a,
0x00050041,0x00000038,0x0000005c,0x00000015,0x00000025,0x0004003d,0x00000006,0x0000005d,
0x0000005c,0x00050085,0x00000006,0x0000005e,0x0000005b,0x0000005d,0x00050041,0x00000038,
0x0000005f,0x00000015,0x0000002d,0x0004003d,0x00000006,0x00000060,0x0000005f,0x00050041,
0x00000038,0x00000061,0x00000015,0x0000002d,0x0004003d,0x00000006,0x00000062,0x00000061,
0x00050085,0x00000006,0x00000063,0x00000060,0x00000062,0x00050081,0x00000006,0x00000064,
0x0000005e,0x00000063,0x0006000c,0x00000006,0x00000065,0x00000001,0x0000001f,0x00000064,
0x0003003e,0x00000059,0x00000065,0x0004003d,0x00000007,0x00000066,0x00000015,0x0004003d,
0x00000006,0x00000067,0x00000059,0x0004003d,0x00000006,0x00000068,0x00000059,0x00050085,
0x00000006,0x00000069,0x00000067,0x00000068,0x0005008e,0x00000007,0x0000006a,0x00000066,
0x00000069,0x0005008e,0x00000007,0x0000006c,0x0000006a,0x0000006b,0x0004003d,0x00000007,
0x0000006d,0x00000015,0x00050081,0x00000007,0x0000006e,0x0000006d,0x0000006c,0x0003003e,
0x00000015,0x0000006e,0x0004003d,0x00000007,0x0000006f,0x00000015,0x0005008e,0x00000007,
0x00000070,0x0000006f,0x0000004d,0x00050050,0x00000007,0x00000071,0x0000004d,0x0000004d,
0x00050081,0x00000007,0x00000072,0x00000070,0x00000071,0x000200fe,0x00000072,0x00010038
0x000200f8,0x0000000d,0x0004003b,0x00000015,0x00000016,0x00000007,0x0004003b,0x00000015,
0x00000020,0x00000007,0x0004003b,0x00000031,0x00000032,0x00000007,0x0004003b,0x00000015,
0x00000058,0x00000007,0x0004003b,0x00000015,0x00000066,0x00000007,0x0004003d,0x00000018,
0x0000001b,0x0000001a,0x0004003d,0x00000007,0x0000001c,0x0000000b,0x00050057,0x0000001d,
0x0000001e,0x0000001b,0x0000001c,0x0008004f,0x00000009,0x0000001f,0x0000001e,0x0000001e,
0x00000000,0x00000001,0x00000002,0x0003003e,0x00000016,0x0000001f,0x0004003d,0x00000009,
0x00000021,0x00000016,0x00050090,0x00000009,0x00000030,0x00000021,0x0000002f,0x0003003e,
0x00000020,0x00000030,0x00050041,0x00000031,0x00000036,0x0000000b,0x00000035,0x0004003d,
0x00000006,0x00000037,0x00000036,0x00060041,0x0000003d,0x0000003e,0x0000003a,0x0000003c,
0x00000035,0x0004003d,0x00000006,0x0000003f,0x0000003e,0x00050085,0x00000006,0x00000040,
0x00000037,0x0000003f,0x0005008d,0x00000006,0x00000042,0x00000040,0x00000041,0x00050041,
0x0000003d,0x00000044,0x0000003a,0x00000043,0x0004003d,0x00000006,0x00000045,0x00000044,
0x00050081,0x00000006,0x00000046,0x00000042,0x00000045,0x00050085,0x00000006,0x00000047,
0x00000033,0x00000046,0x0003003e,0x00000032,0x00000047,0x0004003d,0x00000006,0x00000048,
0x00000032,0x00050085,0x00000006,0x0000004a,0x00000048,0x00000049,0x0006000c,0x00000006,
0x0000004b,0x00000001,0x0000000e,0x0000004a,0x00050041,0x00000031,0x0000004c,0x00000020,
0x00000035,0x0004003d,0x00000006,0x0000004d,0x0000004c,0x00050085,0x00000006,0x0000004e,
0x0000004d,0x0000004b,0x00050041,0x00000031,0x0000004f,0x00000020,0x00000035,0x0003003e,
0x0000004f,0x0000004e,0x0004003d,0x00000006,0x00000050,0x00000032,0x00050085,0x00000006,
0x00000051,0x00000050,0x00000049,0x0006000c,0x00000006,0x00000052,0x00000001,0x0000000d,
0x00000051,0x00050041,0x00000031,0x00000054,0x00000020,0x00000053,0x0004003d,0x00000006,
0x00000055,0x00000054,0x00050085,0x00000006,0x00000056,0x00000055,0x00000052,0x00050041,
0x00000031,0x00000057,0x00000020,0x00000053,0x0003003e,0x00000057,0x00000056,0x0004003d,
0x00000009,0x00000059,0x00000020,0x00050090,0x00000009,0x00000065,0x00000059,0x00000064,
0x0003003e,0x00000058,0x00000065,0x0004003d,0x00000018,0x00000067,0x0000001a,0x0004003d,
0x00000007,0x00000068,0x0000000b,0x00050081,0x00000007,0x0000006c,0x00000068,0x0000006b,
0x00050057,0x0000001d,0x0000006d,0x00000067,0x0000006c,0x00050051,0x00000006,0x0000006f,
0x0000006d,0x00000000,0x00050041,0x00000031,0x00000070,0x00000066,0x0000006e,0x0003003e,
0x00000070,0x0000006f,0x0004003d,0x00000018,0x00000071,0x0000001a,0x0004003d,0x00000007,
0x00000072,0x0000000b,0x00050081,0x00000007,0x00000075,0x00000072,0x00000074,0x00050057,
0x0000001d,0x00000076,0x00000071,0x00000075,0x00050051,0x00000006,0x00000077,0x00000076,
0x00000001,0x00050041,0x00000031,0x00000078,0x00000066,0x00000035,0x0003003e,0x00000078,
0x00000077,0x0004003d,0x00000018,0x00000079,0x0000001a,0x0004003d,0x00000007,0x0000007a,
0x0000000b,0x00050083,0x00000007,0x0000007b,0x0000007a,0x0000006b,0x00050057,0x0000001d,
0x0000007c,0x00000079,0x0000007b,0x00050051,0x00000006,0x0000007d,0x0000007c,0x00000002,
0x00050041,0x00000031,0x0000007e,0x00000066,0x00000053,0x0003003e,0x0000007e,0x0000007d,
0x0004003d,0x00000009,0x0000007f,0x00000066,0x000200fe,0x0000007f,0x00010038,0x00050036,
0x00000009,0x0000000f,0x00000000,0x0000000a,0x00030037,0x00000008,0x0000000e,0x000200f8,
0x00000010,0x0004003b,0x00000015,0x00000082,0x00000007,0x0004003b,0x00000031,0x00000087,
0x00000007,0x0004003d,0x00000018,0x00000083,0x0000001a,0x0004003d,0x00000007,0x00000084,
0x0000000e,0x00050057,0x0000001d,0x00000085,0x00000083,0x00000084,0x0008004f,0x00000009,
0x00000086,0x00000085,0x00000085,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000082,
0x00000086,0x00050041,0x00000031,0x00000088,0x0000000e,0x00000035,0x0004003d,0x00000006,
0x00000089,0x00000088,0x00060041,0x0000003d,0x0000008a,0x0000003a,0x0000003c,0x00000035,
0x0004003d,0x00000006,0x0000008b,0x0000008a,0x00050085,0x00000006,0x0000008c,0x00000089,
0x0000008b,0x00050085,0x00000006,0x0000008d,0x0000008c,0x00000041,0x0006000c,0x00000006,
0x0000008e,0x00000001,0x0000000d,0x0000008d,0x0006000c,0x00000006,0x0000008f,0x00000001,
0x00000004,0x0000008e,0x00050085,0x00000006,0x00000091,0x0000008f,0x00000090,0x0003003e,
0x00000087,0x00000091,0x0004003d,0x00000006,0x00000092,0x00000087,0x00050085,0x00000006,
0x00000093,0x00000092,0x00000049,0x00050083,0x00000006,0x00000094,0x0000005a,0x00000093,
0x0004003d,0x00000009,0x00000095,0x00000082,0x0005008e,0x00000009,0x00000096,0x00000095,
0x00000094,0x0003003e,0x00000082,0x00000096,0x0004003d,0x00000009,0x00000097,0x00000082,
0x000200fe,0x00000097,0x00010038,0x00050036,0x00000007,0x00000013,0x00000000,0x00000011,
0x00030037,0x00000008,0x00000012,0x000200f8,0x00000014,0x0004003b,0x00000031,0x0000009e,
0x00000007,0x0004003d,0x00000007,0x0000009a,0x00000012,0x0005008e,0x00000007,0x0000009b,
0x0000009a,0x00000041,0x00050050,0x00000007,0x0000009c,0x0000005a,0x0000005a,0x00050083,
0x00000007,0x0000009d,0x0000009b,0x0000009c,0x0003003e,0x00000012,0x0000009d,0x00050041,
0x00000031,0x0000009f,0x00000012,0x0000006e,0x0004003d,0x00000006,0x000000a0,0x0000009f,
0x00050041,0x00000031,0x000000a1,0x00000012,0x0000006e,0x0004003d,0x00000006,0x000000a2,
0x000000a1,0x00050085,0x00000006,0x000000a3,0x000000a0,0x000000a2,0x00050041,0x00000031,
0x000000a4,0x00000012,0x00000035,0x0004003d,0x00000006,0x000000a5,0x000000a4,0x00050041,
0x00000031,0x000000a6,0x00000012,0x00000035,0x0004003d,0x00000006,0x000000a7,0x000000a6,
0x00050085,0x00000006,0x000000a8,0x000000a5,0x000000a7,0x00050081,0x00000006,0x000000a9,
0x000000a3,0x000000a8,0x0006000c,0x00000006,0x000000aa,0x00000001,0x0000001f,0x000000a9,
0x0003003e,0x0000009e,0x000000aa,0x0004003d,0x00000007,0x000000ab,0x00000012,0x0004003d,
0x00000006,0x000000ac,0x0000009e,0x0004003d,0x00000006,0x000000ad,0x0000009e,0x00050085,
0x00000006,0x000000ae,0x000000ac,0x000000ad,0x0005008e,0x00000007,0x000000af,0x000000ab,
0x000000ae,0x0005008e,0x00000007,0x000000b1,0x000000af,0x000000b0,0x0004003d,0x00000007,
0x000000b2,0x00000012,0x00050081,0x00000007,0x000000b3,0x000000b2,0x000000b1,0x0003003e,
0x00000012,0x000000b3,0x0004003d,0x00000007,0x000000b4,0x00000012,0x0005008e,0x00000007,
0x000000b5,0x000000b4,0x00000049,0x00050050,0x00000007,0x000000b6,0x00000049,0x00000049,
0x00050081,0x00000007,0x000000b7,0x000000b5,0x000000b6,0x000200fe,0x000000b7,0x00010038
};
-108
View File
@@ -1,108 +0,0 @@
#version 450
// =============================================================================
// Snapdragon Game Super Resolution (SGSR) 1.0 - spatial upscaler, mobile path.
//
// Ported from Qualcomm's reference shader:
// SnapdragonStudios/snapdragon-gsr sgsr/v1/include/glsl/sgsr1_shader_mobile.frag
//
// Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
//
// Adapted for the Winlator native Vulkan compositor:
// - #version 450 (Vulkan GLSL)
// - ViewportInfo passed via push constant instead of a uniform block
// - specialised to OperationMode == 1 (RGBA); green channel is the edge luma
// - reuses window.vert (full-screen quad; fragTexCoord in [0,1] over the
// destination rect = normalised output position = normalised source position)
// =============================================================================
layout(binding = 0) uniform sampler2D ps0;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0)
vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels
float EdgeSharpness; // driven by the "Sharpness" slider (default 2.0)
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 out_Target0;
const float EdgeThreshold = 8.0 / 255.0;
float fastLanczos2(float x) {
float wA = x - 4.0;
float wB = x * wA - wA;
wA *= wA;
return wB * wA;
}
vec2 weightY(float dx, float dy, float c, float std) {
float x = ((dx * dx) + (dy * dy)) * 0.55 + clamp(abs(c) * std, 0.0, 1.0);
float w = fastLanczos2(x);
return vec2(w, w * c);
}
void main() {
vec4 ViewportInfo = pc.ViewportInfo;
vec2 uv = fragTexCoord;
vec4 color;
color.xyz = textureLod(ps0, uv, 0.0).xyz;
vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5));
vec2 imgCoordPixel = floor(imgCoord);
vec2 coord = (imgCoordPixel * ViewportInfo.xy);
vec2 pl = (imgCoord + (-imgCoordPixel));
vec4 left = textureGather(ps0, coord, 1);
float edgeVote = abs(left.z - left.y) + abs(color.y - left.y) + abs(color.y - left.z);
if (edgeVote > EdgeThreshold) {
coord.x += ViewportInfo.x;
vec4 right = textureGather(ps0, coord + vec2(ViewportInfo.x, 0.0), 1);
vec4 upDown;
upDown.xy = textureGather(ps0, coord + vec2(0.0, -ViewportInfo.y), 1).wz;
upDown.zw = textureGather(ps0, coord + vec2(0.0, ViewportInfo.y), 1).yx;
float mean = (left.y + left.z + right.x + right.w) * 0.25;
left = left - vec4(mean);
right = right - vec4(mean);
upDown = upDown - vec4(mean);
color.w = color.y - mean;
float sum = (((((abs(left.x) + abs(left.y)) + abs(left.z)) + abs(left.w))
+ (((abs(right.x) + abs(right.y)) + abs(right.z)) + abs(right.w)))
+ (((abs(upDown.x) + abs(upDown.y)) + abs(upDown.z)) + abs(upDown.w)));
float std = 2.181818 / sum;
vec2 aWY = weightY(pl.x, pl.y + 1.0, upDown.x, std);
aWY += weightY(pl.x - 1.0, pl.y + 1.0, upDown.y, std);
aWY += weightY(pl.x - 1.0, pl.y - 2.0, upDown.z, std);
aWY += weightY(pl.x, pl.y - 2.0, upDown.w, std);
aWY += weightY(pl.x + 1.0, pl.y - 1.0, left.x, std);
aWY += weightY(pl.x, pl.y - 1.0, left.y, std);
aWY += weightY(pl.x, pl.y, left.z, std);
aWY += weightY(pl.x + 1.0, pl.y, left.w, std);
aWY += weightY(pl.x - 1.0, pl.y - 1.0, right.x, std);
aWY += weightY(pl.x - 2.0, pl.y - 1.0, right.y, std);
aWY += weightY(pl.x - 2.0, pl.y, right.z, std);
aWY += weightY(pl.x - 1.0, pl.y, right.w, std);
float finalY = aWY.y / aWY.x;
float maxY = max(max(left.y, left.z), max(right.x, right.w));
float minY = min(min(left.y, left.z), min(right.x, right.w));
finalY = clamp(pc.EdgeSharpness * finalY, minY, maxY);
float deltaY = finalY - color.w;
deltaY = clamp(deltaY, -23.0 / 255.0, 23.0 / 255.0);
color.x = clamp((color.x + deltaY), 0.0, 1.0);
color.y = clamp((color.y + deltaY), 0.0, 1.0);
color.z = clamp((color.z + deltaY), 0.0, 1.0);
}
color.w = 1.0; // alpha channel unused by the compositor blit
out_Target0 = color;
}
-132
View File
@@ -1,132 +0,0 @@
#version 450
// =============================================================================
// Snapdragon Game Super Resolution (SGSR) 1 - "Quality" variant (edge direction).
//
// Ported from Qualcomm's reference shader:
// SnapdragonGameStudios/snapdragon-gsr
// sgsr/v1/include/glsl/sgsr1_shader_mobile_edge_direction.frag
//
// Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved.
// SPDX-License-Identifier: BSD-3-Clause
//
// Same single pass, inputs and push constants as sgsr.frag (the mode-3 "SGSR"
// shader, left untouched). Differences, both taken from the reference file:
// - UseEdgeDirection: the Lanczos weights are stretched along the local edge
// direction, so diagonal edges reconstruct cleaner ("minimal cost increase"
// per Qualcomm).
// - the reference's retuned contrast term: std = (10.14185 / sum)^2
// (sgsr.frag keeps the older 2.181818 / sum).
// Adapted for the Winlator native Vulkan compositor exactly like sgsr.frag:
// - #version 450 (Vulkan GLSL), ViewportInfo via push constant
// - specialised to OperationMode == 1 (RGBA); green channel is the edge luma
// - reuses window.vert (full-screen quad over the destination rect)
// =============================================================================
layout(binding = 0) uniform sampler2D ps0;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by window.vert (offset 0)
vec4 ViewportInfo; // xy = 1/inputSize (texel size), zw = inputSize in pixels
float EdgeSharpness; // driven by the "Sharpness" slider
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 out_Target0;
const float EdgeThreshold = 8.0 / 255.0;
float fastLanczos2(float x) {
float wA = x - 4.0;
float wB = x * wA - wA;
wA *= wA;
return wB * wA;
}
// data.x = std, data.yz = normalised edge direction
vec2 weightY(float dx, float dy, float c, vec3 data) {
float std = data.x;
vec2 dir = data.yz;
float edgeDis = (dx * dir.y) + (dy * dir.x);
float x = ((dx * dx) + (dy * dy))
+ ((edgeDis * edgeDis) * ((clamp((c * c) * std, 0.0, 1.0) * 0.7) - 1.0));
float w = fastLanczos2(x);
return vec2(w, w * c);
}
vec2 edgeDirection(vec4 left, vec4 right) {
float RxLz = right.x - left.z;
float RwLy = right.w - left.y;
vec2 delta;
delta.x = RxLz + RwLy;
delta.y = RxLz - RwLy;
float lengthInv = inversesqrt((delta.x * delta.x + 3.075740e-05) + (delta.y * delta.y));
return delta * lengthInv;
}
void main() {
vec4 ViewportInfo = pc.ViewportInfo;
vec2 uv = fragTexCoord;
vec4 color;
color.xyz = textureLod(ps0, uv, 0.0).xyz;
vec2 imgCoord = ((uv * ViewportInfo.zw) + vec2(-0.5, 0.5));
vec2 imgCoordPixel = floor(imgCoord);
vec2 coord = (imgCoordPixel * ViewportInfo.xy);
vec2 pl = (imgCoord + (-imgCoordPixel));
vec4 left = textureGather(ps0, coord, 1);
float edgeVote = abs(left.z - left.y) + abs(color.y - left.y) + abs(color.y - left.z);
if (edgeVote > EdgeThreshold) {
coord.x += ViewportInfo.x;
vec4 right = textureGather(ps0, coord + vec2(ViewportInfo.x, 0.0), 1);
vec4 upDown;
upDown.xy = textureGather(ps0, coord + vec2(0.0, -ViewportInfo.y), 1).wz;
upDown.zw = textureGather(ps0, coord + vec2(0.0, ViewportInfo.y), 1).yx;
float mean = (left.y + left.z + right.x + right.w) * 0.25;
left = left - vec4(mean);
right = right - vec4(mean);
upDown = upDown - vec4(mean);
color.w = color.y - mean;
float sum = (((((abs(left.x) + abs(left.y)) + abs(left.z)) + abs(left.w))
+ (((abs(right.x) + abs(right.y)) + abs(right.z)) + abs(right.w)))
+ (((abs(upDown.x) + abs(upDown.y)) + abs(upDown.z)) + abs(upDown.w)));
float sumMean = 1.014185e+01 / sum;
float std = sumMean * sumMean;
vec3 data = vec3(std, edgeDirection(left, right));
vec2 aWY = weightY(pl.x, pl.y + 1.0, upDown.x, data);
aWY += weightY(pl.x - 1.0, pl.y + 1.0, upDown.y, data);
aWY += weightY(pl.x - 1.0, pl.y - 2.0, upDown.z, data);
aWY += weightY(pl.x, pl.y - 2.0, upDown.w, data);
aWY += weightY(pl.x + 1.0, pl.y - 1.0, left.x, data);
aWY += weightY(pl.x, pl.y - 1.0, left.y, data);
aWY += weightY(pl.x, pl.y, left.z, data);
aWY += weightY(pl.x + 1.0, pl.y, left.w, data);
aWY += weightY(pl.x - 1.0, pl.y - 1.0, right.x, data);
aWY += weightY(pl.x - 2.0, pl.y - 1.0, right.y, data);
aWY += weightY(pl.x - 2.0, pl.y, right.z, data);
aWY += weightY(pl.x - 1.0, pl.y, right.w, data);
float finalY = aWY.y / aWY.x;
float maxY = max(max(left.y, left.z), max(right.x, right.w));
float minY = min(min(left.y, left.z), min(right.x, right.w));
finalY = clamp(pc.EdgeSharpness * finalY, minY, maxY);
float deltaY = finalY - color.w;
deltaY = clamp(deltaY, -23.0 / 255.0, 23.0 / 255.0);
color.x = clamp((color.x + deltaY), 0.0, 1.0);
color.y = clamp((color.y + deltaY), 0.0, 1.0);
color.z = clamp((color.z + deltaY), 0.0, 1.0);
}
color.w = 1.0; // alpha channel unused by the compositor blit
out_Target0 = color;
}
-30
View File
@@ -1,30 +0,0 @@
#version 450
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
layout(set = 0, binding = 0) uniform sampler2D InputTexture;
layout(set = 1, binding = 0) uniform sampler2D WeightTexture;
layout(push_constant) uniform Constants {
vec4 ndc;
vec2 resolution;
float extra;
float pad;
} pc;
void main() {
vec2 px = 1.0 / max(pc.resolution, vec2(1.0));
vec2 uv = clamp(fragTexCoord, px * 0.5, vec2(1.0) - px * 0.5);
vec4 center = texture(InputTexture, uv);
vec4 weights = texture(WeightTexture, uv);
float weight = clamp(weights.r, 0.0, 0.42);
if (weight <= 0.001) {
outColor = center;
return;
}
vec2 normal = weights.gb * 2.0 - 1.0;
vec2 acrossUv = clamp(uv + normal * px, px * 0.5, vec2(1.0) - px * 0.5);
vec3 across = texture(InputTexture, acrossUv).rgb;
outColor = vec4(mix(center.rgb, across, weight), center.a);
}
@@ -1,88 +0,0 @@
// 1116.3.0
#pragma once
const uint32_t smaa_blend_code[] = {
0x07230203,0x00010000,0x0008000b,0x0000006b,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000001a,0x00000041,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00007870,0x00050005,0x0000000c,0x736e6f43,0x746e6174,
0x00000073,0x00040006,0x0000000c,0x00000000,0x0063646e,0x00060006,0x0000000c,0x00000001,
0x6f736572,0x6974756c,0x00006e6f,0x00050006,0x0000000c,0x00000002,0x72747865,0x00000061,
0x00040006,0x0000000c,0x00000003,0x00646170,0x00030005,0x0000000e,0x00006370,0x00030005,
0x00000018,0x00007675,0x00060005,0x0000001a,0x67617266,0x43786554,0x64726f6f,0x00000000,
0x00040005,0x00000024,0x746e6563,0x00007265,0x00060005,0x00000028,0x75706e49,0x78655474,
0x65727574,0x00000000,0x00040005,0x0000002c,0x67696577,0x00737468,0x00060005,0x0000002d,
0x67696557,0x65547468,0x72757478,0x00000065,0x00040005,0x00000032,0x67696577,0x00007468,
0x00050005,0x00000041,0x4374756f,0x726f6c6f,0x00000000,0x00040005,0x00000044,0x6d726f6e,
0x00006c61,0x00050005,0x0000004b,0x6f726361,0x76557373,0x00000000,0x00040005,0x00000059,
0x6f726361,0x00007373,0x00030047,0x0000000c,0x00000002,0x00050048,0x0000000c,0x00000000,
0x00000023,0x00000000,0x00050048,0x0000000c,0x00000001,0x00000023,0x00000010,0x00050048,
0x0000000c,0x00000002,0x00000023,0x00000018,0x00050048,0x0000000c,0x00000003,0x00000023,
0x0000001c,0x00040047,0x0000001a,0x0000001e,0x00000000,0x00040047,0x00000028,0x00000021,
0x00000000,0x00040047,0x00000028,0x00000022,0x00000000,0x00040047,0x0000002d,0x00000021,
0x00000000,0x00040047,0x0000002d,0x00000022,0x00000001,0x00040047,0x00000041,0x0000001e,
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,
0x00000007,0x0004002b,0x00000006,0x0000000a,0x3f800000,0x00040017,0x0000000b,0x00000006,
0x00000004,0x0006001e,0x0000000c,0x0000000b,0x00000007,0x00000006,0x00000006,0x00040020,
0x0000000d,0x00000009,0x0000000c,0x0004003b,0x0000000d,0x0000000e,0x00000009,0x00040015,
0x0000000f,0x00000020,0x00000001,0x0004002b,0x0000000f,0x00000010,0x00000001,0x00040020,
0x00000011,0x00000009,0x00000007,0x0005002c,0x00000007,0x00000014,0x0000000a,0x0000000a,
0x00040020,0x00000019,0x00000001,0x00000007,0x0004003b,0x00000019,0x0000001a,0x00000001,
0x0004002b,0x00000006,0x0000001d,0x3f000000,0x00040020,0x00000023,0x00000007,0x0000000b,
0x00090019,0x00000025,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x0003001b,0x00000026,0x00000025,0x00040020,0x00000027,0x00000000,0x00000026,
0x0004003b,0x00000027,0x00000028,0x00000000,0x0004003b,0x00000027,0x0000002d,0x00000000,
0x00040020,0x00000031,0x00000007,0x00000006,0x00040015,0x00000033,0x00000020,0x00000000,
0x0004002b,0x00000033,0x00000034,0x00000000,0x0004002b,0x00000006,0x00000037,0x00000000,
0x0004002b,0x00000006,0x00000038,0x3ed70a3d,0x0004002b,0x00000006,0x0000003b,0x3a83126f,
0x00020014,0x0000003c,0x00040020,0x00000040,0x00000003,0x0000000b,0x0004003b,0x00000040,
0x00000041,0x00000003,0x0004002b,0x00000006,0x00000047,0x40000000,0x00040017,0x00000057,
0x00000006,0x00000003,0x00040020,0x00000058,0x00000007,0x00000057,0x0004002b,0x00000033,
0x00000064,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x0004003b,0x00000008,0x00000009,0x00000007,0x0004003b,0x00000008,0x00000018,
0x00000007,0x0004003b,0x00000023,0x00000024,0x00000007,0x0004003b,0x00000023,0x0000002c,
0x00000007,0x0004003b,0x00000031,0x00000032,0x00000007,0x0004003b,0x00000008,0x00000044,
0x00000007,0x0004003b,0x00000008,0x0000004b,0x00000007,0x0004003b,0x00000058,0x00000059,
0x00000007,0x00050041,0x00000011,0x00000012,0x0000000e,0x00000010,0x0004003d,0x00000007,
0x00000013,0x00000012,0x0007000c,0x00000007,0x00000015,0x00000001,0x00000028,0x00000013,
0x00000014,0x00050050,0x00000007,0x00000016,0x0000000a,0x0000000a,0x00050088,0x00000007,
0x00000017,0x00000016,0x00000015,0x0003003e,0x00000009,0x00000017,0x0004003d,0x00000007,
0x0000001b,0x0000001a,0x0004003d,0x00000007,0x0000001c,0x00000009,0x0005008e,0x00000007,
0x0000001e,0x0000001c,0x0000001d,0x0004003d,0x00000007,0x0000001f,0x00000009,0x0005008e,
0x00000007,0x00000020,0x0000001f,0x0000001d,0x00050083,0x00000007,0x00000021,0x00000014,
0x00000020,0x0008000c,0x00000007,0x00000022,0x00000001,0x0000002b,0x0000001b,0x0000001e,
0x00000021,0x0003003e,0x00000018,0x00000022,0x0004003d,0x00000026,0x00000029,0x00000028,
0x0004003d,0x00000007,0x0000002a,0x00000018,0x00050057,0x0000000b,0x0000002b,0x00000029,
0x0000002a,0x0003003e,0x00000024,0x0000002b,0x0004003d,0x00000026,0x0000002e,0x0000002d,
0x0004003d,0x00000007,0x0000002f,0x00000018,0x00050057,0x0000000b,0x00000030,0x0000002e,
0x0000002f,0x0003003e,0x0000002c,0x00000030,0x00050041,0x00000031,0x00000035,0x0000002c,
0x00000034,0x0004003d,0x00000006,0x00000036,0x00000035,0x0008000c,0x00000006,0x00000039,
0x00000001,0x0000002b,0x00000036,0x00000037,0x00000038,0x0003003e,0x00000032,0x00000039,
0x0004003d,0x00000006,0x0000003a,0x00000032,0x000500bc,0x0000003c,0x0000003d,0x0000003a,
0x0000003b,0x000300f7,0x0000003f,0x00000000,0x000400fa,0x0000003d,0x0000003e,0x0000003f,
0x000200f8,0x0000003e,0x0004003d,0x0000000b,0x00000042,0x00000024,0x0003003e,0x00000041,
0x00000042,0x000100fd,0x000200f8,0x0000003f,0x0004003d,0x0000000b,0x00000045,0x0000002c,
0x0007004f,0x00000007,0x00000046,0x00000045,0x00000045,0x00000001,0x00000002,0x0005008e,
0x00000007,0x00000048,0x00000046,0x00000047,0x00050050,0x00000007,0x00000049,0x0000000a,
0x0000000a,0x00050083,0x00000007,0x0000004a,0x00000048,0x00000049,0x0003003e,0x00000044,
0x0000004a,0x0004003d,0x00000007,0x0000004c,0x00000018,0x0004003d,0x00000007,0x0000004d,
0x00000044,0x0004003d,0x00000007,0x0000004e,0x00000009,0x00050085,0x00000007,0x0000004f,
0x0000004d,0x0000004e,0x00050081,0x00000007,0x00000050,0x0000004c,0x0000004f,0x0004003d,
0x00000007,0x00000051,0x00000009,0x0005008e,0x00000007,0x00000052,0x00000051,0x0000001d,
0x0004003d,0x00000007,0x00000053,0x00000009,0x0005008e,0x00000007,0x00000054,0x00000053,
0x0000001d,0x00050083,0x00000007,0x00000055,0x00000014,0x00000054,0x0008000c,0x00000007,
0x00000056,0x00000001,0x0000002b,0x00000050,0x00000052,0x00000055,0x0003003e,0x0000004b,
0x00000056,0x0004003d,0x00000026,0x0000005a,0x00000028,0x0004003d,0x00000007,0x0000005b,
0x0000004b,0x00050057,0x0000000b,0x0000005c,0x0000005a,0x0000005b,0x0008004f,0x00000057,
0x0000005d,0x0000005c,0x0000005c,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000059,
0x0000005d,0x0004003d,0x0000000b,0x0000005e,0x00000024,0x0008004f,0x00000057,0x0000005f,
0x0000005e,0x0000005e,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000057,0x00000060,
0x00000059,0x0004003d,0x00000006,0x00000061,0x00000032,0x00060050,0x00000057,0x00000062,
0x00000061,0x00000061,0x00000061,0x0008000c,0x00000057,0x00000063,0x00000001,0x0000002e,
0x0000005f,0x00000060,0x00000062,0x00050041,0x00000031,0x00000065,0x00000024,0x00000064,
0x0004003d,0x00000006,0x00000066,0x00000065,0x00050051,0x00000006,0x00000067,0x00000063,
0x00000000,0x00050051,0x00000006,0x00000068,0x00000063,0x00000001,0x00050051,0x00000006,
0x00000069,0x00000063,0x00000002,0x00070050,0x0000000b,0x0000006a,0x00000067,0x00000068,
0x00000069,0x00000066,0x0003003e,0x00000041,0x0000006a,0x000100fd,0x00010038
};
-29
View File
@@ -1,29 +0,0 @@
#version 450
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
layout(set = 0, binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform Constants {
vec4 ndc;
vec2 resolution;
float extra;
float pad;
} pc;
float luma(vec3 c) {
return dot(c, vec3(0.2126, 0.7152, 0.0722));
}
void main() {
vec2 px = 1.0 / max(pc.resolution, vec2(1.0));
vec2 uv = clamp(fragTexCoord, px * 0.5, vec2(1.0) - px * 0.5);
float center = luma(texture(InputTexture, uv).rgb);
float left = luma(texture(InputTexture, uv - vec2(px.x, 0.0)).rgb);
float right = luma(texture(InputTexture, uv + vec2(px.x, 0.0)).rgb);
float up = luma(texture(InputTexture, uv - vec2(0.0, px.y)).rgb);
float down = luma(texture(InputTexture, uv + vec2(0.0, px.y)).rgb);
// Store directional edge strengths for the weight pass.
outColor = vec4(abs(center - left), abs(center - right),
abs(center - up), abs(center - down));
}
-102
View File
@@ -1,102 +0,0 @@
// 1116.3.0
#pragma once
const uint32_t smaa_edge_code[] = {
0x07230203,0x00010000,0x0008000b,0x00000080,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000028,0x0000006e,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00050005,0x0000000b,0x616d756c,0x33667628,0x0000003b,0x00030005,0x0000000a,
0x00000063,0x00030005,0x00000017,0x00007870,0x00050005,0x0000001a,0x736e6f43,0x746e6174,
0x00000073,0x00040006,0x0000001a,0x00000000,0x0063646e,0x00060006,0x0000001a,0x00000001,
0x6f736572,0x6974756c,0x00006e6f,0x00050006,0x0000001a,0x00000002,0x72747865,0x00000061,
0x00040006,0x0000001a,0x00000003,0x00646170,0x00030005,0x0000001c,0x00006370,0x00030005,
0x00000026,0x00007675,0x00060005,0x00000028,0x67617266,0x43786554,0x64726f6f,0x00000000,
0x00040005,0x00000032,0x746e6563,0x00007265,0x00060005,0x00000036,0x75706e49,0x78655474,
0x65727574,0x00000000,0x00040005,0x0000003a,0x61726170,0x0000006d,0x00040005,0x0000003d,
0x7466656c,0x00000000,0x00040005,0x00000048,0x61726170,0x0000006d,0x00040005,0x0000004b,
0x68676972,0x00000074,0x00040005,0x00000053,0x61726170,0x0000006d,0x00030005,0x00000056,
0x00007075,0x00040005,0x0000005f,0x61726170,0x0000006d,0x00040005,0x00000062,0x6e776f64,
0x00000000,0x00040005,0x0000006a,0x61726170,0x0000006d,0x00050005,0x0000006e,0x4374756f,
0x726f6c6f,0x00000000,0x00030047,0x0000001a,0x00000002,0x00050048,0x0000001a,0x00000000,
0x00000023,0x00000000,0x00050048,0x0000001a,0x00000001,0x00000023,0x00000010,0x00050048,
0x0000001a,0x00000002,0x00000023,0x00000018,0x00050048,0x0000001a,0x00000003,0x00000023,
0x0000001c,0x00040047,0x00000028,0x0000001e,0x00000000,0x00040047,0x00000036,0x00000021,
0x00000000,0x00040047,0x00000036,0x00000022,0x00000000,0x00040047,0x0000006e,0x0000001e,
0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,
0x00000020,0x00040017,0x00000007,0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,
0x00000007,0x00040021,0x00000009,0x00000006,0x00000008,0x0004002b,0x00000006,0x0000000e,
0x3e59b3d0,0x0004002b,0x00000006,0x0000000f,0x3f371759,0x0004002b,0x00000006,0x00000010,
0x3d93dd98,0x0006002c,0x00000007,0x00000011,0x0000000e,0x0000000f,0x00000010,0x00040017,
0x00000015,0x00000006,0x00000002,0x00040020,0x00000016,0x00000007,0x00000015,0x0004002b,
0x00000006,0x00000018,0x3f800000,0x00040017,0x00000019,0x00000006,0x00000004,0x0006001e,
0x0000001a,0x00000019,0x00000015,0x00000006,0x00000006,0x00040020,0x0000001b,0x00000009,
0x0000001a,0x0004003b,0x0000001b,0x0000001c,0x00000009,0x00040015,0x0000001d,0x00000020,
0x00000001,0x0004002b,0x0000001d,0x0000001e,0x00000001,0x00040020,0x0000001f,0x00000009,
0x00000015,0x0005002c,0x00000015,0x00000022,0x00000018,0x00000018,0x00040020,0x00000027,
0x00000001,0x00000015,0x0004003b,0x00000027,0x00000028,0x00000001,0x0004002b,0x00000006,
0x0000002b,0x3f000000,0x00040020,0x00000031,0x00000007,0x00000006,0x00090019,0x00000033,
0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,
0x00000034,0x00000033,0x00040020,0x00000035,0x00000000,0x00000034,0x0004003b,0x00000035,
0x00000036,0x00000000,0x00040015,0x00000040,0x00000020,0x00000000,0x0004002b,0x00000040,
0x00000041,0x00000000,0x0004002b,0x00000006,0x00000044,0x00000000,0x0004002b,0x00000040,
0x00000059,0x00000001,0x00040020,0x0000006d,0x00000003,0x00000019,0x0004003b,0x0000006d,
0x0000006e,0x00000003,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,
0x00000005,0x0004003b,0x00000016,0x00000017,0x00000007,0x0004003b,0x00000016,0x00000026,
0x00000007,0x0004003b,0x00000031,0x00000032,0x00000007,0x0004003b,0x00000008,0x0000003a,
0x00000007,0x0004003b,0x00000031,0x0000003d,0x00000007,0x0004003b,0x00000008,0x00000048,
0x00000007,0x0004003b,0x00000031,0x0000004b,0x00000007,0x0004003b,0x00000008,0x00000053,
0x00000007,0x0004003b,0x00000031,0x00000056,0x00000007,0x0004003b,0x00000008,0x0000005f,
0x00000007,0x0004003b,0x00000031,0x00000062,0x00000007,0x0004003b,0x00000008,0x0000006a,
0x00000007,0x00050041,0x0000001f,0x00000020,0x0000001c,0x0000001e,0x0004003d,0x00000015,
0x00000021,0x00000020,0x0007000c,0x00000015,0x00000023,0x00000001,0x00000028,0x00000021,
0x00000022,0x00050050,0x00000015,0x00000024,0x00000018,0x00000018,0x00050088,0x00000015,
0x00000025,0x00000024,0x00000023,0x0003003e,0x00000017,0x00000025,0x0004003d,0x00000015,
0x00000029,0x00000028,0x0004003d,0x00000015,0x0000002a,0x00000017,0x0005008e,0x00000015,
0x0000002c,0x0000002a,0x0000002b,0x0004003d,0x00000015,0x0000002d,0x00000017,0x0005008e,
0x00000015,0x0000002e,0x0000002d,0x0000002b,0x00050083,0x00000015,0x0000002f,0x00000022,
0x0000002e,0x0008000c,0x00000015,0x00000030,0x00000001,0x0000002b,0x00000029,0x0000002c,
0x0000002f,0x0003003e,0x00000026,0x00000030,0x0004003d,0x00000034,0x00000037,0x00000036,
0x0004003d,0x00000015,0x00000038,0x00000026,0x00050057,0x00000019,0x00000039,0x00000037,
0x00000038,0x0008004f,0x00000007,0x0000003b,0x00000039,0x00000039,0x00000000,0x00000001,
0x00000002,0x0003003e,0x0000003a,0x0000003b,0x00050039,0x00000006,0x0000003c,0x0000000b,
0x0000003a,0x0003003e,0x00000032,0x0000003c,0x0004003d,0x00000034,0x0000003e,0x00000036,
0x0004003d,0x00000015,0x0000003f,0x00000026,0x00050041,0x00000031,0x00000042,0x00000017,
0x00000041,0x0004003d,0x00000006,0x00000043,0x00000042,0x00050050,0x00000015,0x00000045,
0x00000043,0x00000044,0x00050083,0x00000015,0x00000046,0x0000003f,0x00000045,0x00050057,
0x00000019,0x00000047,0x0000003e,0x00000046,0x0008004f,0x00000007,0x00000049,0x00000047,
0x00000047,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000048,0x00000049,0x00050039,
0x00000006,0x0000004a,0x0000000b,0x00000048,0x0003003e,0x0000003d,0x0000004a,0x0004003d,
0x00000034,0x0000004c,0x00000036,0x0004003d,0x00000015,0x0000004d,0x00000026,0x00050041,
0x00000031,0x0000004e,0x00000017,0x00000041,0x0004003d,0x00000006,0x0000004f,0x0000004e,
0x00050050,0x00000015,0x00000050,0x0000004f,0x00000044,0x00050081,0x00000015,0x00000051,
0x0000004d,0x00000050,0x00050057,0x00000019,0x00000052,0x0000004c,0x00000051,0x0008004f,
0x00000007,0x00000054,0x00000052,0x00000052,0x00000000,0x00000001,0x00000002,0x0003003e,
0x00000053,0x00000054,0x00050039,0x00000006,0x00000055,0x0000000b,0x00000053,0x0003003e,
0x0000004b,0x00000055,0x0004003d,0x00000034,0x00000057,0x00000036,0x0004003d,0x00000015,
0x00000058,0x00000026,0x00050041,0x00000031,0x0000005a,0x00000017,0x00000059,0x0004003d,
0x00000006,0x0000005b,0x0000005a,0x00050050,0x00000015,0x0000005c,0x00000044,0x0000005b,
0x00050083,0x00000015,0x0000005d,0x00000058,0x0000005c,0x00050057,0x00000019,0x0000005e,
0x00000057,0x0000005d,0x0008004f,0x00000007,0x00000060,0x0000005e,0x0000005e,0x00000000,
0x00000001,0x00000002,0x0003003e,0x0000005f,0x00000060,0x00050039,0x00000006,0x00000061,
0x0000000b,0x0000005f,0x0003003e,0x00000056,0x00000061,0x0004003d,0x00000034,0x00000063,
0x00000036,0x0004003d,0x00000015,0x00000064,0x00000026,0x00050041,0x00000031,0x00000065,
0x00000017,0x00000059,0x0004003d,0x00000006,0x00000066,0x00000065,0x00050050,0x00000015,
0x00000067,0x00000044,0x00000066,0x00050081,0x00000015,0x00000068,0x00000064,0x00000067,
0x00050057,0x00000019,0x00000069,0x00000063,0x00000068,0x0008004f,0x00000007,0x0000006b,
0x00000069,0x00000069,0x00000000,0x00000001,0x00000002,0x0003003e,0x0000006a,0x0000006b,
0x00050039,0x00000006,0x0000006c,0x0000000b,0x0000006a,0x0003003e,0x00000062,0x0000006c,
0x0004003d,0x00000006,0x0000006f,0x00000032,0x0004003d,0x00000006,0x00000070,0x0000003d,
0x00050083,0x00000006,0x00000071,0x0000006f,0x00000070,0x0006000c,0x00000006,0x00000072,
0x00000001,0x00000004,0x00000071,0x0004003d,0x00000006,0x00000073,0x00000032,0x0004003d,
0x00000006,0x00000074,0x0000004b,0x00050083,0x00000006,0x00000075,0x00000073,0x00000074,
0x0006000c,0x00000006,0x00000076,0x00000001,0x00000004,0x00000075,0x0004003d,0x00000006,
0x00000077,0x00000032,0x0004003d,0x00000006,0x00000078,0x00000056,0x00050083,0x00000006,
0x00000079,0x00000077,0x00000078,0x0006000c,0x00000006,0x0000007a,0x00000001,0x00000004,
0x00000079,0x0004003d,0x00000006,0x0000007b,0x00000032,0x0004003d,0x00000006,0x0000007c,
0x00000062,0x00050083,0x00000006,0x0000007d,0x0000007b,0x0000007c,0x0006000c,0x00000006,
0x0000007e,0x00000001,0x00000004,0x0000007d,0x00070050,0x00000019,0x0000007f,0x00000072,
0x00000076,0x0000007a,0x0000007e,0x0003003e,0x0000006e,0x0000007f,0x000100fd,0x00010038,
0x00050036,0x00000006,0x0000000b,0x00000000,0x00000009,0x00030037,0x00000008,0x0000000a,
0x000200f8,0x0000000c,0x0004003d,0x00000007,0x0000000d,0x0000000a,0x00050094,0x00000006,
0x00000012,0x0000000d,0x00000011,0x000200fe,0x00000012,0x00010038
};
-153
View File
@@ -1,153 +0,0 @@
#version 450
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
layout(set = 0, binding = 0) uniform sampler2D EdgeTexture;
layout(push_constant) uniform Constants {
vec4 ndc;
vec2 resolution;
float extra;
float pad;
} pc;
vec4 edgeAt(vec2 uv, vec2 px) {
vec2 edgeUV = clamp(uv, px * 0.5, vec2(1.0) - px * 0.5);
vec4 e = textureLod(EdgeTexture, edgeUV, 0.0);
e.a = edgeUV.y >= 1.0 - px.y ? 0.0 : e.a;
return e;
}
float verticalEdge(vec2 uv, vec2 px) {
vec4 e = edgeAt(uv, px);
return max(e.r, e.g);
}
float horizontalEdge(vec2 uv, vec2 px) {
vec4 e = edgeAt(uv, px);
return max(e.b, e.a);
}
float measureRun(vec2 origin, vec2 texel, vec2 tangent,
bool verticalLine, float limit, bool positive) {
float run = 0.0;
for (int i = 1; i <= 6; ++i) {
vec2 probe = origin + tangent * float(i) * (positive ? 1.0 : -1.0);
ivec2 index = ivec2(floor(probe * pc.resolution));
ivec2 size = ivec2(pc.resolution);
if (any(lessThan(index, ivec2(0))) ||
any(greaterThanEqual(index, size))) {
break;
}
float edge = verticalLine
? verticalEdge(probe, texel)
: horizontalEdge(probe, texel);
if (edge <= limit * 0.65) {
break;
}
run = float(i);
}
return run;
}
void main() {
vec2 px = 1.0 / max(pc.resolution, vec2(1.0));
vec2 uv = clamp(fragTexCoord, px * 0.5, vec2(1.0) - px * 0.5);
vec4 e = edgeAt(uv, px);
float dL = e.r;
float dR = e.g;
float dU = e.b;
float dD = e.a;
float vertical = max(dL, dR);
float horizontal = max(dU, dD);
float strongest = max(vertical, horizontal);
float threshold = max(0.045, strongest * 0.12);
if (strongest <= threshold) {
outColor = vec4(0.0, 0.5, 0.5, 0.0);
return;
}
bool verticalLine;
float negativeRun = 0.0;
float positiveRun = 0.0;
bool runsMeasured = false;
if (vertical > horizontal) {
verticalLine = true;
} else if (horizontal > vertical) {
verticalLine = false;
} else {
float vNeg = measureRun(uv, px, vec2(0.0, px.y), true, threshold, false);
float vPos = measureRun(uv, px, vec2(0.0, px.y), true, threshold, true);
float hNeg = measureRun(uv, px, vec2(px.x, 0.0), false, threshold, false);
float hPos = measureRun(uv, px, vec2(px.x, 0.0), false, threshold, true);
verticalLine = (vNeg + vPos) >= (hNeg + hPos);
negativeRun = verticalLine ? vNeg : hNeg;
positiveRun = verticalLine ? vPos : hPos;
runsMeasured = true;
}
vec2 tangent = verticalLine ? vec2(0.0, px.y) : vec2(px.x, 0.0);
vec2 normal = verticalLine
? vec2(dL >= dR ? -1.0 : 1.0, 0.0)
: vec2(0.0, dU >= dD ? -1.0 : 1.0);
if (!runsMeasured) {
negativeRun = measureRun(uv, px, tangent, verticalLine, threshold, false);
positiveRun = measureRun(uv, px, tangent, verticalLine, threshold, true);
}
float span = negativeRun + positiveRun;
float edgeConfidence = smoothstep(threshold, threshold * 2.5, strongest);
vec4 nw = edgeAt(uv + vec2(-px.x, -px.y), px);
vec4 ne = edgeAt(uv + vec2(px.x, -px.y), px);
vec4 sw = edgeAt(uv + vec2(-px.x, px.y), px);
vec4 se = edgeAt(uv + vec2(px.x, px.y), px);
float runEndpointPattern = clamp(
abs(negativeRun - positiveRun) / max(span, 1.0), 0.0, 1.0);
float crossingA = verticalLine
? abs(nw.a - ne.a)
: abs(nw.g - sw.g);
float crossingB = verticalLine
? abs(sw.b - se.b)
: abs(ne.r - se.r);
float crossingContrast = abs(crossingA - crossingB);
float crossingPattern = smoothstep(threshold, threshold * 2.5, crossingContrast);
vec4 edgeMin = min(min(nw, ne), min(sw, se));
vec4 edgeMax = max(max(nw, ne), max(sw, se));
float edgeVariation = max(
max(edgeMax.r - edgeMin.r, edgeMax.g - edgeMin.g),
max(edgeMax.b - edgeMin.b, edgeMax.a - edgeMin.a));
float balancedCrossing = edgeVariation > 0.01
? smoothstep(threshold, threshold * 2.5, min(crossingA, crossingB))
: 0.0;
float endpointPattern = runEndpointPattern > 0.01
? max(runEndpointPattern, balancedCrossing)
: runEndpointPattern;
float endpointArea = endpointPattern / (1.0 + span * 0.055);
float areaWeight = 0.38 * crossingPattern * clamp(span / 4.0, 0.0, 1.0);
float diagonalContrast = max(
max(max(abs(nw.r - se.r), abs(nw.g - se.g)),
max(abs(nw.b - se.b), abs(nw.a - se.a))),
max(max(abs(ne.r - sw.r), abs(ne.g - sw.g)),
max(abs(ne.b - sw.b), abs(ne.a - sw.a))));
float cornerFactor = 1.0 - 0.35 * smoothstep(threshold, threshold * 3.0, diagonalContrast);
float baseWeight = areaWeight * endpointArea * edgeConfidence * cornerFactor;
float diagonalStrength = min(vertical, horizontal);
float diagonalPattern = smoothstep(threshold, threshold * 2.5, diagonalStrength);
float diagonalContinuity = smoothstep(1.0, 3.0, span);
float shortDiagonalFallback =
(span > 0.0 && span <= 1.0 && crossingContrast <= threshold && diagonalStrength > threshold)
? 1.0 : 0.0;
float diagonalFallback = 0.16 * diagonalPattern * edgeConfidence
* cornerFactor * max(
diagonalContinuity * max(crossingPattern, balancedCrossing),
shortDiagonalFallback);
float weight = clamp(max(baseWeight, diagonalFallback), 0.0, 0.42);
outColor = vec4(weight, normal.x * 0.5 + 0.5, normal.y * 0.5 + 0.5, 1.0);
}
@@ -1,567 +0,0 @@
// SPIR-V gerado
#pragma once
const uint32_t smaa_weights_code[] = {
0x07230203,0x00010000,0x0008000b,0x000002e6,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x000000cb,0x000000fd,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00060005,0x0000000d,0x65676465,0x76287441,0x763b3266,0x003b3266,0x00030005,
0x0000000b,0x00007675,0x00030005,0x0000000c,0x00007870,0x00080005,0x00000012,0x74726576,
0x6c616369,0x65676445,0x32667628,0x3266763b,0x0000003b,0x00030005,0x00000010,0x00007675,
0x00030005,0x00000011,0x00007870,0x00080005,0x00000016,0x69726f68,0x746e6f7a,0x64456c61,
0x76286567,0x763b3266,0x003b3266,0x00030005,0x00000014,0x00007675,0x00030005,0x00000015,
0x00007870,0x000b0005,0x00000022,0x7361656d,0x52657275,0x76286e75,0x763b3266,0x763b3266,
0x623b3266,0x31663b31,0x3b31623b,0x00000000,0x00040005,0x0000001c,0x6769726f,0x00006e69,
0x00040005,0x0000001d,0x65786574,0x0000006c,0x00040005,0x0000001e,0x676e6174,0x00746e65,
0x00060005,0x0000001f,0x74726576,0x6c616369,0x656e694c,0x00000000,0x00040005,0x00000020,
0x696d696c,0x00000074,0x00050005,0x00000021,0x69736f70,0x65766974,0x00000000,0x00040005,
0x00000024,0x65676465,0x00005655,0x00030005,0x00000030,0x00000065,0x00050005,0x00000034,
0x65676445,0x74786554,0x00657275,0x00030005,0x0000004d,0x00000065,0x00040005,0x0000004e,
0x61726170,0x0000006d,0x00040005,0x00000050,0x61726170,0x0000006d,0x00030005,0x0000005b,
0x00000065,0x00040005,0x0000005c,0x61726170,0x0000006d,0x00040005,0x0000005e,0x61726170,
0x0000006d,0x00030005,0x00000069,0x006e7572,0x00030005,0x0000006c,0x00000069,0x00040005,
0x00000076,0x626f7270,0x00000065,0x00040005,0x00000083,0x65646e69,0x00000078,0x00050005,
0x00000085,0x736e6f43,0x746e6174,0x00000073,0x00040006,0x00000085,0x00000000,0x0063646e,
0x00060006,0x00000085,0x00000001,0x6f736572,0x6974756c,0x00006e6f,0x00050006,0x00000085,
0x00000002,0x72747865,0x00000061,0x00040006,0x00000085,0x00000003,0x00646170,0x00030005,
0x00000087,0x00006370,0x00040005,0x0000008e,0x657a6973,0x00000000,0x00040005,0x000000a3,
0x65676465,0x00000000,0x00040005,0x000000a8,0x61726170,0x0000006d,0x00040005,0x000000aa,
0x61726170,0x0000006d,0x00040005,0x000000ae,0x61726170,0x0000006d,0x00040005,0x000000b0,
0x61726170,0x0000006d,0x00030005,0x000000c3,0x00007870,0x00030005,0x000000c9,0x00007675,
0x00060005,0x000000cb,0x67617266,0x43786554,0x64726f6f,0x00000000,0x00030005,0x000000d3,
0x00000065,0x00040005,0x000000d4,0x61726170,0x0000006d,0x00040005,0x000000d6,0x61726170,
0x0000006d,0x00030005,0x000000d9,0x00004c64,0x00030005,0x000000dc,0x00005264,0x00030005,
0x000000df,0x00005564,0x00030005,0x000000e2,0x00004464,0x00050005,0x000000e5,0x74726576,
0x6c616369,0x00000000,0x00050005,0x000000e9,0x69726f68,0x746e6f7a,0x00006c61,0x00050005,
0x000000ed,0x6f727473,0x7365676e,0x00000074,0x00050005,0x000000f1,0x65726874,0x6c6f6873,
0x00000064,0x00050005,0x000000fd,0x4374756f,0x726f6c6f,0x00000000,0x00050005,0x00000100,
0x6167656e,0x65766974,0x006e7552,0x00050005,0x00000101,0x69736f70,0x65766974,0x006e7552,
0x00060005,0x00000102,0x736e7572,0x7361654d,0x64657275,0x00000000,0x00060005,0x00000109,
0x74726576,0x6c616369,0x656e694c,0x00000000,0x00040005,0x00000112,0x67654e76,0x00000000,
0x00040005,0x00000116,0x61726170,0x0000006d,0x00040005,0x00000118,0x61726170,0x0000006d,
0x00040005,0x0000011a,0x61726170,0x0000006d,0x00040005,0x0000011b,0x61726170,0x0000006d,
0x00040005,0x0000011c,0x61726170,0x0000006d,0x00040005,0x0000011e,0x61726170,0x0000006d,
0x00040005,0x00000120,0x736f5076,0x00000000,0x00040005,0x00000124,0x61726170,0x0000006d,
0x00040005,0x00000126,0x61726170,0x0000006d,0x00040005,0x00000128,0x61726170,0x0000006d,
0x00040005,0x00000129,0x61726170,0x0000006d,0x00040005,0x0000012a,0x61726170,0x0000006d,
0x00040005,0x0000012c,0x61726170,0x0000006d,0x00040005,0x0000012e,0x67654e68,0x00000000,
0x00040005,0x00000132,0x61726170,0x0000006d,0x00040005,0x00000134,0x61726170,0x0000006d,
0x00040005,0x00000136,0x61726170,0x0000006d,0x00040005,0x00000137,0x61726170,0x0000006d,
0x00040005,0x00000138,0x61726170,0x0000006d,0x00040005,0x0000013a,0x61726170,0x0000006d,
0x00040005,0x0000013c,0x736f5068,0x00000000,0x00040005,0x00000140,0x61726170,0x0000006d,
0x00040005,0x00000142,0x61726170,0x0000006d,0x00040005,0x00000144,0x61726170,0x0000006d,
0x00040005,0x00000145,0x61726170,0x0000006d,0x00040005,0x00000146,0x61726170,0x0000006d,
0x00040005,0x00000148,0x61726170,0x0000006d,0x00040005,0x00000159,0x676e6174,0x00746e65,
0x00040005,0x00000166,0x6d726f6e,0x00006c61,0x00040005,0x0000017b,0x61726170,0x0000006d,
0x00040005,0x0000017d,0x61726170,0x0000006d,0x00040005,0x0000017f,0x61726170,0x0000006d,
0x00040005,0x00000181,0x61726170,0x0000006d,0x00040005,0x00000183,0x61726170,0x0000006d,
0x00040005,0x00000185,0x61726170,0x0000006d,0x00040005,0x00000187,0x61726170,0x0000006d,
0x00040005,0x00000189,0x61726170,0x0000006d,0x00040005,0x0000018b,0x61726170,0x0000006d,
0x00040005,0x0000018d,0x61726170,0x0000006d,0x00040005,0x0000018f,0x61726170,0x0000006d,
0x00040005,0x00000191,0x61726170,0x0000006d,0x00040005,0x00000193,0x6e617073,0x00000000,
0x00060005,0x00000197,0x65676465,0x666e6f43,0x6e656469,0x00006563,0x00030005,0x0000019e,
0x0000776e,0x00040005,0x000001a8,0x61726170,0x0000006d,0x00040005,0x000001a9,0x61726170,
0x0000006d,0x00030005,0x000001ac,0x0000656e,0x00040005,0x000001b5,0x61726170,0x0000006d,
0x00040005,0x000001b6,0x61726170,0x0000006d,0x00030005,0x000001b9,0x00007773,0x00040005,
0x000001c2,0x61726170,0x0000006d,0x00040005,0x000001c3,0x61726170,0x0000006d,0x00030005,
0x000001c6,0x00006573,0x00040005,0x000001ce,0x61726170,0x0000006d,0x00040005,0x000001cf,
0x61726170,0x0000006d,0x00070005,0x000001d2,0x456e7572,0x6f70646e,0x50746e69,0x65747461,
0x00006e72,0x00050005,0x000001db,0x736f7263,0x676e6973,0x00000041,0x00050005,0x000001ee,
0x736f7263,0x676e6973,0x00000042,0x00070005,0x00000201,0x736f7263,0x676e6973,0x746e6f43,
0x74736172,0x00000000,0x00060005,0x00000206,0x736f7263,0x676e6973,0x74746150,0x006e7265,
0x00040005,0x0000020c,0x65676465,0x006e694d,0x00040005,0x00000214,0x65676465,0x0078614d,
0x00060005,0x0000021c,0x65676465,0x69726156,0x6f697461,0x0000006e,0x00070005,0x00000234,
0x616c6162,0x6465636e,0x736f7243,0x676e6973,0x00000000,0x00060005,0x00000244,0x70646e65,
0x746e696f,0x74746150,0x006e7265,0x00060005,0x00000250,0x70646e65,0x746e696f,0x61657241,
0x00000000,0x00050005,0x00000257,0x61657261,0x67696557,0x00007468,0x00070005,0x00000260,
0x67616964,0x6c616e6f,0x746e6f43,0x74736172,0x00000000,0x00060005,0x00000298,0x6e726f63,
0x61467265,0x726f7463,0x00000000,0x00050005,0x000002a2,0x65736162,0x67696557,0x00007468,
0x00070005,0x000002aa,0x67616964,0x6c616e6f,0x65727453,0x6874676e,0x00000000,0x00060005,
0x000002ae,0x67616964,0x6c616e6f,0x74746150,0x006e7265,0x00070005,0x000002b4,0x67616964,
0x6c616e6f,0x746e6f43,0x69756e69,0x00007974,0x00080005,0x000002b7,0x726f6873,0x61694474,
0x616e6f67,0x6c61466c,0x6361626c,0x0000006b,0x00070005,0x000002c6,0x67616964,0x6c616e6f,
0x6c6c6146,0x6b636162,0x00000000,0x00040005,0x000002d6,0x67696577,0x00007468,0x00040047,
0x00000034,0x00000021,0x00000000,0x00040047,0x00000034,0x00000022,0x00000000,0x00030047,
0x00000085,0x00000002,0x00050048,0x00000085,0x00000000,0x00000023,0x00000000,0x00050048,
0x00000085,0x00000001,0x00000023,0x00000010,0x00050048,0x00000085,0x00000002,0x00000023,
0x00000018,0x00050048,0x00000085,0x00000003,0x00000023,0x0000001c,0x00040047,0x000000cb,
0x0000001e,0x00000000,0x00040047,0x000000fd,0x0000001e,0x00000000,0x00020013,0x00000002,
0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,
0x00000006,0x00000002,0x00040020,0x00000008,0x00000007,0x00000007,0x00040017,0x00000009,
0x00000006,0x00000004,0x00050021,0x0000000a,0x00000009,0x00000008,0x00000008,0x00050021,
0x0000000f,0x00000006,0x00000008,0x00000008,0x00020014,0x00000018,0x00040020,0x00000019,
0x00000007,0x00000018,0x00040020,0x0000001a,0x00000007,0x00000006,0x00090021,0x0000001b,
0x00000006,0x00000008,0x00000008,0x00000008,0x00000019,0x0000001a,0x00000019,0x0004002b,
0x00000006,0x00000027,0x3f000000,0x0004002b,0x00000006,0x00000029,0x3f800000,0x0005002c,
0x00000007,0x0000002a,0x00000029,0x00000029,0x00040020,0x0000002f,0x00000007,0x00000009,
0x00090019,0x00000031,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,
0x00000000,0x0003001b,0x00000032,0x00000031,0x00040020,0x00000033,0x00000000,0x00000032,
0x0004003b,0x00000033,0x00000034,0x00000000,0x0004002b,0x00000006,0x00000037,0x00000000,
0x00040015,0x00000039,0x00000020,0x00000000,0x0004002b,0x00000039,0x0000003a,0x00000001,
0x0004002b,0x00000039,0x00000045,0x00000003,0x0004002b,0x00000039,0x00000053,0x00000000,
0x0004002b,0x00000039,0x00000061,0x00000002,0x00040015,0x0000006a,0x00000020,0x00000001,
0x00040020,0x0000006b,0x00000007,0x0000006a,0x0004002b,0x0000006a,0x0000006d,0x00000001,
0x0004002b,0x0000006a,0x00000074,0x00000006,0x0004002b,0x00000006,0x0000007d,0xbf800000,
0x00040017,0x00000081,0x0000006a,0x00000002,0x00040020,0x00000082,0x00000007,0x00000081,
0x0006001e,0x00000085,0x00000009,0x00000007,0x00000006,0x00000006,0x00040020,0x00000086,
0x00000009,0x00000085,0x0004003b,0x00000086,0x00000087,0x00000009,0x00040020,0x00000088,
0x00000009,0x00000007,0x0004002b,0x0000006a,0x00000093,0x00000000,0x0005002c,0x00000081,
0x00000094,0x00000093,0x00000093,0x00040017,0x00000095,0x00000018,0x00000002,0x0004002b,
0x00000006,0x000000b6,0x3f266666,0x00040020,0x000000ca,0x00000001,0x00000007,0x0004003b,
0x000000ca,0x000000cb,0x00000001,0x0004002b,0x00000006,0x000000f2,0x3d3851ec,0x0004002b,
0x00000006,0x000000f4,0x3df5c28f,0x00040020,0x000000fc,0x00000003,0x00000009,0x0004003b,
0x000000fc,0x000000fd,0x00000003,0x0007002c,0x00000009,0x000000fe,0x00000037,0x00000027,
0x00000027,0x00000037,0x0003002a,0x00000018,0x00000103,0x00030029,0x00000018,0x0000010a,
0x0004002b,0x00000006,0x0000019a,0x40200000,0x0004002b,0x00000006,0x00000236,0x3c23d70a,
0x0004002b,0x00000006,0x00000253,0x3d6147ae,0x0004002b,0x00000006,0x00000258,0x3ec28f5c,
0x0004002b,0x00000006,0x0000025c,0x40800000,0x0004002b,0x00000006,0x00000299,0x3eb33333,
0x0004002b,0x00000006,0x0000029c,0x40400000,0x0004002b,0x00000006,0x000002c7,0x3e23d70a,
0x0004002b,0x00000006,0x000002da,0x3ed70a3d,0x00050036,0x00000002,0x00000004,0x00000000,
0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,0x000000c3,0x00000007,0x0004003b,
0x00000008,0x000000c9,0x00000007,0x0004003b,0x0000002f,0x000000d3,0x00000007,0x0004003b,
0x00000008,0x000000d4,0x00000007,0x0004003b,0x00000008,0x000000d6,0x00000007,0x0004003b,
0x0000001a,0x000000d9,0x00000007,0x0004003b,0x0000001a,0x000000dc,0x00000007,0x0004003b,
0x0000001a,0x000000df,0x00000007,0x0004003b,0x0000001a,0x000000e2,0x00000007,0x0004003b,
0x0000001a,0x000000e5,0x00000007,0x0004003b,0x0000001a,0x000000e9,0x00000007,0x0004003b,
0x0000001a,0x000000ed,0x00000007,0x0004003b,0x0000001a,0x000000f1,0x00000007,0x0004003b,
0x0000001a,0x00000100,0x00000007,0x0004003b,0x0000001a,0x00000101,0x00000007,0x0004003b,
0x00000019,0x00000102,0x00000007,0x0004003b,0x00000019,0x00000109,0x00000007,0x0004003b,
0x0000001a,0x00000112,0x00000007,0x0004003b,0x00000008,0x00000116,0x00000007,0x0004003b,
0x00000008,0x00000118,0x00000007,0x0004003b,0x00000008,0x0000011a,0x00000007,0x0004003b,
0x00000019,0x0000011b,0x00000007,0x0004003b,0x0000001a,0x0000011c,0x00000007,0x0004003b,
0x00000019,0x0000011e,0x00000007,0x0004003b,0x0000001a,0x00000120,0x00000007,0x0004003b,
0x00000008,0x00000124,0x00000007,0x0004003b,0x00000008,0x00000126,0x00000007,0x0004003b,
0x00000008,0x00000128,0x00000007,0x0004003b,0x00000019,0x00000129,0x00000007,0x0004003b,
0x0000001a,0x0000012a,0x00000007,0x0004003b,0x00000019,0x0000012c,0x00000007,0x0004003b,
0x0000001a,0x0000012e,0x00000007,0x0004003b,0x00000008,0x00000132,0x00000007,0x0004003b,
0x00000008,0x00000134,0x00000007,0x0004003b,0x00000008,0x00000136,0x00000007,0x0004003b,
0x00000019,0x00000137,0x00000007,0x0004003b,0x0000001a,0x00000138,0x00000007,0x0004003b,
0x00000019,0x0000013a,0x00000007,0x0004003b,0x0000001a,0x0000013c,0x00000007,0x0004003b,
0x00000008,0x00000140,0x00000007,0x0004003b,0x00000008,0x00000142,0x00000007,0x0004003b,
0x00000008,0x00000144,0x00000007,0x0004003b,0x00000019,0x00000145,0x00000007,0x0004003b,
0x0000001a,0x00000146,0x00000007,0x0004003b,0x00000019,0x00000148,0x00000007,0x0004003b,
0x00000008,0x00000159,0x00000007,0x0004003b,0x00000008,0x0000015b,0x00000007,0x0004003b,
0x00000008,0x00000166,0x00000007,0x0004003b,0x00000008,0x00000168,0x00000007,0x0004003b,
0x00000008,0x0000017b,0x00000007,0x0004003b,0x00000008,0x0000017d,0x00000007,0x0004003b,
0x00000008,0x0000017f,0x00000007,0x0004003b,0x00000019,0x00000181,0x00000007,0x0004003b,
0x0000001a,0x00000183,0x00000007,0x0004003b,0x00000019,0x00000185,0x00000007,0x0004003b,
0x00000008,0x00000187,0x00000007,0x0004003b,0x00000008,0x00000189,0x00000007,0x0004003b,
0x00000008,0x0000018b,0x00000007,0x0004003b,0x00000019,0x0000018d,0x00000007,0x0004003b,
0x0000001a,0x0000018f,0x00000007,0x0004003b,0x00000019,0x00000191,0x00000007,0x0004003b,
0x0000001a,0x00000193,0x00000007,0x0004003b,0x0000001a,0x00000197,0x00000007,0x0004003b,
0x0000002f,0x0000019e,0x00000007,0x0004003b,0x00000008,0x000001a8,0x00000007,0x0004003b,
0x00000008,0x000001a9,0x00000007,0x0004003b,0x0000002f,0x000001ac,0x00000007,0x0004003b,
0x00000008,0x000001b5,0x00000007,0x0004003b,0x00000008,0x000001b6,0x00000007,0x0004003b,
0x0000002f,0x000001b9,0x00000007,0x0004003b,0x00000008,0x000001c2,0x00000007,0x0004003b,
0x00000008,0x000001c3,0x00000007,0x0004003b,0x0000002f,0x000001c6,0x00000007,0x0004003b,
0x00000008,0x000001ce,0x00000007,0x0004003b,0x00000008,0x000001cf,0x00000007,0x0004003b,
0x0000001a,0x000001d2,0x00000007,0x0004003b,0x0000001a,0x000001db,0x00000007,0x0004003b,
0x0000001a,0x000001dd,0x00000007,0x0004003b,0x0000001a,0x000001ee,0x00000007,0x0004003b,
0x0000001a,0x000001f0,0x00000007,0x0004003b,0x0000001a,0x00000201,0x00000007,0x0004003b,
0x0000001a,0x00000206,0x00000007,0x0004003b,0x0000002f,0x0000020c,0x00000007,0x0004003b,
0x0000002f,0x00000214,0x00000007,0x0004003b,0x0000001a,0x0000021c,0x00000007,0x0004003b,
0x0000001a,0x00000234,0x00000007,0x0004003b,0x0000001a,0x00000238,0x00000007,0x0004003b,
0x0000001a,0x00000244,0x00000007,0x0004003b,0x0000001a,0x00000247,0x00000007,0x0004003b,
0x0000001a,0x00000250,0x00000007,0x0004003b,0x0000001a,0x00000257,0x00000007,0x0004003b,
0x0000001a,0x00000260,0x00000007,0x0004003b,0x0000001a,0x00000298,0x00000007,0x0004003b,
0x0000001a,0x000002a2,0x00000007,0x0004003b,0x0000001a,0x000002aa,0x00000007,0x0004003b,
0x0000001a,0x000002ae,0x00000007,0x0004003b,0x0000001a,0x000002b4,0x00000007,0x0004003b,
0x0000001a,0x000002b7,0x00000007,0x0004003b,0x0000001a,0x000002c6,0x00000007,0x0004003b,
0x0000001a,0x000002d6,0x00000007,0x00050041,0x00000088,0x000000c4,0x00000087,0x0000006d,
0x0004003d,0x00000007,0x000000c5,0x000000c4,0x0007000c,0x00000007,0x000000c6,0x00000001,
0x00000028,0x000000c5,0x0000002a,0x00050050,0x00000007,0x000000c7,0x00000029,0x00000029,
0x00050088,0x00000007,0x000000c8,0x000000c7,0x000000c6,0x0003003e,0x000000c3,0x000000c8,
0x0004003d,0x00000007,0x000000cc,0x000000cb,0x0004003d,0x00000007,0x000000cd,0x000000c3,
0x0005008e,0x00000007,0x000000ce,0x000000cd,0x00000027,0x0004003d,0x00000007,0x000000cf,
0x000000c3,0x0005008e,0x00000007,0x000000d0,0x000000cf,0x00000027,0x00050083,0x00000007,
0x000000d1,0x0000002a,0x000000d0,0x0008000c,0x00000007,0x000000d2,0x00000001,0x0000002b,
0x000000cc,0x000000ce,0x000000d1,0x0003003e,0x000000c9,0x000000d2,0x0004003d,0x00000007,
0x000000d5,0x000000c9,0x0003003e,0x000000d4,0x000000d5,0x0004003d,0x00000007,0x000000d7,
0x000000c3,0x0003003e,0x000000d6,0x000000d7,0x00060039,0x00000009,0x000000d8,0x0000000d,
0x000000d4,0x000000d6,0x0003003e,0x000000d3,0x000000d8,0x00050041,0x0000001a,0x000000da,
0x000000d3,0x00000053,0x0004003d,0x00000006,0x000000db,0x000000da,0x0003003e,0x000000d9,
0x000000db,0x00050041,0x0000001a,0x000000dd,0x000000d3,0x0000003a,0x0004003d,0x00000006,
0x000000de,0x000000dd,0x0003003e,0x000000dc,0x000000de,0x00050041,0x0000001a,0x000000e0,
0x000000d3,0x00000061,0x0004003d,0x00000006,0x000000e1,0x000000e0,0x0003003e,0x000000df,
0x000000e1,0x00050041,0x0000001a,0x000000e3,0x000000d3,0x00000045,0x0004003d,0x00000006,
0x000000e4,0x000000e3,0x0003003e,0x000000e2,0x000000e4,0x0004003d,0x00000006,0x000000e6,
0x000000d9,0x0004003d,0x00000006,0x000000e7,0x000000dc,0x0007000c,0x00000006,0x000000e8,
0x00000001,0x00000028,0x000000e6,0x000000e7,0x0003003e,0x000000e5,0x000000e8,0x0004003d,
0x00000006,0x000000ea,0x000000df,0x0004003d,0x00000006,0x000000eb,0x000000e2,0x0007000c,
0x00000006,0x000000ec,0x00000001,0x00000028,0x000000ea,0x000000eb,0x0003003e,0x000000e9,
0x000000ec,0x0004003d,0x00000006,0x000000ee,0x000000e5,0x0004003d,0x00000006,0x000000ef,
0x000000e9,0x0007000c,0x00000006,0x000000f0,0x00000001,0x00000028,0x000000ee,0x000000ef,
0x0003003e,0x000000ed,0x000000f0,0x0004003d,0x00000006,0x000000f3,0x000000ed,0x00050085,
0x00000006,0x000000f5,0x000000f3,0x000000f4,0x0007000c,0x00000006,0x000000f6,0x00000001,
0x00000028,0x000000f2,0x000000f5,0x0003003e,0x000000f1,0x000000f6,0x0004003d,0x00000006,
0x000000f7,0x000000ed,0x0004003d,0x00000006,0x000000f8,0x000000f1,0x000500bc,0x00000018,
0x000000f9,0x000000f7,0x000000f8,0x000300f7,0x000000fb,0x00000000,0x000400fa,0x000000f9,
0x000000fa,0x000000fb,0x000200f8,0x000000fa,0x0003003e,0x000000fd,0x000000fe,0x000100fd,
0x000200f8,0x000000fb,0x0003003e,0x00000100,0x00000037,0x0003003e,0x00000101,0x00000037,
0x0003003e,0x00000102,0x00000103,0x0004003d,0x00000006,0x00000104,0x000000e5,0x0004003d,
0x00000006,0x00000105,0x000000e9,0x000500ba,0x00000018,0x00000106,0x00000104,0x00000105,
0x000300f7,0x00000108,0x00000000,0x000400fa,0x00000106,0x00000107,0x0000010b,0x000200f8,
0x00000107,0x0003003e,0x00000109,0x0000010a,0x000200f9,0x00000108,0x000200f8,0x0000010b,
0x0004003d,0x00000006,0x0000010c,0x000000e9,0x0004003d,0x00000006,0x0000010d,0x000000e5,
0x000500ba,0x00000018,0x0000010e,0x0000010c,0x0000010d,0x000300f7,0x00000110,0x00000000,
0x000400fa,0x0000010e,0x0000010f,0x00000111,0x000200f8,0x0000010f,0x0003003e,0x00000109,
0x00000103,0x000200f9,0x00000110,0x000200f8,0x00000111,0x00050041,0x0000001a,0x00000113,
0x000000c3,0x0000003a,0x0004003d,0x00000006,0x00000114,0x00000113,0x00050050,0x00000007,
0x00000115,0x00000037,0x00000114,0x0004003d,0x00000007,0x00000117,0x000000c9,0x0003003e,
0x00000116,0x00000117,0x0004003d,0x00000007,0x00000119,0x000000c3,0x0003003e,0x00000118,
0x00000119,0x0003003e,0x0000011a,0x00000115,0x0003003e,0x0000011b,0x0000010a,0x0004003d,
0x00000006,0x0000011d,0x000000f1,0x0003003e,0x0000011c,0x0000011d,0x0003003e,0x0000011e,
0x00000103,0x000a0039,0x00000006,0x0000011f,0x00000022,0x00000116,0x00000118,0x0000011a,
0x0000011b,0x0000011c,0x0000011e,0x0003003e,0x00000112,0x0000011f,0x00050041,0x0000001a,
0x00000121,0x000000c3,0x0000003a,0x0004003d,0x00000006,0x00000122,0x00000121,0x00050050,
0x00000007,0x00000123,0x00000037,0x00000122,0x0004003d,0x00000007,0x00000125,0x000000c9,
0x0003003e,0x00000124,0x00000125,0x0004003d,0x00000007,0x00000127,0x000000c3,0x0003003e,
0x00000126,0x00000127,0x0003003e,0x00000128,0x00000123,0x0003003e,0x00000129,0x0000010a,
0x0004003d,0x00000006,0x0000012b,0x000000f1,0x0003003e,0x0000012a,0x0000012b,0x0003003e,
0x0000012c,0x0000010a,0x000a0039,0x00000006,0x0000012d,0x00000022,0x00000124,0x00000126,
0x00000128,0x00000129,0x0000012a,0x0000012c,0x0003003e,0x00000120,0x0000012d,0x00050041,
0x0000001a,0x0000012f,0x000000c3,0x00000053,0x0004003d,0x00000006,0x00000130,0x0000012f,
0x00050050,0x00000007,0x00000131,0x00000130,0x00000037,0x0004003d,0x00000007,0x00000133,
0x000000c9,0x0003003e,0x00000132,0x00000133,0x0004003d,0x00000007,0x00000135,0x000000c3,
0x0003003e,0x00000134,0x00000135,0x0003003e,0x00000136,0x00000131,0x0003003e,0x00000137,
0x00000103,0x0004003d,0x00000006,0x00000139,0x000000f1,0x0003003e,0x00000138,0x00000139,
0x0003003e,0x0000013a,0x00000103,0x000a0039,0x00000006,0x0000013b,0x00000022,0x00000132,
0x00000134,0x00000136,0x00000137,0x00000138,0x0000013a,0x0003003e,0x0000012e,0x0000013b,
0x00050041,0x0000001a,0x0000013d,0x000000c3,0x00000053,0x0004003d,0x00000006,0x0000013e,
0x0000013d,0x00050050,0x00000007,0x0000013f,0x0000013e,0x00000037,0x0004003d,0x00000007,
0x00000141,0x000000c9,0x0003003e,0x00000140,0x00000141,0x0004003d,0x00000007,0x00000143,
0x000000c3,0x0003003e,0x00000142,0x00000143,0x0003003e,0x00000144,0x0000013f,0x0003003e,
0x00000145,0x00000103,0x0004003d,0x00000006,0x00000147,0x000000f1,0x0003003e,0x00000146,
0x00000147,0x0003003e,0x00000148,0x0000010a,0x000a0039,0x00000006,0x00000149,0x00000022,
0x00000140,0x00000142,0x00000144,0x00000145,0x00000146,0x00000148,0x0003003e,0x0000013c,
0x00000149,0x0004003d,0x00000006,0x0000014a,0x00000112,0x0004003d,0x00000006,0x0000014b,
0x00000120,0x00050081,0x00000006,0x0000014c,0x0000014a,0x0000014b,0x0004003d,0x00000006,
0x0000014d,0x0000012e,0x0004003d,0x00000006,0x0000014e,0x0000013c,0x00050081,0x00000006,
0x0000014f,0x0000014d,0x0000014e,0x000500be,0x00000018,0x00000150,0x0000014c,0x0000014f,
0x0003003e,0x00000109,0x00000150,0x0004003d,0x00000018,0x00000151,0x00000109,0x0004003d,
0x00000006,0x00000152,0x00000112,0x0004003d,0x00000006,0x00000153,0x0000012e,0x000600a9,
0x00000006,0x00000154,0x00000151,0x00000152,0x00000153,0x0003003e,0x00000100,0x00000154,
0x0004003d,0x00000018,0x00000155,0x00000109,0x0004003d,0x00000006,0x00000156,0x00000120,
0x0004003d,0x00000006,0x00000157,0x0000013c,0x000600a9,0x00000006,0x00000158,0x00000155,
0x00000156,0x00000157,0x0003003e,0x00000101,0x00000158,0x0003003e,0x00000102,0x0000010a,
0x000200f9,0x00000110,0x000200f8,0x00000110,0x000200f9,0x00000108,0x000200f8,0x00000108,
0x0004003d,0x00000018,0x0000015a,0x00000109,0x000300f7,0x0000015d,0x00000000,0x000400fa,
0x0000015a,0x0000015c,0x00000161,0x000200f8,0x0000015c,0x00050041,0x0000001a,0x0000015e,
0x000000c3,0x0000003a,0x0004003d,0x00000006,0x0000015f,0x0000015e,0x00050050,0x00000007,
0x00000160,0x00000037,0x0000015f,0x0003003e,0x0000015b,0x00000160,0x000200f9,0x0000015d,
0x000200f8,0x00000161,0x00050041,0x0000001a,0x00000162,0x000000c3,0x00000053,0x0004003d,
0x00000006,0x00000163,0x00000162,0x00050050,0x00000007,0x00000164,0x00000163,0x00000037,
0x0003003e,0x0000015b,0x00000164,0x000200f9,0x0000015d,0x000200f8,0x0000015d,0x0004003d,
0x00000007,0x00000165,0x0000015b,0x0003003e,0x00000159,0x00000165,0x0004003d,0x00000018,
0x00000167,0x00000109,0x000300f7,0x0000016a,0x00000000,0x000400fa,0x00000167,0x00000169,
0x00000170,0x000200f8,0x00000169,0x0004003d,0x00000006,0x0000016b,0x000000d9,0x0004003d,
0x00000006,0x0000016c,0x000000dc,0x000500be,0x00000018,0x0000016d,0x0000016b,0x0000016c,
0x000600a9,0x00000006,0x0000016e,0x0000016d,0x0000007d,0x00000029,0x00050050,0x00000007,
0x0000016f,0x0000016e,0x00000037,0x0003003e,0x00000168,0x0000016f,0x000200f9,0x0000016a,
0x000200f8,0x00000170,0x0004003d,0x00000006,0x00000171,0x000000df,0x0004003d,0x00000006,
0x00000172,0x000000e2,0x000500be,0x00000018,0x00000173,0x00000171,0x00000172,0x000600a9,
0x00000006,0x00000174,0x00000173,0x0000007d,0x00000029,0x00050050,0x00000007,0x00000175,
0x00000037,0x00000174,0x0003003e,0x00000168,0x00000175,0x000200f9,0x0000016a,0x000200f8,
0x0000016a,0x0004003d,0x00000007,0x00000176,0x00000168,0x0003003e,0x00000166,0x00000176,
0x0004003d,0x00000018,0x00000177,0x00000102,0x000400a8,0x00000018,0x00000178,0x00000177,
0x000300f7,0x0000017a,0x00000000,0x000400fa,0x00000178,0x00000179,0x0000017a,0x000200f8,
0x00000179,0x0004003d,0x00000007,0x0000017c,0x000000c9,0x0003003e,0x0000017b,0x0000017c,
0x0004003d,0x00000007,0x0000017e,0x000000c3,0x0003003e,0x0000017d,0x0000017e,0x0004003d,
0x00000007,0x00000180,0x00000159,0x0003003e,0x0000017f,0x00000180,0x0004003d,0x00000018,
0x00000182,0x00000109,0x0003003e,0x00000181,0x00000182,0x0004003d,0x00000006,0x00000184,
0x000000f1,0x0003003e,0x00000183,0x00000184,0x0003003e,0x00000185,0x00000103,0x000a0039,
0x00000006,0x00000186,0x00000022,0x0000017b,0x0000017d,0x0000017f,0x00000181,0x00000183,
0x00000185,0x0003003e,0x00000100,0x00000186,0x0004003d,0x00000007,0x00000188,0x000000c9,
0x0003003e,0x00000187,0x00000188,0x0004003d,0x00000007,0x0000018a,0x000000c3,0x0003003e,
0x00000189,0x0000018a,0x0004003d,0x00000007,0x0000018c,0x00000159,0x0003003e,0x0000018b,
0x0000018c,0x0004003d,0x00000018,0x0000018e,0x00000109,0x0003003e,0x0000018d,0x0000018e,
0x0004003d,0x00000006,0x00000190,0x000000f1,0x0003003e,0x0000018f,0x00000190,0x0003003e,
0x00000191,0x0000010a,0x000a0039,0x00000006,0x00000192,0x00000022,0x00000187,0x00000189,
0x0000018b,0x0000018d,0x0000018f,0x00000191,0x0003003e,0x00000101,0x00000192,0x000200f9,
0x0000017a,0x000200f8,0x0000017a,0x0004003d,0x00000006,0x00000194,0x00000100,0x0004003d,
0x00000006,0x00000195,0x00000101,0x00050081,0x00000006,0x00000196,0x00000194,0x00000195,
0x0003003e,0x00000193,0x00000196,0x0004003d,0x00000006,0x00000198,0x000000f1,0x0004003d,
0x00000006,0x00000199,0x000000f1,0x00050085,0x00000006,0x0000019b,0x00000199,0x0000019a,
0x0004003d,0x00000006,0x0000019c,0x000000ed,0x0008000c,0x00000006,0x0000019d,0x00000001,
0x00000031,0x00000198,0x0000019b,0x0000019c,0x0003003e,0x00000197,0x0000019d,0x0004003d,
0x00000007,0x0000019f,0x000000c9,0x00050041,0x0000001a,0x000001a0,0x000000c3,0x00000053,
0x0004003d,0x00000006,0x000001a1,0x000001a0,0x0004007f,0x00000006,0x000001a2,0x000001a1,
0x00050041,0x0000001a,0x000001a3,0x000000c3,0x0000003a,0x0004003d,0x00000006,0x000001a4,
0x000001a3,0x0004007f,0x00000006,0x000001a5,0x000001a4,0x00050050,0x00000007,0x000001a6,
0x000001a2,0x000001a5,0x00050081,0x00000007,0x000001a7,0x0000019f,0x000001a6,0x0003003e,
0x000001a8,0x000001a7,0x0004003d,0x00000007,0x000001aa,0x000000c3,0x0003003e,0x000001a9,
0x000001aa,0x00060039,0x00000009,0x000001ab,0x0000000d,0x000001a8,0x000001a9,0x0003003e,
0x0000019e,0x000001ab,0x0004003d,0x00000007,0x000001ad,0x000000c9,0x00050041,0x0000001a,
0x000001ae,0x000000c3,0x00000053,0x0004003d,0x00000006,0x000001af,0x000001ae,0x00050041,
0x0000001a,0x000001b0,0x000000c3,0x0000003a,0x0004003d,0x00000006,0x000001b1,0x000001b0,
0x0004007f,0x00000006,0x000001b2,0x000001b1,0x00050050,0x00000007,0x000001b3,0x000001af,
0x000001b2,0x00050081,0x00000007,0x000001b4,0x000001ad,0x000001b3,0x0003003e,0x000001b5,
0x000001b4,0x0004003d,0x00000007,0x000001b7,0x000000c3,0x0003003e,0x000001b6,0x000001b7,
0x00060039,0x00000009,0x000001b8,0x0000000d,0x000001b5,0x000001b6,0x0003003e,0x000001ac,
0x000001b8,0x0004003d,0x00000007,0x000001ba,0x000000c9,0x00050041,0x0000001a,0x000001bb,
0x000000c3,0x00000053,0x0004003d,0x00000006,0x000001bc,0x000001bb,0x0004007f,0x00000006,
0x000001bd,0x000001bc,0x00050041,0x0000001a,0x000001be,0x000000c3,0x0000003a,0x0004003d,
0x00000006,0x000001bf,0x000001be,0x00050050,0x00000007,0x000001c0,0x000001bd,0x000001bf,
0x00050081,0x00000007,0x000001c1,0x000001ba,0x000001c0,0x0003003e,0x000001c2,0x000001c1,
0x0004003d,0x00000007,0x000001c4,0x000000c3,0x0003003e,0x000001c3,0x000001c4,0x00060039,
0x00000009,0x000001c5,0x0000000d,0x000001c2,0x000001c3,0x0003003e,0x000001b9,0x000001c5,
0x0004003d,0x00000007,0x000001c7,0x000000c9,0x00050041,0x0000001a,0x000001c8,0x000000c3,
0x00000053,0x0004003d,0x00000006,0x000001c9,0x000001c8,0x00050041,0x0000001a,0x000001ca,
0x000000c3,0x0000003a,0x0004003d,0x00000006,0x000001cb,0x000001ca,0x00050050,0x00000007,
0x000001cc,0x000001c9,0x000001cb,0x00050081,0x00000007,0x000001cd,0x000001c7,0x000001cc,
0x0003003e,0x000001ce,0x000001cd,0x0004003d,0x00000007,0x000001d0,0x000000c3,0x0003003e,
0x000001cf,0x000001d0,0x00060039,0x00000009,0x000001d1,0x0000000d,0x000001ce,0x000001cf,
0x0003003e,0x000001c6,0x000001d1,0x0004003d,0x00000006,0x000001d3,0x00000100,0x0004003d,
0x00000006,0x000001d4,0x00000101,0x00050083,0x00000006,0x000001d5,0x000001d3,0x000001d4,
0x0006000c,0x00000006,0x000001d6,0x00000001,0x00000004,0x000001d5,0x0004003d,0x00000006,
0x000001d7,0x00000193,0x0007000c,0x00000006,0x000001d8,0x00000001,0x00000028,0x000001d7,
0x00000029,0x00050088,0x00000006,0x000001d9,0x000001d6,0x000001d8,0x0008000c,0x00000006,
0x000001da,0x00000001,0x0000002b,0x000001d9,0x00000037,0x00000029,0x0003003e,0x000001d2,
0x000001da,0x0004003d,0x00000018,0x000001dc,0x00000109,0x000300f7,0x000001df,0x00000000,
0x000400fa,0x000001dc,0x000001de,0x000001e6,0x000200f8,0x000001de,0x00050041,0x0000001a,
0x000001e0,0x0000019e,0x00000045,0x0004003d,0x00000006,0x000001e1,0x000001e0,0x00050041,
0x0000001a,0x000001e2,0x000001ac,0x00000045,0x0004003d,0x00000006,0x000001e3,0x000001e2,
0x00050083,0x00000006,0x000001e4,0x000001e1,0x000001e3,0x0006000c,0x00000006,0x000001e5,
0x00000001,0x00000004,0x000001e4,0x0003003e,0x000001dd,0x000001e5,0x000200f9,0x000001df,
0x000200f8,0x000001e6,0x00050041,0x0000001a,0x000001e7,0x0000019e,0x0000003a,0x0004003d,
0x00000006,0x000001e8,0x000001e7,0x00050041,0x0000001a,0x000001e9,0x000001b9,0x0000003a,
0x0004003d,0x00000006,0x000001ea,0x000001e9,0x00050083,0x00000006,0x000001eb,0x000001e8,
0x000001ea,0x0006000c,0x00000006,0x000001ec,0x00000001,0x00000004,0x000001eb,0x0003003e,
0x000001dd,0x000001ec,0x000200f9,0x000001df,0x000200f8,0x000001df,0x0004003d,0x00000006,
0x000001ed,0x000001dd,0x0003003e,0x000001db,0x000001ed,0x0004003d,0x00000018,0x000001ef,
0x00000109,0x000300f7,0x000001f2,0x00000000,0x000400fa,0x000001ef,0x000001f1,0x000001f9,
0x000200f8,0x000001f1,0x00050041,0x0000001a,0x000001f3,0x000001b9,0x00000061,0x0004003d,
0x00000006,0x000001f4,0x000001f3,0x00050041,0x0000001a,0x000001f5,0x000001c6,0x00000061,
0x0004003d,0x00000006,0x000001f6,0x000001f5,0x00050083,0x00000006,0x000001f7,0x000001f4,
0x000001f6,0x0006000c,0x00000006,0x000001f8,0x00000001,0x00000004,0x000001f7,0x0003003e,
0x000001f0,0x000001f8,0x000200f9,0x000001f2,0x000200f8,0x000001f9,0x00050041,0x0000001a,
0x000001fa,0x000001ac,0x00000053,0x0004003d,0x00000006,0x000001fb,0x000001fa,0x00050041,
0x0000001a,0x000001fc,0x000001c6,0x00000053,0x0004003d,0x00000006,0x000001fd,0x000001fc,
0x00050083,0x00000006,0x000001fe,0x000001fb,0x000001fd,0x0006000c,0x00000006,0x000001ff,
0x00000001,0x00000004,0x000001fe,0x0003003e,0x000001f0,0x000001ff,0x000200f9,0x000001f2,
0x000200f8,0x000001f2,0x0004003d,0x00000006,0x00000200,0x000001f0,0x0003003e,0x000001ee,
0x00000200,0x0004003d,0x00000006,0x00000202,0x000001db,0x0004003d,0x00000006,0x00000203,
0x000001ee,0x00050083,0x00000006,0x00000204,0x00000202,0x00000203,0x0006000c,0x00000006,
0x00000205,0x00000001,0x00000004,0x00000204,0x0003003e,0x00000201,0x00000205,0x0004003d,
0x00000006,0x00000207,0x000000f1,0x0004003d,0x00000006,0x00000208,0x000000f1,0x00050085,
0x00000006,0x00000209,0x00000208,0x0000019a,0x0004003d,0x00000006,0x0000020a,0x00000201,
0x0008000c,0x00000006,0x0000020b,0x00000001,0x00000031,0x00000207,0x00000209,0x0000020a,
0x0003003e,0x00000206,0x0000020b,0x0004003d,0x00000009,0x0000020d,0x0000019e,0x0004003d,
0x00000009,0x0000020e,0x000001ac,0x0007000c,0x00000009,0x0000020f,0x00000001,0x00000025,
0x0000020d,0x0000020e,0x0004003d,0x00000009,0x00000210,0x000001b9,0x0004003d,0x00000009,
0x00000211,0x000001c6,0x0007000c,0x00000009,0x00000212,0x00000001,0x00000025,0x00000210,
0x00000211,0x0007000c,0x00000009,0x00000213,0x00000001,0x00000025,0x0000020f,0x00000212,
0x0003003e,0x0000020c,0x00000213,0x0004003d,0x00000009,0x00000215,0x0000019e,0x0004003d,
0x00000009,0x00000216,0x000001ac,0x0007000c,0x00000009,0x00000217,0x00000001,0x00000028,
0x00000215,0x00000216,0x0004003d,0x00000009,0x00000218,0x000001b9,0x0004003d,0x00000009,
0x00000219,0x000001c6,0x0007000c,0x00000009,0x0000021a,0x00000001,0x00000028,0x00000218,
0x00000219,0x0007000c,0x00000009,0x0000021b,0x00000001,0x00000028,0x00000217,0x0000021a,
0x0003003e,0x00000214,0x0000021b,0x00050041,0x0000001a,0x0000021d,0x00000214,0x00000053,
0x0004003d,0x00000006,0x0000021e,0x0000021d,0x00050041,0x0000001a,0x0000021f,0x0000020c,
0x00000053,0x0004003d,0x00000006,0x00000220,0x0000021f,0x00050083,0x00000006,0x00000221,
0x0000021e,0x00000220,0x00050041,0x0000001a,0x00000222,0x00000214,0x0000003a,0x0004003d,
0x00000006,0x00000223,0x00000222,0x00050041,0x0000001a,0x00000224,0x0000020c,0x0000003a,
0x0004003d,0x00000006,0x00000225,0x00000224,0x00050083,0x00000006,0x00000226,0x00000223,
0x00000225,0x0007000c,0x00000006,0x00000227,0x00000001,0x00000028,0x00000221,0x00000226,
0x00050041,0x0000001a,0x00000228,0x00000214,0x00000061,0x0004003d,0x00000006,0x00000229,
0x00000228,0x00050041,0x0000001a,0x0000022a,0x0000020c,0x00000061,0x0004003d,0x00000006,
0x0000022b,0x0000022a,0x00050083,0x00000006,0x0000022c,0x00000229,0x0000022b,0x00050041,
0x0000001a,0x0000022d,0x00000214,0x00000045,0x0004003d,0x00000006,0x0000022e,0x0000022d,
0x00050041,0x0000001a,0x0000022f,0x0000020c,0x00000045,0x0004003d,0x00000006,0x00000230,
0x0000022f,0x00050083,0x00000006,0x00000231,0x0000022e,0x00000230,0x0007000c,0x00000006,
0x00000232,0x00000001,0x00000028,0x0000022c,0x00000231,0x0007000c,0x00000006,0x00000233,
0x00000001,0x00000028,0x00000227,0x00000232,0x0003003e,0x0000021c,0x00000233,0x0004003d,
0x00000006,0x00000235,0x0000021c,0x000500ba,0x00000018,0x00000237,0x00000235,0x00000236,
0x000300f7,0x0000023a,0x00000000,0x000400fa,0x00000237,0x00000239,0x00000242,0x000200f8,
0x00000239,0x0004003d,0x00000006,0x0000023b,0x000000f1,0x0004003d,0x00000006,0x0000023c,
0x000000f1,0x00050085,0x00000006,0x0000023d,0x0000023c,0x0000019a,0x0004003d,0x00000006,
0x0000023e,0x000001db,0x0004003d,0x00000006,0x0000023f,0x000001ee,0x0007000c,0x00000006,
0x00000240,0x00000001,0x00000025,0x0000023e,0x0000023f,0x0008000c,0x00000006,0x00000241,
0x00000001,0x00000031,0x0000023b,0x0000023d,0x00000240,0x0003003e,0x00000238,0x00000241,
0x000200f9,0x0000023a,0x000200f8,0x00000242,0x0003003e,0x00000238,0x00000037,0x000200f9,
0x0000023a,0x000200f8,0x0000023a,0x0004003d,0x00000006,0x00000243,0x00000238,0x0003003e,
0x00000234,0x00000243,0x0004003d,0x00000006,0x00000245,0x000001d2,0x000500ba,0x00000018,
0x00000246,0x00000245,0x00000236,0x000300f7,0x00000249,0x00000000,0x000400fa,0x00000246,
0x00000248,0x0000024d,0x000200f8,0x00000248,0x0004003d,0x00000006,0x0000024a,0x000001d2,
0x0004003d,0x00000006,0x0000024b,0x00000234,0x0007000c,0x00000006,0x0000024c,0x00000001,
0x00000028,0x0000024a,0x0000024b,0x0003003e,0x00000247,0x0000024c,0x000200f9,0x00000249,
0x000200f8,0x0000024d,0x0004003d,0x00000006,0x0000024e,0x000001d2,0x0003003e,0x00000247,
0x0000024e,0x000200f9,0x00000249,0x000200f8,0x00000249,0x0004003d,0x00000006,0x0000024f,
0x00000247,0x0003003e,0x00000244,0x0000024f,0x0004003d,0x00000006,0x00000251,0x00000244,
0x0004003d,0x00000006,0x00000252,0x00000193,0x00050085,0x00000006,0x00000254,0x00000252,
0x00000253,0x00050081,0x00000006,0x00000255,0x00000029,0x00000254,0x00050088,0x00000006,
0x00000256,0x00000251,0x00000255,0x0003003e,0x00000250,0x00000256,0x0004003d,0x00000006,
0x00000259,0x00000206,0x00050085,0x00000006,0x0000025a,0x00000258,0x00000259,0x0004003d,
0x00000006,0x0000025b,0x00000193,0x00050088,0x00000006,0x0000025d,0x0000025b,0x0000025c,
0x0008000c,0x00000006,0x0000025e,0x00000001,0x0000002b,0x0000025d,0x00000037,0x00000029,
0x00050085,0x00000006,0x0000025f,0x0000025a,0x0000025e,0x0003003e,0x00000257,0x0000025f,
0x00050041,0x0000001a,0x00000261,0x0000019e,0x00000053,0x0004003d,0x00000006,0x00000262,
0x00000261,0x00050041,0x0000001a,0x00000263,0x000001c6,0x00000053,0x0004003d,0x00000006,
0x00000264,0x00000263,0x00050083,0x00000006,0x00000265,0x00000262,0x00000264,0x0006000c,
0x00000006,0x00000266,0x00000001,0x00000004,0x00000265,0x00050041,0x0000001a,0x00000267,
0x0000019e,0x0000003a,0x0004003d,0x00000006,0x00000268,0x00000267,0x00050041,0x0000001a,
0x00000269,0x000001c6,0x0000003a,0x0004003d,0x00000006,0x0000026a,0x00000269,0x00050083,
0x00000006,0x0000026b,0x00000268,0x0000026a,0x0006000c,0x00000006,0x0000026c,0x00000001,
0x00000004,0x0000026b,0x0007000c,0x00000006,0x0000026d,0x00000001,0x00000028,0x00000266,
0x0000026c,0x00050041,0x0000001a,0x0000026e,0x0000019e,0x00000061,0x0004003d,0x00000006,
0x0000026f,0x0000026e,0x00050041,0x0000001a,0x00000270,0x000001c6,0x00000061,0x0004003d,
0x00000006,0x00000271,0x00000270,0x00050083,0x00000006,0x00000272,0x0000026f,0x00000271,
0x0006000c,0x00000006,0x00000273,0x00000001,0x00000004,0x00000272,0x00050041,0x0000001a,
0x00000274,0x0000019e,0x00000045,0x0004003d,0x00000006,0x00000275,0x00000274,0x00050041,
0x0000001a,0x00000276,0x000001c6,0x00000045,0x0004003d,0x00000006,0x00000277,0x00000276,
0x00050083,0x00000006,0x00000278,0x00000275,0x00000277,0x0006000c,0x00000006,0x00000279,
0x00000001,0x00000004,0x00000278,0x0007000c,0x00000006,0x0000027a,0x00000001,0x00000028,
0x00000273,0x00000279,0x0007000c,0x00000006,0x0000027b,0x00000001,0x00000028,0x0000026d,
0x0000027a,0x00050041,0x0000001a,0x0000027c,0x000001ac,0x00000053,0x0004003d,0x00000006,
0x0000027d,0x0000027c,0x00050041,0x0000001a,0x0000027e,0x000001b9,0x00000053,0x0004003d,
0x00000006,0x0000027f,0x0000027e,0x00050083,0x00000006,0x00000280,0x0000027d,0x0000027f,
0x0006000c,0x00000006,0x00000281,0x00000001,0x00000004,0x00000280,0x00050041,0x0000001a,
0x00000282,0x000001ac,0x0000003a,0x0004003d,0x00000006,0x00000283,0x00000282,0x00050041,
0x0000001a,0x00000284,0x000001b9,0x0000003a,0x0004003d,0x00000006,0x00000285,0x00000284,
0x00050083,0x00000006,0x00000286,0x00000283,0x00000285,0x0006000c,0x00000006,0x00000287,
0x00000001,0x00000004,0x00000286,0x0007000c,0x00000006,0x00000288,0x00000001,0x00000028,
0x00000281,0x00000287,0x00050041,0x0000001a,0x00000289,0x000001ac,0x00000061,0x0004003d,
0x00000006,0x0000028a,0x00000289,0x00050041,0x0000001a,0x0000028b,0x000001b9,0x00000061,
0x0004003d,0x00000006,0x0000028c,0x0000028b,0x00050083,0x00000006,0x0000028d,0x0000028a,
0x0000028c,0x0006000c,0x00000006,0x0000028e,0x00000001,0x00000004,0x0000028d,0x00050041,
0x0000001a,0x0000028f,0x000001ac,0x00000045,0x0004003d,0x00000006,0x00000290,0x0000028f,
0x00050041,0x0000001a,0x00000291,0x000001b9,0x00000045,0x0004003d,0x00000006,0x00000292,
0x00000291,0x00050083,0x00000006,0x00000293,0x00000290,0x00000292,0x0006000c,0x00000006,
0x00000294,0x00000001,0x00000004,0x00000293,0x0007000c,0x00000006,0x00000295,0x00000001,
0x00000028,0x0000028e,0x00000294,0x0007000c,0x00000006,0x00000296,0x00000001,0x00000028,
0x00000288,0x00000295,0x0007000c,0x00000006,0x00000297,0x00000001,0x00000028,0x0000027b,
0x00000296,0x0003003e,0x00000260,0x00000297,0x0004003d,0x00000006,0x0000029a,0x000000f1,
0x0004003d,0x00000006,0x0000029b,0x000000f1,0x00050085,0x00000006,0x0000029d,0x0000029b,
0x0000029c,0x0004003d,0x00000006,0x0000029e,0x00000260,0x0008000c,0x00000006,0x0000029f,
0x00000001,0x00000031,0x0000029a,0x0000029d,0x0000029e,0x00050085,0x00000006,0x000002a0,
0x00000299,0x0000029f,0x00050083,0x00000006,0x000002a1,0x00000029,0x000002a0,0x0003003e,
0x00000298,0x000002a1,0x0004003d,0x00000006,0x000002a3,0x00000257,0x0004003d,0x00000006,
0x000002a4,0x00000250,0x00050085,0x00000006,0x000002a5,0x000002a3,0x000002a4,0x0004003d,
0x00000006,0x000002a6,0x00000197,0x00050085,0x00000006,0x000002a7,0x000002a5,0x000002a6,
0x0004003d,0x00000006,0x000002a8,0x00000298,0x00050085,0x00000006,0x000002a9,0x000002a7,
0x000002a8,0x0003003e,0x000002a2,0x000002a9,0x0004003d,0x00000006,0x000002ab,0x000000e5,
0x0004003d,0x00000006,0x000002ac,0x000000e9,0x0007000c,0x00000006,0x000002ad,0x00000001,
0x00000025,0x000002ab,0x000002ac,0x0003003e,0x000002aa,0x000002ad,0x0004003d,0x00000006,
0x000002af,0x000000f1,0x0004003d,0x00000006,0x000002b0,0x000000f1,0x00050085,0x00000006,
0x000002b1,0x000002b0,0x0000019a,0x0004003d,0x00000006,0x000002b2,0x000002aa,0x0008000c,
0x00000006,0x000002b3,0x00000001,0x00000031,0x000002af,0x000002b1,0x000002b2,0x0003003e,
0x000002ae,0x000002b3,0x0004003d,0x00000006,0x000002b5,0x00000193,0x0008000c,0x00000006,
0x000002b6,0x00000001,0x00000031,0x00000029,0x0000029c,0x000002b5,0x0003003e,0x000002b4,
0x000002b6,0x0004003d,0x00000006,0x000002b8,0x00000193,0x000500ba,0x00000018,0x000002b9,
0x000002b8,0x00000037,0x0004003d,0x00000006,0x000002ba,0x00000193,0x000500bc,0x00000018,
0x000002bb,0x000002ba,0x00000029,0x000500a7,0x00000018,0x000002bc,0x000002b9,0x000002bb,
0x0004003d,0x00000006,0x000002bd,0x00000201,0x0004003d,0x00000006,0x000002be,0x000000f1,
0x000500bc,0x00000018,0x000002bf,0x000002bd,0x000002be,0x000500a7,0x00000018,0x000002c0,
0x000002bc,0x000002bf,0x0004003d,0x00000006,0x000002c1,0x000002aa,0x0004003d,0x00000006,
0x000002c2,0x000000f1,0x000500ba,0x00000018,0x000002c3,0x000002c1,0x000002c2,0x000500a7,
0x00000018,0x000002c4,0x000002c0,0x000002c3,0x000600a9,0x00000006,0x000002c5,0x000002c4,
0x00000029,0x00000037,0x0003003e,0x000002b7,0x000002c5,0x0004003d,0x00000006,0x000002c8,
0x000002ae,0x00050085,0x00000006,0x000002c9,0x000002c7,0x000002c8,0x0004003d,0x00000006,
0x000002ca,0x00000197,0x00050085,0x00000006,0x000002cb,0x000002c9,0x000002ca,0x0004003d,
0x00000006,0x000002cc,0x00000298,0x00050085,0x00000006,0x000002cd,0x000002cb,0x000002cc,
0x0004003d,0x00000006,0x000002ce,0x000002b4,0x0004003d,0x00000006,0x000002cf,0x00000206,
0x0004003d,0x00000006,0x000002d0,0x00000234,0x0007000c,0x00000006,0x000002d1,0x00000001,
0x00000028,0x000002cf,0x000002d0,0x00050085,0x00000006,0x000002d2,0x000002ce,0x000002d1,
0x0004003d,0x00000006,0x000002d3,0x000002b7,0x0007000c,0x00000006,0x000002d4,0x00000001,
0x00000028,0x000002d2,0x000002d3,0x00050085,0x00000006,0x000002d5,0x000002cd,0x000002d4,
0x0003003e,0x000002c6,0x000002d5,0x0004003d,0x00000006,0x000002d7,0x000002a2,0x0004003d,
0x00000006,0x000002d8,0x000002c6,0x0007000c,0x00000006,0x000002d9,0x00000001,0x00000028,
0x000002d7,0x000002d8,0x0008000c,0x00000006,0x000002db,0x00000001,0x0000002b,0x000002d9,
0x00000037,0x000002da,0x0003003e,0x000002d6,0x000002db,0x0004003d,0x00000006,0x000002dc,
0x000002d6,0x00050041,0x0000001a,0x000002dd,0x00000166,0x00000053,0x0004003d,0x00000006,
0x000002de,0x000002dd,0x00050085,0x00000006,0x000002df,0x000002de,0x00000027,0x00050081,
0x00000006,0x000002e0,0x000002df,0x00000027,0x00050041,0x0000001a,0x000002e1,0x00000166,
0x0000003a,0x0004003d,0x00000006,0x000002e2,0x000002e1,0x00050085,0x00000006,0x000002e3,
0x000002e2,0x00000027,0x00050081,0x00000006,0x000002e4,0x000002e3,0x00000027,0x00070050,
0x00000009,0x000002e5,0x000002dc,0x000002e0,0x000002e4,0x00000029,0x0003003e,0x000000fd,
0x000002e5,0x000100fd,0x00010038,0x00050036,0x00000009,0x0000000d,0x00000000,0x0000000a,
0x00030037,0x00000008,0x0000000b,0x00030037,0x00000008,0x0000000c,0x000200f8,0x0000000e,
0x0004003b,0x00000008,0x00000024,0x00000007,0x0004003b,0x0000002f,0x00000030,0x00000007,
0x0004003b,0x0000001a,0x00000041,0x00000007,0x0004003d,0x00000007,0x00000025,0x0000000b,
0x0004003d,0x00000007,0x00000026,0x0000000c,0x0005008e,0x00000007,0x00000028,0x00000026,
0x00000027,0x0004003d,0x00000007,0x0000002b,0x0000000c,0x0005008e,0x00000007,0x0000002c,
0x0000002b,0x00000027,0x00050083,0x00000007,0x0000002d,0x0000002a,0x0000002c,0x0008000c,
0x00000007,0x0000002e,0x00000001,0x0000002b,0x00000025,0x00000028,0x0000002d,0x0003003e,
0x00000024,0x0000002e,0x0004003d,0x00000032,0x00000035,0x00000034,0x0004003d,0x00000007,
0x00000036,0x00000024,0x00070058,0x00000009,0x00000038,0x00000035,0x00000036,0x00000002,
0x00000037,0x0003003e,0x00000030,0x00000038,0x00050041,0x0000001a,0x0000003b,0x00000024,
0x0000003a,0x0004003d,0x00000006,0x0000003c,0x0000003b,0x00050041,0x0000001a,0x0000003d,
0x0000000c,0x0000003a,0x0004003d,0x00000006,0x0000003e,0x0000003d,0x00050083,0x00000006,
0x0000003f,0x00000029,0x0000003e,0x000500be,0x00000018,0x00000040,0x0000003c,0x0000003f,
0x000300f7,0x00000043,0x00000000,0x000400fa,0x00000040,0x00000042,0x00000044,0x000200f8,
0x00000042,0x0003003e,0x00000041,0x00000037,0x000200f9,0x00000043,0x000200f8,0x00000044,
0x00050041,0x0000001a,0x00000046,0x00000030,0x00000045,0x0004003d,0x00000006,0x00000047,
0x00000046,0x0003003e,0x00000041,0x00000047,0x000200f9,0x00000043,0x000200f8,0x00000043,
0x0004003d,0x00000006,0x00000048,0x00000041,0x00050041,0x0000001a,0x00000049,0x00000030,
0x00000045,0x0003003e,0x00000049,0x00000048,0x0004003d,0x00000009,0x0000004a,0x00000030,
0x000200fe,0x0000004a,0x00010038,0x00050036,0x00000006,0x00000012,0x00000000,0x0000000f,
0x00030037,0x00000008,0x00000010,0x00030037,0x00000008,0x00000011,0x000200f8,0x00000013,
0x0004003b,0x0000002f,0x0000004d,0x00000007,0x0004003b,0x00000008,0x0000004e,0x00000007,
0x0004003b,0x00000008,0x00000050,0x00000007,0x0004003d,0x00000007,0x0000004f,0x00000010,
0x0003003e,0x0000004e,0x0000004f,0x0004003d,0x00000007,0x00000051,0x00000011,0x0003003e,
0x00000050,0x00000051,0x00060039,0x00000009,0x00000052,0x0000000d,0x0000004e,0x00000050,
0x0003003e,0x0000004d,0x00000052,0x00050041,0x0000001a,0x00000054,0x0000004d,0x00000053,
0x0004003d,0x00000006,0x00000055,0x00000054,0x00050041,0x0000001a,0x00000056,0x0000004d,
0x0000003a,0x0004003d,0x00000006,0x00000057,0x00000056,0x0007000c,0x00000006,0x00000058,
0x00000001,0x00000028,0x00000055,0x00000057,0x000200fe,0x00000058,0x00010038,0x00050036,
0x00000006,0x00000016,0x00000000,0x0000000f,0x00030037,0x00000008,0x00000014,0x00030037,
0x00000008,0x00000015,0x000200f8,0x00000017,0x0004003b,0x0000002f,0x0000005b,0x00000007,
0x0004003b,0x00000008,0x0000005c,0x00000007,0x0004003b,0x00000008,0x0000005e,0x00000007,
0x0004003d,0x00000007,0x0000005d,0x00000014,0x0003003e,0x0000005c,0x0000005d,0x0004003d,
0x00000007,0x0000005f,0x00000015,0x0003003e,0x0000005e,0x0000005f,0x00060039,0x00000009,
0x00000060,0x0000000d,0x0000005c,0x0000005e,0x0003003e,0x0000005b,0x00000060,0x00050041,
0x0000001a,0x00000062,0x0000005b,0x00000061,0x0004003d,0x00000006,0x00000063,0x00000062,
0x00050041,0x0000001a,0x00000064,0x0000005b,0x00000045,0x0004003d,0x00000006,0x00000065,
0x00000064,0x0007000c,0x00000006,0x00000066,0x00000001,0x00000028,0x00000063,0x00000065,
0x000200fe,0x00000066,0x00010038,0x00050036,0x00000006,0x00000022,0x00000000,0x0000001b,
0x00030037,0x00000008,0x0000001c,0x00030037,0x00000008,0x0000001d,0x00030037,0x00000008,
0x0000001e,0x00030037,0x00000019,0x0000001f,0x00030037,0x0000001a,0x00000020,0x00030037,
0x00000019,0x00000021,0x000200f8,0x00000023,0x0004003b,0x0000001a,0x00000069,0x00000007,
0x0004003b,0x0000006b,0x0000006c,0x00000007,0x0004003b,0x00000008,0x00000076,0x00000007,
0x0004003b,0x00000082,0x00000083,0x00000007,0x0004003b,0x00000082,0x0000008e,0x00000007,
0x0004003b,0x0000001a,0x000000a3,0x00000007,0x0004003b,0x0000001a,0x000000a5,0x00000007,
0x0004003b,0x00000008,0x000000a8,0x00000007,0x0004003b,0x00000008,0x000000aa,0x00000007,
0x0004003b,0x00000008,0x000000ae,0x00000007,0x0004003b,0x00000008,0x000000b0,0x00000007,
0x0003003e,0x00000069,0x00000037,0x0003003e,0x0000006c,0x0000006d,0x000200f9,0x0000006e,
0x000200f8,0x0000006e,0x000400f6,0x00000070,0x00000071,0x00000000,0x000200f9,0x00000072,
0x000200f8,0x00000072,0x0004003d,0x0000006a,0x00000073,0x0000006c,0x000500b3,0x00000018,
0x00000075,0x00000073,0x00000074,0x000400fa,0x00000075,0x0000006f,0x00000070,0x000200f8,
0x0000006f,0x0004003d,0x00000007,0x00000077,0x0000001c,0x0004003d,0x00000007,0x00000078,
0x0000001e,0x0004003d,0x0000006a,0x00000079,0x0000006c,0x0004006f,0x00000006,0x0000007a,
0x00000079,0x0005008e,0x00000007,0x0000007b,0x00000078,0x0000007a,0x0004003d,0x00000018,
0x0000007c,0x00000021,0x000600a9,0x00000006,0x0000007e,0x0000007c,0x00000029,0x0000007d,
0x0005008e,0x00000007,0x0000007f,0x0000007b,0x0000007e,0x00050081,0x00000007,0x00000080,
0x00000077,0x0000007f,0x0003003e,0x00000076,0x00000080,0x0004003d,0x00000007,0x00000084,
0x00000076,0x00050041,0x00000088,0x00000089,0x00000087,0x0000006d,0x0004003d,0x00000007,
0x0000008a,0x00000089,0x00050085,0x00000007,0x0000008b,0x00000084,0x0000008a,0x0006000c,
0x00000007,0x0000008c,0x00000001,0x00000008,0x0000008b,0x0004006e,0x00000081,0x0000008d,
0x0000008c,0x0003003e,0x00000083,0x0000008d,0x00050041,0x00000088,0x0000008f,0x00000087,
0x0000006d,0x0004003d,0x00000007,0x00000090,0x0000008f,0x0004006e,0x00000081,0x00000091,
0x00000090,0x0003003e,0x0000008e,0x00000091,0x0004003d,0x00000081,0x00000092,0x00000083,
0x000500b1,0x00000095,0x00000096,0x00000092,0x00000094,0x0004009a,0x00000018,0x00000097,
0x00000096,0x000400a8,0x00000018,0x00000098,0x00000097,0x000300f7,0x0000009a,0x00000000,
0x000400fa,0x00000098,0x00000099,0x0000009a,0x000200f8,0x00000099,0x0004003d,0x00000081,
0x0000009b,0x00000083,0x0004003d,0x00000081,0x0000009c,0x0000008e,0x000500af,0x00000095,
0x0000009d,0x0000009b,0x0000009c,0x0004009a,0x00000018,0x0000009e,0x0000009d,0x000200f9,
0x0000009a,0x000200f8,0x0000009a,0x000700f5,0x00000018,0x0000009f,0x00000097,0x0000006f,
0x0000009e,0x00000099,0x000300f7,0x000000a1,0x00000000,0x000400fa,0x0000009f,0x000000a0,
0x000000a1,0x000200f8,0x000000a0,0x000200f9,0x00000070,0x000200f8,0x000000a1,0x0004003d,
0x00000018,0x000000a4,0x0000001f,0x000300f7,0x000000a7,0x00000000,0x000400fa,0x000000a4,
0x000000a6,0x000000ad,0x000200f8,0x000000a6,0x0004003d,0x00000007,0x000000a9,0x00000076,
0x0003003e,0x000000a8,0x000000a9,0x0004003d,0x00000007,0x000000ab,0x0000001d,0x0003003e,
0x000000aa,0x000000ab,0x00060039,0x00000006,0x000000ac,0x00000012,0x000000a8,0x000000aa,
0x0003003e,0x000000a5,0x000000ac,0x000200f9,0x000000a7,0x000200f8,0x000000ad,0x0004003d,
0x00000007,0x000000af,0x00000076,0x0003003e,0x000000ae,0x000000af,0x0004003d,0x00000007,
0x000000b1,0x0000001d,0x0003003e,0x000000b0,0x000000b1,0x00060039,0x00000006,0x000000b2,
0x00000016,0x000000ae,0x000000b0,0x0003003e,0x000000a5,0x000000b2,0x000200f9,0x000000a7,
0x000200f8,0x000000a7,0x0004003d,0x00000006,0x000000b3,0x000000a5,0x0003003e,0x000000a3,
0x000000b3,0x0004003d,0x00000006,0x000000b4,0x000000a3,0x0004003d,0x00000006,0x000000b5,
0x00000020,0x00050085,0x00000006,0x000000b7,0x000000b5,0x000000b6,0x000500bc,0x00000018,
0x000000b8,0x000000b4,0x000000b7,0x000300f7,0x000000ba,0x00000000,0x000400fa,0x000000b8,
0x000000b9,0x000000ba,0x000200f8,0x000000b9,0x000200f9,0x00000070,0x000200f8,0x000000ba,
0x0004003d,0x0000006a,0x000000bc,0x0000006c,0x0004006f,0x00000006,0x000000bd,0x000000bc,
0x0003003e,0x00000069,0x000000bd,0x000200f9,0x00000071,0x000200f8,0x00000071,0x0004003d,
0x0000006a,0x000000be,0x0000006c,0x00050080,0x0000006a,0x000000bf,0x000000be,0x0000006d,
0x0003003e,0x0000006c,0x000000bf,0x000200f9,0x0000006e,0x000200f8,0x00000070,0x0004003d,
0x00000006,0x000000c0,0x00000069,0x000200fe,0x000000c0,0x00010038,
};
-44
View File
@@ -1,44 +0,0 @@
#version 450
// =============================================================================
// Toon / cel edge-outline post effect.
//
// Ported verbatim from the OpenGL ToonEffect.java shader. GL derived uv from
// gl_FragCoord.xy / resolution; here fragTexCoord already spans [0,1] across
// the output, so it IS that uv. edgeThreshold/offset constants unchanged.
//
// Conventions match upscale.vert: combined-image-sampler at binding 0, the
// push-constant block leads with vec4 ndc (offset 0), fragTexCoord in [0,1].
// Runs after FXAA in the canonical chain (stylize the clean image).
// =============================================================================
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc; // quad NDC rect, consumed by upscale.vert (offset 0)
vec2 resolution; // input texture size in px
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
void main() {
vec2 uv = fragTexCoord;
float edgeThreshold = 0.2; // edge-detect threshold
vec2 offset = vec2(1.0) / pc.resolution; // 1-texel neighbour offset
vec3 colorCenter = texture(InputTexture, uv).rgb;
vec3 colorLeft = texture(InputTexture, uv - vec2(offset.x, 0.0)).rgb;
vec3 colorRight = texture(InputTexture, uv + vec2(offset.x, 0.0)).rgb;
vec3 colorUp = texture(InputTexture, uv - vec2(0.0, offset.y)).rgb;
vec3 colorDown = texture(InputTexture, uv + vec2(0.0, offset.y)).rgb;
float diffHorizontal = length(colorRight - colorLeft);
float diffVertical = length(colorUp - colorDown);
float edgeFactor = step(edgeThreshold, diffHorizontal + diffVertical);
vec3 outlineColor = mix(colorCenter, vec3(0.0), edgeFactor);
outColor = vec4(outlineColor, 1.0);
}
-51
View File
@@ -1,51 +0,0 @@
#version 450
layout(binding = 0) uniform sampler2D InputTexture;
layout(push_constant) uniform PC {
vec4 ndc;
vec2 resolution;
float brightness;
float contrast;
float gamma;
float saturation;
} pc;
layout(location = 0) in vec2 fragTexCoord;
layout(location = 0) out vec4 outColor;
void main() {
vec2 uv = fragTexCoord;
vec2 offset = vec2(1.0) / pc.resolution;
vec3 center = texture(InputTexture, uv).rgb;
vec3 left = texture(
InputTexture, uv - vec2(offset.x, 0.0)).rgb;
vec3 right = texture(
InputTexture, uv + vec2(offset.x, 0.0)).rgb;
vec3 up = texture(
InputTexture, uv - vec2(0.0, offset.y)).rgb;
vec3 down = texture(
InputTexture, uv + vec2(0.0, offset.y)).rgb;
float horizontal = length(right - left);
float vertical = length(up - down);
float edge = step(0.2, horizontal + vertical);
vec3 color = mix(center, vec3(0.0), edge);
color = roundEven(clamp(color, 0.0, 1.0) * 255.0) / 255.0;
color = clamp(color + pc.brightness, 0.0, 1.0);
color = (color - 0.5) *
clamp(pc.contrast + 1.0, 0.5, 2.0) + 0.5;
vec3 grey = vec3(
dot(color, vec3(0.2126, 0.7152, 0.0722)));
color = mix(grey, color, clamp(pc.saturation, 0.0, 2.0));
color = max(color, vec3(0.0));
color = pow(color, vec3(1.0 / pc.gamma));
outColor = vec4(color, 1.0);
}
-133
View File
@@ -1,133 +0,0 @@
// 1116.3.0
#pragma once
const uint32_t toon_color_code[] = {
0x07230203,0x00010000,0x0008000b,0x000000a4,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0007000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000000b,0x0000009e,0x00030010,
0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,0x6e69616d,
0x00000000,0x00030005,0x00000009,0x00007675,0x00060005,0x0000000b,0x67617266,0x43786554,
0x64726f6f,0x00000000,0x00040005,0x0000000d,0x7366666f,0x00007465,0x00030005,0x00000011,
0x00004350,0x00040006,0x00000011,0x00000000,0x0063646e,0x00060006,0x00000011,0x00000001,
0x6f736572,0x6974756c,0x00006e6f,0x00060006,0x00000011,0x00000002,0x67697262,0x656e7468,
0x00007373,0x00060006,0x00000011,0x00000003,0x746e6f63,0x74736172,0x00000000,0x00050006,
0x00000011,0x00000004,0x6d6d6167,0x00000061,0x00060006,0x00000011,0x00000005,0x75746173,
0x69746172,0x00006e6f,0x00030005,0x00000013,0x00006370,0x00040005,0x0000001c,0x746e6563,
0x00007265,0x00060005,0x00000020,0x75706e49,0x78655474,0x65727574,0x00000000,0x00040005,
0x00000025,0x7466656c,0x00000000,0x00040005,0x00000032,0x68676972,0x00000074,0x00030005,
0x0000003b,0x00007075,0x00040005,0x00000045,0x6e776f64,0x00000000,0x00050005,0x0000004e,
0x69726f68,0x746e6f7a,0x00006c61,0x00050005,0x00000053,0x74726576,0x6c616369,0x00000000,
0x00040005,0x00000058,0x65676465,0x00000000,0x00040005,0x0000005e,0x6f6c6f63,0x00000072,
0x00040005,0x00000084,0x79657267,0x00000000,0x00050005,0x0000009e,0x4374756f,0x726f6c6f,
0x00000000,0x00040047,0x0000000b,0x0000001e,0x00000000,0x00030047,0x00000011,0x00000002,
0x00050048,0x00000011,0x00000000,0x00000023,0x00000000,0x00050048,0x00000011,0x00000001,
0x00000023,0x00000010,0x00050048,0x00000011,0x00000002,0x00000023,0x00000018,0x00050048,
0x00000011,0x00000003,0x00000023,0x0000001c,0x00050048,0x00000011,0x00000004,0x00000023,
0x00000020,0x00050048,0x00000011,0x00000005,0x00000023,0x00000024,0x00040047,0x00000020,
0x00000021,0x00000000,0x00040047,0x00000020,0x00000022,0x00000000,0x00040047,0x0000009e,
0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,
0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,0x00000008,
0x00000007,0x00000007,0x00040020,0x0000000a,0x00000001,0x00000007,0x0004003b,0x0000000a,
0x0000000b,0x00000001,0x0004002b,0x00000006,0x0000000e,0x3f800000,0x0005002c,0x00000007,
0x0000000f,0x0000000e,0x0000000e,0x00040017,0x00000010,0x00000006,0x00000004,0x0008001e,
0x00000011,0x00000010,0x00000007,0x00000006,0x00000006,0x00000006,0x00000006,0x00040020,
0x00000012,0x00000009,0x00000011,0x0004003b,0x00000012,0x00000013,0x00000009,0x00040015,
0x00000014,0x00000020,0x00000001,0x0004002b,0x00000014,0x00000015,0x00000001,0x00040020,
0x00000016,0x00000009,0x00000007,0x00040017,0x0000001a,0x00000006,0x00000003,0x00040020,
0x0000001b,0x00000007,0x0000001a,0x00090019,0x0000001d,0x00000006,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x0000001e,0x0000001d,0x00040020,
0x0000001f,0x00000000,0x0000001e,0x0004003b,0x0000001f,0x00000020,0x00000000,0x00040015,
0x00000028,0x00000020,0x00000000,0x0004002b,0x00000028,0x00000029,0x00000000,0x00040020,
0x0000002a,0x00000007,0x00000006,0x0004002b,0x00000006,0x0000002d,0x00000000,0x0004002b,
0x00000028,0x0000003e,0x00000001,0x0004002b,0x00000006,0x00000059,0x3e4ccccd,0x0006002c,
0x0000001a,0x00000060,0x0000002d,0x0000002d,0x0000002d,0x0004002b,0x00000006,0x00000068,
0x437f0000,0x0004002b,0x00000014,0x0000006e,0x00000002,0x00040020,0x0000006f,0x00000009,
0x00000006,0x0004002b,0x00000006,0x00000078,0x3f000000,0x0004002b,0x00000014,0x0000007b,
0x00000003,0x0004002b,0x00000006,0x0000007f,0x40000000,0x0004002b,0x00000006,0x00000086,
0x3e59b3d0,0x0004002b,0x00000006,0x00000087,0x3f371759,0x0004002b,0x00000006,0x00000088,
0x3d93dd98,0x0006002c,0x0000001a,0x00000089,0x00000086,0x00000087,0x00000088,0x0004002b,
0x00000014,0x0000008e,0x00000005,0x0004002b,0x00000014,0x00000097,0x00000004,0x00040020,
0x0000009d,0x00000003,0x00000010,0x0004003b,0x0000009d,0x0000009e,0x00000003,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000008,0x0000000d,0x00000007,0x0004003b,0x0000001b,
0x0000001c,0x00000007,0x0004003b,0x0000001b,0x00000025,0x00000007,0x0004003b,0x0000001b,
0x00000032,0x00000007,0x0004003b,0x0000001b,0x0000003b,0x00000007,0x0004003b,0x0000001b,
0x00000045,0x00000007,0x0004003b,0x0000002a,0x0000004e,0x00000007,0x0004003b,0x0000002a,
0x00000053,0x00000007,0x0004003b,0x0000002a,0x00000058,0x00000007,0x0004003b,0x0000001b,
0x0000005e,0x00000007,0x0004003b,0x0000001b,0x00000084,0x00000007,0x0004003d,0x00000007,
0x0000000c,0x0000000b,0x0003003e,0x00000009,0x0000000c,0x00050041,0x00000016,0x00000017,
0x00000013,0x00000015,0x0004003d,0x00000007,0x00000018,0x00000017,0x00050088,0x00000007,
0x00000019,0x0000000f,0x00000018,0x0003003e,0x0000000d,0x00000019,0x0004003d,0x0000001e,
0x00000021,0x00000020,0x0004003d,0x00000007,0x00000022,0x00000009,0x00050057,0x00000010,
0x00000023,0x00000021,0x00000022,0x0008004f,0x0000001a,0x00000024,0x00000023,0x00000023,
0x00000000,0x00000001,0x00000002,0x0003003e,0x0000001c,0x00000024,0x0004003d,0x0000001e,
0x00000026,0x00000020,0x0004003d,0x00000007,0x00000027,0x00000009,0x00050041,0x0000002a,
0x0000002b,0x0000000d,0x00000029,0x0004003d,0x00000006,0x0000002c,0x0000002b,0x00050050,
0x00000007,0x0000002e,0x0000002c,0x0000002d,0x00050083,0x00000007,0x0000002f,0x00000027,
0x0000002e,0x00050057,0x00000010,0x00000030,0x00000026,0x0000002f,0x0008004f,0x0000001a,
0x00000031,0x00000030,0x00000030,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000025,
0x00000031,0x0004003d,0x0000001e,0x00000033,0x00000020,0x0004003d,0x00000007,0x00000034,
0x00000009,0x00050041,0x0000002a,0x00000035,0x0000000d,0x00000029,0x0004003d,0x00000006,
0x00000036,0x00000035,0x00050050,0x00000007,0x00000037,0x00000036,0x0000002d,0x00050081,
0x00000007,0x00000038,0x00000034,0x00000037,0x00050057,0x00000010,0x00000039,0x00000033,
0x00000038,0x0008004f,0x0000001a,0x0000003a,0x00000039,0x00000039,0x00000000,0x00000001,
0x00000002,0x0003003e,0x00000032,0x0000003a,0x0004003d,0x0000001e,0x0000003c,0x00000020,
0x0004003d,0x00000007,0x0000003d,0x00000009,0x00050041,0x0000002a,0x0000003f,0x0000000d,
0x0000003e,0x0004003d,0x00000006,0x00000040,0x0000003f,0x00050050,0x00000007,0x00000041,
0x0000002d,0x00000040,0x00050083,0x00000007,0x00000042,0x0000003d,0x00000041,0x00050057,
0x00000010,0x00000043,0x0000003c,0x00000042,0x0008004f,0x0000001a,0x00000044,0x00000043,
0x00000043,0x00000000,0x00000001,0x00000002,0x0003003e,0x0000003b,0x00000044,0x0004003d,
0x0000001e,0x00000046,0x00000020,0x0004003d,0x00000007,0x00000047,0x00000009,0x00050041,
0x0000002a,0x00000048,0x0000000d,0x0000003e,0x0004003d,0x00000006,0x00000049,0x00000048,
0x00050050,0x00000007,0x0000004a,0x0000002d,0x00000049,0x00050081,0x00000007,0x0000004b,
0x00000047,0x0000004a,0x00050057,0x00000010,0x0000004c,0x00000046,0x0000004b,0x0008004f,
0x0000001a,0x0000004d,0x0000004c,0x0000004c,0x00000000,0x00000001,0x00000002,0x0003003e,
0x00000045,0x0000004d,0x0004003d,0x0000001a,0x0000004f,0x00000032,0x0004003d,0x0000001a,
0x00000050,0x00000025,0x00050083,0x0000001a,0x00000051,0x0000004f,0x00000050,0x0006000c,
0x00000006,0x00000052,0x00000001,0x00000042,0x00000051,0x0003003e,0x0000004e,0x00000052,
0x0004003d,0x0000001a,0x00000054,0x0000003b,0x0004003d,0x0000001a,0x00000055,0x00000045,
0x00050083,0x0000001a,0x00000056,0x00000054,0x00000055,0x0006000c,0x00000006,0x00000057,
0x00000001,0x00000042,0x00000056,0x0003003e,0x00000053,0x00000057,0x0004003d,0x00000006,
0x0000005a,0x0000004e,0x0004003d,0x00000006,0x0000005b,0x00000053,0x00050081,0x00000006,
0x0000005c,0x0000005a,0x0000005b,0x0007000c,0x00000006,0x0000005d,0x00000001,0x00000030,
0x00000059,0x0000005c,0x0003003e,0x00000058,0x0000005d,0x0004003d,0x0000001a,0x0000005f,
0x0000001c,0x0004003d,0x00000006,0x00000061,0x00000058,0x00060050,0x0000001a,0x00000062,
0x00000061,0x00000061,0x00000061,0x0008000c,0x0000001a,0x00000063,0x00000001,0x0000002e,
0x0000005f,0x00000060,0x00000062,0x0003003e,0x0000005e,0x00000063,0x0004003d,0x0000001a,
0x00000064,0x0000005e,0x00060050,0x0000001a,0x00000065,0x0000002d,0x0000002d,0x0000002d,
0x00060050,0x0000001a,0x00000066,0x0000000e,0x0000000e,0x0000000e,0x0008000c,0x0000001a,
0x00000067,0x00000001,0x0000002b,0x00000064,0x00000065,0x00000066,0x0005008e,0x0000001a,
0x00000069,0x00000067,0x00000068,0x0006000c,0x0000001a,0x0000006a,0x00000001,0x00000002,
0x00000069,0x00060050,0x0000001a,0x0000006b,0x00000068,0x00000068,0x00000068,0x00050088,
0x0000001a,0x0000006c,0x0000006a,0x0000006b,0x0003003e,0x0000005e,0x0000006c,0x0004003d,
0x0000001a,0x0000006d,0x0000005e,0x00050041,0x0000006f,0x00000070,0x00000013,0x0000006e,
0x0004003d,0x00000006,0x00000071,0x00000070,0x00060050,0x0000001a,0x00000072,0x00000071,
0x00000071,0x00000071,0x00050081,0x0000001a,0x00000073,0x0000006d,0x00000072,0x00060050,
0x0000001a,0x00000074,0x0000002d,0x0000002d,0x0000002d,0x00060050,0x0000001a,0x00000075,
0x0000000e,0x0000000e,0x0000000e,0x0008000c,0x0000001a,0x00000076,0x00000001,0x0000002b,
0x00000073,0x00000074,0x00000075,0x0003003e,0x0000005e,0x00000076,0x0004003d,0x0000001a,
0x00000077,0x0000005e,0x00060050,0x0000001a,0x00000079,0x00000078,0x00000078,0x00000078,
0x00050083,0x0000001a,0x0000007a,0x00000077,0x00000079,0x00050041,0x0000006f,0x0000007c,
0x00000013,0x0000007b,0x0004003d,0x00000006,0x0000007d,0x0000007c,0x00050081,0x00000006,
0x0000007e,0x0000007d,0x0000000e,0x0008000c,0x00000006,0x00000080,0x00000001,0x0000002b,
0x0000007e,0x00000078,0x0000007f,0x0005008e,0x0000001a,0x00000081,0x0000007a,0x00000080,
0x00060050,0x0000001a,0x00000082,0x00000078,0x00000078,0x00000078,0x00050081,0x0000001a,
0x00000083,0x00000081,0x00000082,0x0003003e,0x0000005e,0x00000083,0x0004003d,0x0000001a,
0x00000085,0x0000005e,0x00050094,0x00000006,0x0000008a,0x00000085,0x00000089,0x00060050,
0x0000001a,0x0000008b,0x0000008a,0x0000008a,0x0000008a,0x0003003e,0x00000084,0x0000008b,
0x0004003d,0x0000001a,0x0000008c,0x00000084,0x0004003d,0x0000001a,0x0000008d,0x0000005e,
0x00050041,0x0000006f,0x0000008f,0x00000013,0x0000008e,0x0004003d,0x00000006,0x00000090,
0x0000008f,0x0008000c,0x00000006,0x00000091,0x00000001,0x0000002b,0x00000090,0x0000002d,
0x0000007f,0x00060050,0x0000001a,0x00000092,0x00000091,0x00000091,0x00000091,0x0008000c,
0x0000001a,0x00000093,0x00000001,0x0000002e,0x0000008c,0x0000008d,0x00000092,0x0003003e,
0x0000005e,0x00000093,0x0004003d,0x0000001a,0x00000094,0x0000005e,0x0007000c,0x0000001a,
0x00000095,0x00000001,0x00000028,0x00000094,0x00000060,0x0003003e,0x0000005e,0x00000095,
0x0004003d,0x0000001a,0x00000096,0x0000005e,0x00050041,0x0000006f,0x00000098,0x00000013,
0x00000097,0x0004003d,0x00000006,0x00000099,0x00000098,0x00050088,0x00000006,0x0000009a,
0x0000000e,0x00000099,0x00060050,0x0000001a,0x0000009b,0x0000009a,0x0000009a,0x0000009a,
0x0007000c,0x0000001a,0x0000009c,0x00000001,0x0000001a,0x00000096,0x0000009b,0x0003003e,
0x0000005e,0x0000009c,0x0004003d,0x0000001a,0x0000009f,0x0000005e,0x00050051,0x00000006,
0x000000a0,0x0000009f,0x00000000,0x00050051,0x00000006,0x000000a1,0x0000009f,0x00000001,
0x00050051,0x00000006,0x000000a2,0x0000009f,0x00000002,0x00070050,0x00000010,0x000000a3,
0x000000a0,0x000000a1,0x000000a2,0x0000000e,0x0003003e,0x0000009e,0x000000a3,0x000100fd,
0x00010038
};
-23
View File
@@ -1,23 +0,0 @@
#version 450
// Full-screen / sub-rect quad for the spatial-upscaler post passes (SGSR, FSR
// EASU/RCAS). Identical quad generation to window.vert, but the push-constant
// block is declared as a single vec4 `ndc` so it matches the leading member of
// the upscaler fragment shaders' push-constant blocks (cross-stage layout must
// agree). gl_VertexIndex 0..3 over a TRIANGLE_STRIP -> the rect; fragTexCoord
// spans [0,1] across that rect (= normalised output position).
layout(push_constant) uniform PC {
vec4 ndc; // (x0, y0, x1, y1) destination rect in NDC
} pc;
layout(location = 0) out vec2 fragTexCoord;
void main() {
int xi = (gl_VertexIndex >> 1) & 1;
int yi = gl_VertexIndex & 1;
float x = xi == 1 ? pc.ndc.z : pc.ndc.x;
float y = yi == 1 ? pc.ndc.w : pc.ndc.y;
gl_Position = vec4(x, y, 0.0, 1.0);
fragTexCoord = vec2(float(xi), float(yi));
}
+2 -5
View File
@@ -1,6 +1,5 @@
add_library(droiddeckwayland SHARED
src/compositor.c
src/clock_domain.c
src/vk_present.c
src/effects_chain.c
src/cardboard.c
@@ -8,7 +7,6 @@ add_library(droiddeckwayland SHARED
src/vk_loader.c
src/sc_layer.c
src/ahb_swapchain.c
src/display_buffers.c
src/waylandcomp_jni.c
src/gpu_clock_pin.c
src/droiddeck_ext.c
@@ -27,7 +25,7 @@ add_library(droiddeckwayland SHARED
generated/linux-dmabuf-v1-protocol.c
generated/wayland-android-protocol.c
generated/viewporter-protocol.c
generated/droiddeck-desktop-v1-protocol.c
generated/banner-desktop-v1-protocol.c
generated/presentation-time-protocol.c
generated/pointer-constraints-unstable-v1-protocol.c
generated/relative-pointer-unstable-v1-protocol.c
@@ -35,8 +33,7 @@ add_library(droiddeckwayland SHARED
generated/text-input-unstable-v3-protocol.c
generated/xdg-toplevel-icon-v1-protocol.c
generated/single-pixel-buffer-v1-protocol.c
generated/droiddeck-ahb-v1-protocol.c
generated/droiddeck-refresh-v1-protocol.c
generated/banner-ahb-v1-protocol.c
src/framegen_bridge.c
src/framegen_jni.c
src/hudframes.c
@@ -19,8 +19,8 @@ exactly how Turnip already imports every gralloc buffer on Android (`vk_android.
in play already have every extension needed; nothing is missing in the drivers. What is missing is
a **WSI hook**: Mesa's Wayland WSI always allocates its own dma-bufs and has no way to receive or
allocate compositor-visible buffers, so **option (a) or (c) each need a ~300-line patch to
`wsi_common_wayland.c` in our own Wayland Turnip build**
(`build_turnip_wayland_wsi.sh`, Mesa `7cda7850`) plus a small private Wayland protocol. Nothing in
`wsi_common_wayland.c` in our own Wayland Turnip build** (banners-turnip-wayland
`build_turnip_wayland_wsi.sh`, Mesa `7cda7850`) plus a small private Wayland protocol. Nothing in
the app can remove the copy on its own. Recommended: **option (a′) - the game's WSI allocates its
swapchain images as `AHardwareBuffer`s (gralloc-native, UBWC), imports them through the AHB path
Turnip already has, and hands the compositor the AHB over a Unix socket (`AHardwareBuffer_send/
@@ -77,7 +77,7 @@ Mesa's Wayland WSI creates every native swapchain image with `wsi_create_native_
(the Android-WSI import path, `tu_image.cc:880-925`) is only reachable from the Android swapchain.
The patch (in our Wayland Turnip build): a new `create_mem` for the Wayland chain, selected when the
compositor advertises a private global `droiddeck_layer_buffer_v1`:
compositor advertises a private global `banner_layer_buffer_v1`:
1. `AHardwareBuffer_allocate(w, h, R8G8B8A8, GPU_COLOR_OUTPUT | GPU_SAMPLED_IMAGE)`;
`vkGetAndroidHardwareBufferPropertiesANDROID` → `vkAllocateMemory` with
`VkImportAndroidHardwareBufferInfoANDROID` (Turnip: `tu_device.cc:3828`), bind - the image was
@@ -85,7 +85,7 @@ compositor advertises a private global `droiddeck_layer_buffer_v1`:
2. `wsi_image.dma_buf_fd = dup(native_handle->data[0])`, `drm_modifier` / `row_pitches[0]` from
the same layout → the existing `zwp_linux_dmabuf_v1` path stays untouched: the compositor keeps
importing a dma-buf and can keep the blit path as the fallback.
3. `droiddeck_layer_buffer_v1.attach(wl_buffer, socket_fd)`: the WSI creates a `socketpair`, sends one
3. `banner_layer_buffer_v1.attach(wl_buffer, socket_fd)`: the WSI creates a `socketpair`, sends one
end in the request, and calls `AHardwareBuffer_sendHandleToUnixSocket(ahb, other_end)`; the
compositor's request handler does `AHardwareBuffer_recvHandleFromUnixSocket` and stores the AHB
on `struct dmabuf_buffer`. Per swapchain image, once - not per frame.
@@ -262,7 +262,7 @@ D3D12 tabs) as the workload, session log in `Download/Wayland-logs/`.
since the blit only changed its destination) and `dumpsys gfxinfo`/battery for 5 min each. This
is the baseline the WSI patch is measured against.
4. **Fence probe outcome → choose the acquire-fence design** (§3) before starting the WSI patch.
5. **WSI patch (option a) in the Wayland Turnip build**, wcp rebuild, then the same steps 1–3 with
5. **WSI patch (option a) in banners-turnip-wayland**, wcp rebuild, then the same steps 1–3 with
the AHB arriving from the guest: log line to add on the compositor side `layer: buffer N of
"<window>" received from the game (AHardwareBuffer WxH, UBWC)` and the fps delta vs X11.
@@ -296,7 +296,7 @@ unchanged. Off by default: with the variable unset no new code runs.
Not zero-copy yet - it is the receive side. The copy disappears when step 5 lands and
`sc_layer_present` is handed the game's own `AHardwareBuffer` instead of a pool slot.
## 7. Step 5 implemented (feat/wayland-zero-copy-wsi + the Wayland Turnip build `droiddeck_ahb_wsi.py`)
## 7. Step 5 implemented (feat/wayland-zero-copy-wsi + banners-turnip-wayland `banner_ahb_wsi.py`)
Option (a′) as recommended, with one deviation forced by the build: the Wayland Turnip is a
`platforms=wayland` build with Android detection off, so `VK_ANDROID_external_memory_android_hardware_buffer`
@@ -38,7 +38,7 @@
extern const struct wl_interface wl_buffer_interface;
static const struct wl_interface *droiddeck_ahb_v1_types[] = {
static const struct wl_interface *banner_ahb_v1_types[] = {
NULL,
&wl_buffer_interface,
NULL,
@@ -50,18 +50,18 @@ static const struct wl_interface *droiddeck_ahb_v1_types[] = {
NULL,
};
static const struct wl_message droiddeck_ahb_v1_requests[] = {
{ "destroy", "", droiddeck_ahb_v1_types + 0 },
{ "attach", "ohuuuuuu", droiddeck_ahb_v1_types + 1 },
static const struct wl_message banner_ahb_v1_requests[] = {
{ "destroy", "", banner_ahb_v1_types + 0 },
{ "attach", "ohuuuuuu", banner_ahb_v1_types + 1 },
};
static const struct wl_message droiddeck_ahb_v1_events[] = {
{ "mode", "2u", droiddeck_ahb_v1_types + 0 },
static const struct wl_message banner_ahb_v1_events[] = {
{ "mode", "2u", banner_ahb_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface droiddeck_ahb_v1_interface = {
"droiddeck_ahb_v1", 2,
2, droiddeck_ahb_v1_requests,
1, droiddeck_ahb_v1_events,
WL_PRIVATE const struct wl_interface banner_ahb_v1_interface = {
"banner_ahb_v1", 2,
2, banner_ahb_v1_requests,
1, banner_ahb_v1_events,
};
@@ -1,6 +1,6 @@
#ifndef DROIDDECK_AHB_V1_SERVER_PROTOCOL_H
#define DROIDDECK_AHB_V1_SERVER_PROTOCOL_H
#ifndef BANNER_AHB_V1_SERVER_PROTOCOL_H
#define BANNER_AHB_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
@@ -14,7 +14,7 @@ struct wl_client;
struct wl_resource;
/*
* @section page_copyright_droiddeck_ahb_v1 Copyright
* @section page_copyright_banner_ahb_v1 Copyright
*
* Copyright 2026 The412Banner
*
@@ -42,15 +42,15 @@ struct wl_resource;
struct droiddeck_ahb_v1;
struct banner_ahb_v1;
struct wl_buffer;
#ifndef DROIDDECK_AHB_V1_INTERFACE
#define DROIDDECK_AHB_V1_INTERFACE
extern const struct wl_interface droiddeck_ahb_v1_interface;
#ifndef BANNER_AHB_V1_INTERFACE
#define BANNER_AHB_V1_INTERFACE
extern const struct wl_interface banner_ahb_v1_interface;
#endif
struct droiddeck_ahb_v1_interface {
struct banner_ahb_v1_interface {
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
void (*attach)(struct wl_client *client,
@@ -65,17 +65,17 @@ struct droiddeck_ahb_v1_interface {
uint32_t image_count);
};
#define DROIDDECK_AHB_V1_MODE 0
#define BANNER_AHB_V1_MODE 0
#define DROIDDECK_AHB_V1_MODE_SINCE_VERSION 2
#define BANNER_AHB_V1_MODE_SINCE_VERSION 2
#define DROIDDECK_AHB_V1_DESTROY_SINCE_VERSION 1
#define DROIDDECK_AHB_V1_ATTACH_SINCE_VERSION 1
#define BANNER_AHB_V1_DESTROY_SINCE_VERSION 1
#define BANNER_AHB_V1_ATTACH_SINCE_VERSION 1
static inline void
droiddeck_ahb_v1_send_mode(struct wl_resource *resource_, uint32_t enabled)
banner_ahb_v1_send_mode(struct wl_resource *resource_, uint32_t enabled)
{
wl_resource_post_event(resource_, DROIDDECK_AHB_V1_MODE, enabled);
wl_resource_post_event(resource_, BANNER_AHB_V1_MODE, enabled);
}
#ifdef __cplusplus
@@ -38,7 +38,7 @@
extern const struct wl_interface wl_surface_interface;
static const struct wl_interface *droiddeck_desktop_v1_types[] = {
static const struct wl_interface *banner_desktop_v1_types[] = {
NULL,
&wl_surface_interface,
&wl_surface_interface,
@@ -47,16 +47,16 @@ static const struct wl_interface *droiddeck_desktop_v1_types[] = {
NULL,
};
static const struct wl_message droiddeck_desktop_v1_requests[] = {
{ "destroy", "", droiddeck_desktop_v1_types + 0 },
{ "set_desktop", "o", droiddeck_desktop_v1_types + 1 },
{ "set_window", "ouii", droiddeck_desktop_v1_types + 2 },
{ "set_zorder", "a", droiddeck_desktop_v1_types + 0 },
static const struct wl_message banner_desktop_v1_requests[] = {
{ "destroy", "", banner_desktop_v1_types + 0 },
{ "set_desktop", "o", banner_desktop_v1_types + 1 },
{ "set_window", "ouii", banner_desktop_v1_types + 2 },
{ "set_zorder", "a", banner_desktop_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface droiddeck_desktop_v1_interface = {
"droiddeck_desktop_v1", 1,
4, droiddeck_desktop_v1_requests,
WL_PRIVATE const struct wl_interface banner_desktop_v1_interface = {
"banner_desktop_v1", 1,
4, banner_desktop_v1_requests,
0, NULL,
};
@@ -1,6 +1,6 @@
#ifndef DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
#define DROIDDECK_DESKTOP_V1_SERVER_PROTOCOL_H
#ifndef BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
#define BANNER_DESKTOP_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
@@ -14,7 +14,7 @@ struct wl_client;
struct wl_resource;
/*
* @section page_copyright_droiddeck_desktop_v1 Copyright
* @section page_copyright_banner_desktop_v1 Copyright
*
* Copyright 2026 The412Banner
*
@@ -42,15 +42,15 @@ struct wl_resource;
struct droiddeck_desktop_v1;
struct banner_desktop_v1;
struct wl_surface;
#ifndef DROIDDECK_DESKTOP_V1_INTERFACE
#define DROIDDECK_DESKTOP_V1_INTERFACE
extern const struct wl_interface droiddeck_desktop_v1_interface;
#ifndef BANNER_DESKTOP_V1_INTERFACE
#define BANNER_DESKTOP_V1_INTERFACE
extern const struct wl_interface banner_desktop_v1_interface;
#endif
struct droiddeck_desktop_v1_interface {
struct banner_desktop_v1_interface {
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
void (*set_desktop)(struct wl_client *client,
@@ -68,10 +68,10 @@ struct droiddeck_desktop_v1_interface {
};
#define DROIDDECK_DESKTOP_V1_DESTROY_SINCE_VERSION 1
#define DROIDDECK_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
#define DROIDDECK_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
#define DROIDDECK_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
#define BANNER_DESKTOP_V1_DESTROY_SINCE_VERSION 1
#define BANNER_DESKTOP_V1_SET_DESKTOP_SINCE_VERSION 1
#define BANNER_DESKTOP_V1_SET_WINDOW_SINCE_VERSION 1
#define BANNER_DESKTOP_V1_SET_ZORDER_SINCE_VERSION 1
#ifdef __cplusplus
}
@@ -1,59 +0,0 @@
/*
* Copyright 2026 DroidDeck contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
#ifndef __has_attribute
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
#else
#define WL_PRIVATE
#endif
static const struct wl_interface *droiddeck_refresh_v1_types[] = {
NULL,
NULL,
};
static const struct wl_message droiddeck_refresh_v1_requests[] = {
{ "destroy", "", droiddeck_refresh_v1_types + 0 },
{ "set_target", "uu", droiddeck_refresh_v1_types + 0 },
};
static const struct wl_message droiddeck_refresh_v1_events[] = {
{ "rate", "u", droiddeck_refresh_v1_types + 0 },
{ "done", "", droiddeck_refresh_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface droiddeck_refresh_v1_interface = {
"droiddeck_refresh_v1", 1,
2, droiddeck_refresh_v1_requests,
2, droiddeck_refresh_v1_events,
};
@@ -1,175 +0,0 @@
#ifndef DROIDDECK_REFRESH_V1_SERVER_PROTOCOL_H
#define DROIDDECK_REFRESH_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_droiddeck_refresh_v1 The droiddeck_refresh_v1 protocol
* @section page_ifaces_droiddeck_refresh_v1 Interfaces
* - @subpage page_iface_droiddeck_refresh_v1 - panel refresh rates a nested compositor may ask for
* @section page_copyright_droiddeck_refresh_v1 Copyright
* <pre>
*
* Copyright 2026 DroidDeck contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
* </pre>
*/
struct droiddeck_refresh_v1;
#ifndef DROIDDECK_REFRESH_V1_INTERFACE
#define DROIDDECK_REFRESH_V1_INTERFACE
/**
* @page page_iface_droiddeck_refresh_v1 droiddeck_refresh_v1
* @section page_iface_droiddeck_refresh_v1_desc Description
*
* A nested compositor paces its clients against the refresh rate of the
* panel it is shown on. When its clients are held to a frame rate the
* panel's current rate does not divide evenly, frames are shown for an
* uneven number of refreshes. This interface lets the nested compositor
* see every refresh rate the panel can run at its current size and ask
* for the one that suits the frame rate it is pacing to.
*
* On bind the compositor sends one rate event per refresh rate, lowest
* first, followed by done. The list is sent again, in full, whenever it
* changes (a different panel, or a limit the user placed on the panel's
* rate). The rate the panel is running at is still reported the standard
* way, through wl_output.mode.
*
* A request is a preference, not a guarantee: the user, the platform or
* another output mirroring the panel may hold the panel at another rate.
* The client reads the result from wl_output.mode.
* @section page_iface_droiddeck_refresh_v1_api API
* See @ref iface_droiddeck_refresh_v1.
*/
/**
* @defgroup iface_droiddeck_refresh_v1 The droiddeck_refresh_v1 interface
*
* A nested compositor paces its clients against the refresh rate of the
* panel it is shown on. When its clients are held to a frame rate the
* panel's current rate does not divide evenly, frames are shown for an
* uneven number of refreshes. This interface lets the nested compositor
* see every refresh rate the panel can run at its current size and ask
* for the one that suits the frame rate it is pacing to.
*
* On bind the compositor sends one rate event per refresh rate, lowest
* first, followed by done. The list is sent again, in full, whenever it
* changes (a different panel, or a limit the user placed on the panel's
* rate). The rate the panel is running at is still reported the standard
* way, through wl_output.mode.
*
* A request is a preference, not a guarantee: the user, the platform or
* another output mirroring the panel may hold the panel at another rate.
* The client reads the result from wl_output.mode.
*/
extern const struct wl_interface droiddeck_refresh_v1_interface;
#endif
/**
* @ingroup iface_droiddeck_refresh_v1
* @struct droiddeck_refresh_v1_interface
*/
struct droiddeck_refresh_v1_interface {
/**
* destroy the object
*
* The preference set through this object is dropped.
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
/**
* ask for a refresh rate
*
* refresh is the panel rate the client would like, in Hz, taken
* from the advertised list; 0 withdraws the preference. frame_rate
* is the frame rate the client holds its content to, in frames per
* second, or 0 when the content is not held to a rate. The
* compositor may multiply the content's frame rate itself
* (generated frames); when it does, it picks the advertised rate
* that the multiplied frame rate divides evenly instead of the
* requested one.
* @param refresh wanted panel refresh rate in Hz, 0 for none
* @param frame_rate content frame rate in frames per second, 0 for unpaced
*/
void (*set_target)(struct wl_client *client,
struct wl_resource *resource,
uint32_t refresh,
uint32_t frame_rate);
};
#define DROIDDECK_REFRESH_V1_RATE 0
#define DROIDDECK_REFRESH_V1_DONE 1
/**
* @ingroup iface_droiddeck_refresh_v1
*/
#define DROIDDECK_REFRESH_V1_RATE_SINCE_VERSION 1
/**
* @ingroup iface_droiddeck_refresh_v1
*/
#define DROIDDECK_REFRESH_V1_DONE_SINCE_VERSION 1
/**
* @ingroup iface_droiddeck_refresh_v1
*/
#define DROIDDECK_REFRESH_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_droiddeck_refresh_v1
*/
#define DROIDDECK_REFRESH_V1_SET_TARGET_SINCE_VERSION 1
/**
* @ingroup iface_droiddeck_refresh_v1
* Sends an rate event to the client owning the resource.
* @param resource_ The client's resource
* @param refresh panel refresh rate in Hz
*/
static inline void
droiddeck_refresh_v1_send_rate(struct wl_resource *resource_, uint32_t refresh)
{
wl_resource_post_event(resource_, DROIDDECK_REFRESH_V1_RATE, refresh);
}
/**
* @ingroup iface_droiddeck_refresh_v1
* Sends an done event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
droiddeck_refresh_v1_send_done(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, DROIDDECK_REFRESH_V1_DONE);
}
#ifdef __cplusplus
}
#endif
#endif
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="droiddeck_ahb_v1">
<protocol name="banner_ahb_v1">
<copyright>
Copyright 2026 The412Banner
@@ -23,7 +23,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="droiddeck_ahb_v1" version="2">
<interface name="banner_ahb_v1" version="2">
<description summary="Android gralloc buffers behind dma-buf wl_buffers">
Zero-copy window layers on Android. A Vulkan swapchain image that the
client allocated as an Android AHardwareBuffer (gralloc) is still shared
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="droiddeck_desktop_v1">
<protocol name="banner_desktop_v1">
<copyright>
Copyright 2026 The412Banner
@@ -23,7 +23,7 @@
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="droiddeck_desktop_v1" version="1">
<interface name="banner_desktop_v1" version="1">
<description summary="Windows virtual desktop layout">
Each Wine process is a separate Wayland client, so a Windows virtual
desktop can't be built from subsurfaces. Instead the process that owns
@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="droiddeck_refresh_v1">
<copyright>
Copyright 2026 DroidDeck contributors
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="droiddeck_refresh_v1" version="1">
<description summary="panel refresh rates a nested compositor may ask for">
A nested compositor paces its clients against the refresh rate of the
panel it is shown on. When its clients are held to a frame rate the
panel's current rate does not divide evenly, frames are shown for an
uneven number of refreshes. This interface lets the nested compositor
see every refresh rate the panel can run at its current size and ask
for the one that suits the frame rate it is pacing to.
On bind the compositor sends one rate event per refresh rate, lowest
first, followed by done. The list is sent again, in full, whenever it
changes (a different panel, or a limit the user placed on the panel's
rate). The rate the panel is running at is still reported the standard
way, through wl_output.mode.
A request is a preference, not a guarantee: the user, the platform or
another output mirroring the panel may hold the panel at another rate.
The client reads the result from wl_output.mode.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the object">
The preference set through this object is dropped.
</description>
</request>
<request name="set_target">
<description summary="ask for a refresh rate">
refresh is the panel rate the client would like, in Hz, taken from
the advertised list; 0 withdraws the preference. frame_rate is the
frame rate the client holds its content to, in frames per second, or
0 when the content is not held to a rate. The compositor may multiply
the content's frame rate itself (generated frames); when it does, it
picks the advertised rate that the multiplied frame rate divides
evenly instead of the requested one.
</description>
<arg name="refresh" type="uint" summary="wanted panel refresh rate in Hz, 0 for none"/>
<arg name="frame_rate" type="uint" summary="content frame rate in frames per second, 0 for unpaced"/>
</request>
<event name="rate">
<description summary="a refresh rate the panel can run">
Sent once per rate, lowest first, in Hz rounded to the nearest whole
number.
</description>
<arg name="refresh" type="uint" summary="panel refresh rate in Hz"/>
</event>
<event name="done">
<description summary="the list of rates is complete">
Ends a list of rate events. The rates received since the previous
done replace the earlier list.
</description>
</event>
</interface>
</protocol>
@@ -4,7 +4,7 @@
#include "droiddeck_ext.h"
#include "sc_layer.h"
#include "vk_present.h"
#include "droiddeck-ahb-v1-server-protocol.h"
#include "banner-ahb-v1-server-protocol.h"
#include <android/hardware_buffer.h>
#include <errno.h>
#include <fcntl.h>
@@ -25,7 +25,6 @@ struct droiddeck_dma_buf_sync_file { uint32_t flags; int32_t fd; };
#define DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE _IOW('b', 3, struct droiddeck_dma_buf_sync_file)
extern volatile int g_zero_copy;
void droiddeck_dmabuf_formats_stale(void);
struct ahb_buf {
uint64_t id;
@@ -38,7 +37,6 @@ struct ahb_buf {
struct wl_client *client;
struct wl_resource *resource;
struct wl_listener resource_destroy;
int display;
int on_layer;
int release_pending;
int64_t deferred_ns;
@@ -133,10 +131,10 @@ static void handle_released(uint64_t id, int fd) {
if (fd >= 0) {
struct droiddeck_dma_buf_sync_file imp = {.flags = DROIDDECK_DMA_BUF_SYNC_READ, .fd = fd};
int dmabuf_fd = droiddeck_dmabuf_fd(ab->b);
if (!ab->display && dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) {
if (dmabuf_fd >= 0 && ioctl(dmabuf_fd, DROIDDECK_DMA_BUF_IOCTL_IMPORT_SYNC_FILE, &imp) == 0) {
close(fd);
} else {
if (!ab->display && !g_import_failed_logged) {
if (!g_import_failed_logged) {
g_import_failed_logged = 1;
droiddeck_log("layer", "zero-copy: DMA_BUF_IOCTL_IMPORT_SYNC_FILE failed (%s): releases wait for the display's fence here instead",
strerror(errno));
@@ -189,7 +187,7 @@ int ahb_swapchain_has_ahb(const struct dmabuf_buffer *b) {
return b && *droiddeck_dmabuf_ahb_slot((struct dmabuf_buffer *)b) != NULL;
}
int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_w, int scene_h, const struct vkp_draw *draw) {
int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_w, int scene_h) {
struct ahb_buf *ab = b ? *droiddeck_dmabuf_ahb_slot(b) : NULL;
if (!ab) return -1;
int dmabuf_fd = droiddeck_dmabuf_fd(b);
@@ -207,7 +205,7 @@ int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_
int r;
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
}
int r = sc_layer_present_ahb(ab->ahb, ab->w, ab->h, acquire, (void *)(uintptr_t)ab->id, scene_w, scene_h, draw,
int r = sc_layer_present_ahb(ab->ahb, ab->w, ab->h, acquire, (void *)(uintptr_t)ab->id, scene_w, scene_h,
s ? droiddeck_surface_color(s) : NULL, ab->format);
if (r < 0) return -1;
if (r == 1) return 0;
@@ -261,58 +259,6 @@ uint32_t ahb_swapchain_ahb_format(const struct dmabuf_buffer *b) {
}
static int adopt(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b, AHardwareBuffer *ahb,
uint32_t stride, uint32_t image_count, uint64_t modifier) {
AHardwareBuffer_Desc d;
AHardwareBuffer_describe(ahb, &d);
int bw, bh;
droiddeck_dmabuf_size(b, &bw, &bh);
struct ahb_buf *ab = calloc(1, sizeof(*ab));
if (!ab) return -1;
ab->id = g_next_id++;
ab->b = b;
droiddeck_dmabuf_ref(b);
ab->ahb = ahb;
ab->w = bw; ab->h = bh;
ab->stride = d.stride ? d.stride : stride;
ab->image_count = image_count;
ab->format = d.format;
ab->modifier = modifier;
ab->client = c;
ab->resource = buffer;
ab->resource_destroy.notify = on_buffer_resource_destroyed;
wl_resource_add_destroy_listener(buffer, &ab->resource_destroy);
ab->fence_fd = -1;
wl_list_insert(g_bufs.prev, &ab->link);
*droiddeck_dmabuf_ahb_slot(b) = ab;
if (g_last_chain.client != c || g_last_chain.w != bw || g_last_chain.h != bh ||
g_last_chain.image_count != image_count || g_last_chain.modifier != modifier || g_last_chain.format != d.format) {
char count[32] = "";
if (image_count) snprintf(count, sizeof(count), "%u images, ", image_count);
g_last_chain = (struct chain_seen){c, bw, bh, image_count, modifier, d.format};
droiddeck_log("layer", "zero-copy: %s from %s (%s%dx%d, %s, %s, stride %u px)",
image_count ? "AHB swapchain" : "display buffers", droiddeck_client_name(c), count, bw, bh,
droiddeck_ahb_format_name(d.format), modifier == MOD_QCOM_COMPRESSED ? "UBWC (QCOM_COMPRESSED)"
: modifier == 0 ? "linear" : "unknown modifier", ab->stride);
}
return 0;
}
int ahb_swapchain_adopt(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b, AHardwareBuffer *ahb,
uint64_t modifier) {
if (!g_advertised || *droiddeck_dmabuf_ahb_slot(b)) return -1;
AHardwareBuffer_acquire(ahb);
if (adopt(c, buffer, b, ahb, 0, 0, modifier) != 0) { AHardwareBuffer_release(ahb); return -1; }
((struct ahb_buf *)*droiddeck_dmabuf_ahb_slot(b))->display = 1;
return 0;
}
AHardwareBuffer *ahb_swapchain_display_buffer(const struct dmabuf_buffer *b) {
struct ahb_buf *ab = b ? *droiddeck_dmabuf_ahb_slot((struct dmabuf_buffer *)b) : NULL;
return ab && ab->display ? ab->ahb : NULL;
}
static void ahb_destroy(struct wl_client *c, struct wl_resource *r) { wl_resource_destroy(r); }
static void ahb_attach(struct wl_client *c, struct wl_resource *r, struct wl_resource *buffer, int32_t sock,
@@ -349,13 +295,36 @@ static void ahb_attach(struct wl_client *c, struct wl_resource *r, struct wl_res
AHardwareBuffer_release(ahb);
return;
}
if (adopt(c, buffer, b, ahb, stride, image_count, modifier) != 0) {
AHardwareBuffer_release(ahb);
wl_client_post_no_memory(c);
struct ahb_buf *ab = calloc(1, sizeof(*ab));
if (!ab) { AHardwareBuffer_release(ahb); wl_client_post_no_memory(c); return; }
ab->id = g_next_id++;
ab->b = b;
droiddeck_dmabuf_ref(b);
ab->ahb = ahb;
ab->w = bw; ab->h = bh;
ab->stride = d.stride ? d.stride : stride;
ab->image_count = image_count;
ab->format = d.format;
ab->modifier = modifier;
ab->client = c;
ab->resource = buffer;
ab->resource_destroy.notify = on_buffer_resource_destroyed;
wl_resource_add_destroy_listener(buffer, &ab->resource_destroy);
ab->fence_fd = -1;
wl_list_insert(g_bufs.prev, &ab->link);
*slot = ab;
if (g_last_chain.client != c || g_last_chain.w != bw || g_last_chain.h != bh ||
g_last_chain.image_count != image_count || g_last_chain.modifier != modifier || g_last_chain.format != d.format) {
g_last_chain = (struct chain_seen){c, bw, bh, image_count, modifier, d.format};
droiddeck_log("layer", "zero-copy: AHB swapchain from %s (%u images, %dx%d, %s, %s, stride %u px)", droiddeck_client_name(c),
image_count, bw, bh, droiddeck_ahb_format_name(d.format), modifier == MOD_QCOM_COMPRESSED ? "UBWC (QCOM_COMPRESSED)"
: modifier == 0 ? "linear" : "unknown modifier", ab->stride);
}
}
static const struct droiddeck_ahb_v1_interface ahb_impl = {
static const struct banner_ahb_v1_interface ahb_impl = {
.destroy = ahb_destroy,
.attach = ahb_attach,
};
@@ -367,21 +336,20 @@ static void on_client_resource_destroyed(struct wl_resource *r) {
static void bind_ahb(struct wl_client *c, void *data, uint32_t ver, uint32_t id) {
static struct wl_client *last_named;
if (ver > 2) ver = 2;
struct wl_resource *r = wl_resource_create(c, &droiddeck_ahb_v1_interface, (int)ver, id);
struct wl_resource *r = wl_resource_create(c, &banner_ahb_v1_interface, (int)ver, id);
if (!r) { wl_client_post_no_memory(c); return; }
wl_resource_set_implementation(r, &ahb_impl, NULL, on_client_resource_destroyed);
wl_list_insert(&g_clients, wl_resource_get_link(r));
if (ver >= DROIDDECK_AHB_V1_MODE_SINCE_VERSION) droiddeck_ahb_v1_send_mode(r, g_zero_copy ? 1u : 0u);
if (ver >= BANNER_AHB_V1_MODE_SINCE_VERSION) banner_ahb_v1_send_mode(r, g_zero_copy ? 1u : 0u);
if (last_named != c) {
last_named = c;
droiddeck_log("layer", "zero-copy: %s bound droiddeck_ahb_v1 version %u (%s)", droiddeck_client_name(c), ver,
droiddeck_log("layer", "zero-copy: %s bound banner_ahb_v1 version %u (%s)", droiddeck_client_name(c), ver,
ver >= 2 ? "follows the live switch" : "version 1: decides from its launch environment only");
}
}
void ahb_swapchain_set_mode(int on, int live) {
on = on ? 1 : 0;
if (g_zero_copy != on) droiddeck_dmabuf_formats_stale();
g_zero_copy = on;
if (!g_advertised) {
if (live) droiddeck_log("layer", "zero-copy switched %s from the drawer, but no display layer is available on this device: no change",
@@ -393,8 +361,8 @@ void ahb_swapchain_set_mode(int on, int live) {
int told = 0;
struct wl_resource *r;
wl_resource_for_each(r, &g_clients) {
if (wl_resource_get_version(r) >= DROIDDECK_AHB_V1_MODE_SINCE_VERSION) {
droiddeck_ahb_v1_send_mode(r, (uint32_t)on);
if (wl_resource_get_version(r) >= BANNER_AHB_V1_MODE_SINCE_VERSION) {
banner_ahb_v1_send_mode(r, (uint32_t)on);
told++;
}
}
@@ -417,7 +385,7 @@ void ahb_swapchain_init(struct wl_display *display) {
wl_list_init(&g_bufs);
wl_list_init(&g_clients);
if (!sc_layer_available()) {
droiddeck_log("layer", "zero-copy: no display layer on this device (see the line above): droiddeck_ahb_v1 not advertised");
droiddeck_log("layer", "zero-copy: no display layer on this device (see the line above): banner_ahb_v1 not advertised");
return;
}
g_loop = wl_display_get_event_loop(display);
@@ -427,11 +395,11 @@ void ahb_swapchain_init(struct wl_display *display) {
return;
}
wl_event_loop_add_fd(g_loop, g_rel_pipe[0], WL_EVENT_READABLE, on_release_pipe, NULL);
if (!wl_global_create(display, &droiddeck_ahb_v1_interface, 2, NULL, bind_ahb)) {
droiddeck_log("error", "zero-copy: droiddeck_ahb_v1 global creation failed");
if (!wl_global_create(display, &banner_ahb_v1_interface, 2, NULL, bind_ahb)) {
droiddeck_log("error", "zero-copy: banner_ahb_v1 global creation failed");
return;
}
g_advertised = 1;
droiddeck_log("layer", "zero-copy: droiddeck_ahb_v1 version 2 advertised (games built for it present their own gralloc buffers while the switch is on)");
droiddeck_log("layer", "zero-copy: banner_ahb_v1 version 2 advertised (games built for it present their own gralloc buffers while the switch is on)");
ahb_swapchain_set_mode(g_zero_copy, 0);
}
@@ -2,21 +2,16 @@
#define AHB_SWAPCHAIN_H
#include <stddef.h>
#include <stdint.h>
#include <android/hardware_buffer.h>
#include <wayland-server.h>
struct dmabuf_buffer;
struct surface;
struct vkp_draw;
void ahb_swapchain_init(struct wl_display *display);
void ahb_swapchain_set_mode(int on, int live);
int ahb_swapchain_last_frame_age_ms(void);
int ahb_swapchain_has_ahb(const struct dmabuf_buffer *b);
int ahb_swapchain_adopt(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b, AHardwareBuffer *ahb,
uint64_t modifier);
AHardwareBuffer *ahb_swapchain_display_buffer(const struct dmabuf_buffer *b);
int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_w, int scene_h, const struct vkp_draw *draw);
int ahb_swapchain_present(struct dmabuf_buffer *b, struct surface *s, int scene_w, int scene_h);
int ahb_swapchain_defer_release(struct dmabuf_buffer *b, struct wl_resource *buffer, struct surface *s, int paced);
void ahb_swapchain_surface_gone(struct surface *s);
unsigned ahb_swapchain_stats_take(void);
@@ -1,72 +0,0 @@
#define _GNU_SOURCE
#include "clock_domain.h"
#include <fcntl.h>
#include <pthread.h>
#include <stdint.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
static const int64_t *g_shift;
static pthread_mutex_t g_control_lock = PTHREAD_MUTEX_INITIALIZER;
static dev_t g_device;
static ino_t g_inode;
void droiddeck_clock_domain_set_control(const char *path) {
int fd;
struct stat st;
pthread_mutex_lock(&g_control_lock);
if (!path || !*path) {
const int64_t *previous = g_shift;
g_shift = NULL;
if (previous) munmap((void *)previous, sizeof(*previous));
pthread_mutex_unlock(&g_control_lock);
return;
}
fd = open(path, O_RDONLY | O_CLOEXEC);
if (fd < 0 || fstat(fd, &st) != 0 || st.st_size < (off_t)sizeof(int64_t)) {
if (fd >= 0) close(fd);
pthread_mutex_unlock(&g_control_lock);
return;
}
if (g_shift && st.st_dev == g_device && st.st_ino == g_inode) {
close(fd);
pthread_mutex_unlock(&g_control_lock);
return;
}
const int64_t *shift = mmap(NULL, sizeof(*shift), PROT_READ, MAP_SHARED, fd, 0);
close(fd);
if (shift != MAP_FAILED) {
g_device = st.st_dev;
g_inode = st.st_ino;
const int64_t *previous = g_shift;
g_shift = shift;
if (previous) munmap((void *)previous, sizeof(*previous));
}
pthread_mutex_unlock(&g_control_lock);
}
static int64_t shift_ns(void) {
pthread_mutex_lock(&g_control_lock);
const int64_t *mapping = g_shift;
int64_t shift = mapping ? __atomic_load_n(mapping, __ATOMIC_RELAXED) : 0;
pthread_mutex_unlock(&g_control_lock);
return shift > 0 ? shift : 0;
}
int64_t droiddeck_clock_domain_adjust_ns(int64_t value) {
int64_t shift = shift_ns();
return value > shift ? value - shift : 0;
}
int64_t droiddeck_clock_domain_now_ns(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return droiddeck_clock_domain_adjust_ns((int64_t)ts.tv_sec * 1000000000LL + ts.tv_nsec);
}
uint32_t droiddeck_clock_domain_now_ms(void) {
return (uint32_t)(droiddeck_clock_domain_now_ns() / 1000000LL);
}
@@ -1,11 +0,0 @@
#ifndef DROIDDECK_CLOCK_DOMAIN_H
#define DROIDDECK_CLOCK_DOMAIN_H
#include <stdint.h>
void droiddeck_clock_domain_set_control(const char *path);
int64_t droiddeck_clock_domain_now_ns(void);
uint32_t droiddeck_clock_domain_now_ms(void);
int64_t droiddeck_clock_domain_adjust_ns(int64_t value);
#endif
File diff suppressed because it is too large. Load diff
@@ -20,7 +20,6 @@
#define DRM_XBGR8888 FOURCC('X', 'B', '2', '4')
#define MOD_LINEAR VKP_MOD_LINEAR
#define MOD_INVALID VKP_MOD_INVALID
#define MOD_QCOM_COMPRESSED VKP_MOD_QCOM_COMPRESSED
#define MAX_PLANES 4
struct dmabuf_params {
@@ -1,343 +0,0 @@
#define _GNU_SOURCE
#include "display_buffers.h"
#include "ahb_swapchain.h"
#include "compositor_internal.h"
#include "droiddeck_color.h"
#include "droiddeck_ext.h"
#include "sc_layer.h"
#include <android/hardware_buffer.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
#define DISPLAY_BUFFERS_SOCKET "droiddeck-display-buffers"
#define DISPLAY_BUFFERS_MAGIC 0x42444444u
#define DISPLAY_BUFFERS_VERSION 1u
#define DISPLAY_BUFFERS_ALLOC 1u
#define DISPLAY_BUFFERS_FREE 2u
#define DISPLAY_BUFFERS_MAX_SIDE 16384u
#define DISPLAY_BUFFERS_MAX_PER_CLIENT 256
#define DISPLAY_BUFFERS_PROBE_W 1280u
#define DISPLAY_BUFFERS_PROBE_H 720u
#define ALIGN_UP(v, a) (((v) + (a) - 1) / (a) * (a))
extern volatile int g_zero_copy;
volatile int g_display_buffer_driver;
struct display_buffers_request {
uint32_t magic, version, op, width, height, format, stride, offset;
uint64_t size, id, modifier;
};
struct display_buffers_reply {
uint32_t magic, status;
uint64_t id, size;
};
struct peer {
int fd;
pid_t pid;
int count;
int logged_w, logged_h;
uint32_t logged_format;
struct wl_event_source *src;
};
struct entry {
uint64_t id;
dev_t dev;
ino_t ino;
AHardwareBuffer *ahb;
uint32_t format, stride, width, height;
uint64_t modifier;
struct peer *peer;
struct wl_list link;
};
static struct wl_list g_entries;
static struct wl_event_loop *g_loop;
static uint64_t g_next_id = 1;
static int g_refused_logged;
static int g_ubwc_promised;
static int g_ubwc_probed[2];
static uint32_t ahb_format_of(uint32_t drm, uint64_t modifier) {
switch (drm) {
case DRM_ABGR8888: case DRM_XBGR8888: return AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
case DRM_ARGB8888: case DRM_XRGB8888: return modifier == MOD_QCOM_COMPRESSED ? AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM : 0;
case FOURCC('A', 'B', '3', '0'): case FOURCC('X', 'B', '3', '0'): return AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM;
default: return 0;
}
}
static uint64_t ubwc_meta_size(uint32_t w, uint32_t h) {
return ALIGN_UP((uint64_t)ALIGN_UP((w + 15) / 16, 64) * ALIGN_UP((h + 3) / 4, 16), 4096);
}
static uint64_t ubwc_size(uint32_t w, uint32_t h, uint32_t stride) {
return ubwc_meta_size(w, h) + ALIGN_UP((uint64_t)stride * ALIGN_UP(h, 16), 4096);
}
static void entry_free(struct entry *e) {
wl_list_remove(&e->link);
e->peer->count--;
AHardwareBuffer_release(e->ahb);
free(e);
}
static AHardwareBuffer *allocate_ubwc(uint32_t w, uint32_t h, uint32_t format, uint32_t stride, int *fd, uint64_t *size) {
const uint64_t tiers[2] = {SC_LAYER_AHB_USAGE_VENDOR_UBWC, 0};
for (int i = 0; i < 2; i++) {
AHardwareBuffer_Desc d = {
.width = w, .height = h, .layers = 1, .format = format,
.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY | tiers[i]};
AHardwareBuffer *ahb = NULL;
if (AHardwareBuffer_allocate(&d, &ahb) != 0 || !ahb) continue;
AHardwareBuffer_Desc got;
AHardwareBuffer_describe(ahb, &got);
const uint64_t need = ubwc_size(w, h, got.stride * 4);
*fd = !stride || (uint64_t)got.stride * 4 == stride ? sc_layer_ahb_fd(ahb, need) : -1;
if (*fd >= 0 && (uint64_t)lseek(*fd, 0, SEEK_END) == need) { *size = need; return ahb; }
*fd = -1;
AHardwareBuffer_release(ahb);
}
return NULL;
}
static uint64_t gralloc_bytes(uint32_t format, uint64_t usage, uint32_t *stride) {
AHardwareBuffer_Desc d = {
.width = DISPLAY_BUFFERS_PROBE_W, .height = DISPLAY_BUFFERS_PROBE_H, .layers = 1, .format = format,
.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY | usage};
AHardwareBuffer *ahb = NULL;
if (AHardwareBuffer_allocate(&d, &ahb) != 0 || !ahb) return 0;
AHardwareBuffer_describe(ahb, &d);
const int fd = sc_layer_ahb_fd(ahb, 1);
const off_t bytes = fd >= 0 ? lseek(fd, 0, SEEK_END) : 0;
if (fd >= 0) lseek(fd, 0, SEEK_SET);
AHardwareBuffer_release(ahb);
*stride = d.stride;
return bytes > 0 ? (uint64_t)bytes : 0;
}
static int ubwc_probe(uint32_t format) {
int *state = &g_ubwc_probed[format == AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM ? 0 : 1];
if (*state) return *state > 0;
uint32_t stride = 0, linear_stride = 0;
const uint64_t flagged = gralloc_bytes(format, SC_LAYER_AHB_USAGE_VENDOR_UBWC, &stride);
const uint64_t plain = gralloc_bytes(format, 0, &stride);
const uint64_t linear = gralloc_bytes(format, AHARDWAREBUFFER_USAGE_CPU_READ_RARELY, &linear_stride);
const uint64_t need = ubwc_size(DISPLAY_BUFFERS_PROBE_W, DISPLAY_BUFFERS_PROBE_H, stride * 4);
*state = stride && linear != need && (flagged == need || plain == need) ? 1 : -1;
droiddeck_log("layer", "display buffers: gralloc %s buffers %s (%ux%u: the layout takes %llu bytes; gralloc gives %llu "
"asked for UBWC, %llu unasked, %llu linear)", droiddeck_ahb_format_name(format),
*state > 0 ? "use the UBWC layout the drivers render to: compressed frames can go on the display layer"
: "do not match the UBWC layout the drivers render to: compressed frames are not offered",
DISPLAY_BUFFERS_PROBE_W, DISPLAY_BUFFERS_PROBE_H, (unsigned long long)need, (unsigned long long)flagged,
(unsigned long long)plain, (unsigned long long)linear);
return *state > 0;
}
int display_buffers_offer_ubwc(uint32_t drm) {
const uint32_t format = ahb_format_of(drm, MOD_QCOM_COMPRESSED);
if (!g_loop || !g_zero_copy || !g_ubwc || !g_display_buffer_driver || !format || !ubwc_probe(format)) return 0;
g_ubwc_promised = 1;
return 1;
}
void display_buffers_withdraw_ubwc(void) { g_ubwc_promised = 0; }
static AHardwareBuffer *allocate(const struct display_buffers_request *q, uint32_t format, int *fd) {
const uint32_t rows = (uint32_t)((q->size + q->stride - 1) / q->stride);
const uint32_t dims[2][2] = {{q->width, q->height}, {q->stride / 4, rows}};
for (int i = 0; i < 2; i++) {
AHardwareBuffer_Desc d = {
.width = dims[i][0], .height = dims[i][1], .layers = 1, .format = format,
.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY | AHARDWAREBUFFER_USAGE_CPU_READ_RARELY};
AHardwareBuffer *ahb = NULL;
if (i && dims[1][0] == dims[0][0] && dims[1][1] == dims[0][1]) break;
if (AHardwareBuffer_allocate(&d, &ahb) != 0 || !ahb) continue;
AHardwareBuffer_Desc got;
AHardwareBuffer_describe(ahb, &got);
*fd = (uint64_t)got.stride * 4 == q->stride ? sc_layer_ahb_fd(ahb, q->size) : -1;
if (*fd >= 0) return ahb;
AHardwareBuffer_release(ahb);
}
return NULL;
}
static int reply(struct peer *p, const struct display_buffers_reply *r, int fd) {
char control[CMSG_SPACE(sizeof(int))] = {0};
struct iovec iov = {.iov_base = (void *)r, .iov_len = sizeof(*r)};
struct msghdr msg = {.msg_iov = &iov, .msg_iovlen = 1};
if (fd >= 0) {
msg.msg_control = control;
msg.msg_controllen = sizeof(control);
struct cmsghdr *c = CMSG_FIRSTHDR(&msg);
c->cmsg_level = SOL_SOCKET;
c->cmsg_type = SCM_RIGHTS;
c->cmsg_len = CMSG_LEN(sizeof(int));
memcpy(CMSG_DATA(c), &fd, sizeof(int));
}
ssize_t n;
do { n = sendmsg(p->fd, &msg, MSG_NOSIGNAL); } while (n < 0 && errno == EINTR);
return n == (ssize_t)sizeof(*r) ? 0 : -1;
}
static void handle_alloc(struct peer *p, const struct display_buffers_request *q) {
struct display_buffers_reply r = {.magic = DISPLAY_BUFFERS_MAGIC, .status = 1};
const int compressed = q->modifier == MOD_QCOM_COMPRESSED;
const uint32_t format = compressed || q->modifier == MOD_LINEAR ? ahb_format_of(q->format, q->modifier) : 0;
struct entry *e = NULL;
AHardwareBuffer *ahb = NULL;
struct stat st;
uint64_t need = 0;
int fd = -1;
const int sized = format && q->width && q->height && q->width <= DISPLAY_BUFFERS_MAX_SIDE &&
q->height <= DISPLAY_BUFFERS_MAX_SIDE && q->stride % 4 == 0 && q->stride / 4 >= q->width &&
q->stride / 4 <= DISPLAY_BUFFERS_MAX_SIDE;
const int sane = !sized ? 0
: compressed ? q->offset == ubwc_meta_size(q->width, q->height) &&
q->size == ubwc_size(q->width, q->height, q->stride)
: q->offset == 0 && q->size >= (uint64_t)q->stride * q->height &&
q->size <= (uint64_t)q->stride * DISPLAY_BUFFERS_MAX_SIDE;
const int wanted = compressed ? g_ubwc_promised : g_zero_copy;
if (sane && wanted && ahb_swapchain_advertised() && p->count < DISPLAY_BUFFERS_MAX_PER_CLIENT)
ahb = compressed ? allocate_ubwc(q->width, q->height, format, q->stride, &fd, &need) : allocate(q, format, &fd);
if (ahb && fstat(fd, &st) == 0) e = calloc(1, sizeof(*e));
if (e) {
e->id = r.id = g_next_id++;
e->dev = st.st_dev; e->ino = st.st_ino;
e->ahb = ahb;
e->format = format; e->stride = q->stride;
e->width = q->width; e->height = q->height;
e->modifier = q->modifier;
e->peer = p;
p->count++;
wl_list_insert(&g_entries, &e->link);
r.status = 0;
r.size = (uint64_t)lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
if (p->logged_w != (int)q->width || p->logged_h != (int)q->height || p->logged_format != q->format) {
AHardwareBuffer_Desc got;
AHardwareBuffer_describe(ahb, &got);
p->logged_w = (int)q->width; p->logged_h = (int)q->height; p->logged_format = q->format;
droiddeck_log("layer", "display buffers: pid %d renders %ux%u %c%c%c%c %s straight into gralloc buffers "
"(%s %ux%u, stride %u px, %llu bytes for the %llu it asked for)", (int)p->pid, q->width, q->height,
q->format & 0xff, (q->format >> 8) & 0xff, (q->format >> 16) & 0xff, (q->format >> 24) & 0xff,
compressed ? "UBWC" : "linear", droiddeck_ahb_format_name(format), got.width, got.height,
got.stride, (unsigned long long)r.size, (unsigned long long)q->size);
}
} else {
if (ahb) AHardwareBuffer_release(ahb);
fd = -1;
if (sized && wanted && (compressed || !g_refused_logged)) {
g_refused_logged = 1;
droiddeck_log(compressed ? "error" : "layer", "display buffers: no gralloc buffer matches pid %d's %ux%u "
"%c%c%c%c %s layout (stride %u bytes, pixels at %u, %llu bytes; gralloc's layout has pixels at "
"%llu, %llu bytes): %s", (int)p->pid, q->width, q->height,
q->format & 0xff, (q->format >> 8) & 0xff, (q->format >> 16) & 0xff, (q->format >> 24) & 0xff,
compressed ? "UBWC" : "linear", q->stride, q->offset, (unsigned long long)q->size,
(unsigned long long)(compressed ? ubwc_meta_size(q->width, q->height) : 0),
(unsigned long long)(compressed ? ubwc_size(q->width, q->height, q->stride) : q->size),
compressed ? "its compressed frames cannot be shown" : "its frames keep the copy path");
}
}
if (reply(p, &r, fd) != 0 && e) entry_free(e);
}
static void peer_gone(struct peer *p) {
struct entry *e, *tmp;
wl_list_for_each_safe(e, tmp, &g_entries, link)
if (e->peer == p) entry_free(e);
wl_event_source_remove(p->src);
close(p->fd);
free(p);
}
static int on_peer(int fd, uint32_t mask, void *data) {
struct peer *p = data;
for (;;) {
struct display_buffers_request q;
ssize_t n = recv(fd, &q, sizeof(q), MSG_DONTWAIT);
if (n < 0 && errno == EINTR) continue;
if (n < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) return 0;
if (n != (ssize_t)sizeof(q) || q.magic != DISPLAY_BUFFERS_MAGIC || q.version != DISPLAY_BUFFERS_VERSION) break;
if (q.op == DISPLAY_BUFFERS_ALLOC) {
handle_alloc(p, &q);
} else if (q.op == DISPLAY_BUFFERS_FREE) {
struct entry *e, *tmp;
wl_list_for_each_safe(e, tmp, &g_entries, link)
if (e->peer == p && e->id == q.id) entry_free(e);
} else {
break;
}
}
peer_gone(p);
return 0;
}
static int on_listen(int fd, uint32_t mask, void *data) {
int c = accept4(fd, NULL, NULL, SOCK_CLOEXEC | SOCK_NONBLOCK);
if (c < 0) return 0;
struct peer *p = calloc(1, sizeof(*p));
if (!p) { close(c); return 0; }
struct ucred cred = {0};
socklen_t len = sizeof(cred);
if (getsockopt(c, SOL_SOCKET, SO_PEERCRED, &cred, &len) == 0) p->pid = cred.pid;
p->fd = c;
p->src = wl_event_loop_add_fd(g_loop, c, WL_EVENT_READABLE, on_peer, p);
if (!p->src) { close(c); free(p); }
return 0;
}
void display_buffers_match(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b) {
struct stat st;
struct entry *e;
if (!g_loop || wl_list_empty(&g_entries) || b->n_planes != 1 || b->offset[0] != 0 || fstat(b->fd[0], &st) != 0) return;
wl_list_for_each(e, &g_entries, link) {
if (e->dev != st.st_dev || e->ino != st.st_ino) continue;
AHardwareBuffer_Desc d;
AHardwareBuffer_describe(e->ahb, &d);
const int compressed = e->modifier == MOD_QCOM_COMPRESSED;
const int laid_out = compressed ? b->modifier == MOD_QCOM_COMPRESSED && (uint32_t)b->width == e->width &&
(uint32_t)b->height == e->height
: (b->modifier == MOD_LINEAR || b->modifier == MOD_INVALID) &&
e->stride == b->stride[0];
if (laid_out && e->format == ahb_format_of(b->format, e->modifier) && b->width > 0 && b->height > 0 &&
(uint32_t)b->width <= d.width && (uint32_t)b->height <= d.height)
ahb_swapchain_adopt(c, buffer, b, e->ahb, e->modifier);
return;
}
}
void display_buffers_init(struct wl_display *display) {
wl_list_init(&g_entries);
const char *dir = getenv("XDG_RUNTIME_DIR");
struct sockaddr_un addr = {.sun_family = AF_UNIX};
if (!ahb_swapchain_advertised() || !dir) return;
if (snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/" DISPLAY_BUFFERS_SOCKET, dir) >= (int)sizeof(addr.sun_path)) {
droiddeck_log("layer", "display buffers: %s is too long for a socket path, not offered", dir);
return;
}
int fd = socket(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC | SOCK_NONBLOCK, 0);
if (fd < 0) return;
unlink(addr.sun_path);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0 || listen(fd, 16) != 0 ||
!wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, on_listen, NULL)) {
droiddeck_log("layer", "display buffers: socket %s failed (%s), not offered", addr.sun_path, strerror(errno));
close(fd);
return;
}
g_loop = loop;
droiddeck_log("layer", "display buffers: offered on %s (programs whose driver asks render into gralloc buffers while "
"zero-copy is on)", addr.sun_path);
}
@@ -1,12 +0,0 @@
#ifndef DISPLAY_BUFFERS_H
#define DISPLAY_BUFFERS_H
#include <wayland-server.h>
struct dmabuf_buffer;
void display_buffers_init(struct wl_display *display);
int display_buffers_offer_ubwc(uint32_t drm);
void display_buffers_withdraw_ubwc(void);
void display_buffers_match(struct wl_client *c, struct wl_resource *buffer, struct dmabuf_buffer *b);
#endif
@@ -16,9 +16,6 @@ struct droiddeck_color {
float max_lum, min_lum;
int has_cta861;
float max_cll, max_fall;
int convert;
float to2020[9];
float gain;
char text[256];
};
+44 -184
View File
@@ -17,12 +17,7 @@
#include "cas_frag.h"
#include "color_frag.h"
#include "fxaa_frag.h"
#include "fxaa_toon_frag.h"
#include "smaa_edge_frag.h"
#include "smaa_weights_frag.h"
#include "smaa_blend_frag.h"
#include "toon_frag.h"
#include "toon_color_frag.h"
#include "hdr_frag.h"
#include "ntsc_frag.h"
#include "crt_frag.h"
@@ -34,7 +29,6 @@
static VkFormat g_fx_fmt = FX_FORMAT, g_scene_fmt = FX_FORMAT;
static int g_scene_is_pq;
#define FX_MAX_DIM 4096
@@ -47,7 +41,7 @@ struct fx_settings {
int color_on;
float brightness, contrast, gamma, saturation;
float b_raw, c_raw, s_raw;
int aa_mode, toon, crt, ntsc;
int fxaa, toon, crt, ntsc;
char look[48];
};
@@ -84,7 +78,7 @@ void vkp_effects_set_deband(int enabled, int pct) {
}
static float clampf(float v, float lo, float hi) { return v < lo ? lo : v > hi ? hi : v; }
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
int aa_mode, int toon, int crt, int ntsc) {
int fxaa, int toon, int crt, int ntsc) {
int on = !(brightness == 0.0f && contrast == 0.0f && gamma == 1.0f && saturation == 100.0f);
set_begin();
g_set.color_on = on;
@@ -93,8 +87,7 @@ void vkp_effects_set_screen(float brightness, float contrast, float gamma, float
g_set.contrast = clampf(contrast / 100.0f, 0.0f, 2.0f);
g_set.saturation = clampf(saturation / 100.0f, 0.0f, 2.0f);
g_set.gamma = clampf(gamma, 0.1f, 5.0f);
g_set.aa_mode = (aa_mode >= 0 && aa_mode <= 2) ? aa_mode : 0;
g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
g_set.fxaa = fxaa ? 1 : 0; g_set.toon = toon ? 1 : 0; g_set.crt = crt ? 1 : 0; g_set.ntsc = ntsc ? 1 : 0;
set_end();
}
void vkp_effects_set_look(const char *name) {
@@ -109,12 +102,10 @@ static const char *scaling_name(int m) {
}
static int spatial_mode(int m) { return m >= 3 && m <= 8; }
static int cas_active(const struct fx_settings *s) { return s->cas_on && s->cas_pct > 0; }
static int deband_active(const struct fx_settings *s) { return s->deband_on && s->deband_pct > 0; }
static int effect_count(const struct fx_settings *s) {
return (s->aa_mode != 0) + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + deband_active(s);
return s->fxaa + s->toon + s->color_on + cas_active(s) + s->hdr_on + s->ntsc + s->crt + s->deband_on;
}
static void log_settings(const struct fx_settings *s) {
char line[400];
int n;
@@ -130,13 +121,12 @@ static void log_settings(const struct fx_settings *s) {
if (s->color_on)
n += snprintf(line + n, sizeof(line) - n, ", colour b=%+.0f c=%+.0f g=%.2f s=%.0f%%",
s->b_raw, s->c_raw, s->gamma, s->s_raw);
if (s->aa_mode == 1) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
else if (s->aa_mode == 2) n += snprintf(line + n, sizeof(line) - n, ", SMAA on");
if (s->fxaa) n += snprintf(line + n, sizeof(line) - n, ", FXAA on");
if (s->toon) n += snprintf(line + n, sizeof(line) - n, ", Toon on");
if (s->hdr_on) n += snprintf(line + n, sizeof(line) - n, ", HDR on");
if (s->ntsc) n += snprintf(line + n, sizeof(line) - n, ", NTSC on");
if (s->crt) n += snprintf(line + n, sizeof(line) - n, ", CRT on");
if (deband_active(s)) n += snprintf(line + n, sizeof(line) - n, ", Deband on %d%%", s->deband_pct);
if (s->deband_on) n += snprintf(line + n, sizeof(line) - n, ", Deband on %d%%", s->deband_pct);
(void)n;
droiddeck_log("effects", "%s", line);
}
@@ -162,10 +152,6 @@ int vkp_effects_upscaling(void) {
return spatial_mode(g_cur.scaling) && g_cur.scaling != 6;
}
int vkp_effects_sharpening(void) {
return vkp_effects_upscaling() || cas_active(&g_cur);
}
int vkp_effects_postprocessing(void) {
vkp_effects_sync();
return effect_count(&g_cur) > 0;
@@ -183,11 +169,6 @@ struct pc_easu { float ndc[4]; uint32_t con0[4], con1[4], con2[4], con3[4]; flo
struct pc_rcas { float ndc[4]; uint32_t con[4]; float outW, outH; };
struct pc_res { float ndc[4]; float res[2]; float extra; float pad; };
struct pc_color { float ndc[4]; float b, c, g, s; };
struct pc_toon_color {
float ndc[4]; float res[2]; float b, c, g, s;
};
_Static_assert(sizeof(struct pc_toon_color) == 40,
"toon_color push constants layout mismatch");
#define PC_MAX_SIZE sizeof(struct pc_easu)
static uint32_t packf(float f) { uint32_t u; memcpy(&u, &f, 4); return u; }
@@ -216,16 +197,17 @@ static VkDevice g_dev;
static VkPhysicalDevice g_pd;
static VkPhysicalDeviceMemoryProperties g_mp;
static int g_ready;
static VkRenderPass g_rp, g_smaa_rp;
static VkRenderPass g_rp;
static VkDescriptorSetLayout g_dsl;
static VkPipelineLayout g_pl;
static VkDescriptorPool g_dpool;
static VkSampler g_sampler;
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_FXAA_TOON, P_SMAA_EDGE, P_SMAA_WEIGHTS, P_SMAA_BLEND, P_TOON, P_TOON_COLOR, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_TOON, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_COUNT };
static VkPipeline g_pipe[P_COUNT];
static struct fx_target g_t[2], g_mid, g_smaa_edges, g_smaa_weights;
static struct fx_target g_t[2], g_mid;
static struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } g_scene;
static uint32_t g_ntsc_frame;
void vkp_effects_bind_device(VkDevice dev, VkPhysicalDevice pd,
const VkPhysicalDeviceMemoryProperties *memprops) {
@@ -271,20 +253,15 @@ static void target_destroy(struct fx_target *t) {
memset(t, 0, sizeof(*t));
}
#define FX_TARGET_USAGE (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | \
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT)
#define FX_SCRATCH_USAGE (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT)
static int target_ensure_format(struct fx_target *t, int w, int h,
VkImageUsageFlags usage, const char *what,
VkFormat format, VkRenderPass render_pass) {
static int target_ensure(struct fx_target *t, int w, int h, const char *what) {
if (t->img && t->w == w && t->h == h) return 0;
target_destroy(t);
VkImageCreateInfo ii = {.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
.flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, .imageType = VK_IMAGE_TYPE_2D,
.format = format, .extent = {(uint32_t)w, (uint32_t)h, 1}, .mipLevels = 1,
.format = g_fx_fmt, .extent = {(uint32_t)w, (uint32_t)h, 1}, .mipLevels = 1,
.arrayLayers = 1, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL,
.usage = usage,
.usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED};
VkResult r = g_vk.CreateImage(g_dev, &ii, NULL, &t->img);
if (r != VK_SUCCESS) { droiddeck_log("error", "effects: %s image %dx%d: vkCreateImage %d", what, w, h, (int)r); return -1; }
@@ -301,8 +278,8 @@ static int target_ensure_format(struct fx_target *t, int w, int h,
target_destroy(t); return -1;
}
g_vk.BindImageMemory(g_dev, t->img, t->mem, 0);
if (!(t->view = make_view(t->img, format))) { target_destroy(t); return -1; }
VkFramebufferCreateInfo fi = {.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .renderPass = render_pass,
if (!(t->view = make_view(t->img, g_fx_fmt))) { target_destroy(t); return -1; }
VkFramebufferCreateInfo fi = {.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO, .renderPass = g_rp,
.attachmentCount = 1, .pAttachments = &t->view, .width = (uint32_t)w,
.height = (uint32_t)h, .layers = 1};
if (g_vk.CreateFramebuffer(g_dev, &fi, NULL, &t->fb) != VK_SUCCESS) { target_destroy(t); return -1; }
@@ -311,11 +288,6 @@ static int target_ensure_format(struct fx_target *t, int w, int h,
return 0;
}
static int target_ensure(struct fx_target *t, int w, int h,
VkImageUsageFlags usage, const char *what) {
return target_ensure_format(t, w, h, usage, what, g_fx_fmt, g_rp);
}
static void scene_release(void) {
if (g_scene.ds) g_vk.FreeDescriptorSets(g_dev, g_dpool, 1, &g_scene.ds);
if (g_scene.view) g_vk.DestroyImageView(g_dev, g_scene.view, NULL);
@@ -342,9 +314,7 @@ static VkShaderModule shader(const uint32_t *code, size_t size) {
return m;
}
static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert,
const uint32_t *frag_code, size_t frag_size, VkRenderPass render_pass,
const char *name) {
static VkPipeline post_pipeline(VkShaderModule vert, const uint32_t *frag_code, size_t frag_size, const char *name) {
VkShaderModule frag = shader(frag_code, frag_size);
if (!frag) { droiddeck_log("error", "effects: %s: vkCreateShaderModule failed", name); return VK_NULL_HANDLE; }
VkPipelineShaderStageCreateInfo st[2] = {
@@ -370,7 +340,7 @@ static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert,
.pStages = st, .pVertexInputState = &vi, .pInputAssemblyState = &ia,
.pViewportState = &vp, .pRasterizationState = &rs, .pMultisampleState = &ms,
.pColorBlendState = &cb, .pDynamicState = &ds, .layout = g_pl,
.renderPass = render_pass, .subpass = 0};
.renderPass = g_rp, .subpass = 0};
VkPipeline p = VK_NULL_HANDLE;
VkResult r = g_vk.CreateGraphicsPipelines(g_dev, VK_NULL_HANDLE, 1, &pi, NULL, &p);
g_vk.DestroyShaderModule(g_dev, frag, NULL);
@@ -378,32 +348,23 @@ static VkPipeline post_pipeline_for_renderpass(VkShaderModule vert,
return p;
}
static VkPipeline post_pipeline(VkShaderModule vert, const uint32_t *frag_code,
size_t frag_size, const char *name) {
return post_pipeline_for_renderpass(vert, frag_code, frag_size, g_rp, name);
}
static void objects_destroy(void) {
if (!g_dev) return;
scene_release();
target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid);
target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights);
for (int i = 0; i < P_COUNT; i++) { if (g_pipe[i]) g_vk.DestroyPipeline(g_dev, g_pipe[i], NULL); g_pipe[i] = VK_NULL_HANDLE; }
if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL);
if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL);
if (g_dsl) g_vk.DestroyDescriptorSetLayout(g_dev, g_dsl, NULL);
if (g_sampler) g_vk.DestroySampler(g_dev, g_sampler, NULL);
if (g_smaa_rp) g_vk.DestroyRenderPass(g_dev, g_smaa_rp, NULL);
if (g_rp) g_vk.DestroyRenderPass(g_dev, g_rp, NULL);
g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE; g_dsl = VK_NULL_HANDLE;
g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE; g_smaa_rp = VK_NULL_HANDLE;
g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE; g_dsl = VK_NULL_HANDLE; g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE;
g_ready = 0;
}
void vkp_effects_destroy(void) { objects_destroy(); g_dev = VK_NULL_HANDLE; }
void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt, int scene_is_pq) {
g_scene_is_pq = scene_is_pq != 0;
void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt) {
if (target_fmt != g_fx_fmt) {
if (g_ready) objects_destroy();
g_fx_fmt = target_fmt;
@@ -445,12 +406,6 @@ static int objects_ensure(void) {
.subpassCount = 1, .pSubpasses = &sub, .dependencyCount = 2, .pDependencies = deps};
if (g_vk.CreateRenderPass(g_dev, &rci, NULL, &g_rp) != VK_SUCCESS) goto fail;
VkAttachmentDescription smaa_att = att;
smaa_att.format = FX_FORMAT;
VkRenderPassCreateInfo smaa_rci = rci;
smaa_rci.pAttachments = &smaa_att;
if (g_vk.CreateRenderPass(g_dev, &smaa_rci, NULL, &g_smaa_rp) != VK_SUCCESS) goto fail;
VkSamplerCreateInfo sci = {.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO, .magFilter = VK_FILTER_LINEAR,
.minFilter = VK_FILTER_LINEAR, .mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST,
.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
@@ -463,8 +418,7 @@ static int objects_ensure(void) {
VkDescriptorSetLayoutCreateInfo dli = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO, .bindingCount = 1, .pBindings = &b};
if (g_vk.CreateDescriptorSetLayout(g_dev, &dli, NULL, &g_dsl) != VK_SUCCESS) goto fail;
VkPushConstantRange pcr = {.stageFlags = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, .offset = 0, .size = PC_MAX_SIZE};
VkDescriptorSetLayout set_layouts[2] = {g_dsl, g_dsl};
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = set_layouts,
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 1, .pSetLayouts = &g_dsl,
.pushConstantRangeCount = 1, .pPushConstantRanges = &pcr};
if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl) != VK_SUCCESS) goto fail;
VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 8};
@@ -484,16 +438,7 @@ static int objects_ensure(void) {
MK(P_CAS, cas_code, "cas");
MK(P_COLOR, color_code, "color");
MK(P_FXAA, fxaa_code, "fxaa");
MK(P_FXAA_TOON, fxaa_toon_code, "fxaa_toon");
g_pipe[P_SMAA_EDGE] = post_pipeline_for_renderpass(
vert, smaa_edge_code, sizeof(smaa_edge_code), g_smaa_rp, "smaa_edge");
if (!g_pipe[P_SMAA_EDGE]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; }
g_pipe[P_SMAA_WEIGHTS] = post_pipeline_for_renderpass(
vert, smaa_weights_code, sizeof(smaa_weights_code), g_smaa_rp, "smaa_weights");
if (!g_pipe[P_SMAA_WEIGHTS]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; }
MK(P_SMAA_BLEND, smaa_blend_code, "smaa_blend");
MK(P_TOON, toon_code, "toon");
MK(P_TOON_COLOR, toon_color_code, "toon_color");
MK(P_HDR, hdr_code, "hdr");
MK(P_NTSC, ntsc_code, "ntsc");
MK(P_CRT, crt_code, "crt");
@@ -501,7 +446,7 @@ static int objects_ensure(void) {
#undef MK
g_vk.DestroyShaderModule(g_dev, vert, NULL);
g_ready = 1;
droiddeck_log("effects", "chain ready: 16 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA edge/weights/blend, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
droiddeck_log("effects", "chain ready: 13 passes (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, Toon, HDR, NTSC, CRT, deband) on %s", vkp_gpu_name());
return 0;
fail:
objects_destroy();
@@ -521,33 +466,17 @@ static void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImag
g_vk.CmdPipelineBarrier(cmd, src_stage, dst_stage, 0, 0, NULL, 0, NULL, 1, &b);
}
static void pass_renderpass(VkCommandBuffer cmd, VkRenderPass render_pass,
VkPipeline p, struct fx_target *dst, VkDescriptorSet src,
static void pass(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst, VkDescriptorSet src,
const void *pc, uint32_t pcsz) {
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = render_pass, .framebuffer = dst->fb,
.renderArea = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}}};
g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE);
g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, p);
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 1, &src, 0, NULL);
g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, pcsz, pc);
g_vk.CmdDraw(cmd, 4, 1, 0, 0);
g_vk.CmdEndRenderPass(cmd);
}
static void pass(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst,
VkDescriptorSet src, const void *pc, uint32_t pcsz) {
pass_renderpass(cmd, g_rp, p, dst, src, pc, pcsz);
}
static void pass_dual(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst,
VkDescriptorSet src, VkDescriptorSet second,
const void *pc, uint32_t pcsz) {
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = g_rp, .framebuffer = dst->fb,
.renderArea = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}}};
VkDescriptorSet sets[2] = {src, second};
VkViewport vp = {0, 0, (float)dst->w, (float)dst->h, 0, 1};
VkRect2D sc = {{0, 0}, {(uint32_t)dst->w, (uint32_t)dst->h}};
g_vk.CmdBeginRenderPass(cmd, &rpi, VK_SUBPASS_CONTENTS_INLINE);
g_vk.CmdSetViewport(cmd, 0, 1, &vp);
g_vk.CmdSetScissor(cmd, 0, 1, &sc);
g_vk.CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, p);
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 2, sets, 0, NULL);
g_vk.CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, g_pl, 0, 1, &src, 0, NULL);
g_vk.CmdPushConstants(cmd, g_pl, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, pcsz, pc);
g_vk.CmdDraw(cmd, 4, 1, 0, 0);
g_vk.CmdEndRenderPass(cmd);
@@ -558,13 +487,9 @@ static const float FULL_NDC[4] = {-1.0f, -1.0f, 1.0f, 1.0f};
VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
int out_w, int out_h, int *res_w, int *res_h) {
struct fx_settings snapshot;
const struct fx_settings *s;
vkp_effects_sync();
pthread_mutex_lock(&g_lock);
snapshot = g_cur;
pthread_mutex_unlock(&g_lock);
s = &snapshot;
s = &g_cur;
*res_w = scene_w; *res_h = scene_h;
int cw = out_w > 0 ? out_w : scene_w, ch = out_h > 0 ? out_h : scene_h;
@@ -575,53 +500,18 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
const int upscaling = cw > scene_w || ch > scene_h;
int spatial = 0;
if (spatial_mode(s->scaling) && (s->scaling == 6 || upscaling)) spatial = s->scaling;
/* NIS here is the SDR implementation and is documented for <=2x upscales. */
const int nis_fallback = spatial == 7 &&
(g_scene_is_pq || cw < scene_w || ch < scene_h ||
(double)cw > (double)scene_w * 2.0 ||
(double)ch > (double)scene_h * 2.0);
static int last_nis_fallback = 0;
const int was_nis_fallback =
__atomic_exchange_n(&last_nis_fallback, nis_fallback, __ATOMIC_RELAXED);
if (nis_fallback) {
spatial = 4; /* FSR fallback; keep the saved NIS selection unchanged. */
if (!was_nis_fallback)
droiddeck_log("effects", "NIS unsupported for this output; FSR fallback active");
} else if (was_nis_fallback && s->scaling == 7) {
droiddeck_log("effects", "NIS supported again; NIS active");
}
const int nfx = effect_count(s);
const int resize = cw != scene_w || ch != scene_h;
const int fuse_toon_color = s->toon && s->color_on && g_fx_fmt == FX_FORMAT;
const int fuse_fxaa_toon = 0;
const int chain_passes = ((spatial || resize) ? 1 : 0) +
effect_count(s) - (fuse_toon_color ? 1 : 0) -
(fuse_fxaa_toon ? 1 : 0);
const int npasses = ((spatial || resize) ? 1 : 0) + nfx;
if ((spatial || nfx) && objects_ensure() == 0 && scene_ensure(scene, scene_w, scene_h) == 0 &&
target_ensure(&g_t[0], cw, ch, FX_TARGET_USAGE, "chain") == 0 && (chain_passes < 2 || target_ensure(&g_t[1], cw, ch, FX_TARGET_USAGE, "chain") == 0) &&
(!(spatial == 4 || spatial == 5) || s->sharp_pct == 0 ||
target_ensure(&g_mid, cw, ch, FX_SCRATCH_USAGE, "EASU") == 0)) {
if (s->aa_mode == 2 &&
(target_ensure_format(&g_smaa_edges, cw, ch, FX_SCRATCH_USAGE,
"SMAA edges", FX_FORMAT, g_smaa_rp) != 0 ||
target_ensure_format(&g_smaa_weights, cw, ch, FX_SCRATCH_USAGE,
"SMAA weights", FX_FORMAT, g_smaa_rp) != 0)) {
droiddeck_log("error", "effects: SMAA scratch allocation failed; falling back to FXAA");
snapshot.aa_mode = 1;
s = &snapshot;
}
target_ensure(&g_t[0], cw, ch, "chain") == 0 && (npasses < 2 || target_ensure(&g_t[1], cw, ch, "chain") == 0) &&
(!(spatial == 4 || spatial == 5) || target_ensure(&g_mid, cw, ch, "EASU") == 0)) {
VkDescriptorSet cur_ds;
struct fx_target *cur = NULL;
#define FREE_TARGET() ((cur == &g_t[0]) ? &g_t[1] : &g_t[0])
const float sharp01 = (float)s->sharp_pct / 100.0f;
VkViewport chain_vp = {0, 0, (float)cw, (float)ch, 0, 1};
VkRect2D chain_sc = {{0, 0}, {(uint32_t)cw, (uint32_t)ch}};
g_vk.CmdSetViewport(cmd, 0, 1, &chain_vp);
g_vk.CmdSetScissor(cmd, 0, 1, &chain_sc);
if (spatial) {
barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
@@ -648,14 +538,11 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
SET_NDC(e);
easu_con(&e, (float)scene_w, (float)scene_h, (float)cw, (float)ch);
e.outW = (float)cw; e.outH = (float)ch;
struct fx_target *easu_dst = sharp01 == 0.0f ? dst : &g_mid;
pass(cmd, g_pipe[P_EASU], easu_dst, g_scene.ds, &e, sizeof(e));
if (sharp01 != 0.0f) {
SET_NDC(r);
rcas_con(&r, sharp01);
r.outW = (float)cw; r.outH = (float)ch;
pass(cmd, g_pipe[P_RCAS], dst, g_mid.ds, &r, sizeof(r));
}
pass(cmd, g_pipe[P_EASU], &g_mid, g_scene.ds, &e, sizeof(e));
SET_NDC(r);
rcas_con(&r, sharp01);
r.outW = (float)cw; r.outH = (float)ch;
pass(cmd, g_pipe[P_RCAS], dst, g_mid.ds, &r, sizeof(r));
}
cur = dst; cur_ds = dst->ds;
} else if (resize) {
@@ -668,7 +555,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
VkImageBlit bl = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .srcOffsets = {{0, 0, 0}, {scene_w, scene_h, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}, .dstOffsets = {{0, 0, 0}, {cw, ch, 1}}};
g_vk.CmdBlitImage(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst->img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
1, &bl, s->scaling == 2 ? VK_FILTER_NEAREST : VK_FILTER_LINEAR);
1, &bl, vkp_effects_blit_filter());
barrier(cmd, dst->img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
@@ -680,22 +567,16 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
cur = NULL; cur_ds = g_scene.ds;
}
enum { FX_FXAA, FX_FXAA_TOON, FX_SMAA, FX_TOON, FX_COLOR, FX_TOON_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
enum { FX_FXAA, FX_TOON, FX_COLOR, FX_CAS, FX_HDR, FX_NTSC, FX_CRT, FX_DEBAND };
int order[8], n = 0;
if (s->aa_mode == 1)
order[n++] = fuse_fxaa_toon ? FX_FXAA_TOON : FX_FXAA;
else if (s->aa_mode == 2) order[n++] = FX_SMAA;
if (s->toon && s->color_on && g_fx_fmt == FX_FORMAT) {
order[n++] = FX_TOON_COLOR;
} else {
if (s->toon && !fuse_fxaa_toon) order[n++] = FX_TOON;
if (s->color_on) order[n++] = FX_COLOR;
}
if (s->fxaa) order[n++] = FX_FXAA;
if (s->toon) order[n++] = FX_TOON;
if (s->color_on) order[n++] = FX_COLOR;
if (cas_active(s)) order[n++] = FX_CAS;
if (s->hdr_on) order[n++] = FX_HDR;
if (s->ntsc) order[n++] = FX_NTSC;
if (s->crt) order[n++] = FX_CRT;
if (deband_active(s)) order[n++] = FX_DEBAND;
if (s->deband_on) order[n++] = FX_DEBAND;
for (int i = 0; i < n; i++) {
struct fx_target *dst = FREE_TARGET();
struct pc_res pr = {0};
@@ -703,29 +584,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
pr.res[0] = (float)cw; pr.res[1] = (float)ch;
switch (order[i]) {
case FX_FXAA: pass(cmd, g_pipe[P_FXAA], dst, cur_ds, &pr, sizeof(pr)); break;
case FX_FXAA_TOON: pass(cmd, g_pipe[P_FXAA_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
case FX_SMAA:
pass_renderpass(cmd, g_smaa_rp, g_pipe[P_SMAA_EDGE],
&g_smaa_edges, cur_ds, &pr, sizeof(pr));
pass_renderpass(cmd, g_smaa_rp, g_pipe[P_SMAA_WEIGHTS],
&g_smaa_weights, g_smaa_edges.ds, &pr, sizeof(pr));
pass_dual(cmd, g_pipe[P_SMAA_BLEND], dst, cur_ds,
g_smaa_weights.ds, &pr, sizeof(pr));
break;
case FX_TOON: pass(cmd, g_pipe[P_TOON], dst, cur_ds, &pr, sizeof(pr)); break;
case FX_TOON_COLOR: {
struct pc_toon_color pc = {0};
SET_NDC(pc);
pc.res[0] = (float)cw;
pc.res[1] = (float)ch;
pc.b = s->brightness;
pc.c = s->contrast;
pc.g = s->gamma;
pc.s = s->saturation;
pass(cmd, g_pipe[P_TOON_COLOR], dst, cur_ds,
&pc, sizeof(pc));
break;
}
case FX_COLOR: {
struct pc_color pc = {0};
SET_NDC(pc);
@@ -736,6 +595,7 @@ VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int sce
case FX_CAS: pr.extra = (float)s->cas_pct / 100.0f; pass(cmd, g_pipe[P_CAS], dst, cur_ds, &pr, sizeof(pr)); break;
case FX_HDR: pass(cmd, g_pipe[P_HDR], dst, cur_ds, &pr, sizeof(pr)); break;
case FX_NTSC:
pr.extra = (float)(g_ntsc_frame++ & 3u);
pass(cmd, g_pipe[P_NTSC], dst, cur_ds, &pr, sizeof(pr));
break;
case FX_CRT: pass(cmd, g_pipe[P_CRT], dst, cur_ds, &pr, sizeof(pr)); break;
@@ -11,7 +11,6 @@ int vkp_effects_sync(void);
int vkp_effects_active(void);
int vkp_effects_upscaling(void);
int vkp_effects_sharpening(void);
int vkp_effects_postprocessing(void);
VkFilter vkp_effects_blit_filter(void);
@@ -23,7 +22,7 @@ void vkp_effects_destroy(void);
void vkp_effects_forget_image(VkImage img);
void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt, int scene_is_pq);
void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt);
void vkp_effects_set_scaling(int mode);
void vkp_effects_set_upscale_sharpness(int pct);
@@ -31,7 +30,7 @@ void vkp_effects_set_cas(int enabled, int pct);
void vkp_effects_set_hdr(int enabled);
void vkp_effects_set_deband(int enabled, int pct);
void vkp_effects_set_screen(float brightness, float contrast, float gamma, float saturation,
int aa_mode, int toon, int crt, int ntsc);
int fxaa, int toon, int crt, int ntsc);
void vkp_effects_set_look(const char *name);
#endif
@@ -33,9 +33,7 @@ static PFN_vkGetInstanceProcAddr g_gipa;
static VkPhysicalDevice g_pd;
static VkQueue g_queue;
static uint32_t g_qfam;
static _Atomic int g_dev_ready, g_dev_lost;
static int g_features_enabled;
static _Atomic int g_caps_lsfg_ok, g_caps_ddfg_ok;
static int g_dev_ready, g_dev_lost, g_features_enabled;
static VkPhysicalDeviceMemoryProperties g_memprops;
static struct {
PFN_vkCreateImage CreateImage;
@@ -143,12 +141,9 @@ static void mark_failed(int kind) {
}
int vkp_framegen_problem(void) {
if (!atomic_load(&g_dev_ready)) return -1;
if (!g_dev_ready) return -1;
int kind = atomic_load(&g_kind);
int caps_ok = kind == VKP_FG_ENGINE_DDFG
? atomic_load(&g_caps_ddfg_ok)
: atomic_load(&g_caps_lsfg_ok);
if (!caps_ok) return 1;
if (!fge_caps_ok(kind)) return 1;
if (start_failed_for(kind)) return 2;
if (g_engine_ok && g_engine_kind == kind && fge_unavailable()) return 2;
return 0;
@@ -184,17 +179,13 @@ void vkp_framegen_device_ready(VkDevice dev, VkQueue queue, uint32_t qfam, int f
#undef R
g_vk.GetPhysicalDeviceMemoryProperties(g_pd, &g_memprops);
fge_device_ready(g_gipa, g_inst, g_pd, dev, queue, qfam, features_enabled);
atomic_store(&g_caps_lsfg_ok, fge_caps_ok(VKP_FG_ENGINE_LSFG));
atomic_store(&g_caps_ddfg_ok, fge_caps_ok(VKP_FG_ENGINE_DDFG));
atomic_store(&g_dev_lost, 0);
atomic_store(&g_dev_ready,
vk.CreateImage && vk.CreateImageView && vk.CmdPipelineBarrier);
g_dev_ready = vk.CreateImage && vk.CreateImageView && vk.CmdPipelineBarrier;
FGLOG("engines ready on the compositor's device: LSFG Native %s (%s), DD-FG Native %s",
fge_caps_ok(VKP_FG_ENGINE_LSFG) ? "available" : "unavailable", fge_caps_reason(),
fge_caps_ok(VKP_FG_ENGINE_DDFG) ? "available" : "unavailable");
}
void vkp_framegen_device_lost(void) { atomic_store(&g_dev_lost, 1); }
void vkp_framegen_device_lost(void) { g_dev_lost = 1; }
static void destroy_ring(void) {
@@ -253,12 +244,7 @@ static int ensure_ring(uint32_t w, uint32_t h, VkFormat fmt, uint32_t n) {
static int engine_usable(void) {
int kind = atomic_load(&g_kind);
int ready = atomic_load(&g_dev_ready);
int lost = atomic_load(&g_dev_lost);
int caps_ok = kind == VKP_FG_ENGINE_DDFG
? atomic_load(&g_caps_ddfg_ok)
: atomic_load(&g_caps_lsfg_ok);
return ready && !lost && caps_ok && !start_failed_for(kind);
return g_dev_ready && !g_dev_lost && fge_caps_ok(kind) && !start_failed_for(kind);
}
int vkp_framegen_format_ok(VkFormat fmt) {
@@ -8,7 +8,7 @@
#include <android/log.h>
#include "VkDispatchTable.h"
#include "VulkanRendererContext.h"
#include "lsfg/lsfg_engine.h"
#include "lsfg/lsfg_probe.h"
#include "lsfg/lsfg_vkd.h"
@@ -50,12 +50,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeFrameGenCapsReason(J
return (*env)->NewStringUTF(env, r ? r : "");
}
JNIEXPORT jboolean JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeFrameGenActive(JNIEnv *env, jclass clazz) {
(void)env; (void)clazz;
return vkp_framegen_active() ? JNI_TRUE : JNI_FALSE;
}
JNIEXPORT jfloatArray JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeFrameGenStats(JNIEnv *env, jclass clazz) {
(void)clazz;
+2 -11
View File
@@ -12,7 +12,7 @@
#define MIXED_FORMAT VK_FORMAT_A2B10G10R10_UNORM_PACK32
struct pc_encode { float ndc[4]; float params[4]; uint32_t rects[HDRC_MAX_RECTS][2]; float conv[3][4]; };
struct pc_encode { float ndc[4]; float params[4]; float rects[HDRC_MAX_RECTS][4]; };
static VkDevice g_dev;
static int g_ready;
@@ -266,16 +266,7 @@ int hdrc_encode(VkCommandBuffer cmd, VkImage mixed, VkImage out, VkFormat out_fm
pc.params[1] = p->peak_nits > 0.0f ? p->peak_nits : 1000.0f;
pc.params[2] = p->mode == HDRC_OUT_SDR ? 1.0f : 0.0f;
pc.params[3] = (float)count + 16.0f * (float)mask;
for (int i = 0; i < count; i++) {
uint32_t v[4];
for (int k = 0; k < 4; k++) v[k] = p->rects[i][k] <= 0.0f ? 0u : p->rects[i][k] >= 65535.0f ? 65535u : (uint32_t)p->rects[i][k];
pc.rects[i][0] = v[0] | v[1] << 16;
pc.rects[i][1] = v[2] | v[3] << 16;
}
for (int k = 0; k < 3; k++) memcpy(pc.conv[k], &p->conv[3 * k], 3 * sizeof(float));
pc.conv[0][3] = (float)(p->conv_mask & mask);
pc.conv[1][3] = p->conv_linear ? 1.0f : 0.0f;
pc.conv[2][3] = p->conv_gain;
for (int i = 0; i < count; i++) memcpy(pc.rects[i], p->rects[i], sizeof(pc.rects[i]));
VkRenderPassBeginInfo rpi = {.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO, .renderPass = g_out[slot].rp,
.framebuffer = fb, .renderArea = {{0, 0}, {(uint32_t)w, (uint32_t)h}}};
@@ -14,10 +14,6 @@ struct hdrc_params {
int count;
unsigned hdr_mask;
float rects[HDRC_MAX_RECTS][4];
unsigned conv_mask;
int conv_linear;
float conv_gain;
float conv[9];
};
void hdrc_bind_device(VkDevice dev, const VkPhysicalDeviceMemoryProperties *memprops);
@@ -6,8 +6,7 @@ layout(binding = 0) uniform sampler2D Mixed;
layout(push_constant) uniform PC {
vec4 ndc;
vec4 params;
uvec2 rects[6];
vec4 conv[3];
vec4 rects[6];
} pc;
layout(location = 0) in vec2 fragTexCoord;
@@ -56,38 +55,28 @@ float toneCurve(float x, float peak) {
return knee + (1.0 - knee) * (1.0 - exp(-(x - knee) / rate));
}
int rectAt(vec2 p) {
float count = mod(pc.params.w, 16.0);
bool isHdrPixel(vec2 p) {
float packed = pc.params.w;
float count = mod(packed, 16.0);
float mask = floor(packed / 16.0);
for (int i = 0; i < 6; i++) {
if (float(i) >= count - 0.5) break;
uvec2 r = pc.rects[i];
vec2 lo = vec2(float(r.x & 0xFFFFu), float(r.x >> 16));
vec2 hi = vec2(float(r.y & 0xFFFFu), float(r.y >> 16));
if (p.x >= lo.x && p.y >= lo.y && p.x < hi.x && p.y < hi.y) return i;
vec4 r = pc.rects[i];
if (p.x >= r.x && p.y >= r.y && p.x < r.z && p.y < r.w) {
float bit = mod(floor(mask / exp2(float(i))), 2.0);
return bit > 0.5;
}
}
return -1;
}
bool bitOf(float mask, int i) {
return i >= 0 && mod(floor(mask / exp2(float(i))), 2.0) > 0.5;
}
vec3 convertedNits(vec3 c) {
vec3 lin = pc.conv[1].w > 0.5 ? c : pqToLinear(c);
return vec3(dot(pc.conv[0].xyz, lin), dot(pc.conv[1].xyz, lin), dot(pc.conv[2].xyz, lin)) * pc.conv[2].w;
return false;
}
void main() {
vec3 c = texelFetch(Mixed, ivec2(gl_FragCoord.xy), 0).rgb;
int at = rectAt(gl_FragCoord.xy);
bool hdr = bitOf(floor(pc.params.w / 16.0), at);
bool conv = hdr && bitOf(pc.conv[0].w, at);
bool hdr = isHdrPixel(gl_FragCoord.xy);
float sdrWhite = max(pc.params.x, 1.0);
vec3 outc;
if (pc.params.z < 0.5) {
if (conv) {
outc = linearToPq(max(convertedNits(c), 0.0) / 10000.0);
} else if (hdr) {
if (hdr) {
outc = c;
} else {
vec3 nits = (BT709_TO_BT2020 * srgbToLinear(c)) * sdrWhite;
@@ -97,8 +86,7 @@ void main() {
if (!hdr) {
outc = c;
} else {
vec3 nits = conv ? convertedNits(c) : pqToLinear(c) * 10000.0;
vec3 rel = max(BT2020_TO_BT709 * nits, 0.0) / sdrWhite;
vec3 rel = max(BT2020_TO_BT709 * (pqToLinear(c) * 10000.0), 0.0) / sdrWhite;
float m = max(max(rel.r, rel.g), rel.b);
if (m > 1e-6) rel *= toneCurve(m, max(pc.params.y, sdrWhite) / sdrWhite) / m;
outc = linearToSrgb(clamp(rel, 0.0, 1.0));
+264 -346
View File
@@ -1,8 +1,8 @@
#pragma once
const uint32_t hdr_encode_code[] = {
0x07230203,0x00010000,0x0008000b,0x000001ff,0x00000000,0x00020011,0x00000001,0x0006000b,
0x07230203,0x00010000,0x0008000b,0x0000018e,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000151,0x000001f7,0x000001fe,
0x0008000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x0000010d,0x00000186,0x0000018d,
0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001c2,0x00040005,0x00000004,
0x6e69616d,0x00000000,0x00070005,0x0000000b,0x62677273,0x694c6f54,0x7261656e,0x33667628,
0x0000003b,0x00030005,0x0000000a,0x00000063,0x00070005,0x0000000e,0x656e696c,0x6f547261,
@@ -10,354 +10,272 @@ const uint32_t hdr_encode_code[] = {
0x6f547170,0x656e694c,0x76287261,0x003b3366,0x00030005,0x00000010,0x00000065,0x00060005,
0x00000014,0x656e696c,0x6f547261,0x76287150,0x003b3366,0x00030005,0x00000013,0x00000079,
0x00070005,0x0000001a,0x656e6f74,0x76727543,0x31662865,0x3b31663b,0x00000000,0x00030005,
0x00000018,0x00000078,0x00040005,0x00000019,0x6b616570,0x00000000,0x00050005,0x00000021,
0x74636572,0x76287441,0x003b3266,0x00030005,0x00000020,0x00000070,0x00060005,0x00000028,
0x4f746962,0x31662866,0x3b31693b,0x00000000,0x00040005,0x00000026,0x6b73616d,0x00000000,
0x00030005,0x00000027,0x00000069,0x00070005,0x0000002b,0x766e6f63,0x65747265,0x74694e64,
0x66762873,0x00003b33,0x00030005,0x0000002a,0x00000063,0x00030005,0x0000002d,0x00006f6c,
0x00030005,0x00000032,0x00006968,0x00030005,0x00000046,0x00006f6c,0x00030005,0x00000049,
0x00006968,0x00030005,0x0000005a,0x00000070,0x00030005,0x00000079,0x00000070,0x00040005,
0x00000096,0x6e617073,0x00000000,0x00040005,0x0000009b,0x65746172,0x00000000,0x00040005,
0x000000ac,0x6e756f63,0x00000074,0x00030005,0x000000b4,0x00004350,0x00040006,0x000000b4,
0x00000000,0x0063646e,0x00050006,0x000000b4,0x00000001,0x61726170,0x0000736d,0x00050006,
0x000000b4,0x00000002,0x74636572,0x00000073,0x00050006,0x000000b4,0x00000003,0x766e6f63,
0x00000000,0x00030005,0x000000b6,0x00006370,0x00030005,0x000000bd,0x00000069,0x00030005,
0x000000d1,0x00000072,0x00030005,0x000000d7,0x00006f6c,0x00030005,0x000000e5,0x00006968,
0x00030005,0x00000126,0x006e696c,0x00040005,0x00000130,0x61726170,0x0000006d,0x00030005,
0x0000014a,0x00000063,0x00040005,0x0000014e,0x6578694d,0x00000064,0x00060005,0x00000151,
0x465f6c67,0x43676172,0x64726f6f,0x00000000,0x00030005,0x00000159,0x00007461,0x00040005,
0x0000015a,0x61726170,0x0000006d,0x00030005,0x0000015f,0x00726468,0x00040005,0x00000164,
0x61726170,0x0000006d,0x00040005,0x00000165,0x61726170,0x0000006d,0x00040005,0x00000168,
0x766e6f63,0x00000000,0x00040005,0x0000016c,0x61726170,0x0000006d,0x00040005,0x0000016f,
0x61726170,0x0000006d,0x00050005,0x00000173,0x57726473,0x65746968,0x00000000,0x00040005,
0x00000180,0x6374756f,0x00000000,0x00040005,0x00000181,0x61726170,0x0000006d,0x00040005,
0x00000189,0x61726170,0x0000006d,0x00040005,0x00000191,0x7374696e,0x00000000,0x00040005,
0x000001a0,0x61726170,0x0000006d,0x00040005,0x000001a9,0x61726170,0x0000006d,0x00040005,
0x000001b2,0x7374696e,0x00000000,0x00040005,0x000001b7,0x61726170,0x0000006d,0x00040005,
0x000001bb,0x61726170,0x0000006d,0x00030005,0x000001c0,0x006c6572,0x00030005,0x000001d5,
0x0000006d,0x00040005,0x000001e8,0x61726170,0x0000006d,0x00040005,0x000001ea,0x61726170,
0x0000006d,0x00040005,0x000001f4,0x61726170,0x0000006d,0x00050005,0x000001f7,0x4374756f,
0x726f6c6f,0x00000000,0x00060005,0x000001fe,0x67617266,0x43786554,0x64726f6f,0x00000000,
0x00040047,0x000000b1,0x00000006,0x00000008,0x00040047,0x000000b3,0x00000006,0x00000010,
0x00030047,0x000000b4,0x00000002,0x00050048,0x000000b4,0x00000000,0x00000023,0x00000000,
0x00050048,0x000000b4,0x00000001,0x00000023,0x00000010,0x00050048,0x000000b4,0x00000002,
0x00000023,0x00000020,0x00050048,0x000000b4,0x00000003,0x00000023,0x00000050,0x00040047,
0x0000014e,0x00000021,0x00000000,0x00040047,0x0000014e,0x00000022,0x00000000,0x00040047,
0x00000151,0x0000000b,0x0000000f,0x00040047,0x000001f7,0x0000001e,0x00000000,0x00040047,
0x000001fe,0x0000001e,0x00000000,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,
0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,0x00000006,0x00000003,0x00040020,
0x00000008,0x00000007,0x00000007,0x00040021,0x00000009,0x00000007,0x00000008,0x00040020,
0x00000016,0x00000007,0x00000006,0x00050021,0x00000017,0x00000006,0x00000016,0x00000016,
0x00040017,0x0000001c,0x00000006,0x00000002,0x00040020,0x0000001d,0x00000007,0x0000001c,
0x00040015,0x0000001e,0x00000020,0x00000001,0x00040021,0x0000001f,0x0000001e,0x0000001d,
0x00040020,0x00000023,0x00000007,0x0000001e,0x00020014,0x00000024,0x00050021,0x00000025,
0x00000024,0x00000016,0x00000023,0x0004002b,0x00000006,0x0000002f,0x414eb852,0x0004002b,
0x00000006,0x00000034,0x3d6147ae,0x0004002b,0x00000006,0x00000037,0x3f870a3d,0x0004002b,
0x00000006,0x0000003a,0x4019999a,0x0006002c,0x00000007,0x0000003b,0x0000003a,0x0000003a,
0x0000003a,0x0004002b,0x00000006,0x0000003f,0x3d25aee6,0x0006002c,0x00000007,0x00000040,
0x0000003f,0x0000003f,0x0000003f,0x0004002b,0x00000006,0x0000004b,0x3ed55555,0x0006002c,
0x00000007,0x0000004c,0x0000004b,0x0000004b,0x0000004b,0x0004002b,0x00000006,0x00000053,
0x3b4d2e1c,0x0006002c,0x00000007,0x00000054,0x00000053,0x00000053,0x00000053,0x0004002b,
0x00000006,0x0000005c,0x00000000,0x0004002b,0x00000006,0x0000005d,0x3f800000,0x0004002b,
0x00000006,0x00000061,0x3c4fcdac,0x0006002c,0x00000007,0x00000062,0x00000061,0x00000061,
0x00000061,0x0004002b,0x00000006,0x00000065,0x3f560000,0x0004002b,0x00000006,0x0000006a,
0x4196d000,0x0004002b,0x00000006,0x0000006b,0x41958000,0x0004002b,0x00000006,0x00000070,
0x358637bd,0x0004002b,0x00000006,0x00000074,0x40c8e06b,0x0006002c,0x00000007,0x00000075,
0x00000074,0x00000074,0x00000074,0x0004002b,0x00000006,0x0000007e,0x3e232000,0x0006002c,
0x00000007,0x0000007f,0x0000007e,0x0000007e,0x0000007e,0x0004002b,0x00000006,0x0000008a,
0x429db000,0x0006002c,0x00000007,0x0000008b,0x0000008a,0x0000008a,0x0000008a,0x0004002b,
0x00000006,0x00000090,0x3f4ccccd,0x0004002b,0x00000006,0x00000099,0x3d4ccccd,0x0004002b,
0x00000006,0x0000009d,0x407a5e35,0x0004002b,0x00000006,0x0000009f,0x3e4ccccd,0x00040017,
0x000000ad,0x00000006,0x00000004,0x00040015,0x000000ae,0x00000020,0x00000000,0x00040017,
0x000000af,0x000000ae,0x00000002,0x0004002b,0x000000ae,0x000000b0,0x00000006,0x0004001c,
0x000000b1,0x000000af,0x000000b0,0x0004002b,0x000000ae,0x000000b2,0x00000003,0x0004001c,
0x000000b3,0x000000ad,0x000000b2,0x0006001e,0x000000b4,0x000000ad,0x000000ad,0x000000b1,
0x000000b3,0x00040020,0x000000b5,0x00000009,0x000000b4,0x0004003b,0x000000b5,0x000000b6,
0x00000009,0x0004002b,0x0000001e,0x000000b7,0x00000001,0x00040020,0x000000b8,0x00000009,
0x00000006,0x0004002b,0x00000006,0x000000bb,0x41800000,0x0004002b,0x0000001e,0x000000be,
0x00000000,0x0004002b,0x0000001e,0x000000c5,0x00000006,0x0004002b,0x00000006,0x000000ca,
0x3f000000,0x00040020,0x000000d0,0x00000007,0x000000af,0x0004002b,0x0000001e,0x000000d2,
0x00000002,0x00040020,0x000000d4,0x00000009,0x000000af,0x0004002b,0x000000ae,0x000000d8,
0x00000000,0x00040020,0x000000d9,0x00000007,0x000000ae,0x0004002b,0x000000ae,0x000000dc,
0x0000ffff,0x0004002b,0x0000001e,0x000000e1,0x00000010,0x0004002b,0x000000ae,0x000000e6,
0x00000001,0x0004002b,0x0000001e,0x00000113,0xffffffff,0x0004002b,0x00000006,0x00000120,
0x40000000,0x0004002b,0x0000001e,0x00000127,0x00000003,0x00040020,0x00000134,0x00000009,
0x000000ad,0x00090019,0x0000014b,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,
0x00000001,0x00000000,0x0003001b,0x0000014c,0x0000014b,0x00040020,0x0000014d,0x00000000,
0x0000014c,0x0004003b,0x0000014d,0x0000014e,0x00000000,0x00040020,0x00000150,0x00000001,
0x000000ad,0x0004003b,0x00000150,0x00000151,0x00000001,0x00040017,0x00000154,0x0000001e,
0x00000002,0x00040020,0x0000015e,0x00000007,0x00000024,0x0004002b,0x000000ae,0x00000177,
0x00000002,0x0004002b,0x00000006,0x00000186,0x461c4000,0x00040018,0x00000192,0x00000007,
0x00000003,0x0004002b,0x00000006,0x00000193,0x3f209d49,0x0004002b,0x00000006,0x00000194,
0x3d8d844d,0x0004002b,0x00000006,0x00000195,0x3c86594b,0x0006002c,0x00000007,0x00000196,
0x00000193,0x00000194,0x00000195,0x0004002b,0x00000006,0x00000197,0x3ea89a02,0x0004002b,
0x00000006,0x00000198,0x3f6b645a,0x0004002b,0x00000006,0x00000199,0x3db43958,0x0006002c,
0x00000007,0x0000019a,0x00000197,0x00000198,0x00000199,0x0004002b,0x00000006,0x0000019b,
0x3d315b57,0x0004002b,0x00000006,0x0000019c,0x3c3ac711,0x0004002b,0x00000006,0x0000019d,
0x3f65460b,0x0006002c,0x00000007,0x0000019e,0x0000019b,0x0000019c,0x0000019d,0x0006002c,
0x00000192,0x0000019f,0x00000196,0x0000019a,0x0000019e,0x0004002b,0x00000006,0x000001c1,
0x3fd48b44,0x0004002b,0x00000006,0x000001c2,0xbdff2e49,0x0004002b,0x00000006,0x000001c3,
0xbc95182b,0x0006002c,0x00000007,0x000001c4,0x000001c1,0x000001c2,0x000001c3,0x0004002b,
0x00000006,0x000001c5,0xbf166cf4,0x0004002b,0x00000006,0x000001c6,0x3f9102de,0x0004002b,
0x00000006,0x000001c7,0xbdce075f,0x0006002c,0x00000007,0x000001c8,0x000001c5,0x000001c6,
0x000001c7,0x0004002b,0x00000006,0x000001c9,0xbd95182b,0x0004002b,0x00000006,0x000001ca,
0xbc07fcb9,0x0004002b,0x00000006,0x000001cb,0x3f8f3190,0x0006002c,0x00000007,0x000001cc,
0x000001c9,0x000001ca,0x000001cb,0x0006002c,0x00000192,0x000001cd,0x000001c4,0x000001c8,
0x000001cc,0x00040020,0x000001f6,0x00000003,0x000000ad,0x0004003b,0x000001f6,0x000001f7,
0x00000003,0x00040020,0x000001fd,0x00000001,0x0000001c,0x0004003b,0x000001fd,0x000001fe,
0x00000018,0x00000078,0x00040005,0x00000019,0x6b616570,0x00000000,0x00060005,0x00000021,
0x64487369,0x78695072,0x76286c65,0x003b3266,0x00030005,0x00000020,0x00000070,0x00030005,
0x00000023,0x00006f6c,0x00030005,0x00000028,0x00006968,0x00030005,0x0000003c,0x00006f6c,
0x00030005,0x0000003f,0x00006968,0x00030005,0x00000050,0x00000070,0x00030005,0x0000006f,
0x00000070,0x00040005,0x0000008c,0x6e617073,0x00000000,0x00040005,0x00000091,0x65746172,
0x00000000,0x00040005,0x000000a2,0x6b636170,0x00006465,0x00030005,0x000000a7,0x00004350,
0x00040006,0x000000a7,0x00000000,0x0063646e,0x00050006,0x000000a7,0x00000001,0x61726170,
0x0000736d,0x00050006,0x000000a7,0x00000002,0x74636572,0x00000073,0x00030005,0x000000a9,
0x00006370,0x00040005,0x000000b0,0x6e756f63,0x00000074,0x00040005,0x000000b4,0x6b73616d,
0x00000000,0x00030005,0x000000b9,0x00000069,0x00030005,0x000000cd,0x00000072,0x00030005,
0x000000f5,0x00746962,0x00030005,0x00000106,0x00000063,0x00040005,0x0000010a,0x6578694d,
0x00000064,0x00060005,0x0000010d,0x465f6c67,0x43676172,0x64726f6f,0x00000000,0x00030005,
0x00000116,0x00726468,0x00040005,0x00000117,0x61726170,0x0000006d,0x00050005,0x0000011b,
0x57726473,0x65746968,0x00000000,0x00040005,0x00000127,0x6374756f,0x00000000,0x00040005,
0x0000012a,0x7374696e,0x00000000,0x00040005,0x00000139,0x61726170,0x0000006d,0x00040005,
0x00000143,0x61726170,0x0000006d,0x00030005,0x0000014c,0x006c6572,0x00040005,0x0000015a,
0x61726170,0x0000006d,0x00030005,0x00000164,0x0000006d,0x00040005,0x00000177,0x61726170,
0x0000006d,0x00040005,0x00000179,0x61726170,0x0000006d,0x00040005,0x00000183,0x61726170,
0x0000006d,0x00050005,0x00000186,0x4374756f,0x726f6c6f,0x00000000,0x00060005,0x0000018d,
0x67617266,0x43786554,0x64726f6f,0x00000000,0x00040047,0x000000a6,0x00000006,0x00000010,
0x00030047,0x000000a7,0x00000002,0x00050048,0x000000a7,0x00000000,0x00000023,0x00000000,
0x00050048,0x000000a7,0x00000001,0x00000023,0x00000010,0x00050048,0x000000a7,0x00000002,
0x00000023,0x00000020,0x00040047,0x0000010a,0x00000021,0x00000000,0x00040047,0x0000010a,
0x00000022,0x00000000,0x00040047,0x0000010d,0x0000000b,0x0000000f,0x00040047,0x00000186,
0x0000001e,0x00000000,0x00040047,0x0000018d,0x0000001e,0x00000000,0x00020013,0x00000002,
0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,0x00040017,0x00000007,
0x00000006,0x00000003,0x00040020,0x00000008,0x00000007,0x00000007,0x00040021,0x00000009,
0x00000007,0x00000008,0x00040020,0x00000016,0x00000007,0x00000006,0x00050021,0x00000017,
0x00000006,0x00000016,0x00000016,0x00040017,0x0000001c,0x00000006,0x00000002,0x00040020,
0x0000001d,0x00000007,0x0000001c,0x00020014,0x0000001e,0x00040021,0x0000001f,0x0000001e,
0x0000001d,0x0004002b,0x00000006,0x00000025,0x414eb852,0x0004002b,0x00000006,0x0000002a,
0x3d6147ae,0x0004002b,0x00000006,0x0000002d,0x3f870a3d,0x0004002b,0x00000006,0x00000030,
0x4019999a,0x0006002c,0x00000007,0x00000031,0x00000030,0x00000030,0x00000030,0x0004002b,
0x00000006,0x00000035,0x3d25aee6,0x0006002c,0x00000007,0x00000036,0x00000035,0x00000035,
0x00000035,0x0004002b,0x00000006,0x00000041,0x3ed55555,0x0006002c,0x00000007,0x00000042,
0x00000041,0x00000041,0x00000041,0x0004002b,0x00000006,0x00000049,0x3b4d2e1c,0x0006002c,
0x00000007,0x0000004a,0x00000049,0x00000049,0x00000049,0x0004002b,0x00000006,0x00000052,
0x00000000,0x0004002b,0x00000006,0x00000053,0x3f800000,0x0004002b,0x00000006,0x00000057,
0x3c4fcdac,0x0006002c,0x00000007,0x00000058,0x00000057,0x00000057,0x00000057,0x0004002b,
0x00000006,0x0000005b,0x3f560000,0x0004002b,0x00000006,0x00000060,0x4196d000,0x0004002b,
0x00000006,0x00000061,0x41958000,0x0004002b,0x00000006,0x00000066,0x358637bd,0x0004002b,
0x00000006,0x0000006a,0x40c8e06b,0x0006002c,0x00000007,0x0000006b,0x0000006a,0x0000006a,
0x0000006a,0x0004002b,0x00000006,0x00000074,0x3e232000,0x0006002c,0x00000007,0x00000075,
0x00000074,0x00000074,0x00000074,0x0004002b,0x00000006,0x00000080,0x429db000,0x0006002c,
0x00000007,0x00000081,0x00000080,0x00000080,0x00000080,0x0004002b,0x00000006,0x00000086,
0x3f4ccccd,0x0004002b,0x00000006,0x0000008f,0x3d4ccccd,0x0004002b,0x00000006,0x00000093,
0x407a5e35,0x0004002b,0x00000006,0x00000095,0x3e4ccccd,0x00040017,0x000000a3,0x00000006,
0x00000004,0x00040015,0x000000a4,0x00000020,0x00000000,0x0004002b,0x000000a4,0x000000a5,
0x00000006,0x0004001c,0x000000a6,0x000000a3,0x000000a5,0x0005001e,0x000000a7,0x000000a3,
0x000000a3,0x000000a6,0x00040020,0x000000a8,0x00000009,0x000000a7,0x0004003b,0x000000a8,
0x000000a9,0x00000009,0x00040015,0x000000aa,0x00000020,0x00000001,0x0004002b,0x000000aa,
0x000000ab,0x00000001,0x0004002b,0x000000a4,0x000000ac,0x00000003,0x00040020,0x000000ad,
0x00000009,0x00000006,0x0004002b,0x00000006,0x000000b2,0x41800000,0x00040020,0x000000b8,
0x00000007,0x000000aa,0x0004002b,0x000000aa,0x000000ba,0x00000000,0x0004002b,0x000000aa,
0x000000c1,0x00000006,0x0004002b,0x00000006,0x000000c6,0x3f000000,0x00040020,0x000000cc,
0x00000007,0x000000a3,0x0004002b,0x000000aa,0x000000ce,0x00000002,0x00040020,0x000000d0,
0x00000009,0x000000a3,0x0004002b,0x000000a4,0x000000d3,0x00000000,0x0004002b,0x000000a4,
0x000000db,0x00000001,0x0004002b,0x000000a4,0x000000e6,0x00000002,0x0004002b,0x00000006,
0x000000fc,0x40000000,0x0003002a,0x0000001e,0x00000103,0x00090019,0x00000107,0x00000006,
0x00000001,0x00000000,0x00000000,0x00000000,0x00000001,0x00000000,0x0003001b,0x00000108,
0x00000107,0x00040020,0x00000109,0x00000000,0x00000108,0x0004003b,0x00000109,0x0000010a,
0x00000000,0x00040020,0x0000010c,0x00000001,0x000000a3,0x0004003b,0x0000010c,0x0000010d,
0x00000001,0x00040017,0x00000110,0x000000aa,0x00000002,0x00040020,0x00000115,0x00000007,
0x0000001e,0x00040018,0x0000012b,0x00000007,0x00000003,0x0004002b,0x00000006,0x0000012c,
0x3f209d49,0x0004002b,0x00000006,0x0000012d,0x3d8d844d,0x0004002b,0x00000006,0x0000012e,
0x3c86594b,0x0006002c,0x00000007,0x0000012f,0x0000012c,0x0000012d,0x0000012e,0x0004002b,
0x00000006,0x00000130,0x3ea89a02,0x0004002b,0x00000006,0x00000131,0x3f6b645a,0x0004002b,
0x00000006,0x00000132,0x3db43958,0x0006002c,0x00000007,0x00000133,0x00000130,0x00000131,
0x00000132,0x0004002b,0x00000006,0x00000134,0x3d315b57,0x0004002b,0x00000006,0x00000135,
0x3c3ac711,0x0004002b,0x00000006,0x00000136,0x3f65460b,0x0006002c,0x00000007,0x00000137,
0x00000134,0x00000135,0x00000136,0x0006002c,0x0000012b,0x00000138,0x0000012f,0x00000133,
0x00000137,0x0004002b,0x00000006,0x00000140,0x461c4000,0x0004002b,0x00000006,0x0000014d,
0x3fd48b44,0x0004002b,0x00000006,0x0000014e,0xbdff2e49,0x0004002b,0x00000006,0x0000014f,
0xbc95182b,0x0006002c,0x00000007,0x00000150,0x0000014d,0x0000014e,0x0000014f,0x0004002b,
0x00000006,0x00000151,0xbf166cf4,0x0004002b,0x00000006,0x00000152,0x3f9102de,0x0004002b,
0x00000006,0x00000153,0xbdce075f,0x0006002c,0x00000007,0x00000154,0x00000151,0x00000152,
0x00000153,0x0004002b,0x00000006,0x00000155,0xbd95182b,0x0004002b,0x00000006,0x00000156,
0xbc07fcb9,0x0004002b,0x00000006,0x00000157,0x3f8f3190,0x0006002c,0x00000007,0x00000158,
0x00000155,0x00000156,0x00000157,0x0006002c,0x0000012b,0x00000159,0x00000150,0x00000154,
0x00000158,0x00040020,0x00000185,0x00000003,0x000000a3,0x0004003b,0x00000185,0x00000186,
0x00000003,0x00040020,0x0000018c,0x00000001,0x0000001c,0x0004003b,0x0000018c,0x0000018d,
0x00000001,0x00050036,0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,
0x0004003b,0x00000008,0x0000014a,0x00000007,0x0004003b,0x00000023,0x00000159,0x00000007,
0x0004003b,0x0000001d,0x0000015a,0x00000007,0x0004003b,0x0000015e,0x0000015f,0x00000007,
0x0004003b,0x00000016,0x00000164,0x00000007,0x0004003b,0x00000023,0x00000165,0x00000007,
0x0004003b,0x0000015e,0x00000168,0x00000007,0x0004003b,0x00000016,0x0000016c,0x00000007,
0x0004003b,0x00000023,0x0000016f,0x00000007,0x0004003b,0x00000016,0x00000173,0x00000007,
0x0004003b,0x00000008,0x00000180,0x00000007,0x0004003b,0x00000008,0x00000181,0x00000007,
0x0004003b,0x00000008,0x00000189,0x00000007,0x0004003b,0x00000008,0x00000191,0x00000007,
0x0004003b,0x00000008,0x000001a0,0x00000007,0x0004003b,0x00000008,0x000001a9,0x00000007,
0x0004003b,0x00000008,0x000001b2,0x00000007,0x0004003b,0x00000008,0x000001b4,0x00000007,
0x0004003b,0x00000008,0x000001b7,0x00000007,0x0004003b,0x00000008,0x000001bb,0x00000007,
0x0004003b,0x00000008,0x000001c0,0x00000007,0x0004003b,0x00000016,0x000001d5,0x00000007,
0x0004003b,0x00000016,0x000001e8,0x00000007,0x0004003b,0x00000016,0x000001ea,0x00000007,
0x0004003b,0x00000008,0x000001f4,0x00000007,0x0004003d,0x0000014c,0x0000014f,0x0000014e,
0x0004003d,0x000000ad,0x00000152,0x00000151,0x0007004f,0x0000001c,0x00000153,0x00000152,
0x00000152,0x00000000,0x00000001,0x0004006e,0x00000154,0x00000155,0x00000153,0x00040064,
0x0000014b,0x00000156,0x0000014f,0x0007005f,0x000000ad,0x00000157,0x00000156,0x00000155,
0x00000002,0x000000be,0x0008004f,0x00000007,0x00000158,0x00000157,0x00000157,0x00000000,
0x00000001,0x00000002,0x0003003e,0x0000014a,0x00000158,0x0004003d,0x000000ad,0x0000015b,
0x00000151,0x0007004f,0x0000001c,0x0000015c,0x0000015b,0x0000015b,0x00000000,0x00000001,
0x0003003e,0x0000015a,0x0000015c,0x00050039,0x0000001e,0x0000015d,0x00000021,0x0000015a,
0x0003003e,0x00000159,0x0000015d,0x00060041,0x000000b8,0x00000160,0x000000b6,0x000000b7,
0x000000b2,0x0004003d,0x00000006,0x00000161,0x00000160,0x00050088,0x00000006,0x00000162,
0x00000161,0x000000bb,0x0006000c,0x00000006,0x00000163,0x00000001,0x00000008,0x00000162,
0x0003003e,0x00000164,0x00000163,0x0004003d,0x0000001e,0x00000166,0x00000159,0x0003003e,
0x00000165,0x00000166,0x00060039,0x00000024,0x00000167,0x00000028,0x00000164,0x00000165,
0x0003003e,0x0000015f,0x00000167,0x0004003d,0x00000024,0x00000169,0x0000015f,0x000300f7,
0x0000016b,0x00000000,0x000400fa,0x00000169,0x0000016a,0x0000016b,0x000200f8,0x0000016a,
0x00070041,0x000000b8,0x0000016d,0x000000b6,0x00000127,0x000000be,0x000000b2,0x0004003d,
0x00000006,0x0000016e,0x0000016d,0x0003003e,0x0000016c,0x0000016e,0x0004003d,0x0000001e,
0x00000170,0x00000159,0x0003003e,0x0000016f,0x00000170,0x00060039,0x00000024,0x00000171,
0x00000028,0x0000016c,0x0000016f,0x000200f9,0x0000016b,0x000200f8,0x0000016b,0x000700f5,
0x00000024,0x00000172,0x00000169,0x00000005,0x00000171,0x0000016a,0x0003003e,0x00000168,
0x00000172,0x00060041,0x000000b8,0x00000174,0x000000b6,0x000000b7,0x000000d8,0x0004003d,
0x00000006,0x00000175,0x00000174,0x0007000c,0x00000006,0x00000176,0x00000001,0x00000028,
0x00000175,0x0000005d,0x0003003e,0x00000173,0x00000176,0x00060041,0x000000b8,0x00000178,
0x000000b6,0x000000b7,0x00000177,0x0004003d,0x00000006,0x00000179,0x00000178,0x000500b8,
0x00000024,0x0000017a,0x00000179,0x000000ca,0x000300f7,0x0000017c,0x00000000,0x000400fa,
0x0000017a,0x0000017b,0x000001ab,0x000200f8,0x0000017b,0x0004003d,0x00000024,0x0000017d,
0x00000168,0x000300f7,0x0000017f,0x00000000,0x000400fa,0x0000017d,0x0000017e,0x0000018b,
0x000200f8,0x0000017e,0x0004003d,0x00000007,0x00000182,0x0000014a,0x0003003e,0x00000181,
0x00000182,0x00050039,0x00000007,0x00000183,0x0000002b,0x00000181,0x00060050,0x00000007,
0x00000184,0x0000005c,0x0000005c,0x0000005c,0x0007000c,0x00000007,0x00000185,0x00000001,
0x00000028,0x00000183,0x00000184,0x00060050,0x00000007,0x00000187,0x00000186,0x00000186,
0x00000186,0x00050088,0x00000007,0x00000188,0x00000185,0x00000187,0x0003003e,0x00000189,
0x00000188,0x00050039,0x00000007,0x0000018a,0x00000014,0x00000189,0x0003003e,0x00000180,
0x0000018a,0x000200f9,0x0000017f,0x000200f8,0x0000018b,0x0004003d,0x00000024,0x0000018c,
0x0000015f,0x000300f7,0x0000018e,0x00000000,0x000400fa,0x0000018c,0x0000018d,0x00000190,
0x000200f8,0x0000018d,0x0004003d,0x00000007,0x0000018f,0x0000014a,0x0003003e,0x00000180,
0x0000018f,0x000200f9,0x0000018e,0x000200f8,0x00000190,0x0004003d,0x00000007,0x000001a1,
0x0000014a,0x0003003e,0x000001a0,0x000001a1,0x00050039,0x00000007,0x000001a2,0x0000000b,
0x000001a0,0x00050091,0x00000007,0x000001a3,0x0000019f,0x000001a2,0x0004003d,0x00000006,
0x000001a4,0x00000173,0x0005008e,0x00000007,0x000001a5,0x000001a3,0x000001a4,0x0003003e,
0x00000191,0x000001a5,0x0004003d,0x00000007,0x000001a6,0x00000191,0x00060050,0x00000007,
0x000001a7,0x00000186,0x00000186,0x00000186,0x00050088,0x00000007,0x000001a8,0x000001a6,
0x000001a7,0x0003003e,0x000001a9,0x000001a8,0x00050039,0x00000007,0x000001aa,0x00000014,
0x000001a9,0x0003003e,0x00000180,0x000001aa,0x000200f9,0x0000018e,0x000200f8,0x0000018e,
0x000200f9,0x0000017f,0x000200f8,0x0000017f,0x000200f9,0x0000017c,0x000200f8,0x000001ab,
0x0004003d,0x00000024,0x000001ac,0x0000015f,0x000400a8,0x00000024,0x000001ad,0x000001ac,
0x000300f7,0x000001af,0x00000000,0x000400fa,0x000001ad,0x000001ae,0x000001b1,0x000200f8,
0x000001ae,0x0004003d,0x00000007,0x000001b0,0x0000014a,0x0003003e,0x00000180,0x000001b0,
0x000200f9,0x000001af,0x000200f8,0x000001b1,0x0004003d,0x00000024,0x000001b3,0x00000168,
0x000300f7,0x000001b6,0x00000000,0x000400fa,0x000001b3,0x000001b5,0x000001ba,0x000200f8,
0x000001b5,0x0004003d,0x00000007,0x000001b8,0x0000014a,0x0003003e,0x000001b7,0x000001b8,
0x00050039,0x00000007,0x000001b9,0x0000002b,0x000001b7,0x0003003e,0x000001b4,0x000001b9,
0x000200f9,0x000001b6,0x000200f8,0x000001ba,0x0004003d,0x00000007,0x000001bc,0x0000014a,
0x0003003e,0x000001bb,0x000001bc,0x00050039,0x00000007,0x000001bd,0x00000011,0x000001bb,
0x0005008e,0x00000007,0x000001be,0x000001bd,0x00000186,0x0003003e,0x000001b4,0x000001be,
0x000200f9,0x000001b6,0x000200f8,0x000001b6,0x0004003d,0x00000007,0x000001bf,0x000001b4,
0x0003003e,0x000001b2,0x000001bf,0x0004003d,0x00000007,0x000001ce,0x000001b2,0x00050091,
0x00000007,0x000001cf,0x000001cd,0x000001ce,0x00060050,0x00000007,0x000001d0,0x0000005c,
0x0000005c,0x0000005c,0x0007000c,0x00000007,0x000001d1,0x00000001,0x00000028,0x000001cf,
0x000001d0,0x0004003d,0x00000006,0x000001d2,0x00000173,0x00060050,0x00000007,0x000001d3,
0x000001d2,0x000001d2,0x000001d2,0x00050088,0x00000007,0x000001d4,0x000001d1,0x000001d3,
0x0003003e,0x000001c0,0x000001d4,0x00050041,0x00000016,0x000001d6,0x000001c0,0x000000d8,
0x0004003d,0x00000006,0x000001d7,0x000001d6,0x00050041,0x00000016,0x000001d8,0x000001c0,
0x000000e6,0x0004003d,0x00000006,0x000001d9,0x000001d8,0x0007000c,0x00000006,0x000001da,
0x00000001,0x00000028,0x000001d7,0x000001d9,0x00050041,0x00000016,0x000001db,0x000001c0,
0x00000177,0x0004003d,0x00000006,0x000001dc,0x000001db,0x0007000c,0x00000006,0x000001dd,
0x00000001,0x00000028,0x000001da,0x000001dc,0x0003003e,0x000001d5,0x000001dd,0x0004003d,
0x00000006,0x000001de,0x000001d5,0x000500ba,0x00000024,0x000001df,0x000001de,0x00000070,
0x000300f7,0x000001e1,0x00000000,0x000400fa,0x000001df,0x000001e0,0x000001e1,0x000200f8,
0x000001e0,0x00060041,0x000000b8,0x000001e2,0x000000b6,0x000000b7,0x000000e6,0x0004003d,
0x00000006,0x000001e3,0x000001e2,0x0004003d,0x00000006,0x000001e4,0x00000173,0x0007000c,
0x00000006,0x000001e5,0x00000001,0x00000028,0x000001e3,0x000001e4,0x0004003d,0x00000006,
0x000001e6,0x00000173,0x00050088,0x00000006,0x000001e7,0x000001e5,0x000001e6,0x0004003d,
0x00000006,0x000001e9,0x000001d5,0x0003003e,0x000001e8,0x000001e9,0x0003003e,0x000001ea,
0x000001e7,0x00060039,0x00000006,0x000001eb,0x0000001a,0x000001e8,0x000001ea,0x0004003d,
0x00000006,0x000001ec,0x000001d5,0x00050088,0x00000006,0x000001ed,0x000001eb,0x000001ec,
0x0004003d,0x00000007,0x000001ee,0x000001c0,0x0005008e,0x00000007,0x000001ef,0x000001ee,
0x000001ed,0x0003003e,0x000001c0,0x000001ef,0x000200f9,0x000001e1,0x000200f8,0x000001e1,
0x0004003d,0x00000007,0x000001f0,0x000001c0,0x00060050,0x00000007,0x000001f1,0x0000005c,
0x0000005c,0x0000005c,0x00060050,0x00000007,0x000001f2,0x0000005d,0x0000005d,0x0000005d,
0x0008000c,0x00000007,0x000001f3,0x00000001,0x0000002b,0x000001f0,0x000001f1,0x000001f2,
0x0003003e,0x000001f4,0x000001f3,0x00050039,0x00000007,0x000001f5,0x0000000e,0x000001f4,
0x0003003e,0x00000180,0x000001f5,0x000200f9,0x000001af,0x000200f8,0x000001af,0x000200f9,
0x0000017c,0x000200f8,0x0000017c,0x0004003d,0x00000007,0x000001f8,0x00000180,0x00050051,
0x00000006,0x000001f9,0x000001f8,0x00000000,0x00050051,0x00000006,0x000001fa,0x000001f8,
0x00000001,0x00050051,0x00000006,0x000001fb,0x000001f8,0x00000002,0x00070050,0x000000ad,
0x000001fc,0x000001f9,0x000001fa,0x000001fb,0x0000005d,0x0003003e,0x000001f7,0x000001fc,
0x0004003b,0x00000008,0x00000106,0x00000007,0x0004003b,0x00000115,0x00000116,0x00000007,
0x0004003b,0x0000001d,0x00000117,0x00000007,0x0004003b,0x00000016,0x0000011b,0x00000007,
0x0004003b,0x00000008,0x00000127,0x00000007,0x0004003b,0x00000008,0x0000012a,0x00000007,
0x0004003b,0x00000008,0x00000139,0x00000007,0x0004003b,0x00000008,0x00000143,0x00000007,
0x0004003b,0x00000008,0x0000014c,0x00000007,0x0004003b,0x00000008,0x0000015a,0x00000007,
0x0004003b,0x00000016,0x00000164,0x00000007,0x0004003b,0x00000016,0x00000177,0x00000007,
0x0004003b,0x00000016,0x00000179,0x00000007,0x0004003b,0x00000008,0x00000183,0x00000007,
0x0004003d,0x00000108,0x0000010b,0x0000010a,0x0004003d,0x000000a3,0x0000010e,0x0000010d,
0x0007004f,0x0000001c,0x0000010f,0x0000010e,0x0000010e,0x00000000,0x00000001,0x0004006e,
0x00000110,0x00000111,0x0000010f,0x00040064,0x00000107,0x00000112,0x0000010b,0x0007005f,
0x000000a3,0x00000113,0x00000112,0x00000111,0x00000002,0x000000ba,0x0008004f,0x00000007,
0x00000114,0x00000113,0x00000113,0x00000000,0x00000001,0x00000002,0x0003003e,0x00000106,
0x00000114,0x0004003d,0x000000a3,0x00000118,0x0000010d,0x0007004f,0x0000001c,0x00000119,
0x00000118,0x00000118,0x00000000,0x00000001,0x0003003e,0x00000117,0x00000119,0x00050039,
0x0000001e,0x0000011a,0x00000021,0x00000117,0x0003003e,0x00000116,0x0000011a,0x00060041,
0x000000ad,0x0000011c,0x000000a9,0x000000ab,0x000000d3,0x0004003d,0x00000006,0x0000011d,
0x0000011c,0x0007000c,0x00000006,0x0000011e,0x00000001,0x00000028,0x0000011d,0x00000053,
0x0003003e,0x0000011b,0x0000011e,0x00060041,0x000000ad,0x0000011f,0x000000a9,0x000000ab,
0x000000e6,0x0004003d,0x00000006,0x00000120,0x0000011f,0x000500b8,0x0000001e,0x00000121,
0x00000120,0x000000c6,0x000300f7,0x00000123,0x00000000,0x000400fa,0x00000121,0x00000122,
0x00000145,0x000200f8,0x00000122,0x0004003d,0x0000001e,0x00000124,0x00000116,0x000300f7,
0x00000126,0x00000000,0x000400fa,0x00000124,0x00000125,0x00000129,0x000200f8,0x00000125,
0x0004003d,0x00000007,0x00000128,0x00000106,0x0003003e,0x00000127,0x00000128,0x000200f9,
0x00000126,0x000200f8,0x00000129,0x0004003d,0x00000007,0x0000013a,0x00000106,0x0003003e,
0x00000139,0x0000013a,0x00050039,0x00000007,0x0000013b,0x0000000b,0x00000139,0x00050091,
0x00000007,0x0000013c,0x00000138,0x0000013b,0x0004003d,0x00000006,0x0000013d,0x0000011b,
0x0005008e,0x00000007,0x0000013e,0x0000013c,0x0000013d,0x0003003e,0x0000012a,0x0000013e,
0x0004003d,0x00000007,0x0000013f,0x0000012a,0x00060050,0x00000007,0x00000141,0x00000140,
0x00000140,0x00000140,0x00050088,0x00000007,0x00000142,0x0000013f,0x00000141,0x0003003e,
0x00000143,0x00000142,0x00050039,0x00000007,0x00000144,0x00000014,0x00000143,0x0003003e,
0x00000127,0x00000144,0x000200f9,0x00000126,0x000200f8,0x00000126,0x000200f9,0x00000123,
0x000200f8,0x00000145,0x0004003d,0x0000001e,0x00000146,0x00000116,0x000400a8,0x0000001e,
0x00000147,0x00000146,0x000300f7,0x00000149,0x00000000,0x000400fa,0x00000147,0x00000148,
0x0000014b,0x000200f8,0x00000148,0x0004003d,0x00000007,0x0000014a,0x00000106,0x0003003e,
0x00000127,0x0000014a,0x000200f9,0x00000149,0x000200f8,0x0000014b,0x0004003d,0x00000007,
0x0000015b,0x00000106,0x0003003e,0x0000015a,0x0000015b,0x00050039,0x00000007,0x0000015c,
0x00000011,0x0000015a,0x0005008e,0x00000007,0x0000015d,0x0000015c,0x00000140,0x00050091,
0x00000007,0x0000015e,0x00000159,0x0000015d,0x00060050,0x00000007,0x0000015f,0x00000052,
0x00000052,0x00000052,0x0007000c,0x00000007,0x00000160,0x00000001,0x00000028,0x0000015e,
0x0000015f,0x0004003d,0x00000006,0x00000161,0x0000011b,0x00060050,0x00000007,0x00000162,
0x00000161,0x00000161,0x00000161,0x00050088,0x00000007,0x00000163,0x00000160,0x00000162,
0x0003003e,0x0000014c,0x00000163,0x00050041,0x00000016,0x00000165,0x0000014c,0x000000d3,
0x0004003d,0x00000006,0x00000166,0x00000165,0x00050041,0x00000016,0x00000167,0x0000014c,
0x000000db,0x0004003d,0x00000006,0x00000168,0x00000167,0x0007000c,0x00000006,0x00000169,
0x00000001,0x00000028,0x00000166,0x00000168,0x00050041,0x00000016,0x0000016a,0x0000014c,
0x000000e6,0x0004003d,0x00000006,0x0000016b,0x0000016a,0x0007000c,0x00000006,0x0000016c,
0x00000001,0x00000028,0x00000169,0x0000016b,0x0003003e,0x00000164,0x0000016c,0x0004003d,
0x00000006,0x0000016d,0x00000164,0x000500ba,0x0000001e,0x0000016e,0x0000016d,0x00000066,
0x000300f7,0x00000170,0x00000000,0x000400fa,0x0000016e,0x0000016f,0x00000170,0x000200f8,
0x0000016f,0x00060041,0x000000ad,0x00000171,0x000000a9,0x000000ab,0x000000db,0x0004003d,
0x00000006,0x00000172,0x00000171,0x0004003d,0x00000006,0x00000173,0x0000011b,0x0007000c,
0x00000006,0x00000174,0x00000001,0x00000028,0x00000172,0x00000173,0x0004003d,0x00000006,
0x00000175,0x0000011b,0x00050088,0x00000006,0x00000176,0x00000174,0x00000175,0x0004003d,
0x00000006,0x00000178,0x00000164,0x0003003e,0x00000177,0x00000178,0x0003003e,0x00000179,
0x00000176,0x00060039,0x00000006,0x0000017a,0x0000001a,0x00000177,0x00000179,0x0004003d,
0x00000006,0x0000017b,0x00000164,0x00050088,0x00000006,0x0000017c,0x0000017a,0x0000017b,
0x0004003d,0x00000007,0x0000017d,0x0000014c,0x0005008e,0x00000007,0x0000017e,0x0000017d,
0x0000017c,0x0003003e,0x0000014c,0x0000017e,0x000200f9,0x00000170,0x000200f8,0x00000170,
0x0004003d,0x00000007,0x0000017f,0x0000014c,0x00060050,0x00000007,0x00000180,0x00000052,
0x00000052,0x00000052,0x00060050,0x00000007,0x00000181,0x00000053,0x00000053,0x00000053,
0x0008000c,0x00000007,0x00000182,0x00000001,0x0000002b,0x0000017f,0x00000180,0x00000181,
0x0003003e,0x00000183,0x00000182,0x00050039,0x00000007,0x00000184,0x0000000e,0x00000183,
0x0003003e,0x00000127,0x00000184,0x000200f9,0x00000149,0x000200f8,0x00000149,0x000200f9,
0x00000123,0x000200f8,0x00000123,0x0004003d,0x00000007,0x00000187,0x00000127,0x00050051,
0x00000006,0x00000188,0x00000187,0x00000000,0x00050051,0x00000006,0x00000189,0x00000187,
0x00000001,0x00050051,0x00000006,0x0000018a,0x00000187,0x00000002,0x00070050,0x000000a3,
0x0000018b,0x00000188,0x00000189,0x0000018a,0x00000053,0x0003003e,0x00000186,0x0000018b,
0x000100fd,0x00010038,0x00050036,0x00000007,0x0000000b,0x00000000,0x00000009,0x00030037,
0x00000008,0x0000000a,0x000200f8,0x0000000c,0x0004003b,0x00000008,0x0000002d,0x00000007,
0x0004003b,0x00000008,0x00000032,0x00000007,0x0004003d,0x00000007,0x0000002e,0x0000000a,
0x00060050,0x00000007,0x00000030,0x0000002f,0x0000002f,0x0000002f,0x00050088,0x00000007,
0x00000031,0x0000002e,0x00000030,0x0003003e,0x0000002d,0x00000031,0x0004003d,0x00000007,
0x00000033,0x0000000a,0x00060050,0x00000007,0x00000035,0x00000034,0x00000034,0x00000034,
0x00050081,0x00000007,0x00000036,0x00000033,0x00000035,0x00060050,0x00000007,0x00000038,
0x00000037,0x00000037,0x00000037,0x00050088,0x00000007,0x00000039,0x00000036,0x00000038,
0x0007000c,0x00000007,0x0000003c,0x00000001,0x0000001a,0x00000039,0x0000003b,0x0003003e,
0x00000032,0x0000003c,0x0004003d,0x00000007,0x0000003d,0x0000002d,0x0004003d,0x00000007,
0x0000003e,0x00000032,0x0004003d,0x00000007,0x00000041,0x0000000a,0x0007000c,0x00000007,
0x00000042,0x00000001,0x00000030,0x00000040,0x00000041,0x0008000c,0x00000007,0x00000043,
0x00000001,0x0000002e,0x0000003d,0x0000003e,0x00000042,0x000200fe,0x00000043,0x00010038,
0x00000008,0x0000000a,0x000200f8,0x0000000c,0x0004003b,0x00000008,0x00000023,0x00000007,
0x0004003b,0x00000008,0x00000028,0x00000007,0x0004003d,0x00000007,0x00000024,0x0000000a,
0x00060050,0x00000007,0x00000026,0x00000025,0x00000025,0x00000025,0x00050088,0x00000007,
0x00000027,0x00000024,0x00000026,0x0003003e,0x00000023,0x00000027,0x0004003d,0x00000007,
0x00000029,0x0000000a,0x00060050,0x00000007,0x0000002b,0x0000002a,0x0000002a,0x0000002a,
0x00050081,0x00000007,0x0000002c,0x00000029,0x0000002b,0x00060050,0x00000007,0x0000002e,
0x0000002d,0x0000002d,0x0000002d,0x00050088,0x00000007,0x0000002f,0x0000002c,0x0000002e,
0x0007000c,0x00000007,0x00000032,0x00000001,0x0000001a,0x0000002f,0x00000031,0x0003003e,
0x00000028,0x00000032,0x0004003d,0x00000007,0x00000033,0x00000023,0x0004003d,0x00000007,
0x00000034,0x00000028,0x0004003d,0x00000007,0x00000037,0x0000000a,0x0007000c,0x00000007,
0x00000038,0x00000001,0x00000030,0x00000036,0x00000037,0x0008000c,0x00000007,0x00000039,
0x00000001,0x0000002e,0x00000033,0x00000034,0x00000038,0x000200fe,0x00000039,0x00010038,
0x00050036,0x00000007,0x0000000e,0x00000000,0x00000009,0x00030037,0x00000008,0x0000000d,
0x000200f8,0x0000000f,0x0004003b,0x00000008,0x00000046,0x00000007,0x0004003b,0x00000008,
0x00000049,0x00000007,0x0004003d,0x00000007,0x00000047,0x0000000d,0x0005008e,0x00000007,
0x00000048,0x00000047,0x0000002f,0x0003003e,0x00000046,0x00000048,0x0004003d,0x00000007,
0x0000004a,0x0000000d,0x0007000c,0x00000007,0x0000004d,0x00000001,0x0000001a,0x0000004a,
0x0000004c,0x0005008e,0x00000007,0x0000004e,0x0000004d,0x00000037,0x00060050,0x00000007,
0x0000004f,0x00000034,0x00000034,0x00000034,0x00050083,0x00000007,0x00000050,0x0000004e,
0x0000004f,0x0003003e,0x00000049,0x00000050,0x0004003d,0x00000007,0x00000051,0x00000046,
0x0004003d,0x00000007,0x00000052,0x00000049,0x0004003d,0x00000007,0x00000055,0x0000000d,
0x0007000c,0x00000007,0x00000056,0x00000001,0x00000030,0x00000054,0x00000055,0x0008000c,
0x00000007,0x00000057,0x00000001,0x0000002e,0x00000051,0x00000052,0x00000056,0x000200fe,
0x00000057,0x00010038,0x00050036,0x00000007,0x00000011,0x00000000,0x00000009,0x00030037,
0x00000008,0x00000010,0x000200f8,0x00000012,0x0004003b,0x00000008,0x0000005a,0x00000007,
0x0004003d,0x00000007,0x0000005b,0x00000010,0x00060050,0x00000007,0x0000005e,0x0000005c,
0x0000005c,0x0000005c,0x00060050,0x00000007,0x0000005f,0x0000005d,0x0000005d,0x0000005d,
0x0008000c,0x00000007,0x00000060,0x00000001,0x0000002b,0x0000005b,0x0000005e,0x0000005f,
0x0007000c,0x00000007,0x00000063,0x00000001,0x0000001a,0x00000060,0x00000062,0x0003003e,
0x0000005a,0x00000063,0x0004003d,0x00000007,0x00000064,0x0000005a,0x00060050,0x00000007,
0x00000066,0x00000065,0x00000065,0x00000065,0x00050083,0x00000007,0x00000067,0x00000064,
0x00000066,0x00060050,0x00000007,0x00000068,0x0000005c,0x0000005c,0x0000005c,0x0007000c,
0x00000007,0x00000069,0x00000001,0x00000028,0x00000067,0x00000068,0x0004003d,0x00000007,
0x0000006c,0x0000005a,0x0005008e,0x00000007,0x0000006d,0x0000006c,0x0000006b,0x00060050,
0x00000007,0x0000006e,0x0000006a,0x0000006a,0x0000006a,0x00050083,0x00000007,0x0000006f,
0x0000006e,0x0000006d,0x00060050,0x00000007,0x00000071,0x00000070,0x00000070,0x00000070,
0x0007000c,0x00000007,0x00000072,0x00000001,0x00000028,0x0000006f,0x00000071,0x00050088,
0x00000007,0x00000073,0x00000069,0x00000072,0x0007000c,0x00000007,0x00000076,0x00000001,
0x0000001a,0x00000073,0x00000075,0x000200fe,0x00000076,0x00010038,0x00050036,0x00000007,
0x000200f8,0x0000000f,0x0004003b,0x00000008,0x0000003c,0x00000007,0x0004003b,0x00000008,
0x0000003f,0x00000007,0x0004003d,0x00000007,0x0000003d,0x0000000d,0x0005008e,0x00000007,
0x0000003e,0x0000003d,0x00000025,0x0003003e,0x0000003c,0x0000003e,0x0004003d,0x00000007,
0x00000040,0x0000000d,0x0007000c,0x00000007,0x00000043,0x00000001,0x0000001a,0x00000040,
0x00000042,0x0005008e,0x00000007,0x00000044,0x00000043,0x0000002d,0x00060050,0x00000007,
0x00000045,0x0000002a,0x0000002a,0x0000002a,0x00050083,0x00000007,0x00000046,0x00000044,
0x00000045,0x0003003e,0x0000003f,0x00000046,0x0004003d,0x00000007,0x00000047,0x0000003c,
0x0004003d,0x00000007,0x00000048,0x0000003f,0x0004003d,0x00000007,0x0000004b,0x0000000d,
0x0007000c,0x00000007,0x0000004c,0x00000001,0x00000030,0x0000004a,0x0000004b,0x0008000c,
0x00000007,0x0000004d,0x00000001,0x0000002e,0x00000047,0x00000048,0x0000004c,0x000200fe,
0x0000004d,0x00010038,0x00050036,0x00000007,0x00000011,0x00000000,0x00000009,0x00030037,
0x00000008,0x00000010,0x000200f8,0x00000012,0x0004003b,0x00000008,0x00000050,0x00000007,
0x0004003d,0x00000007,0x00000051,0x00000010,0x00060050,0x00000007,0x00000054,0x00000052,
0x00000052,0x00000052,0x00060050,0x00000007,0x00000055,0x00000053,0x00000053,0x00000053,
0x0008000c,0x00000007,0x00000056,0x00000001,0x0000002b,0x00000051,0x00000054,0x00000055,
0x0007000c,0x00000007,0x00000059,0x00000001,0x0000001a,0x00000056,0x00000058,0x0003003e,
0x00000050,0x00000059,0x0004003d,0x00000007,0x0000005a,0x00000050,0x00060050,0x00000007,
0x0000005c,0x0000005b,0x0000005b,0x0000005b,0x00050083,0x00000007,0x0000005d,0x0000005a,
0x0000005c,0x00060050,0x00000007,0x0000005e,0x00000052,0x00000052,0x00000052,0x0007000c,
0x00000007,0x0000005f,0x00000001,0x00000028,0x0000005d,0x0000005e,0x0004003d,0x00000007,
0x00000062,0x00000050,0x0005008e,0x00000007,0x00000063,0x00000062,0x00000061,0x00060050,
0x00000007,0x00000064,0x00000060,0x00000060,0x00000060,0x00050083,0x00000007,0x00000065,
0x00000064,0x00000063,0x00060050,0x00000007,0x00000067,0x00000066,0x00000066,0x00000066,
0x0007000c,0x00000007,0x00000068,0x00000001,0x00000028,0x00000065,0x00000067,0x00050088,
0x00000007,0x00000069,0x0000005f,0x00000068,0x0007000c,0x00000007,0x0000006c,0x00000001,
0x0000001a,0x00000069,0x0000006b,0x000200fe,0x0000006c,0x00010038,0x00050036,0x00000007,
0x00000014,0x00000000,0x00000009,0x00030037,0x00000008,0x00000013,0x000200f8,0x00000015,
0x0004003b,0x00000008,0x00000079,0x00000007,0x0004003d,0x00000007,0x0000007a,0x00000013,
0x00060050,0x00000007,0x0000007b,0x0000005c,0x0000005c,0x0000005c,0x00060050,0x00000007,
0x0000007c,0x0000005d,0x0000005d,0x0000005d,0x0008000c,0x00000007,0x0000007d,0x00000001,
0x0000002b,0x0000007a,0x0000007b,0x0000007c,0x0007000c,0x00000007,0x00000080,0x00000001,
0x0000001a,0x0000007d,0x0000007f,0x0003003e,0x00000079,0x00000080,0x0004003d,0x00000007,
0x00000081,0x00000079,0x0005008e,0x00000007,0x00000082,0x00000081,0x0000006a,0x00060050,
0x00000007,0x00000083,0x00000065,0x00000065,0x00000065,0x00050081,0x00000007,0x00000084,
0x00000083,0x00000082,0x0004003d,0x00000007,0x00000085,0x00000079,0x0005008e,0x00000007,
0x00000086,0x00000085,0x0000006b,0x00060050,0x00000007,0x00000087,0x0000005d,0x0000005d,
0x0000005d,0x00050081,0x00000007,0x00000088,0x00000087,0x00000086,0x00050088,0x00000007,
0x00000089,0x00000084,0x00000088,0x0007000c,0x00000007,0x0000008c,0x00000001,0x0000001a,
0x00000089,0x0000008b,0x000200fe,0x0000008c,0x00010038,0x00050036,0x00000006,0x0000001a,
0x0004003b,0x00000008,0x0000006f,0x00000007,0x0004003d,0x00000007,0x00000070,0x00000013,
0x00060050,0x00000007,0x00000071,0x00000052,0x00000052,0x00000052,0x00060050,0x00000007,
0x00000072,0x00000053,0x00000053,0x00000053,0x0008000c,0x00000007,0x00000073,0x00000001,
0x0000002b,0x00000070,0x00000071,0x00000072,0x0007000c,0x00000007,0x00000076,0x00000001,
0x0000001a,0x00000073,0x00000075,0x0003003e,0x0000006f,0x00000076,0x0004003d,0x00000007,
0x00000077,0x0000006f,0x0005008e,0x00000007,0x00000078,0x00000077,0x00000060,0x00060050,
0x00000007,0x00000079,0x0000005b,0x0000005b,0x0000005b,0x00050081,0x00000007,0x0000007a,
0x00000079,0x00000078,0x0004003d,0x00000007,0x0000007b,0x0000006f,0x0005008e,0x00000007,
0x0000007c,0x0000007b,0x00000061,0x00060050,0x00000007,0x0000007d,0x00000053,0x00000053,
0x00000053,0x00050081,0x00000007,0x0000007e,0x0000007d,0x0000007c,0x00050088,0x00000007,
0x0000007f,0x0000007a,0x0000007e,0x0007000c,0x00000007,0x00000082,0x00000001,0x0000001a,
0x0000007f,0x00000081,0x000200fe,0x00000082,0x00010038,0x00050036,0x00000006,0x0000001a,
0x00000000,0x00000017,0x00030037,0x00000016,0x00000018,0x00030037,0x00000016,0x00000019,
0x000200f8,0x0000001b,0x0004003b,0x00000016,0x00000096,0x00000007,0x0004003b,0x00000016,
0x0000009b,0x00000007,0x0004003d,0x00000006,0x0000008f,0x00000018,0x000500bc,0x00000024,
0x00000091,0x0000008f,0x00000090,0x000300f7,0x00000093,0x00000000,0x000400fa,0x00000091,
0x00000092,0x00000093,0x000200f8,0x00000092,0x0004003d,0x00000006,0x00000094,0x00000018,
0x000200fe,0x00000094,0x000200f8,0x00000093,0x0004003d,0x00000006,0x00000097,0x00000019,
0x00050083,0x00000006,0x00000098,0x00000097,0x00000090,0x0007000c,0x00000006,0x0000009a,
0x00000001,0x00000028,0x00000098,0x00000099,0x0003003e,0x00000096,0x0000009a,0x0004003d,
0x00000006,0x0000009c,0x00000096,0x00050088,0x00000006,0x0000009e,0x0000009c,0x0000009d,
0x0007000c,0x00000006,0x000000a0,0x00000001,0x00000028,0x0000009e,0x0000009f,0x0003003e,
0x0000009b,0x000000a0,0x0004003d,0x00000006,0x000000a1,0x00000018,0x00050083,0x00000006,
0x000000a2,0x000000a1,0x00000090,0x0004007f,0x00000006,0x000000a3,0x000000a2,0x0004003d,
0x00000006,0x000000a4,0x0000009b,0x00050088,0x00000006,0x000000a5,0x000000a3,0x000000a4,
0x0006000c,0x00000006,0x000000a6,0x00000001,0x0000001b,0x000000a5,0x00050083,0x00000006,
0x000000a7,0x0000005d,0x000000a6,0x00050085,0x00000006,0x000000a8,0x0000009f,0x000000a7,
0x00050081,0x00000006,0x000000a9,0x00000090,0x000000a8,0x000200fe,0x000000a9,0x00010038,
0x000200f8,0x0000001b,0x0004003b,0x00000016,0x0000008c,0x00000007,0x0004003b,0x00000016,
0x00000091,0x00000007,0x0004003d,0x00000006,0x00000085,0x00000018,0x000500bc,0x0000001e,
0x00000087,0x00000085,0x00000086,0x000300f7,0x00000089,0x00000000,0x000400fa,0x00000087,
0x00000088,0x00000089,0x000200f8,0x00000088,0x0004003d,0x00000006,0x0000008a,0x00000018,
0x000200fe,0x0000008a,0x000200f8,0x00000089,0x0004003d,0x00000006,0x0000008d,0x00000019,
0x00050083,0x00000006,0x0000008e,0x0000008d,0x00000086,0x0007000c,0x00000006,0x00000090,
0x00000001,0x00000028,0x0000008e,0x0000008f,0x0003003e,0x0000008c,0x00000090,0x0004003d,
0x00000006,0x00000092,0x0000008c,0x00050088,0x00000006,0x00000094,0x00000092,0x00000093,
0x0007000c,0x00000006,0x00000096,0x00000001,0x00000028,0x00000094,0x00000095,0x0003003e,
0x00000091,0x00000096,0x0004003d,0x00000006,0x00000097,0x00000018,0x00050083,0x00000006,
0x00000098,0x00000097,0x00000086,0x0004007f,0x00000006,0x00000099,0x00000098,0x0004003d,
0x00000006,0x0000009a,0x00000091,0x00050088,0x00000006,0x0000009b,0x00000099,0x0000009a,
0x0006000c,0x00000006,0x0000009c,0x00000001,0x0000001b,0x0000009b,0x00050083,0x00000006,
0x0000009d,0x00000053,0x0000009c,0x00050085,0x00000006,0x0000009e,0x00000095,0x0000009d,
0x00050081,0x00000006,0x0000009f,0x00000086,0x0000009e,0x000200fe,0x0000009f,0x00010038,
0x00050036,0x0000001e,0x00000021,0x00000000,0x0000001f,0x00030037,0x0000001d,0x00000020,
0x000200f8,0x00000022,0x0004003b,0x00000016,0x000000ac,0x00000007,0x0004003b,0x00000023,
0x000000bd,0x00000007,0x0004003b,0x000000d0,0x000000d1,0x00000007,0x0004003b,0x0000001d,
0x000000d7,0x00000007,0x0004003b,0x0000001d,0x000000e5,0x00000007,0x00060041,0x000000b8,
0x000000b9,0x000000b6,0x000000b7,0x000000b2,0x0004003d,0x00000006,0x000000ba,0x000000b9,
0x0005008d,0x00000006,0x000000bc,0x000000ba,0x000000bb,0x0003003e,0x000000ac,0x000000bc,
0x0003003e,0x000000bd,0x000000be,0x000200f9,0x000000bf,0x000200f8,0x000000bf,0x000400f6,
0x000000c1,0x000000c2,0x00000000,0x000200f9,0x000000c3,0x000200f8,0x000000c3,0x0004003d,
0x0000001e,0x000000c4,0x000000bd,0x000500b1,0x00000024,0x000000c6,0x000000c4,0x000000c5,
0x000400fa,0x000000c6,0x000000c0,0x000000c1,0x000200f8,0x000000c0,0x0004003d,0x0000001e,
0x000000c7,0x000000bd,0x0004006f,0x00000006,0x000000c8,0x000000c7,0x0004003d,0x00000006,
0x000000c9,0x000000ac,0x00050083,0x00000006,0x000000cb,0x000000c9,0x000000ca,0x000500be,
0x00000024,0x000000cc,0x000000c8,0x000000cb,0x000300f7,0x000000ce,0x00000000,0x000400fa,
0x000000cc,0x000000cd,0x000000ce,0x000200f8,0x000000cd,0x000200f9,0x000000c1,0x000200f8,
0x000000ce,0x0004003d,0x0000001e,0x000000d3,0x000000bd,0x00060041,0x000000d4,0x000000d5,
0x000000b6,0x000000d2,0x000000d3,0x0004003d,0x000000af,0x000000d6,0x000000d5,0x0003003e,
0x000000d1,0x000000d6,0x00050041,0x000000d9,0x000000da,0x000000d1,0x000000d8,0x0004003d,
0x000000ae,0x000000db,0x000000da,0x000500c7,0x000000ae,0x000000dd,0x000000db,0x000000dc,
0x00040070,0x00000006,0x000000de,0x000000dd,0x00050041,0x000000d9,0x000000df,0x000000d1,
0x000000d8,0x0004003d,0x000000ae,0x000000e0,0x000000df,0x000500c2,0x000000ae,0x000000e2,
0x000000e0,0x000000e1,0x00040070,0x00000006,0x000000e3,0x000000e2,0x00050050,0x0000001c,
0x000000e4,0x000000de,0x000000e3,0x0003003e,0x000000d7,0x000000e4,0x00050041,0x000000d9,
0x000000e7,0x000000d1,0x000000e6,0x0004003d,0x000000ae,0x000000e8,0x000000e7,0x000500c7,
0x000000ae,0x000000e9,0x000000e8,0x000000dc,0x00040070,0x00000006,0x000000ea,0x000000e9,
0x00050041,0x000000d9,0x000000eb,0x000000d1,0x000000e6,0x0004003d,0x000000ae,0x000000ec,
0x000000eb,0x000500c2,0x000000ae,0x000000ed,0x000000ec,0x000000e1,0x00040070,0x00000006,
0x000000ee,0x000000ed,0x00050050,0x0000001c,0x000000ef,0x000000ea,0x000000ee,0x0003003e,
0x000000e5,0x000000ef,0x00050041,0x00000016,0x000000f0,0x00000020,0x000000d8,0x0004003d,
0x00000006,0x000000f1,0x000000f0,0x00050041,0x00000016,0x000000f2,0x000000d7,0x000000d8,
0x0004003d,0x00000006,0x000000f3,0x000000f2,0x000500be,0x00000024,0x000000f4,0x000000f1,
0x000000f3,0x000300f7,0x000000f6,0x00000000,0x000400fa,0x000000f4,0x000000f5,0x000000f6,
0x000200f8,0x000000f5,0x00050041,0x00000016,0x000000f7,0x00000020,0x000000e6,0x0004003d,
0x00000006,0x000000f8,0x000000f7,0x00050041,0x00000016,0x000000f9,0x000000d7,0x000000e6,
0x0004003d,0x00000006,0x000000fa,0x000000f9,0x000500be,0x00000024,0x000000fb,0x000000f8,
0x000000fa,0x000200f9,0x000000f6,0x000200f8,0x000000f6,0x000700f5,0x00000024,0x000000fc,
0x000000f4,0x000000ce,0x000000fb,0x000000f5,0x000300f7,0x000000fe,0x00000000,0x000400fa,
0x000000fc,0x000000fd,0x000000fe,0x000200f8,0x000000fd,0x00050041,0x00000016,0x000000ff,
0x00000020,0x000000d8,0x0004003d,0x00000006,0x00000100,0x000000ff,0x00050041,0x00000016,
0x00000101,0x000000e5,0x000000d8,0x0004003d,0x00000006,0x00000102,0x00000101,0x000500b8,
0x00000024,0x00000103,0x00000100,0x00000102,0x000200f9,0x000000fe,0x000200f8,0x000000fe,
0x000700f5,0x00000024,0x00000104,0x000000fc,0x000000f6,0x00000103,0x000000fd,0x000300f7,
0x00000106,0x00000000,0x000400fa,0x00000104,0x00000105,0x00000106,0x000200f8,0x00000105,
0x00050041,0x00000016,0x00000107,0x00000020,0x000000e6,0x0004003d,0x00000006,0x00000108,
0x00000107,0x00050041,0x00000016,0x00000109,0x000000e5,0x000000e6,0x0004003d,0x00000006,
0x0000010a,0x00000109,0x000500b8,0x00000024,0x0000010b,0x00000108,0x0000010a,0x000200f9,
0x00000106,0x000200f8,0x00000106,0x000700f5,0x00000024,0x0000010c,0x00000104,0x000000fe,
0x0000010b,0x00000105,0x000300f7,0x0000010e,0x00000000,0x000400fa,0x0000010c,0x0000010d,
0x0000010e,0x000200f8,0x0000010d,0x0004003d,0x0000001e,0x0000010f,0x000000bd,0x000200fe,
0x0000010f,0x000200f8,0x0000010e,0x000200f9,0x000000c2,0x000200f8,0x000000c2,0x0004003d,
0x0000001e,0x00000111,0x000000bd,0x00050080,0x0000001e,0x00000112,0x00000111,0x000000b7,
0x0003003e,0x000000bd,0x00000112,0x000200f9,0x000000bf,0x000200f8,0x000000c1,0x000200fe,
0x00000113,0x00010038,0x00050036,0x00000024,0x00000028,0x00000000,0x00000025,0x00030037,
0x00000016,0x00000026,0x00030037,0x00000023,0x00000027,0x000200f8,0x00000029,0x0004003d,
0x0000001e,0x00000116,0x00000027,0x000500af,0x00000024,0x00000117,0x00000116,0x000000be,
0x000300f7,0x00000119,0x00000000,0x000400fa,0x00000117,0x00000118,0x00000119,0x000200f8,
0x00000118,0x0004003d,0x00000006,0x0000011a,0x00000026,0x0004003d,0x0000001e,0x0000011b,
0x00000027,0x0004006f,0x00000006,0x0000011c,0x0000011b,0x0006000c,0x00000006,0x0000011d,
0x00000001,0x0000001d,0x0000011c,0x00050088,0x00000006,0x0000011e,0x0000011a,0x0000011d,
0x0006000c,0x00000006,0x0000011f,0x00000001,0x00000008,0x0000011e,0x0005008d,0x00000006,
0x00000121,0x0000011f,0x00000120,0x000500ba,0x00000024,0x00000122,0x00000121,0x000000ca,
0x000200f9,0x00000119,0x000200f8,0x00000119,0x000700f5,0x00000024,0x00000123,0x00000117,
0x00000029,0x00000122,0x00000118,0x000200fe,0x00000123,0x00010038,0x00050036,0x00000007,
0x0000002b,0x00000000,0x00000009,0x00030037,0x00000008,0x0000002a,0x000200f8,0x0000002c,
0x0004003b,0x00000008,0x00000126,0x00000007,0x0004003b,0x00000008,0x0000012b,0x00000007,
0x0004003b,0x00000008,0x00000130,0x00000007,0x00070041,0x000000b8,0x00000128,0x000000b6,
0x00000127,0x000000b7,0x000000b2,0x0004003d,0x00000006,0x00000129,0x00000128,0x000500ba,
0x00000024,0x0000012a,0x00000129,0x000000ca,0x000300f7,0x0000012d,0x00000000,0x000400fa,
0x0000012a,0x0000012c,0x0000012f,0x000200f8,0x0000012c,0x0004003d,0x00000007,0x0000012e,
0x0000002a,0x0003003e,0x0000012b,0x0000012e,0x000200f9,0x0000012d,0x000200f8,0x0000012f,
0x0004003d,0x00000007,0x00000131,0x0000002a,0x0003003e,0x00000130,0x00000131,0x00050039,
0x00000007,0x00000132,0x00000011,0x00000130,0x0003003e,0x0000012b,0x00000132,0x000200f9,
0x0000012d,0x000200f8,0x0000012d,0x0004003d,0x00000007,0x00000133,0x0000012b,0x0003003e,
0x00000126,0x00000133,0x00060041,0x00000134,0x00000135,0x000000b6,0x00000127,0x000000be,
0x0004003d,0x000000ad,0x00000136,0x00000135,0x0008004f,0x00000007,0x00000137,0x00000136,
0x00000136,0x00000000,0x00000001,0x00000002,0x0004003d,0x00000007,0x00000138,0x00000126,
0x00050094,0x00000006,0x00000139,0x00000137,0x00000138,0x00060041,0x00000134,0x0000013a,
0x000000b6,0x00000127,0x000000b7,0x0004003d,0x000000ad,0x0000013b,0x0000013a,0x0008004f,
0x00000007,0x0000013c,0x0000013b,0x0000013b,0x00000000,0x00000001,0x00000002,0x0004003d,
0x00000007,0x0000013d,0x00000126,0x00050094,0x00000006,0x0000013e,0x0000013c,0x0000013d,
0x00060041,0x00000134,0x0000013f,0x000000b6,0x00000127,0x000000d2,0x0004003d,0x000000ad,
0x00000140,0x0000013f,0x0008004f,0x00000007,0x00000141,0x00000140,0x00000140,0x00000000,
0x00000001,0x00000002,0x0004003d,0x00000007,0x00000142,0x00000126,0x00050094,0x00000006,
0x00000143,0x00000141,0x00000142,0x00060050,0x00000007,0x00000144,0x00000139,0x0000013e,
0x00000143,0x00070041,0x000000b8,0x00000145,0x000000b6,0x00000127,0x000000d2,0x000000b2,
0x0004003d,0x00000006,0x00000146,0x00000145,0x0005008e,0x00000007,0x00000147,0x00000144,
0x00000146,0x000200fe,0x00000147,0x00010038
0x000200f8,0x00000022,0x0004003b,0x00000016,0x000000a2,0x00000007,0x0004003b,0x00000016,
0x000000b0,0x00000007,0x0004003b,0x00000016,0x000000b4,0x00000007,0x0004003b,0x000000b8,
0x000000b9,0x00000007,0x0004003b,0x000000cc,0x000000cd,0x00000007,0x0004003b,0x00000016,
0x000000f5,0x00000007,0x00060041,0x000000ad,0x000000ae,0x000000a9,0x000000ab,0x000000ac,
0x0004003d,0x00000006,0x000000af,0x000000ae,0x0003003e,0x000000a2,0x000000af,0x0004003d,
0x00000006,0x000000b1,0x000000a2,0x0005008d,0x00000006,0x000000b3,0x000000b1,0x000000b2,
0x0003003e,0x000000b0,0x000000b3,0x0004003d,0x00000006,0x000000b5,0x000000a2,0x00050088,
0x00000006,0x000000b6,0x000000b5,0x000000b2,0x0006000c,0x00000006,0x000000b7,0x00000001,
0x00000008,0x000000b6,0x0003003e,0x000000b4,0x000000b7,0x0003003e,0x000000b9,0x000000ba,
0x000200f9,0x000000bb,0x000200f8,0x000000bb,0x000400f6,0x000000bd,0x000000be,0x00000000,
0x000200f9,0x000000bf,0x000200f8,0x000000bf,0x0004003d,0x000000aa,0x000000c0,0x000000b9,
0x000500b1,0x0000001e,0x000000c2,0x000000c0,0x000000c1,0x000400fa,0x000000c2,0x000000bc,
0x000000bd,0x000200f8,0x000000bc,0x0004003d,0x000000aa,0x000000c3,0x000000b9,0x0004006f,
0x00000006,0x000000c4,0x000000c3,0x0004003d,0x00000006,0x000000c5,0x000000b0,0x00050083,
0x00000006,0x000000c7,0x000000c5,0x000000c6,0x000500be,0x0000001e,0x000000c8,0x000000c4,
0x000000c7,0x000300f7,0x000000ca,0x00000000,0x000400fa,0x000000c8,0x000000c9,0x000000ca,
0x000200f8,0x000000c9,0x000200f9,0x000000bd,0x000200f8,0x000000ca,0x0004003d,0x000000aa,
0x000000cf,0x000000b9,0x00060041,0x000000d0,0x000000d1,0x000000a9,0x000000ce,0x000000cf,
0x0004003d,0x000000a3,0x000000d2,0x000000d1,0x0003003e,0x000000cd,0x000000d2,0x00050041,
0x00000016,0x000000d4,0x00000020,0x000000d3,0x0004003d,0x00000006,0x000000d5,0x000000d4,
0x00050041,0x00000016,0x000000d6,0x000000cd,0x000000d3,0x0004003d,0x00000006,0x000000d7,
0x000000d6,0x000500be,0x0000001e,0x000000d8,0x000000d5,0x000000d7,0x000300f7,0x000000da,
0x00000000,0x000400fa,0x000000d8,0x000000d9,0x000000da,0x000200f8,0x000000d9,0x00050041,
0x00000016,0x000000dc,0x00000020,0x000000db,0x0004003d,0x00000006,0x000000dd,0x000000dc,
0x00050041,0x00000016,0x000000de,0x000000cd,0x000000db,0x0004003d,0x00000006,0x000000df,
0x000000de,0x000500be,0x0000001e,0x000000e0,0x000000dd,0x000000df,0x000200f9,0x000000da,
0x000200f8,0x000000da,0x000700f5,0x0000001e,0x000000e1,0x000000d8,0x000000ca,0x000000e0,
0x000000d9,0x000300f7,0x000000e3,0x00000000,0x000400fa,0x000000e1,0x000000e2,0x000000e3,
0x000200f8,0x000000e2,0x00050041,0x00000016,0x000000e4,0x00000020,0x000000d3,0x0004003d,
0x00000006,0x000000e5,0x000000e4,0x00050041,0x00000016,0x000000e7,0x000000cd,0x000000e6,
0x0004003d,0x00000006,0x000000e8,0x000000e7,0x000500b8,0x0000001e,0x000000e9,0x000000e5,
0x000000e8,0x000200f9,0x000000e3,0x000200f8,0x000000e3,0x000700f5,0x0000001e,0x000000ea,
0x000000e1,0x000000da,0x000000e9,0x000000e2,0x000300f7,0x000000ec,0x00000000,0x000400fa,
0x000000ea,0x000000eb,0x000000ec,0x000200f8,0x000000eb,0x00050041,0x00000016,0x000000ed,
0x00000020,0x000000db,0x0004003d,0x00000006,0x000000ee,0x000000ed,0x00050041,0x00000016,
0x000000ef,0x000000cd,0x000000ac,0x0004003d,0x00000006,0x000000f0,0x000000ef,0x000500b8,
0x0000001e,0x000000f1,0x000000ee,0x000000f0,0x000200f9,0x000000ec,0x000200f8,0x000000ec,
0x000700f5,0x0000001e,0x000000f2,0x000000ea,0x000000e3,0x000000f1,0x000000eb,0x000300f7,
0x000000f4,0x00000000,0x000400fa,0x000000f2,0x000000f3,0x000000f4,0x000200f8,0x000000f3,
0x0004003d,0x00000006,0x000000f6,0x000000b4,0x0004003d,0x000000aa,0x000000f7,0x000000b9,
0x0004006f,0x00000006,0x000000f8,0x000000f7,0x0006000c,0x00000006,0x000000f9,0x00000001,
0x0000001d,0x000000f8,0x00050088,0x00000006,0x000000fa,0x000000f6,0x000000f9,0x0006000c,
0x00000006,0x000000fb,0x00000001,0x00000008,0x000000fa,0x0005008d,0x00000006,0x000000fd,
0x000000fb,0x000000fc,0x0003003e,0x000000f5,0x000000fd,0x0004003d,0x00000006,0x000000fe,
0x000000f5,0x000500ba,0x0000001e,0x000000ff,0x000000fe,0x000000c6,0x000200fe,0x000000ff,
0x000200f8,0x000000f4,0x000200f9,0x000000be,0x000200f8,0x000000be,0x0004003d,0x000000aa,
0x00000101,0x000000b9,0x00050080,0x000000aa,0x00000102,0x00000101,0x000000ab,0x0003003e,
0x000000b9,0x00000102,0x000200f9,0x000000bb,0x000200f8,0x000000bd,0x000200fe,0x00000103,
0x00010038
};
+45 -223
View File
@@ -3,7 +3,6 @@
#include "ahb_swapchain.h"
#include "droiddeck_color.h"
#include "vk_present.h"
#include "framegen_bridge.h"
#include <android/hardware_buffer.h>
#include <android/native_window.h>
#include <android/rect.h>
@@ -65,8 +64,6 @@ static struct {
void (*setHdrMetadata_cta861_3)(ASurfaceTransaction *, ASurfaceControl *, const struct droiddeck_hdr_cta861_3 *);
const void *(*getNativeHandle)(const AHardwareBuffer *);
void (*setDesiredHdrHeadroom)(ASurfaceTransaction *, ASurfaceControl *, float);
void (*setEnableBackPressure)(ASurfaceTransaction *, ASurfaceControl *, bool);
void (*setDesiredPresentTime)(ASurfaceTransaction *, int64_t);
int state;
} api;
@@ -108,8 +105,6 @@ static int load_api(void) {
SYM(setHdrMetadata_smpte2086, "ASurfaceTransaction_setHdrMetadata_smpte2086");
SYM(setHdrMetadata_cta861_3, "ASurfaceTransaction_setHdrMetadata_cta861_3");
SYM(setDesiredHdrHeadroom, "ASurfaceTransaction_setDesiredHdrHeadroom");
SYM(setEnableBackPressure, "ASurfaceTransaction_setEnableBackPressure");
SYM(setDesiredPresentTime, "ASurfaceTransaction_setDesiredPresentTime");
#undef SYM
if (!api.createFromWindow || !api.release || !api.txCreate || !api.txDelete || !api.txApply ||
!api.setBuffer || !api.setZOrder || !api.setVisibility || !api.setGeometry ||
@@ -139,7 +134,7 @@ void sc_layer_set_frame_rate(float fps) {
}
#define POOL_MAX 8
#define POOL_MAX 5
struct slot {
AHardwareBuffer *ahb;
@@ -163,7 +158,6 @@ struct layer {
ARect geo_src, geo_dst;
int geo_valid;
int alloc_tier;
unsigned import_failed_fmts;
uint64_t pool_modifier;
int first_logged;
int64_t drop_logged_ns;
@@ -189,12 +183,6 @@ static int g_layers_ready;
static pthread_mutex_t g_lock = PTHREAD_MUTEX_INITIALIZER;
static int g_pending_cb;
static unsigned g_stat_layer_frames;
static pthread_mutex_t g_timeline_lock = PTHREAD_MUTEX_INITIALIZER;
static int64_t g_timeline_present_ns, g_timeline_deadline_ns, g_timeline_period_ns;
static int g_timeline_late;
static int64_t g_cadence_seen_ns, g_cadence_gap_ns, g_cadence_target_ns;
static int g_group_frames = 1, g_group_index;
static unsigned g_stat_aimed_next, g_stat_aimed_later, g_stat_aimed_even;
static int g_two_logged;
static AHardwareBuffer *g_blank;
static ASurfaceControl *g_base_sc;
@@ -231,58 +219,6 @@ static int64_t now_ns(void) {
return (int64_t)ts.tv_sec * 1000000000LL + ts.tv_nsec;
}
void sc_layer_frame_timeline(int64_t present_ns, int64_t deadline_ns, int64_t period_ns) {
pthread_mutex_lock(&g_timeline_lock);
g_timeline_present_ns = present_ns;
g_timeline_deadline_ns = deadline_ns;
g_timeline_period_ns = period_ns;
pthread_mutex_unlock(&g_timeline_lock);
}
static int64_t cadence_target(int64_t now, int64_t earliest, int64_t period) {
const int64_t gap = now - g_cadence_seen_ns;
g_cadence_seen_ns = now;
if (gap <= 0 || gap > 8 * period) {
g_cadence_gap_ns = 0;
g_cadence_target_ns = earliest;
return earliest;
}
g_cadence_gap_ns = g_cadence_gap_ns ? (g_cadence_gap_ns * 15 + gap) / 16 : gap;
const int64_t steps = (g_cadence_gap_ns + period / 2) / period;
const int64_t even = g_cadence_target_ns + steps * period;
int64_t target = earliest;
if (steps >= 1 && llabs(g_cadence_gap_ns - steps * period) < period / 8 &&
even > earliest + period / 2 && even < earliest + steps * period + period / 2) {
target = even;
g_stat_aimed_even++;
}
g_cadence_target_ns = target;
return target;
}
static void apply_present_time(ASurfaceTransaction *tx, int game) {
if (!api.setDesiredPresentTime) return;
pthread_mutex_lock(&g_timeline_lock);
const int64_t present = g_timeline_present_ns, deadline = g_timeline_deadline_ns, period = g_timeline_period_ns;
pthread_mutex_unlock(&g_timeline_lock);
const int64_t now = now_ns();
if (period <= 0 || now - deadline > 4 * period) return;
int64_t ahead = now > deadline ? (now - deadline + period - 1) / period : -((deadline - now) / period);
const int64_t slack = deadline + ahead * period - now;
g_timeline_late = slack < (g_timeline_late ? period * 5 / 8 : period / 8);
if (g_timeline_late) { ahead++; g_stat_aimed_later++; } else g_stat_aimed_next++;
int64_t target = present + ahead * period;
if (game && g_group_index > 0) {
int64_t steps = (g_group_index * g_cadence_gap_ns / g_group_frames + period / 2) / period;
if (steps < g_group_index) steps = g_group_index;
if (target < g_cadence_target_ns + steps * period) target = g_cadence_target_ns + steps * period;
} else if (game) {
target = cadence_target(now, target, period);
}
if (game && g_group_frames > 1 && ++g_group_index >= g_group_frames) { g_group_index = 0; g_group_frames = 1; }
api.setDesiredPresentTime(tx, target - period / 2);
}
static void on_complete(void *context, ASurfaceTransactionStats *stats) {
struct complete_ctx *ctx = context;
pthread_mutex_lock(&g_lock);
@@ -465,22 +401,10 @@ static void describe_handle(const struct droiddeck_native_handle *h, char *out,
o += (size_t)snprintf(out + o, n - o, " %#x", (unsigned)h->data[h->numFds + i]);
}
static int handle_fd(const struct droiddeck_native_handle *h, off_t need, int *which) {
for (int i = 0; h && i < h->numFds; i++) {
off_t sz = lseek(h->data[i], 0, SEEK_END);
if (sz >= 0) lseek(h->data[i], 0, SEEK_SET);
if (sz >= need) { if (which) *which = i; return h->data[i]; }
}
return -1;
}
int sc_layer_ahb_fd(AHardwareBuffer *ahb, uint64_t need) {
return load_api() == 0 ? handle_fd(api.getNativeHandle(ahb), (off_t)need, NULL) : -1;
}
static int g_alloc_failed;
enum { TIER_UBWC, TIER_PLAIN, TIER_LINEAR };
#define DROIDDECK_AHB_USAGE_VENDOR_UBWC (1ULL << 28)
static const char *tier_name(int tier) {
return tier == TIER_UBWC ? "asked for UBWC" : tier == TIER_PLAIN ? "no UBWC request" : "linear by request (CPU bit)";
@@ -488,15 +412,14 @@ static const char *tier_name(int tier) {
static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fmt) {
g_alloc_failed = 0;
const unsigned fmt_bit = fmt == AHB_RGB10A2 ? 2u : 1u;
while (l->alloc_tier <= TIER_LINEAR && !(l->import_failed_fmts & fmt_bit)) {
while (l->alloc_tier <= TIER_LINEAR) {
const int tier = l->alloc_tier;
AHardwareBuffer_Desc d = {
.width = (uint32_t)w, .height = (uint32_t)h, .layers = 1,
.format = fmt,
.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE |
AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY |
(tier == TIER_UBWC ? SC_LAYER_AHB_USAGE_VENDOR_UBWC : 0) |
(tier == TIER_UBWC ? DROIDDECK_AHB_USAGE_VENDOR_UBWC : 0) |
(tier == TIER_LINEAR ? AHARDWAREBUFFER_USAGE_CPU_READ_RARELY : 0)};
AHardwareBuffer *ahb = NULL;
if (AHardwareBuffer_allocate(&d, &ahb) != 0 || !ahb) {
@@ -520,10 +443,6 @@ static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fm
img = vkp_image_import_dmabuf(nh->data[0], fmt == AHB_RGB10A2 ? DRM_ABGR2101010 : DRM_ABGR8888, mod, w, h,
got.stride * 4, 0, 1);
path = "dma-buf (QTI handle)";
if (!img && mod == MOD_LINEAR && vkp_can_import_ahb()) {
img = vkp_image_import_ahb(ahb, info, sizeof(info));
if (img) { mod = SC_MOD_GRALLOC; path = "AHardwareBuffer"; }
}
} else {
if (tier == TIER_UBWC) {
char hd[256];
@@ -540,8 +459,13 @@ static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fm
path = "AHardwareBuffer";
img = vkp_image_import_ahb(ahb, info, sizeof(info));
if (!img && tier == TIER_LINEAR) {
int which = -1;
int fd = handle_fd(nh, (off_t)got.stride * 4 * h, &which);
const off_t need = (off_t)got.stride * 4 * h;
int fd = -1, which = -1;
for (int i = 0; nh && i < nh->numFds; i++) {
off_t sz = lseek(nh->data[i], 0, SEEK_END);
if (sz >= 0) lseek(nh->data[i], 0, SEEK_SET);
if (sz >= need) { fd = nh->data[i]; which = i; break; }
}
if (fd < 0 && nh && nh->numFds > 0) { fd = nh->data[0]; which = 0; }
mod = MOD_LINEAR;
path = "linear dma-buf";
@@ -562,7 +486,6 @@ static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fm
nh ? nh->numFds : -1, nh ? nh->numInts : -1, hd);
AHardwareBuffer_release(ahb);
if (tier < TIER_LINEAR) { l->alloc_tier = tier + 1; continue; }
l->import_failed_fmts |= fmt_bit;
g_alloc_failed = 1;
return -1;
}
@@ -583,27 +506,16 @@ static int alloc_slot(struct layer *l, struct slot *s, int w, int h, uint32_t fm
return -1;
}
static int fence_wait(int fd, int timeout_ms) {
static int fence_signalled(int fd) {
struct pollfd p = {.fd = fd, .events = POLLIN};
int r;
do { r = poll(&p, 1, timeout_ms); } while (r < 0 && errno == EINTR);
return r;
}
static int fence_signalled(int fd) {
return fence_wait(fd, 0) > 0;
}
static void slot_keep_fence(struct slot *s, int fd) {
pthread_mutex_lock(&g_lock);
if (s->release_fd < 0) s->release_fd = fd; else close(fd);
pthread_mutex_unlock(&g_lock);
do { r = poll(&p, 1, 0); } while (r < 0 && errno == EINTR);
return r > 0;
}
static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait_fd) {
int idx = -1, pending = -1, fd = -1;
*wait_fd = -1;
g_alloc_failed = 0;
pthread_mutex_lock(&g_lock);
for (int i = 0; i < l->pool_n; i++) {
if (i == l->cur_slot || l->slots[i].busy) continue;
@@ -623,7 +535,15 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait
memset(s, 0, sizeof(*s)); s->release_fd = -1;
}
if (fd >= 0 && !vkp_can_wait_sync_fd()) {
if (fence_wait(fd, 100) == 0) { slot_keep_fence(s, fd); return -1; }
struct pollfd p = {.fd = fd, .events = POLLIN};
int r;
do { r = poll(&p, 1, 100); } while (r < 0 && errno == EINTR);
if (r == 0) {
pthread_mutex_lock(&g_lock);
if (s->release_fd < 0) s->release_fd = fd; else close(fd);
pthread_mutex_unlock(&g_lock);
return -1;
}
close(fd);
fd = -1;
}
@@ -638,8 +558,6 @@ static int take_free_slot(struct layer *l, int w, int h, uint32_t fmt, int *wait
int sc_layer_available(void) { return load_api() == 0; }
int sc_layer_queues(void) { return load_api() == 0 && api.setEnableBackPressure != NULL; }
void sc_layer_probe_dmabuf_fd(int fd) {
static int done;
if (done || fd < 0) return;
@@ -677,10 +595,9 @@ static int ensure_sc(struct layer *l) {
return 0;
}
static int layer_geometry(int w, int h, int scene_w, int scene_h, const struct vkp_draw *draw, int r[8]) {
static int layer_geometry(int w, int h, int scene_w, int scene_h, int r[8]) {
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
if (draw) return vkp_map_draw(draw, r) ? 1 : 0;
return vkp_map_rect(w, h, (const int[4]){0, 0, scene_w, scene_h}, r) ? 1 : 0;
return vkp_map_rect(w, h, scene_w, scene_h, r) ? 1 : 0;
}
static ARect g_game_src, g_game_dst;
@@ -840,7 +757,6 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d
ASurfaceControl *old = swap_sc_begin(l);
if (old) api.setZOrder(tx, l->sc, l->z);
api.setBuffer(tx, l->sc, s->ahb, -1);
if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true);
api.setBufferTransparency(tx, l->sc,
translucent ? ASC_TRANSPARENCY_TRANSLUCENT : ASC_TRANSPARENCY_OPAQUE);
apply_geometry(tx, l, r);
@@ -853,7 +769,6 @@ static int present_slot(struct layer *l, int idx, const int r[8], const struct d
pthread_mutex_lock(&g_lock);
s->busy = 1;
pthread_mutex_unlock(&g_lock);
apply_present_time(tx, l == &g_layers[SC_LAYER_GAME]);
api.txApply(tx);
api.txDelete(tx);
l->cur_slot = idx;
@@ -884,12 +799,11 @@ unsigned sc_layer_drops_take(void) {
}
int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, void *token, int scene_w, int scene_h,
const struct vkp_draw *draw,
const struct droiddeck_color *color, uint32_t ahb_format) {
struct layer *l = layer_of(SC_LAYER_GAME);
int r[8];
if (!ahb || !token || ensure_sc(l) != 0) goto unavailable;
int g = layer_geometry(w, h, scene_w, scene_h, draw, r);
int g = layer_geometry(w, h, scene_w, scene_h, r);
if (g < 0) goto unavailable;
if (g == 0) { if (acquire_fd >= 0) close(acquire_fd); sc_layer_hide(); return 1; }
if (token == l->cur_token && l->shown && !l->recreate_pending) {
@@ -907,7 +821,6 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi
ASurfaceControl *old = swap_sc_begin(l);
if (old) api.setZOrder(tx, l->sc, l->z);
api.setBuffer(tx, l->sc, ahb, acquire_fd);
if (api.setEnableBackPressure) api.setEnableBackPressure(tx, l->sc, true);
api.setBufferTransparency(tx, l->sc, ASC_TRANSPARENCY_OPAQUE);
apply_geometry(tx, l, r);
apply_frame_rate(tx, l);
@@ -921,7 +834,6 @@ int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, voi
l->ds_applied = -1; l->md_applied = 0; l->hr_applied = -1.0f;
return -1;
}
apply_present_time(tx, 1);
api.txApply(tx);
api.txDelete(tx);
l->cur_slot = -1;
@@ -936,19 +848,18 @@ unavailable:
return -1;
}
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct vkp_draw *draw,
const struct droiddeck_color *color) {
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct droiddeck_color *color) {
struct layer *l = layer_of(SC_LAYER_GAME);
if (!src || ensure_sc(l) != 0) return -1;
int sw = vkp_image_width(src), sh = vkp_image_height(src);
int r[8];
int g = layer_geometry(sw, sh, scene_w, scene_h, draw, r);
int g = layer_geometry(sw, sh, scene_w, scene_h, r);
if (g < 0) return -1;
if (g == 0) { sc_layer_hide(); return 0; }
int wait_fd;
int idx = take_free_slot(l, sw, sh, AHB_RGBA8, &wait_fd);
if (idx < 0) { log_drop(l); return g_alloc_failed ? -1 : 0; }
if (idx < 0) { log_drop(l); return 0; }
if (vkp_blit_image(src, l->slots[idx].img, wait_fd) != 0) return -1;
if (present_slot(l, idx, r, color, 0) != 0) return -1;
if (color && color->dataspace) droiddeck_color_frame_shown(color, DROIDDECK_HDR_LAYER_COPY, AHB_RGBA8);
@@ -968,10 +879,10 @@ int sc_layer_present_pass(const struct vkp_draw *draws, int n, int scene_w, int
if (!draws || n <= 0 || ensure_sc(l) != 0) return -1;
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
if (vkp_pass_begin(scene_w, scene_h, draws, n, &rw, &rh) != 0) return -1;
if (!vkp_map_rect(rw, rh, (const int[4]){0, 0, scene_w, scene_h}, r)) { vkp_pass_abort(); sc_layer_hide(); return 0; }
if (!vkp_map_rect(rw, rh, scene_w, scene_h, r)) { vkp_pass_abort(); sc_layer_hide(); return 0; }
int wait_fd;
int idx = take_free_slot(l, rw, rh, AHB_RGBA8, &wait_fd);
if (idx < 0) { vkp_pass_abort(); log_drop(l); return g_alloc_failed ? -1 : 0; }
if (idx < 0) { vkp_pass_abort(); log_drop(l); return 0; }
if (vkp_pass_copy_to(l->slots[idx].img, wait_fd) != 0) return -1;
if (present_slot(l, idx, r, NULL, 0) != 0) return -1;
if (!l->first_logged) {
@@ -984,97 +895,8 @@ int sc_layer_present_pass(const struct vkp_draw *draws, int n, int scene_w, int
return 0;
}
static void slots_idle(struct layer *l, const int *idx, int from, int to) {
pthread_mutex_lock(&g_lock);
for (int i = from; i < to; i++) l->slots[idx[i]].busy = 0;
pthread_mutex_unlock(&g_lock);
}
static uint32_t g_hdr_pool_fmt = AHB_RGB10A2;
static int take_hdr_slot(struct layer *l, int w, int h, int *wait_fd) {
int idx = take_free_slot(l, w, h, g_hdr_pool_fmt, wait_fd);
if (idx < 0 && g_alloc_failed && g_hdr_pool_fmt == AHB_RGB10A2) {
g_hdr_pool_fmt = AHB_RGBA8;
droiddeck_log("color", "%s: this device will not make a 10-bit layer buffer (RGBA1010102): the HDR picture goes "
"on 8-bit buffers instead (still tagged BT2020_PQ; less precision)", l->name);
idx = take_free_slot(l, w, h, g_hdr_pool_fmt, wait_fd);
}
return idx;
}
int sc_layer_present_generated(const struct vkp_draw *draws, int n_draws, const struct vkp_hdr_frame *hf,
int scene_w, int scene_h, int composed, const struct droiddeck_color *color) {
struct layer *l = layer_of(SC_LAYER_GAME);
int rw = 0, rh = 0, r[8], idx[VKP_FG_MAX_GENERATIONS + 1], m = 0, first_fd = -1, have_fd = 0;
struct vkp_image *dst[VKP_FG_MAX_GENERATIONS], *real = NULL;
g_group_index = 0;
g_group_frames = 1;
if (!draws || n_draws <= 0 || ensure_sc(l) != 0) return -1;
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
const int deep = hf && !hf->tonemap;
if (hf) composed = 1;
if (hf && hf->tonemap) color = NULL;
int n = vkp_pass_begin_generate(scene_w, scene_h, draws, n_draws, hf, &rw, &rh);
if (n < 0) return -1;
const int mapped = vkp_map_rect(rw, rh, (const int[4]){0, 0, scene_w, scene_h}, r);
if (!mapped) n = 0;
if (composed) {
if (!mapped) { vkp_pass_abort(); sc_layer_hide(); return 0; }
idx[VKP_FG_MAX_GENERATIONS] = deep ? take_hdr_slot(l, rw, rh, &first_fd)
: take_free_slot(l, rw, rh, AHB_RGBA8, &first_fd);
if (idx[VKP_FG_MAX_GENERATIONS] < 0) { vkp_pass_abort(); log_drop(l); return g_alloc_failed ? -1 : 0; }
pthread_mutex_lock(&g_lock);
l->slots[idx[VKP_FG_MAX_GENERATIONS]].busy = 1;
pthread_mutex_unlock(&g_lock);
real = l->slots[idx[VKP_FG_MAX_GENERATIONS]].img;
have_fd = 1;
}
for (; m < n; m++) {
int fd;
idx[m] = take_free_slot(l, rw, rh, deep ? g_hdr_pool_fmt : AHB_RGBA8, &fd);
if (idx[m] < 0) { log_drop(l); break; }
if (have_fd && fd >= 0) {
if (fence_wait(fd, 100) == 0) { slot_keep_fence(&l->slots[idx[m]], fd); log_drop(l); break; }
close(fd);
}
pthread_mutex_lock(&g_lock);
l->slots[idx[m]].busy = 1;
pthread_mutex_unlock(&g_lock);
dst[m] = l->slots[idx[m]].img;
if (!have_fd) { first_fd = fd; have_fd = 1; }
}
if (vkp_pass_copy_generated(dst, m, real, first_fd) != 0) {
slots_idle(l, idx, 0, m);
if (real) slots_idle(l, idx, VKP_FG_MAX_GENERATIONS, VKP_FG_MAX_GENERATIONS + 1);
return -1;
}
g_group_frames = m + 1;
for (int k = 0; k < m; k++) {
if (present_slot(l, idx[k], r, color, 0) == 0) continue;
slots_idle(l, idx, k, m);
if (real) slots_idle(l, idx, VKP_FG_MAX_GENERATIONS, VKP_FG_MAX_GENERATIONS + 1);
g_group_index = 0;
g_group_frames = 1;
return -1;
}
vkp_framegen_presented(m);
if (real) {
if (present_slot(l, idx[VKP_FG_MAX_GENERATIONS], r, color, 0) != 0) {
slots_idle(l, idx, VKP_FG_MAX_GENERATIONS, VKP_FG_MAX_GENERATIONS + 1);
g_group_index = 0;
g_group_frames = 1;
return -1;
}
l->first_logged = 1;
vkp_signal_first_frame();
}
if (hf && hf->color && hf->color->dataspace)
droiddeck_color_frame_shown(hf->color, deep ? DROIDDECK_HDR_COMPOSED : DROIDDECK_HDR_TONEMAPPED,
deep ? g_hdr_pool_fmt : AHB_RGBA8);
return m;
}
int sc_layer_present_hdr_scene(const struct vkp_draw *draws, int n, const struct vkp_hdr_frame *hf,
int scene_w, int scene_h, const struct droiddeck_color *color) {
struct layer *l = layer_of(SC_LAYER_GAME);
@@ -1082,11 +904,19 @@ int sc_layer_present_hdr_scene(const struct vkp_draw *draws, int n, const struct
if (!draws || n <= 0 || !hf || ensure_sc(l) != 0) return -1;
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
if (vkp_pass_begin_hdr(scene_w, scene_h, draws, n, hf, &rw, &rh) != 0) return -1;
if (!vkp_map_rect(rw, rh, (const int[4]){0, 0, scene_w, scene_h}, r)) { vkp_pass_abort(); sc_layer_hide(); return 0; }
if (!vkp_map_rect(rw, rh, scene_w, scene_h, r)) { vkp_pass_abort(); sc_layer_hide(); return 0; }
const int tm = hf->tonemap;
const uint32_t fmt = tm ? AHB_RGBA8 : g_hdr_pool_fmt;
g_alloc_failed = 0;
int wait_fd;
int idx = tm ? take_free_slot(l, rw, rh, AHB_RGBA8, &wait_fd) : take_hdr_slot(l, rw, rh, &wait_fd);
if (idx < 0) { vkp_pass_abort(); log_drop(l); return g_alloc_failed ? -1 : 0; }
int idx = take_free_slot(l, rw, rh, fmt, &wait_fd);
if (idx < 0 && g_alloc_failed && fmt == AHB_RGB10A2) {
g_hdr_pool_fmt = AHB_RGBA8;
droiddeck_log("color", "%s: this device will not make a 10-bit layer buffer (RGBA1010102): the HDR picture goes "
"on 8-bit buffers instead (still tagged BT2020_PQ; less precision)", l->name);
idx = take_free_slot(l, rw, rh, g_hdr_pool_fmt, &wait_fd);
}
if (idx < 0) { vkp_pass_abort(); log_drop(l); return 0; }
if (vkp_pass_copy_to(l->slots[idx].img, wait_fd) != 0) return -1;
if (present_slot(l, idx, r, tm ? NULL : color, 0) != 0) return -1;
if (color && color->dataspace)
@@ -1137,9 +967,8 @@ int sc_layer_overlay_affordable(void) {
if (want)
droiddeck_log("layer", "overlay layer declined: this display rotates every layer %d° and the game "
"layer is scaled %dx%d -> %dx%d, and on that combination a second layer drops the "
"whole frame to GPU composition for the rest of the session (measured). A nested "
"compositor is asked to compose its own overlays into the game picture; any other "
"window above the game goes on the copy path instead.",
"whole frame to GPU composition for the rest of the session (measured). The window "
"above the game goes on the copy path instead - same picture, one blit.",
deg, sr[0], sr[1], ds[0], ds[1]);
else if (!first)
droiddeck_log("layer", "overlay layer allowed again: the game layer is no longer both rotated and "
@@ -1157,7 +986,7 @@ int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int transl
if (sw <= 0 || sh <= 0) return -1;
int wait_fd;
int idx = take_free_slot(l, sw, sh, AHB_RGBA8, &wait_fd);
if (idx < 0) { log_drop(l); return g_alloc_failed ? -1 : 0; }
if (idx < 0) { log_drop(l); return 0; }
if (vkp_blit_image(src, l->slots[idx].img, wait_fd) != 0) return -1;
if (present_slot(l, idx, geo, NULL, translucent) != 0) return -1;
if (!l->first_logged) {
@@ -1204,13 +1033,6 @@ void sc_layer_window_gone(void) {
drain_and_free_pools();
}
void sc_layer_aim_take(unsigned *next, unsigned *later, unsigned *even) {
*next = g_stat_aimed_next;
*later = g_stat_aimed_later;
*even = g_stat_aimed_even;
g_stat_aimed_next = g_stat_aimed_later = g_stat_aimed_even = 0;
}
unsigned sc_layer_frames_take(void) {
unsigned n = g_stat_layer_frames;
g_stat_layer_frames = 0;
+3 -12
View File
@@ -7,13 +7,10 @@
struct vkp_image;
struct vkp_draw;
struct droiddeck_color;
struct vkp_hdr_frame;
enum sc_layer_id { SC_LAYER_GAME = 0, SC_LAYER_OVERLAY = 1, SC_LAYER_COUNT = 2 };
int sc_layer_available(void);
#define SC_LAYER_AHB_USAGE_VENDOR_UBWC (1ULL << 28)
int sc_layer_ahb_fd(AHardwareBuffer *ahb, uint64_t need);
void sc_layer_probe_dmabuf_fd(int fd);
@@ -21,25 +18,21 @@ int sc_layer_can_tag_hdr(void);
void sc_layer_hdr_symbols(char *out, size_t size);
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct vkp_draw *draw,
const struct droiddeck_color *color);
int sc_layer_present(struct vkp_image *src, int scene_w, int scene_h, const struct droiddeck_color *color);
int sc_layer_present_pass(const struct vkp_draw *draws, int n, int scene_w, int scene_h);
int sc_layer_present_generated(const struct vkp_draw *draws, int n_draws, const struct vkp_hdr_frame *hf,
int scene_w, int scene_h, int composed, const struct droiddeck_color *color);
struct vkp_hdr_frame;
int sc_layer_present_hdr_scene(const struct vkp_draw *draws, int n, const struct vkp_hdr_frame *hf,
int scene_w, int scene_h, const struct droiddeck_color *color);
int sc_layer_present_ahb(AHardwareBuffer *ahb, int w, int h, int acquire_fd, void *token,
int scene_w, int scene_h, const struct vkp_draw *draw, const struct droiddeck_color *color, uint32_t ahb_format);
int scene_w, int scene_h, const struct droiddeck_color *color, uint32_t ahb_format);
void sc_layer_set_frame_rate(float fps);
int sc_layer_overlay_affordable(void);
int sc_layer_queues(void);
int sc_layer_present_overlay(struct vkp_image *src, const int geo[8], int translucent);
void sc_layer_hide(void);
@@ -49,8 +42,6 @@ void sc_layer_hide_overlay(void);
void sc_layer_window_gone(void);
void sc_layer_frame_timeline(int64_t present_ns, int64_t deadline_ns, int64_t period_ns);
void sc_layer_aim_take(unsigned *next, unsigned *later, unsigned *even);
unsigned sc_layer_frames_take(void);
unsigned sc_layer_drops_take(void);
@@ -1,61 +0,0 @@
#ifndef VK_LINEAR_DMABUF_H
#define VK_LINEAR_DMABUF_H
#include <stdint.h>
#include <vulkan/vulkan.h>
static inline int vkp_linear_dmabuf_through_buffer(int drm_modifiers, uint64_t modifier, int blit_dst) {
return !drm_modifiers && modifier == 0 && !blit_dst;
}
static inline int vkp_linear_dmabuf_foreign_image(int dmabuf, int staged) {
return dmabuf && !staged;
}
static inline VkPipelineStageFlags vkp_linear_dmabuf_readback_stage(int in_general) {
return in_general ? VK_PIPELINE_STAGE_TRANSFER_BIT : VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
}
static inline VkAccessFlags vkp_linear_dmabuf_readback_access(int in_general) {
return in_general ? VK_ACCESS_TRANSFER_WRITE_BIT : 0;
}
static inline uint32_t vkp_linear_dmabuf_texel_bytes(VkFormat fmt) {
return fmt == VK_FORMAT_R16G16B16A16_SFLOAT ? 8u : 4u;
}
static inline int vkp_padded_linear_target_needs_layout(int drm_modifiers, uint64_t modifier, VkFormat fmt,
int w, uint32_t stride, uint32_t offset) {
return !drm_modifiers && modifier == 0 &&
(offset != 0 || (uint64_t)stride != (uint64_t)w * vkp_linear_dmabuf_texel_bytes(fmt));
}
static inline VkDeviceSize vkp_linear_dmabuf_copy(VkFormat fmt, int w, int h, uint32_t stride, uint32_t offset,
VkBufferImageCopy *copy) {
const uint32_t texel = vkp_linear_dmabuf_texel_bytes(fmt);
if (!copy || w <= 0 || h <= 0 || stride % texel || offset % texel || stride / texel < (uint32_t)w) return 0;
*copy = (VkBufferImageCopy){
.bufferOffset = offset,
.bufferRowLength = stride / texel,
.bufferImageHeight = (uint32_t)h,
.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.imageExtent = {(uint32_t)w, (uint32_t)h, 1},
};
return (VkDeviceSize)offset + (VkDeviceSize)stride * (VkDeviceSize)(h - 1) + (VkDeviceSize)w * texel;
}
static inline VkBufferMemoryBarrier vkp_linear_dmabuf_ownership(VkBuffer buffer, uint32_t queue_family,
VkAccessFlags access, int acquire) {
return (VkBufferMemoryBarrier){
.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
.srcAccessMask = acquire ? 0 : access,
.dstAccessMask = acquire ? access : 0,
.srcQueueFamilyIndex = acquire ? VK_QUEUE_FAMILY_FOREIGN_EXT : queue_family,
.dstQueueFamilyIndex = acquire ? queue_family : VK_QUEUE_FAMILY_FOREIGN_EXT,
.buffer = buffer,
.offset = 0,
.size = VK_WHOLE_SIZE,
};
}
#endif
@@ -6,7 +6,6 @@
#include <stdlib.h>
#include <sys/stat.h>
#include <android/log.h>
#include <string.h>
#define TAG "DroidDeckWayland"
@@ -46,13 +45,6 @@ int vk_loader_open(const char *driver_path, const char *library_name,
return g_vk.CreateInstance ? 0 : -1;
}
void vk_loader_close(void) {
if (g_handle) dlclose(g_handle);
g_handle = NULL;
g_gip = NULL;
memset(&g_vk, 0, sizeof(g_vk));
}
PFN_vkGetInstanceProcAddr vk_loader_gipa(void) { return g_gip; }
void vk_loader_load_instance(VkInstance instance) {
+2 -5
View File
@@ -6,7 +6,7 @@
#define VK_GLOBAL_FUNCS(X) X(CreateInstance) X(EnumerateInstanceExtensionProperties)
#define VK_INSTANCE_FUNCS(X) \
X(DestroyInstance) X(EnumeratePhysicalDevices) X(GetPhysicalDeviceProperties) \
X(EnumeratePhysicalDevices) X(GetPhysicalDeviceProperties) \
X(GetPhysicalDeviceQueueFamilyProperties) X(GetPhysicalDeviceSurfaceSupportKHR) \
X(GetPhysicalDeviceSurfaceCapabilitiesKHR) X(GetPhysicalDeviceSurfaceFormatsKHR) \
X(CreateAndroidSurfaceKHR) X(DestroySurfaceKHR) X(CreateDevice) \
@@ -22,9 +22,7 @@
X(ResetCommandBuffer) X(BeginCommandBuffer) X(CmdPipelineBarrier) X(CmdBlitImage) \
X(EndCommandBuffer) X(ResetFences) X(QueueSubmit) X(QueuePresentKHR) X(WaitForFences) \
X(QueueWaitIdle) X(GetMemoryFdPropertiesKHR) X(GetAndroidHardwareBufferPropertiesANDROID) \
X(GetImageSubresourceLayout) X(MapMemory) X(UnmapMemory) X(CmdClearColorImage) X(CmdCopyImageToBuffer) \
X(CreateBuffer) X(DestroyBuffer) X(GetBufferMemoryRequirements) X(BindBufferMemory) \
X(CmdCopyBufferToImage) \
X(GetImageSubresourceLayout) X(MapMemory) X(UnmapMemory) X(CmdClearColorImage) \
\
X(CreateShaderModule) X(DestroyShaderModule) X(CreatePipelineLayout) X(DestroyPipelineLayout) \
X(CreateGraphicsPipelines) X(DestroyPipeline) X(CreateRenderPass) X(DestroyRenderPass) \
@@ -45,7 +43,6 @@ extern struct vk_api g_vk;
int vk_loader_open(const char *driver_path, const char *library_name,
const char *native_lib_dir);
void vk_loader_close(void);
void vk_loader_load_instance(VkInstance instance);
void vk_loader_load_device(VkDevice device);
PFN_vkGetInstanceProcAddr vk_loader_gipa(void);
+82 -352
View File
@@ -2,7 +2,6 @@
#include "vk_present.h"
#include "vk_loader.h"
#include "vk_external_image_sync.h"
#include "vk_linear_dmabuf.h"
#include "sc_layer.h"
#include "effects_chain.h"
#include "cardboard.h"
@@ -14,7 +13,6 @@
#include "quest_device.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/system_properties.h>
#include <unistd.h>
@@ -43,17 +41,11 @@ struct vkp_image {
VkFormat fmt;
int sampled;
AHardwareBuffer *android_buffer;
int staged;
VkBuffer linear_buf;
VkDeviceMemory linear_mem;
VkBufferImageCopy linear_copy;
};
static ANativeWindow *g_window;
static int g_ahb_import;
static int g_drm_modifiers;
static char *g_driver_path, *g_library_name, *g_native_lib_dir;
static int g_allow_driver_fallback;
static int g_dev_state;
static void device_lost(const char *where);
static const char *vk_result_name(VkResult r);
@@ -258,8 +250,6 @@ void vk_present_set_driver(const char *driver_path, const char *library_name,
g_native_lib_dir = native_lib_dir ? strdup(native_lib_dir) : NULL;
}
void vk_present_set_driver_fallback(int allow) { g_allow_driver_fallback = allow; }
static void reset_sync(void) {
VkSemaphoreCreateInfo semci = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO};
for (int k = 0; k < MAX_PRESENTS; k++) {
@@ -423,13 +413,8 @@ static void update_map(int scene_w, int scene_h) {
if (mode == VKP_MODE_FILL) aspect = sx > sy ? sx : sy;
else if (mode == VKP_MODE_INTEGER) {
float m = sx < sy ? sx : sy;
float nearest = roundf(m);
if (nearest >= 1.0f && nearest > m &&
nearest - m < 0.15f) {
aspect = nearest;
} else {
aspect = m >= 1.0f ? (float)(int)m : m;
}
aspect = (float)(int)m;
if (aspect < 1.0f) aspect = 1.0f;
} else aspect = sx < sy ? sx : sy;
g_map.kx = g_map.ky = aspect;
g_map.off_x = (float)(g_map.rx + (int)((g_map.rw - scene_w * aspect) * 0.5f));
@@ -441,7 +426,7 @@ static void update_map(int scene_w, int scene_h) {
else if (align == VKP_ALIGN_PICTURE_RIGHT) g_map.off_x = W - scene_w * g_map.kx;
g_map.valid = 1;
pthread_mutex_lock(&g_game_picture_lock);
g_game_picture_placed = mode == VKP_MODE_INTEGER || align == VKP_ALIGN_PICTURE_TOP || align == VKP_ALIGN_PICTURE_BOTTOM || align == VKP_ALIGN_PICTURE_LEFT || align == VKP_ALIGN_PICTURE_RIGHT;
g_game_picture_placed = align == VKP_ALIGN_PICTURE_TOP || align == VKP_ALIGN_PICTURE_BOTTOM || align == VKP_ALIGN_PICTURE_LEFT || align == VKP_ALIGN_PICTURE_RIGHT;
g_game_picture_rect[0] = g_map.off_x;
g_game_picture_rect[1] = g_map.off_y;
g_game_picture_rect[2] = g_map.off_x + scene_w * g_map.kx;
@@ -564,18 +549,6 @@ static int dev_init(void) {
uint32_t npd = 0;
g_vk.EnumeratePhysicalDevices(g_inst, &npd, NULL);
if (!npd) {
if (g_allow_driver_fallback && g_driver_path && g_library_name) {
LOGE("present: display driver exposed no physical devices; retrying the system Vulkan driver");
g_vk.DestroyInstance(g_inst, NULL);
g_inst = VK_NULL_HANDLE;
vk_loader_close();
free(g_driver_path); g_driver_path = NULL;
free(g_library_name); g_library_name = NULL;
g_allow_driver_fallback = 0;
g_colorspace_ext = 0;
g_dev_state = 0;
return dev_init();
}
LOGE("present: no physical devices"); g_dev_state = -1;
set_fault("the display driver exposed no GPU to the app");
return -1;
@@ -634,7 +607,6 @@ static int dev_init(void) {
if (has_ext(exts, ne, import_exts[i])) dev_exts[n_dev_exts++] = import_exts[i];
else LOGE("present: driver MISSING %s (dmabuf import will fail)", import_exts[i]);
}
g_drm_modifiers = has_ext(exts, ne, "VK_EXT_image_drm_format_modifier");
int want_hdr_md = 0;
if (droiddeck_color_requested()) {
want_hdr_md = has_ext(exts, ne, VK_EXT_HDR_METADATA_EXTENSION_NAME);
@@ -1095,10 +1067,6 @@ struct vkp_image *vkp_image_from_dmabuf(int fd, uint32_t drm_format, uint64_t mo
return vkp_image_import_dmabuf(fd, drm_format, modifier, w, h, stride, offset, 0);
}
static int foreign_image(const struct vkp_image *img) {
return vkp_linear_dmabuf_foreign_image(img->dmabuf, img->staged);
}
/* Return client sources to FOREIGN after their final read. The consuming paths
* wait for our fence before Wayland can release an ordinary dma-buf or an
* android_wlegl AHardwareBuffer. Producer-fence synchronization is separate from
@@ -1106,7 +1074,7 @@ static int foreign_image(const struct vkp_image *img) {
static void release_external_client_image(VkCommandBuffer cmd, struct vkp_image *img) {
struct vkp_external_client_barrier_pair pair;
if (!img || !vkp_external_client_barrier_pair(
img->image, g_qfam, foreign_image(img), img->blit_dst, &pair))
img->image, g_qfam, img->dmabuf, img->blit_dst, &pair))
return;
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, NULL, 0, NULL, 1, &pair.release);
@@ -1120,37 +1088,6 @@ static void release_external_client_draws(VkCommandBuffer cmd, const struct vkp_
}
}
static void stage_linear_dmabuf(VkCommandBuffer cmd, const struct vkp_image *img) {
if (!img || !img->linear_buf) return;
const VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
VkBufferMemoryBarrier acquire = vkp_linear_dmabuf_ownership(img->linear_buf, g_qfam, VK_ACCESS_TRANSFER_READ_BIT, 1);
VkImageMemoryBarrier write = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = img->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0,
0, NULL, 1, &acquire, 1, &write);
g_vk.CmdCopyBufferToImage(cmd, img->linear_buf, img->image, VK_IMAGE_LAYOUT_GENERAL, 1, &img->linear_copy);
VkBufferMemoryBarrier release = vkp_linear_dmabuf_ownership(img->linear_buf, g_qfam, VK_ACCESS_TRANSFER_READ_BIT, 0);
VkImageMemoryBarrier read = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_GENERAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = img->image, .subresourceRange = range, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0,
0, NULL, 1, &release, 1, &read);
}
static void stage_linear_dmabufs(VkCommandBuffer cmd, const struct vkp_draw *draws, int count) {
for (int i = 0; i < count; i++) {
int seen = 0;
for (int j = 0; j < i; j++) if (draws[j].img == draws[i].img) { seen = 1; break; }
if (!seen) stage_linear_dmabuf(cmd, draws[i].img);
}
}
int vkp_image_is_dmabuf(const struct vkp_image *img) {
return img && vkp_is_external_client_image(img->dmabuf, img->blit_dst);
}
@@ -1223,122 +1160,18 @@ fail:
return NULL;
}
static int optimal_sampled(VkFormat fmt) {
if (!g_vk.GetPhysicalDeviceFormatProperties2) return 0;
VkFormatProperties2 fp = {.sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2};
g_vk.GetPhysicalDeviceFormatProperties2(g_pd, fmt, &fp);
const VkFormatFeatureFlags need = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT;
return (fp.formatProperties.optimalTilingFeatures & need) == need;
}
static void destroy_image_objects(struct vkp_image *img) {
if (img->image) g_vk.DestroyImage(g_dev, img->image, NULL);
if (img->mem) g_vk.FreeMemory(g_dev, img->mem, NULL);
if (img->linear_buf) g_vk.DestroyBuffer(g_dev, img->linear_buf, NULL);
if (img->linear_mem) g_vk.FreeMemory(g_dev, img->linear_mem, NULL);
img->image = VK_NULL_HANDLE; img->mem = VK_NULL_HANDLE;
img->linear_buf = VK_NULL_HANDLE; img->linear_mem = VK_NULL_HANDLE;
img->staged = 0; img->in_general = 0;
}
static int import_linear_dmabuf(struct vkp_image *img, int fd, const VkBufferImageCopy *copy, VkDeviceSize need) {
int dupfd = dup(fd);
if (dupfd < 0) return -1;
VkDeviceSize size = need;
off_t end = lseek(dupfd, 0, SEEK_END);
if (end > 0 && (VkDeviceSize)end >= need) size = (VkDeviceSize)end;
lseek(dupfd, 0, SEEK_SET);
if (end > 0 && (VkDeviceSize)end < need) {
LOGE("dmabuf: the linear %dx%d buffer holds %lld bytes, its row pitch needs %llu", img->w, img->h,
(long long)end, (unsigned long long)need);
close(dupfd);
return -1;
}
VkExternalMemoryBufferCreateInfo ext = {
.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO,
.handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT};
VkBufferCreateInfo bci = {.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, .pNext = &ext, .size = size,
.usage = img->blit_dst ? VK_BUFFER_USAGE_TRANSFER_DST_BIT : VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
.sharingMode = VK_SHARING_MODE_EXCLUSIVE};
VkResult r = g_vk.CreateBuffer(g_dev, &bci, NULL, &img->linear_buf);
if (r != VK_SUCCESS) goto fail;
uint32_t allowed = 0xffffffff;
if (g_vk.GetMemoryFdPropertiesKHR) {
VkMemoryFdPropertiesKHR fp = {.sType = VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR};
if (g_vk.GetMemoryFdPropertiesKHR(g_dev, VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT,
dupfd, &fp) == VK_SUCCESS)
allowed = fp.memoryTypeBits;
}
VkMemoryRequirements breq;
g_vk.GetBufferMemoryRequirements(g_dev, img->linear_buf, &breq);
int bidx = memory_type(breq.memoryTypeBits & allowed, 0);
r = VK_ERROR_FORMAT_NOT_SUPPORTED;
if (bidx < 0) goto fail;
VkImportMemoryFdInfoKHR imp = {.sType = VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR,
.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT, .fd = dupfd};
VkMemoryDedicatedAllocateInfo ded = {.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
.pNext = &imp, .buffer = img->linear_buf};
VkMemoryAllocateInfo mai = {.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, .pNext = &ded,
.allocationSize = breq.size, .memoryTypeIndex = (uint32_t)bidx};
r = g_vk.AllocateMemory(g_dev, &mai, NULL, &img->linear_mem);
if (r != VK_SUCCESS) goto fail;
dupfd = -1;
r = g_vk.BindBufferMemory(g_dev, img->linear_buf, img->linear_mem, 0);
if (r != VK_SUCCESS) goto fail;
VkImageCreateInfo ici = {
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .imageType = VK_IMAGE_TYPE_2D, .format = img->fmt,
.extent = {(uint32_t)img->w, (uint32_t)img->h, 1}, .mipLevels = 1, .arrayLayers = 1,
.samples = VK_SAMPLE_COUNT_1_BIT, .tiling = VK_IMAGE_TILING_OPTIMAL,
.usage = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT |
(img->sampled ? VK_IMAGE_USAGE_SAMPLED_BIT : 0),
.sharingMode = VK_SHARING_MODE_EXCLUSIVE, .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED};
r = g_vk.CreateImage(g_dev, &ici, NULL, &img->image);
if (r != VK_SUCCESS) goto fail;
VkMemoryRequirements ireq;
g_vk.GetImageMemoryRequirements(g_dev, img->image, &ireq);
int iidx = memory_type(ireq.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
if (iidx < 0) iidx = memory_type(ireq.memoryTypeBits, 0);
r = VK_ERROR_FORMAT_NOT_SUPPORTED;
if (iidx < 0) goto fail;
VkMemoryAllocateInfo iai = {.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
.allocationSize = ireq.size, .memoryTypeIndex = (uint32_t)iidx};
r = g_vk.AllocateMemory(g_dev, &iai, NULL, &img->mem);
if (r != VK_SUCCESS) goto fail;
r = g_vk.BindImageMemory(g_dev, img->image, img->mem, 0);
if (r != VK_SUCCESS) goto fail;
img->linear_copy = *copy;
img->staged = 1;
img->in_general = 1;
return 0;
fail:
LOGE("dmabuf: %s the linear %dx%d buffer at its row pitch failed (%s)",
img->blit_dst ? "writing" : "reading", img->w, img->h, vk_result_name(r));
if (dupfd >= 0) close(dupfd);
destroy_image_objects(img);
return -1;
}
struct vkp_image *vkp_image_import_dmabuf(int fd, uint32_t drm_format, uint64_t modifier, int w, int h,
uint32_t stride, uint32_t offset, int as_blit_dst) {
if (modifier == MOD_INVALID || w <= 0 || h <= 0) return NULL;
if (dev_init() != 0) return NULL;
const VkFormat format = drm_to_vk(drm_format);
const int padded_target = as_blit_dst &&
vkp_padded_linear_target_needs_layout(g_drm_modifiers, modifier, format, w, stride, offset);
if (padded_target && !g_vk.CmdCopyImageToBuffer) return NULL;
struct vkp_image *img = calloc(1, sizeof(*img));
if (!img) return NULL;
img->w = w; img->h = h; img->dmabuf = 1; img->blit_dst = as_blit_dst ? 1 : 0;
img->fmt = format;
const int through_buffer = padded_target || vkp_linear_dmabuf_through_buffer(g_drm_modifiers, modifier, as_blit_dst);
img->fmt = drm_to_vk(drm_format);
const VkImageUsageFlags sampled_usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
const int modifier_sampled = !as_blit_dst && g_drm_modifiers && g_vk.GetPhysicalDeviceImageFormatProperties2 &&
modifier_importable(img->fmt, modifier, sampled_usage);
img->sampled = !as_blit_dst && (through_buffer ? optimal_sampled(img->fmt) : modifier_sampled);
img->sampled = !as_blit_dst && g_vk.GetPhysicalDeviceImageFormatProperties2 &&
modifier_importable(img->fmt, modifier, sampled_usage);
/* Each new format/modifier/size a client hands over, once, for the graphics report: a colour
* or swizzle mismatch on a non-Adreno driver shows up as the pair it arrived as. */
{
@@ -1349,11 +1182,10 @@ struct vkp_image *vkp_image_import_dmabuf(int fd, uint32_t drm_format, uint64_t
if (seen[i].fmt == drm_format && seen[i].mod == modifier && seen[i].w == w && seen[i].h == h) known = 1;
if (!known && nseen < 32) {
seen[nseen].fmt = drm_format; seen[nseen].mod = modifier; seen[nseen].w = w; seen[nseen].h = h; nseen++;
droiddeck_log("gpu", "dmabuf import: %c%c%c%c %s %dx%d stride %u offset %u -> vk format %d, %s%s%s",
droiddeck_log("gpu", "dmabuf import: %c%c%c%c %s %dx%d stride %u offset %u -> vk format %d, %s%s",
drm_format & 0xff, (drm_format >> 8) & 0xff, (drm_format >> 16) & 0xff, (drm_format >> 24) & 0xff,
vkp_modifier_name(modifier), w, h, stride, offset, (int)img->fmt,
img->sampled ? "sampled" : "copied", as_blit_dst ? ", blit target" : "",
through_buffer ? ", trying a copy at its row pitch (no VK_EXT_image_drm_format_modifier)" : "");
img->sampled ? "sampled" : "copied", as_blit_dst ? ", blit target" : "");
}
}
@@ -1361,17 +1193,6 @@ struct vkp_image *vkp_image_import_dmabuf(int fd, uint32_t drm_format, uint64_t
* vkCreateImage, which left the whole window unshown (David Cimo). One packed, 64-byte aligned
* row is what a linear buffer that small holds. */
if (stride == 0 && modifier == 0) stride = ((uint32_t)w * 4 + 63) & ~63u;
if (through_buffer) {
VkBufferImageCopy linear_copy;
const VkDeviceSize linear_size = vkp_linear_dmabuf_copy(img->fmt, w, h, stride, offset, &linear_copy);
if (linear_size && import_linear_dmabuf(img, fd, &linear_copy, linear_size) == 0) {
if (padded_target) droiddeck_log("gpu", "linear layer target %dx%d writes at pitch %u via DMA-BUF",
w, h, stride);
return img;
}
if (padded_target) { free(img); return NULL; }
img->sampled = modifier_sampled;
}
VkSubresourceLayout plane = {.offset = offset, .rowPitch = stride};
VkImageDrmFormatModifierExplicitCreateInfoEXT modInfo = {
.sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT,
@@ -1494,7 +1315,7 @@ struct vkp_image *vkp_image_from_ahb(AHardwareBuffer *ahb) {
}
int vkp_can_import_ahb(void) {
return dev_init() == 0 && g_vendor_id != VKP_VENDOR_QUALCOMM && !g_library_name && g_ahb_import &&
return dev_init() == 0 && g_vendor_id != VKP_VENDOR_QUALCOMM && g_ahb_import &&
g_vk.GetAndroidHardwareBufferPropertiesANDROID;
}
@@ -1659,7 +1480,8 @@ void vkp_image_destroy(struct vkp_image *img) {
if (g_dev) {
blendp_forget_image(img->image);
if (img->map) g_vk.UnmapMemory(g_dev, img->mem);
destroy_image_objects(img);
if (img->image) g_vk.DestroyImage(g_dev, img->image, NULL);
if (img->mem) g_vk.FreeMemory(g_dev, img->mem, NULL);
}
if (img->android_buffer) AHardwareBuffer_release(img->android_buffer);
free(img);
@@ -1757,7 +1579,7 @@ static void effects_source_note(int scene_w, int scene_h, const struct vkp_draw
static void record_draw(VkCommandBuffer cmd, const struct vkp_draw *d, const VkImageBlit *blit, VkImage target,
VkFormat target_fmt, int target_w, int target_h, VkFilter filter) {
const struct vkp_image *im = d->img;
const int external_client = vkp_is_external_client_image(foreign_image(im), im->blit_dst);
const int external_client = vkp_image_is_dmabuf(im);
if (d->blend && im->sampled &&
blendp_draw(cmd, im->image, im->fmt, im->w, im->h, !external_client,
target, target_fmt, target_w, target_h,
@@ -1891,11 +1713,6 @@ static int compose_hdr(VkCommandBuffer cmd, const struct vkp_draw *draws, int n,
struct hdrc_params p = {.mode = mode, .sdr_white_nits = droiddeck_color_sdr_white(),
.peak_nits = hf->peak_nits > 0.0f ? hf->peak_nits : 1000.0f};
if (hf->convert) {
p.conv_linear = hf->convert->convert == 2;
p.conv_gain = hf->convert->gain;
memcpy(p.conv, hf->convert->to2020, sizeof(p.conv));
}
int lowest_hdr = -1;
for (int i = 0; i < n; i++) {
VkImageBlit blit;
@@ -1912,7 +1729,6 @@ static int compose_hdr(VkCommandBuffer cmd, const struct vkp_draw *draws, int n,
p.rects[p.count][0] = (float)blit.dstOffsets[0].x; p.rects[p.count][1] = (float)blit.dstOffsets[0].y;
p.rects[p.count][2] = (float)blit.dstOffsets[1].x; p.rects[p.count][3] = (float)blit.dstOffsets[1].y;
if (hf->is_hdr[i]) p.hdr_mask |= 1u << p.count;
if (hf->is_hdr[i] == 2 && hf->convert) p.conv_mask |= 1u << p.count;
p.count++;
}
if (i >= lowest_hdr && !truncated_said) {
@@ -2169,9 +1985,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
1 + vkp_framegen_extra_images(), vkp_framegen_extra_images() ? "s" : "");
destroy_swapchain();
}
/* A black refresh carries no HDR frame; it keeps the swapchain's colour mode rather than flipping it. */
const int want_hdr = (g_plain_frame && !hf) ? (g_swapchain && g_swap_is_hdr)
: (hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable);
const int want_hdr = hf && !hf->tonemap && g_colorspace_ext && !g_swap_hdr_unavailable;
if (g_swapchain && want_hdr != g_swap_is_hdr) {
droiddeck_log("color", want_hdr ? "HDR frames with frame generation: rebuilding the screen swapchain as HDR10"
: hf ? "HDR output switched off: rebuilding the screen swapchain as SDR (frames tone-mapped)"
@@ -2247,7 +2061,6 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
g_vk.BeginCommandBuffer(cmd, &bi);
blendp_begin_frame();
stage_linear_dmabufs(cmd, draws, n);
VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
VkImageMemoryBarrier *bars = calloc((size_t)n + 1, sizeof(*bars));
@@ -2265,7 +2078,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
if (seen || !im) continue;
struct vkp_external_client_barrier_pair pair;
if (vkp_external_client_barrier_pair(
im->image, g_qfam, foreign_image(im), im->blit_dst, &pair)) {
im->image, g_qfam, im->dmabuf, im->blit_dst, &pair)) {
bars[nb++] = pair.acquire;
} else if (!im->blit_dst && !im->in_general) {
bars[nb++] = (VkImageMemoryBarrier){
@@ -2309,15 +2122,11 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
int drawn = 0;
int hdr_how = 0;
const int hdr_compose_requested = hf && pass && n > 0;
int hdr_unconverted = 0;
if (hdr_compose_requested &&
if (hf && pass && n > 0 &&
compose_hdr(cmd, draws, n, hf, scene_w, scene_h, scene_img, scene_fmt,
g_swap_is_hdr ? HDRC_OUT_PQ : HDRC_OUT_SDR) == 0) {
hdr_how = g_swap_is_hdr ? 1 : 2;
drawn = n;
} else if (hdr_compose_requested) {
hdr_unconverted = 1;
}
for (int i = 0; i < draw_n && !hdr_how; i++) {
VkImageBlit blit;
@@ -2347,8 +2156,8 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
VkImageLayout result_layout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
if (fx) {
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
if (fg && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; }
vkp_effects_set_formats(scene_fmt, scene_fmt, hdr_how == 1 || hdr_unconverted);
if (fg) { mapped_w = scene_w; mapped_h = scene_h; }
vkp_effects_set_formats(scene_fmt, scene_fmt);
result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh);
effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h,
draws ? draws + overlay_start : NULL, n - overlay_start);
@@ -2521,9 +2330,9 @@ int vkp_update_map(int scene_w, int scene_h) {
return g_map.valid ? 0 : -1;
}
int vkp_map_rect(int img_w, int img_h, const int dst[4], int out[8]) {
int vkp_map_rect(int img_w, int img_h, int scene_w, int scene_h, int out[8]) {
struct vkp_image tmp = {.w = img_w, .h = img_h};
struct vkp_draw d = {&tmp, 0, 0, (float)img_w, (float)img_h, dst[0], dst[1], dst[2], dst[3]};
struct vkp_draw d = {&tmp, 0, 0, (float)img_w, (float)img_h, 0, 0, scene_w, scene_h};
return vkp_map_draw(&d, out);
}
@@ -2537,48 +2346,6 @@ int vkp_map_draw(const struct vkp_draw *d, int out[8]) {
return 1;
}
static void blit_to_layer(VkCommandBuffer cmd, VkImage src, VkImageLayout src_layout, struct vkp_image *dst,
const VkImageBlit *blit, VkFilter filter) {
const VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
const VkImageMemoryBarrier acquire = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.srcQueueFamilyIndex = dst->staged ? VK_QUEUE_FAMILY_IGNORED : VK_QUEUE_FAMILY_FOREIGN_EXT,
.dstQueueFamilyIndex = dst->staged ? VK_QUEUE_FAMILY_IGNORED : g_qfam,
.image = dst->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 0, NULL, 1, &acquire);
g_vk.CmdBlitImage(cmd, src, src_layout, dst->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, blit, filter);
if (dst->staged) {
const VkImageMemoryBarrier read = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = dst->image, .subresourceRange = range, .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 0, NULL, 1, &read);
const VkBufferMemoryBarrier write = vkp_linear_dmabuf_ownership(dst->linear_buf, g_qfam, VK_ACCESS_TRANSFER_WRITE_BIT, 1);
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 1, &write, 0, NULL);
VkBufferImageCopy copy = dst->linear_copy;
copy.imageExtent.width = (uint32_t)blit->dstOffsets[1].x;
copy.imageExtent.height = (uint32_t)blit->dstOffsets[1].y;
g_vk.CmdCopyImageToBuffer(cmd, dst->image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst->linear_buf, 1, &copy);
const VkBufferMemoryBarrier release = vkp_linear_dmabuf_ownership(dst->linear_buf, g_qfam, VK_ACCESS_TRANSFER_WRITE_BIT, 0);
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 1, &release, 0, NULL);
return;
}
const VkImageMemoryBarrier release = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .srcQueueFamilyIndex = g_qfam,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT, .image = dst->image, .subresourceRange = range,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &release);
}
int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd) {
if (!src || src->blit_dst || !dst || !dst->blit_dst || g_dev_state == -2 || dev_init() != 0) {
if (wait_fd >= 0) close(wait_fd);
@@ -2593,32 +2360,44 @@ int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd) {
VkCommandBufferBeginInfo bi = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
g_vk.BeginCommandBuffer(g_cmd, &bi);
stage_linear_dmabuf(g_cmd, src);
struct vkp_external_client_barrier_pair src_pair;
const int src_external = vkp_external_client_barrier_pair(
src->image, g_qfam, foreign_image(src), src->blit_dst, &src_pair);
VkImageMemoryBarrier acq = src_external ? src_pair.acquire : (VkImageMemoryBarrier){
src->image, g_qfam, src->dmabuf, src->blit_dst, &src_pair);
VkImageMemoryBarrier acq[2] = {
src_external ? src_pair.acquire : (VkImageMemoryBarrier){
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = src->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT};
.image = src->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT},
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT, .dstQueueFamilyIndex = g_qfam,
.image = dst->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT}};
if (!src_external) {
acq.oldLayout = src->in_general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_PREINITIALIZED;
acq.newLayout = VK_IMAGE_LAYOUT_GENERAL;
acq.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
acq[0].oldLayout = src->in_general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_PREINITIALIZED;
acq[0].newLayout = VK_IMAGE_LAYOUT_GENERAL;
acq[0].srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
src->in_general = 1;
}
g_vk.CmdPipelineBarrier(g_cmd, VK_PIPELINE_STAGE_HOST_BIT | VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 1, &acq);
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, acq);
int bw = src->w < dst->w ? src->w : dst->w, bh = src->h < dst->h ? src->h : dst->h;
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {bw, bh, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {bw, bh, 1}}};
blit_to_layer(g_cmd, src->image, src_external ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL,
dst, &blit, VK_FILTER_NEAREST);
g_vk.CmdBlitImage(g_cmd, src->image,
src_external ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL,
dst->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit, VK_FILTER_NEAREST);
release_external_client_image(g_cmd, src);
VkImageMemoryBarrier rel = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .srcQueueFamilyIndex = g_qfam,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT, .image = dst->image, .subresourceRange = range,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(g_cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &rel);
g_vk.EndCommandBuffer(g_cmd);
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
@@ -2687,26 +2466,22 @@ int vkp_image_readback(struct vkp_image *src, uint32_t *out, int max_px) {
VkCommandBufferBeginInfo bi = {.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
g_vk.BeginCommandBuffer(cmd, &bi);
stage_linear_dmabuf(cmd, src);
struct vkp_external_client_barrier_pair src_pair;
const int src_external = vkp_external_client_barrier_pair(
src->image, g_qfam, foreign_image(src), src->blit_dst, &src_pair);
src->image, g_qfam, src->dmabuf, src->blit_dst, &src_pair);
VkImageMemoryBarrier acq[2] = {
src_external ? src_pair.acquire : (VkImageMemoryBarrier){
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.oldLayout = src->in_general ? VK_IMAGE_LAYOUT_GENERAL : VK_IMAGE_LAYOUT_UNDEFINED,
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = src->image, .subresourceRange = range,
.srcAccessMask = vkp_linear_dmabuf_readback_access(src->in_general),
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT},
.image = src->image, .subresourceRange = range, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT},
{.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = g_rb->image, .subresourceRange = range,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT}};
g_vk.CmdPipelineBarrier(cmd, vkp_linear_dmabuf_readback_stage(src->in_general),
VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, 0, NULL, 2, acq);
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 0, NULL, 2, acq);
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {src->w, src->h, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
@@ -2753,33 +2528,24 @@ static struct {
int active;
VkImage result;
int rw, rh;
int ngen;
VkImage gens[VKP_FG_MAX_GENERATIONS];
} g_pass;
static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int generate, int *rw, int *rh);
const struct vkp_hdr_frame *hf, int *rw, int *rh);
int vkp_pass_begin(int scene_w, int scene_h, const struct vkp_draw *draws, int n, int *rw, int *rh) {
return pass_begin_impl(scene_w, scene_h, draws, n, NULL, 0, rw, rh);
}
int vkp_pass_begin_generate(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int *rw, int *rh) {
if (pass_begin_impl(scene_w, scene_h, draws, n, hf, 1, rw, rh) != 0) return -1;
return g_pass.ngen;
return pass_begin_impl(scene_w, scene_h, draws, n, NULL, rw, rh);
}
int vkp_pass_begin_hdr(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int *rw, int *rh) {
if (!hf) return -1;
return pass_begin_impl(scene_w, scene_h, draws, n, hf, 0, rw, rh);
return pass_begin_impl(scene_w, scene_h, draws, n, hf, rw, rh);
}
static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int generate, int *rw, int *rh) {
const struct vkp_hdr_frame *hf, int *rw, int *rh) {
if (g_pass.active) vkp_pass_abort();
g_pass.ngen = 0;
if (vkp_update_map(scene_w, scene_h) != 0) return -1;
int input_w = scene_w, input_h = scene_h;
int pass_n = n, overlay_start = n;
@@ -2799,31 +2565,13 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
effects_source_note(scene_w, scene_h, draws, n, input_w, input_h,
(int)(scene_w * g_map.kx + 0.5f), (int)(scene_h * g_map.ky + 0.5f));
}
const int deep = hf && generate && !hf->tonemap && vkp_framegen_format_ok(FG_HDR_FMT) &&
ensure_img(&g_fgscene, scene_w, scene_h, FG_HDR_FMT,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
"HDR frame generation (scene)") == 0;
const int narrow = hf && generate && !deep;
if (hf && !deep && !narrow) {
if (hf) {
if (ensure_img(&g_hdrscene, scene_w, scene_h, HDR_FMT,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT,
"HDR composition (picture)") != 0)
return -1;
} else if (!deep && ensure_scene_image(input_w, input_h) != 0) return -1;
const VkFormat scene_fmt = deep ? FG_HDR_FMT : narrow || !hf ? SCENE_FMT : HDR_FMT;
if (hf && generate) {
static int said = -1;
if (said != deep + 2 * hf->tonemap) {
said = deep + 2 * hf->tonemap;
droiddeck_log("color", hf->tonemap
? "frame generation runs on the tone-mapped picture in 8 bits, onto the game's display layer"
: deep ? "frame generation runs on the HDR picture in FP16 (RGBA16F), onto the game's display layer"
: "frame generation runs on the HDR picture in 8 bits (the engine cannot take FP16 here), onto "
"the game's display layer: banding possible in smooth gradients");
}
}
} else if (ensure_scene_image(input_w, input_h) != 0) return -1;
VkCommandBuffer cmd = g_cmds[0];
g_vk.ResetCommandBuffer(cmd, 0);
@@ -2831,13 +2579,12 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT};
g_vk.BeginCommandBuffer(cmd, &bi);
blendp_begin_frame();
stage_linear_dmabufs(cmd, draws, n);
VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
VkImageMemoryBarrier *bars = calloc((size_t)n + 1, sizeof(*bars));
if (!bars) { g_vk.EndCommandBuffer(cmd); return -1; }
int nb = 0;
VkImage scene_img = deep ? g_fgscene.img : narrow || !hf ? g_scene.img : g_hdrscene.img;
VkImage scene_img = hf ? g_hdrscene.img : g_scene.img;
bars[nb++] = (VkImageMemoryBarrier){
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
@@ -2850,7 +2597,7 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
if (seen || !im) continue;
struct vkp_external_client_barrier_pair pair;
if (vkp_external_client_barrier_pair(
im->image, g_qfam, foreign_image(im), im->blit_dst, &pair)) {
im->image, g_qfam, im->dmabuf, im->blit_dst, &pair)) {
bars[nb++] = pair.acquire;
} else if (!im->blit_dst && !im->in_general) {
bars[nb++] = (VkImageMemoryBarrier){
@@ -2868,12 +2615,12 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
free(bars);
if (hf) {
if (compose_hdr(cmd, draws, n, hf, scene_w, scene_h, scene_img, scene_fmt,
if (compose_hdr(cmd, draws, n, hf, scene_w, scene_h, g_hdrscene.img, HDR_FMT,
hf->tonemap ? HDRC_OUT_SDR : HDRC_OUT_PQ) != 0) {
g_vk.EndCommandBuffer(cmd);
return -1;
}
if (vkp_effects_active()) vkp_effects_set_formats(scene_fmt, scene_fmt, !hf->tonemap);
if (vkp_effects_active()) vkp_effects_set_formats(HDR_FMT, HDR_FMT);
} else {
VkClearColorValue black = {.float32 = {0.0f, 0.0f, 0.0f, 1.0f}};
g_vk.CmdClearColorImage(cmd, g_scene.img, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &black, 1, &range);
@@ -2888,61 +2635,57 @@ static int pass_begin_impl(int scene_w, int scene_h, const struct vkp_draw *draw
record_draw(cmd, &pass_draws[i], &blit, g_scene.img, SCENE_FMT, input_w, input_h,
VK_FILTER_LINEAR);
}
if (vkp_effects_active()) vkp_effects_set_formats(VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM, 0);
if (vkp_effects_active()) vkp_effects_set_formats(VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_UNORM);
}
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
if (generate && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; }
g_pass.rw = input_w; g_pass.rh = input_h;
g_pass.result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h,
&g_pass.rw, &g_pass.rh);
effects_overlay_draws(cmd, g_pass.result, g_pass.rw, g_pass.rh, scene_w, scene_h,
draws ? draws + overlay_start : NULL, n - overlay_start);
release_external_client_draws(cmd, draws, n);
if (generate) {
VkImageMemoryBarrier b = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = g_pass.result, .subresourceRange = range,
.srcAccessMask = VK_ACCESS_MEMORY_WRITE_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_SHADER_READ_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
0, 0, NULL, 0, NULL, 1, &b);
int ngen = vkp_framegen_run(cmd, g_pass.result, VK_NULL_HANDLE, g_pass.rw, g_pass.rh, scene_fmt, g_pass.gens);
if (ngen < 0) ngen = 0;
g_pass.ngen = ngen > VKP_FG_MAX_GENERATIONS ? VKP_FG_MAX_GENERATIONS : ngen;
}
g_pass.active = 1;
if (rw) *rw = g_pass.rw;
if (rh) *rh = g_pass.rh;
return 0;
}
static int pass_finish(const VkImage *srcs, VkImageLayout src_layout, struct vkp_image *const *dsts, int n,
int wait_fd) {
int vkp_pass_copy_to(struct vkp_image *dst, int wait_fd) {
if (!g_pass.active) { if (wait_fd >= 0) close(wait_fd); return -1; }
g_pass.active = 0;
if (g_dev_state != 1) { if (wait_fd >= 0) close(wait_fd); return -1; }
VkCommandBuffer cmd = g_cmds[0];
for (int i = 0; i < n; i++) {
if (dsts[i] && dsts[i]->blit_dst) continue;
if (!dst || !dst->blit_dst) {
if (wait_fd >= 0) close(wait_fd);
g_vk.EndCommandBuffer(cmd);
return -1;
}
const int gpu_wait = take_wait_fd(wait_fd);
if (gpu_wait < 0) { g_vk.EndCommandBuffer(cmd); return -1; }
for (int i = 0; i < n; i++) {
struct vkp_image *dst = dsts[i];
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {g_pass.rw, g_pass.rh, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {dst->w, dst->h, 1}}};
blit_to_layer(cmd, srcs[i], src_layout, dst, &blit,
VkImageSubresourceRange range = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1};
VkImageMemoryBarrier acq = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
.newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, .srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
.dstQueueFamilyIndex = g_qfam, .image = dst->image, .subresourceRange = range,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT,
0, 0, NULL, 0, NULL, 1, &acq);
VkImageBlit blit = {.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.srcOffsets = {{0, 0, 0}, {g_pass.rw, g_pass.rh, 1}},
.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1},
.dstOffsets = {{0, 0, 0}, {dst->w, dst->h, 1}}};
g_vk.CmdBlitImage(cmd, g_pass.result, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, dst->image,
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &blit,
(g_pass.rw == dst->w && g_pass.rh == dst->h) ? VK_FILTER_NEAREST : VK_FILTER_LINEAR);
}
VkImageMemoryBarrier rel = {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
.newLayout = VK_IMAGE_LAYOUT_GENERAL, .srcQueueFamilyIndex = g_qfam,
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT, .image = dst->image, .subresourceRange = range,
.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT};
g_vk.CmdPipelineBarrier(cmd, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT,
0, 0, NULL, 0, NULL, 1, &rel);
g_vk.EndCommandBuffer(cmd);
VkPipelineStageFlags wait_stage = VK_PIPELINE_STAGE_TRANSFER_BIT;
@@ -2962,19 +2705,6 @@ static int pass_finish(const VkImage *srcs, VkImageLayout src_layout, struct vkp
return 0;
}
int vkp_pass_copy_to(struct vkp_image *dst, int wait_fd) {
return pass_finish(&g_pass.result, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, &dst, 1, wait_fd);
}
int vkp_pass_copy_generated(struct vkp_image *const *dsts, int n, struct vkp_image *real, int wait_fd) {
VkImage srcs[VKP_FG_MAX_GENERATIONS + 1];
struct vkp_image *all[VKP_FG_MAX_GENERATIONS + 1];
if (n > g_pass.ngen) n = g_pass.ngen;
for (int i = 0; i < n; i++) { srcs[i] = g_pass.gens[i]; all[i] = dsts[i]; }
if (real) { srcs[n] = g_pass.result; all[n] = real; }
return pass_finish(srcs, VK_IMAGE_LAYOUT_GENERAL, all, n + (real ? 1 : 0), wait_fd);
}
void vkp_pass_abort(void) {
if (!g_pass.active) return;
g_pass.active = 0;
@@ -7,7 +7,6 @@
void vk_present_set_driver(const char *driver_path, const char *library_name,
const char *native_lib_dir);
void vk_present_set_driver_fallback(int allow);
void vk_present_set_window(ANativeWindow *window);
int vkp_apply_window_request(void);
@@ -96,7 +95,6 @@ struct vkp_hdr_frame {
float peak_nits;
int tonemap;
const struct droiddeck_color *color;
const struct droiddeck_color *convert;
};
int vkp_render_hdr(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int *how);
@@ -107,7 +105,7 @@ int vkp_blit_image(struct vkp_image *src, struct vkp_image *dst, int wait_fd);
int vkp_image_readback(struct vkp_image *src, uint32_t *out, int max_px);
int vkp_update_map(int scene_w, int scene_h);
int vkp_map_draw(const struct vkp_draw *d, int out[8]);
int vkp_map_rect(int img_w, int img_h, const int dst[4], int out[8]);
int vkp_map_rect(int img_w, int img_h, int scene_w, int scene_h, int out[8]);
int vkp_surface_rotation_degrees(void);
ANativeWindow *vkp_window(void);
@@ -115,9 +113,6 @@ void vkp_signal_first_frame(void);
int vkp_pass_begin(int scene_w, int scene_h, const struct vkp_draw *draws, int n, int *rw, int *rh);
int vkp_pass_copy_to(struct vkp_image *dst, int wait_fd);
int vkp_pass_begin_generate(int scene_w, int scene_h, const struct vkp_draw *draws, int n,
const struct vkp_hdr_frame *hf, int *rw, int *rh);
int vkp_pass_copy_generated(struct vkp_image *const *dsts, int n, struct vkp_image *real, int wait_fd);
void vkp_pass_abort(void);
void droiddeck_log(const char *tag, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
@@ -18,13 +18,11 @@
#include "cardboard.h"
#include "droiddeck_color.h"
#include "gpu_clock_pin.h"
#include "clock_domain.h"
extern int droiddeck_wayland_run(void);
extern void droiddeck_wayland_set_scale_mode(int mode, int alignment);
extern void droiddeck_wayland_send_pointer(int action, int x, int y);
extern void droiddeck_wayland_send_touch(int action, int pointer_id, int x, int y);
extern void droiddeck_wayland_send_pen(int flags, int x, int y);
extern int droiddeck_cursor_snapshot(int *out, int cap);
extern int droiddeck_cursor_serial(void);
extern int droiddeck_hud_frame_times(float *out, int len, int64_t *total);
@@ -34,24 +32,18 @@ extern int droiddeck_cursor_input_pos(int *x, int *y);
extern void droiddeck_wayland_send_scene_input(int type, int a, int b);
extern void droiddeck_wayland_set_cursor_composite(int on);
extern void droiddeck_wayland_vsync(int64_t frame_time_ns);
extern void sc_layer_frame_timeline(int64_t present_ns, int64_t deadline_ns, int64_t period_ns);
extern void droiddeck_stream_set(int on);
extern void droiddeck_stream_frame(AHardwareBuffer *ahb);
extern unsigned droiddeck_stream_frames(void);
extern void droiddeck_wayland_output_resized(void);
extern void droiddeck_wayland_set_output_refresh_rate(int mhz);
extern void droiddeck_wayland_set_panel_rates(const int *rates, int count);
extern volatile int g_fps_limit;
extern volatile int g_release_unpaced;
extern volatile int g_render_on_commit;
extern volatile int g_bfi;
extern volatile int g_bfi_picture_hold;
extern volatile int g_hide_shell;
extern volatile int g_zero_copy;
extern volatile unsigned g_zero_copy_last;
extern volatile int g_ubwc;
extern volatile int g_display_buffer_driver;
void droiddeck_dmabuf_formats_stale(void);
extern volatile int g_no_render_node;
extern volatile int g_output_w, g_output_h;
@@ -63,14 +55,10 @@ static jclass g_compositor_cls;
static jmethodID g_on_first_frame;
static jmethodID g_on_game_surface;
static jmethodID g_on_game_frame;
static jmethodID g_on_compositor_frame;
static jmethodID g_on_game_program;
static jmethodID g_on_pointer_lock;
static jmethodID g_on_clipboard;
static jmethodID g_on_text_input;
static jmethodID g_on_overlay_planes;
static jmethodID g_on_refresh_target;
static jmethodID g_on_content_rate;
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
(void)reserved;
@@ -85,7 +73,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
g_on_game_surface = (*env)->GetStaticMethodID(env, g_compositor_cls, "onGameSurface",
"(Ljava/lang/String;Ljava/lang/String;)V");
g_on_game_frame = (*env)->GetStaticMethodID(env, g_compositor_cls, "onGameFrame", "()V");
g_on_compositor_frame = (*env)->GetStaticMethodID(env, g_compositor_cls, "onCompositorFrame", "()V");
g_on_game_program = (*env)->GetStaticMethodID(env, g_compositor_cls, "onGameProgram",
"(ILjava/lang/String;)V");
if ((*env)->ExceptionCheck(env)) { (*env)->ExceptionClear(env); g_on_game_program = NULL; }
@@ -93,9 +80,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
g_on_clipboard = (*env)->GetStaticMethodID(env, g_compositor_cls, "onClipboardText", "([B)V");
g_on_text_input = (*env)->GetStaticMethodID(env, g_compositor_cls, "onTextInput",
"(ZLjava/lang/String;IIII)V");
g_on_overlay_planes = (*env)->GetStaticMethodID(env, g_compositor_cls, "onOverlayPlanes", "(I)V");
g_on_refresh_target = (*env)->GetStaticMethodID(env, g_compositor_cls, "onRefreshTarget", "(II)V");
g_on_content_rate = (*env)->GetStaticMethodID(env, g_compositor_cls, "onContentRate", "(I)V");
}
}
return JNI_VERSION_1_6;
@@ -156,34 +140,6 @@ void droiddeck_on_game_frame(void) {
if ((*env)->ExceptionCheck(env)) (*env)->ExceptionClear(env);
}
void droiddeck_on_compositor_frame(void) {
JNIEnv *env;
if (!g_compositor_cls || !g_on_compositor_frame || !(env = thread_env())) return;
(*env)->CallStaticVoidMethod(env, g_compositor_cls, g_on_compositor_frame);
if ((*env)->ExceptionCheck(env)) (*env)->ExceptionClear(env);
}
void droiddeck_on_refresh_target(int refresh, int frame_rate) {
JNIEnv *env;
if (!g_compositor_cls || !g_on_refresh_target || !(env = thread_env())) return;
(*env)->CallStaticVoidMethod(env, g_compositor_cls, g_on_refresh_target, (jint)refresh, (jint)frame_rate);
if ((*env)->ExceptionCheck(env)) (*env)->ExceptionClear(env);
}
void droiddeck_on_content_rate(int fps) {
JNIEnv *env;
if (!g_compositor_cls || !g_on_content_rate || !(env = thread_env())) return;
(*env)->CallStaticVoidMethod(env, g_compositor_cls, g_on_content_rate, (jint)fps);
if ((*env)->ExceptionCheck(env)) (*env)->ExceptionClear(env);
}
void droiddeck_on_overlay_planes(int planes) {
JNIEnv *env;
if (!g_compositor_cls || !g_on_overlay_planes || !(env = thread_env())) return;
(*env)->CallStaticVoidMethod(env, g_compositor_cls, g_on_overlay_planes, (jint)planes);
if ((*env)->ExceptionCheck(env)) (*env)->ExceptionClear(env);
}
void droiddeck_on_pointer_lock(int locked, int x, int y) {
JNIEnv *env;
if (!g_compositor_cls || !g_on_pointer_lock || !(env = thread_env())) return;
@@ -296,13 +252,12 @@ static char *dup_jstr(JNIEnv *env, jstring s) {
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeStartWithSurface(
JNIEnv *env, jclass clazz, jobject surface, jstring xdgRuntimeDir,
jstring driverPath, jstring libraryName, jstring nativeLibDir, jboolean allowDriverFallback) {
jstring driverPath, jstring libraryName, jstring nativeLibDir) {
set_runtime_dir(env, xdgRuntimeDir);
char *dp = dup_jstr(env, driverPath);
char *ln = dup_jstr(env, libraryName);
char *nl = dup_jstr(env, nativeLibDir);
vk_present_set_driver(dp, ln, nl);
vk_present_set_driver_fallback(allowDriverFallback == JNI_TRUE);
free(dp); free(ln); free(nl);
if (surface) {
ANativeWindow *win = ANativeWindow_fromSurface(env, surface);
@@ -324,12 +279,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSendTouch(
droiddeck_wayland_send_touch(action, pointer_id, x, y);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSendPen(
JNIEnv *env, jclass clazz, jint flags, jint x, jint y) {
droiddeck_wayland_send_pen(flags, x, y);
}
JNIEXPORT jint JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeCursorSnapshot(
JNIEnv *env, jclass clazz, jintArray out) {
@@ -405,19 +354,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeVsync(JNIEnv *env, j
droiddeck_wayland_vsync((int64_t)frameTimeNanos);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeFrameTimeline(JNIEnv *env, jclass clazz, jlong presentNanos,
jlong deadlineNanos, jlong periodNanos) {
sc_layer_frame_timeline((int64_t)presentNanos, (int64_t)deadlineNanos, (int64_t)periodNanos);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetClockControl(JNIEnv *env, jclass clazz, jstring path) {
const char *value = path ? (*env)->GetStringUTFChars(env, path, NULL) : NULL;
droiddeck_clock_domain_set_control(value);
if (value) (*env)->ReleaseStringUTFChars(env, path, value);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetHideShell(JNIEnv *env, jclass clazz, jboolean hide) {
g_hide_shell = hide ? 1 : 0;
@@ -426,18 +362,11 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetHideShell(JNIEnv
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetZeroCopy(JNIEnv *env, jclass clazz, jboolean on) {
int live = droiddeck_get_display() != NULL;
if (!live) { g_zero_copy = on ? 1 : 0; droiddeck_dmabuf_formats_stale(); }
if (!live) g_zero_copy = on ? 1 : 0;
droiddeck_host_zero_copy(on ? 1 : 0, live);
__android_log_print(ANDROID_LOG_INFO, TAG, "zero-copy layer mode %s%s", on ? "on" : "off", live ? " (live)" : "");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDisplayBufferDriver(JNIEnv *env, jclass clazz, jboolean on) {
g_display_buffer_driver = on ? 1 : 0;
droiddeck_dmabuf_formats_stale();
__android_log_print(ANDROID_LOG_INFO, TAG, "session driver %s for display buffers", on ? "asks" : "does not ask");
}
JNIEXPORT jint JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeZeroCopyLastFrameAgeMs(JNIEnv *env, jclass clazz) {
return (jint)ahb_swapchain_last_frame_age_ms();
@@ -471,16 +400,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetOutputRefreshRate
droiddeck_wayland_set_output_refresh_rate(hz > 1.0f ? (int)(hz * 1000.0f + 0.5f) : 0);
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetPanelRates(JNIEnv *env, jclass clazz, jintArray rates) {
(void)clazz;
jint values[16];
jsize count = rates ? (*env)->GetArrayLength(env, rates) : 0;
if (count > 16) count = 16;
if (count > 0) (*env)->GetIntArrayRegion(env, rates, 0, count, values);
droiddeck_wayland_set_panel_rates((const int *)values, (int)count);
}
extern void vkp_reset_first_frame(void);
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeResetFirstFrame(JNIEnv *env, jclass clazz) {
@@ -521,18 +440,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeGamePictureRect(JNIE
return JNI_TRUE;
}
JNIEXPORT jboolean JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeOutputSize(JNIEnv *env, jclass clazz, jintArray out) {
(void)clazz;
if (!out || (*env)->GetArrayLength(env, out) < 2) return JNI_FALSE;
int width = 0, height = 0;
vkp_output_size(&width, &height);
if (width <= 0 || height <= 0) return JNI_FALSE;
jint size[2] = {(jint)width, (jint)height};
(*env)->SetIntArrayRegion(env, out, 0, 2, size);
return JNI_TRUE;
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetUpscaler(JNIEnv *env, jclass clazz, jint mode) {
vkp_effects_set_scaling(mode);
@@ -560,8 +467,8 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetDeband(JNIEnv *en
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetScreenEffects(JNIEnv *env, jclass clazz, jfloat brightness,
jfloat contrast, jfloat gamma, jfloat saturation, jint aa_mode, jboolean toon, jboolean crt, jboolean ntsc) {
vkp_effects_set_screen(brightness, contrast, gamma, saturation, aa_mode, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
jfloat contrast, jfloat gamma, jfloat saturation, jboolean fxaa, jboolean toon, jboolean crt, jboolean ntsc) {
vkp_effects_set_screen(brightness, contrast, gamma, saturation, fxaa ? 1 : 0, toon ? 1 : 0, crt ? 1 : 0, ntsc ? 1 : 0);
}
JNIEXPORT void JNICALL
@@ -734,17 +641,6 @@ Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetRenderOnCommit(JN
__android_log_print(ANDROID_LOG_INFO, TAG, "render on commit %s", on ? "on" : "off");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetBlackFrameInsertion(JNIEnv *env, jclass clazz, jboolean on) {
g_bfi = on ? 1 : 0;
__android_log_print(ANDROID_LOG_INFO, TAG, "black frame insertion %s", on ? "requested" : "off");
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetPictureHold(JNIEnv *env, jclass clazz, jboolean on) {
g_bfi_picture_hold = on ? 1 : 0;
}
JNIEXPORT void JNICALL
Java_com_droiddeck_launcher_wayland_WaylandCompositor_nativeSetFpsLimit(JNIEnv *env, jclass clazz, jint fps) {
g_fps_limit = fps > 0 ? fps : 0;
Loaded 100 of 1516 files, more files were not shown because too many files have changed in this diff. Show more