Compare commits

..

10 Commits
main ... main

Author SHA1 Message Date
c5eab43423 Disable cutoff distance option when cover whole map is ON
Some checks reported warnings
checkrefs / checkrefs (push) Successful in 1m6s
pre-commit / build (push) Successful in 1m25s
0ad-windows/pipeline/head This commit looks good
0ad-freebsd/pipeline/head This commit is unstable
0ad-linux/pipeline/head This commit looks good
0ad-macos/pipeline/head This commit is unstable
Gray out the "Cutoff distance" slider on the "Graphics (advanced)" tab
of the game settings screen when this distance is ignored because the
"Cover whole map" configuration option is ON.
2024-09-24 20:39:57 +02:00
288d5002f3 Add support for vendored spirv-reflect
All checks were successful
0ad-freebsd/pipeline/head This commit looks good
checkrefs / checkrefs (push) Successful in 1m9s
pre-commit / build (push) Successful in 1m29s
0ad-linux/pipeline/head This commit looks good
0ad-windows/pipeline/head This commit looks good
0ad-macos/pipeline/head This commit looks good
This allows build-archives.sh to fall back to vendored spirv-reflect if
it can't be found in PATH.

Also update error messages to suggest additional alternatives.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
39f3fa7d5b Package spirv-reflect for building shaders
Usually not available in Linux Distributions as it isn't customary to
package the SDK but only the bits needed as separate packages.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
cf909a81db Add support for vendored spirv-reflect to compile.py
The script build-archive.sh sets a variable SPIRV_REFLECT, even respects
it if it's set in env but without support from the compile.py script for
it there isn't much point.

This commit adds support SPIRV_REFLECT in compile.py and and adds a
fallback to use vendored spirv-reflect for when the envvar is unset and
the tool can't be found in PATH

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
f0d99f8f54 Add output of build-archives to gitignore
build-archives.sh generates output in archives, add it as well as the
rules files for spirv shaders which might be fetched during build to
gitignore.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
9770391bc4 Make failure messages visible for build-archives
Due to "set -e" the script terminates when the required tools aren't
found and the arguably helpful messages later on won't be printed.

Make the initial check for tools non fatal and allow for the later check
to take care of missing tools.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
eb328fc2df Allow building archives without translations
Currently you have to fetch translations first so they can be filtered
by build-archives.sh without the script failing.

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2024-09-24 18:45:22 +02:00
7e91f70e02 Add some more AI names
All checks were successful
0ad-freebsd/pipeline/head This commit looks good
checkrefs / checkrefs (push) Successful in 1m17s
pre-commit / build (push) Successful in 1m32s
0ad-linux/pipeline/head This commit looks good
0ad-windows/pipeline/head This commit looks good
0ad-macos/pipeline/head This commit looks good
A total of 16 possible AI names are added to four civilizations.

Athenians: Callias, Chabrias, Conon, Ephialtes, Nicias, Phocion, and
Pisistratus

Britons: Cassivellaunus, Imanuentius, and Mandubracius

Iberians: Litennon

Spartans: Anaxandridas, Cleomenes, Eurybiades, Gylippus, and
Leotychidas

The lists are sorted alphabetically.
2024-09-24 17:30:56 +02:00
9c72741e69
Fix x86_64 cross-compilation on macOS
All checks were successful
0ad-freebsd/pipeline/pr-main This commit looks good
checkrefs / checkrefs (pull_request) Successful in 57s
pre-commit / build (pull_request) Successful in 1m16s
0ad-linux/pipeline/pr-main This commit looks good
0ad-windows/pipeline/pr-main This commit looks good
0ad-macos/pipeline/pr-main This commit looks good
0ad-freebsd/pipeline/head This commit looks good
checkrefs / checkrefs (push) Successful in 58s
pre-commit / build (push) Successful in 1m15s
0ad-linux/pipeline/head This commit looks good
0ad-windows/pipeline/head This commit looks good
0ad-macos/pipeline/head This commit looks good
2024-09-22 16:16:40 +02:00
660dd63792
Delete existing SPIR-V shaders before regeneration
All checks were successful
0ad-freebsd/pipeline/pr-main This commit looks good
checkrefs / checkrefs (pull_request) Successful in 1m0s
pre-commit / build (pull_request) Successful in 1m17s
0ad-windows/pipeline/pr-main This commit looks good
0ad-linux/pipeline/pr-main This commit looks good
0ad-macos/pipeline/pr-main This commit looks good
checkrefs / checkrefs (push) Successful in 59s
pre-commit / build (push) Successful in 1m5s
0ad-freebsd/pipeline/head This commit looks good
0ad-windows/pipeline/head This commit looks good
0ad-linux/pipeline/head This commit looks good
0ad-macos/pipeline/head This commit looks good
As compile.py only creates shaders for program combinations which don't
have already existing shaders on disk, this removes all SPIR-V shaders
prior to rebuilding them to ensure they actually do get recreated.
2024-09-22 10:49:46 +02:00
12 changed files with 121 additions and 35 deletions

5
.gitignore vendored
View File

@ -20,9 +20,14 @@ libraries/source/cxxtest-4.4/*
libraries/source/fcollada/*
libraries/source/nvtt/*
libraries/source/spidermonkey/*
libraries/source/spirv-reflect/*
!libraries/source/**/build.sh
!libraries/source/**/patches/
# Tools
archives/
source/tools/spirv/rules.*.json
# premake5 build files, adapted from upstream
build/premake/premake5/**/.gitignore
build/premake/premake5/**/.travis.yml

View File

@ -344,15 +344,6 @@
"dependencies": ["shadows"],
"config": "shadowpcf"
},
{
"type": "slider",
"label": "Cutoff distance",
"tooltip": "Hides shadows beyond a certain distance from a camera.",
"dependencies": ["shadows"],
"config": "shadowscutoffdistance",
"min": 100,
"max": 1500
},
{
"type": "boolean",
"label": "Cover whole map",
@ -360,6 +351,15 @@
"dependencies": ["shadows"],
"config": "shadowscovermap"
},
{
"type": "slider",
"label": "Cutoff distance",
"tooltip": "Hides shadows beyond a certain distance from a camera.",
"dependencies": ["shadows", { "config": "shadowscovermap", "value": "false" }],
"config": "shadowscutoffdistance",
"min": 100,
"max": 1500
},
{
"type": "boolean",
"label": "Water effects",

View File

@ -56,18 +56,25 @@
}
],
"AINames": [
"Cimon",
"Aristides",
"Xenophon",
"Hippias",
"Cleisthenes",
"Thucydides",
"Alcibiades",
"Miltiades",
"Aristides",
"Callias",
"Chabrias",
"Cimon",
"Cleisthenes",
"Cleon",
"Cleophon",
"Conon",
"Demosthenes",
"Ephialtes",
"Hippias",
"Miltiades",
"Nicias",
"Phocion",
"Pisistratus",
"Thrasybulus",
"Demosthenes"
"Thucydides",
"Xenophon"
],
"SkirmishReplacements": {
"skirmish/units/default_infantry_ranged_b": "units/athen/infantry_slinger_b",

View File

@ -76,13 +76,16 @@
}
],
"AINames": [
"Prasutagus",
"Venutius",
"Adminius",
"Cassivellaunus",
"Cogidubnus",
"Commius",
"Comux",
"Adminius",
"Dubnovellaunus",
"Imanuentius",
"Mandubracius",
"Prasutagus",
"Venutius",
"Vosenius"
],
"SkirmishReplacements": {

View File

@ -63,6 +63,7 @@
"Audax",
"Calcus",
"Ditalcus",
"Litennon",
"Minurus",
"Olyndicus",
"Orison",

View File

@ -60,16 +60,21 @@
}
],
"AINames": [
"Dienekes",
"Agis II",
"Archidamus",
"Lysander",
"Pausanias",
"Agesilaus",
"Agesipolis",
"Agis II",
"Anaxandridas",
"Archidamus",
"Cleomenes",
"Dienekes",
"Echestratus",
"Eurycrates",
"Eucleidas",
"Agesipolis"
"Eurybiades",
"Eurycrates",
"Gylippus",
"Leotychidas",
"Lysander",
"Pausanias"
],
"SkirmishReplacements": {
"skirmish/structures/default_house_10": "structures/{civ}/house",

View File

@ -127,6 +127,8 @@ pipeline {
}
steps {
ws("workspace/nightly-svn") {
bat "del /s /q binaries\\data\\mods\\mod\\shaders\\spirv"
bat "del /s /q binaries\\data\\mods\\public\\shaders\\spirv"
bat "python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/mod source/tools/spirv/rules.json binaries/data/mods/mod"
bat "python source/tools/spirv/compile.py -d binaries/data/mods/mod binaries/data/mods/public source/tools/spirv/rules.json binaries/data/mods/public"
}

View File

@ -811,6 +811,7 @@ GNUTLS_DIR="$(pwd)/gnutls"
HOGWEED_LIBS="-L${NETTLE_DIR}/lib -lhogweed" \
GMP_CFLAGS="-I${GMP_DIR}/include" \
GMP_LIBS="-L${GMP_DIR}/lib -lgmp" \
"$HOST_PLATFORM" \
--prefix="$INSTALL_DIR" \
--enable-shared=no \
--without-idn \
@ -818,8 +819,10 @@ GNUTLS_DIR="$(pwd)/gnutls"
--with-included-libtasn1 \
--without-p11-kit \
--without-brotli \
--without-zstd \
--without-tpm2 \
--disable-libdane \
--disable-tests \
--disable-guile \
--disable-doc \
--disable-tools \
--disable-nls

View File

@ -24,6 +24,7 @@ esac
without_nvtt=false
with_system_nvtt=false
with_system_mozjs=false
with_spirv_reflect=false
JOBS=${JOBS:="-j2"}
@ -32,6 +33,7 @@ for i in "$@"; do
--without-nvtt) without_nvtt=true ;;
--with-system-nvtt) with_system_nvtt=true ;;
--with-system-mozjs) with_system_mozjs=true ;;
--with-spirv-reflect) with_spirv_reflect=true ;;
-j*) JOBS=$i ;;
esac
done
@ -67,5 +69,8 @@ if [ "$with_system_mozjs" = "false" ]; then
cp source/spidermonkey/bin/* ../binaries/system/
fi
echo
if [ "$with_spirv_reflect" = "true" ]; then
./source/spirv-reflect/build.sh || die "spirv-reflect build failed"
fi
echo "Done."

View File

@ -0,0 +1,35 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
PV=1.3.290.0
LIB_VERSION=${PV}
if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" ]; then
echo "spirv-reflect is already up to date."
exit
fi
# fetch
if [ ! -e "vulkan-sdk-${PV}.tar.gz" ]; then
curl -fLo "vulkan-sdk-${PV}.tar.gz" \
"https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-${PV}.tar.gz"
fi
# unpack
rm -Rf "SPIRV-Reflect-vulkan-sdk-${PV}"
tar xf "vulkan-sdk-${PV}.tar.gz"
# configure
cmake -B build -S "SPIRV-Reflect-vulkan-sdk-${PV}" \
-DCMAKE_INSTALL_PREFIX="$(realpath . || true)"
# build
cmake --build build
# install
rm -Rf bin
cmake --install build
echo "${LIB_VERSION}" >.already-built

View File

@ -23,7 +23,7 @@ LANGS="ast ca cs de el en_GB es eu fi fr gd hu id it nl pl pt_BR ru sk sv tr uk"
REGEX=$(printf "\|%s" ${LANGS} | cut -c 2-)
REGEX=".*/\(${REGEX}\)\.[-A-Za-z0-9_.]\+\.po"
find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -v || die "Error filtering languages."
find binaries/ -name "*.po" | grep -v "$REGEX" | xargs rm -fv || die "Error filtering languages."
# Build archive(s) - don't archive the _test.* mods
cd binaries/data/mods || die
@ -40,13 +40,21 @@ cd - || die
BUILD_SHADERS="${BUILD_SHADERS:=true}"
if [ "${BUILD_SHADERS}" = true ]; then
PYTHON=${PYTHON:=$(command -v python3 || command -v python)}
GLSLC=${GLSLC:=$(command -v glslc)}
SPIRV_REFLECT=${SPIRV_REFLECT:=$(command -v spirv-reflect)}
PYTHON=${PYTHON:=$(command -v python3 || command -v python || true)}
GLSLC=${GLSLC:=$(command -v glslc || true)}
SPIRV_REFLECT=${SPIRV_REFLECT:=$(command -v spirv-reflect || true)}
if [ -e "$(realpath libraries/source/spirv-reflect/bin/spirv-reflect || true)" ]; then
: "${SPIRV_REFLECT:=$(realpath libraries/source/spirv-reflect/bin/spirv-reflect || true)}"
fi
export SPIRV_REFLECT
[ -n "${PYTHON}" ] || die "Error: python is not available. Install it before proceeding."
[ -n "${GLSLC}" ] || die "Error: glslc is not available. Install it with the Vulkan SDK before proceeding."
[ -n "${SPIRV_REFLECT}" ] || die "Error: spirv-reflect is not available. Install it with the Vulkan SDK before proceeding."
[ -n "${GLSLC}" ] ||
die "Error: glslc is not available." \
" Install it with the Vulkan SDK or shaderc package before proceeding."
[ -n "${SPIRV_REFLECT}" ] ||
die "Error: spirv-reflect is not available." \
" Install it with the Vulkan SDK or build vendored spirv-reflect before proceeding."
cd source/tools/spirv || die

View File

@ -25,10 +25,12 @@ import hashlib
import itertools
import json
import os
import shutil
import subprocess
import sys
import xml.etree.ElementTree as ET
from enum import Enum
from pathlib import Path
import yaml
@ -124,7 +126,17 @@ def compile_and_reflect(input_mod_path, dependencies, stage, path, out_path, def
)
execute(command[:-2] + ["-g", "-E", "-o", preprocessor_output_path])
raise ValueError(err)
ret, out, err = execute(["spirv-reflect", "-y", "-v", "1", output_path])
spirv_reflect = os.getenv("SPIRV_REFLECT", "spirv-reflect")
if shutil.which(spirv_reflect) is None:
spirv_reflect = (
Path(__file__).resolve().parent.parent.parent.parent
/ "libraries"
/ "source"
/ "spirv-reflect"
/ "bin"
/ "spirv-reflect"
)
ret, out, err = execute([spirv_reflect, "-y", "-v", "1", output_path])
if ret:
sys.stderr.write(
"Command returned {}:\nCommand: {}\nInput path: {}\nOutput path: {}\n"