improve sw renderer

This commit is contained in:
asrael 2026-01-21 23:19:50 -06:00
parent 415d424057
commit 39ee0fefb7
89 changed files with 9380 additions and 2307 deletions

43
pxl8.sh
View file

@ -62,12 +62,17 @@ build_server() {
print_info "Building server ($mode mode)"
cd server
if [[ "$mode" == "release" ]]; then
cargo build --release > /dev/null 2>&1
cargo build --release
else
cargo build > /dev/null 2>&1
cargo build
fi
local status=$?
cd - > /dev/null
print_info "Built server"
if [[ $status -eq 0 ]]; then
print_info "Built server"
else
print_error "Server build failed"
fi
fi
}
@ -79,11 +84,16 @@ start_server() {
else
server_bin="server/target/debug/pxl8-server"
fi
print_info "Server mode: $mode, binary: $server_bin"
if [[ -f "$server_bin" ]]; then
print_info "Starting server"
print_info "Starting server..."
./$server_bin &
SERVER_PID=$!
sleep 0.2
print_info "Server started with PID $SERVER_PID"
sleep 0.5
else
print_error "Server binary not found: $server_bin"
print_error "Build the server first with: cd server && cargo build"
fi
}
@ -213,7 +223,7 @@ timestamp() {
update_fennel() {
print_info "Fetching Fennel"
local version="1.6.0"
local version="1.6.1"
if curl -sL --max-time 5 -o lib/fennel/fennel.lua "https://fennel-lang.org/downloads/fennel-${version}.lua" 2>/dev/null; then
if [[ -f "lib/fennel/fennel.lua" ]] && [[ -s "lib/fennel/fennel.lua" ]]; then
@ -304,7 +314,8 @@ for arg in "$@"; do
done
if [ "$MODE" = "release" ]; then
CFLAGS="$CFLAGS -O3 -ffast-math -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables"
CFLAGS="$CFLAGS -O3 -flto -ffast-math -funroll-loops -fno-unwind-tables -fno-asynchronous-unwind-tables"
LINKER_FLAGS="$LINKER_FLAGS -flto"
BUILDDIR="$BUILDDIR/release"
BINDIR="$BINDIR/release"
else
@ -313,7 +324,7 @@ else
BINDIR="$BINDIR/debug"
fi
DEP_CFLAGS="-O3 -ffast-math -funroll-loops"
DEP_CFLAGS="-O3 -funroll-loops"
case "$COMMAND" in
build)
@ -360,7 +371,7 @@ case "$COMMAND" in
print_info "Compiler cache: ccache enabled"
fi
INCLUDES="-Isrc/core -Isrc/math -Isrc/gfx -Isrc/sfx -Isrc/script -Isrc/hal -Isrc/world -Isrc/asset -Isrc/game -Isrc/net -Ilib -Ilib/luajit/src -Ilib/linenoise -Ilib/miniz"
INCLUDES="-Isrc/asset -Isrc/core -Isrc/gfx -Isrc/gui -Isrc/hal -Isrc/math -Isrc/net -Isrc/procgen -Isrc/script -Isrc/sfx -Isrc/world -Ilib/linenoise -Ilib/luajit/src -Ilib/miniz"
COMPILE_FLAGS="$CFLAGS $INCLUDES"
DEP_COMPILE_FLAGS="$DEP_CFLAGS $INCLUDES"
@ -377,7 +388,6 @@ case "$COMMAND" in
src/math/pxl8_math.c
src/gfx/pxl8_anim.c
src/gfx/pxl8_atlas.c
src/gfx/pxl8_blend.c
src/gfx/pxl8_blit.c
src/gfx/pxl8_3d_camera.c
src/gfx/pxl8_colormap.c
@ -385,6 +395,9 @@ case "$COMMAND" in
src/gfx/pxl8_dither.c
src/gfx/pxl8_font.c
src/gfx/pxl8_gfx.c
src/gfx/pxl8_glows.c
src/gfx/pxl8_lightmap.c
src/gfx/pxl8_lights.c
src/gfx/pxl8_mesh.c
src/gfx/pxl8_palette.c
src/gfx/pxl8_particles.c
@ -394,15 +407,17 @@ case "$COMMAND" in
src/sfx/pxl8_sfx.c
src/script/pxl8_repl.c
src/script/pxl8_script.c
src/hal/pxl8_sdl3.c
src/hal/pxl8_hal_sdl3.c
src/hal/pxl8_mem_sdl3.c
src/world/pxl8_bsp.c
src/world/pxl8_gen.c
src/world/pxl8_world.c
src/procgen/pxl8_graph.c
src/asset/pxl8_ase.c
src/asset/pxl8_cart.c
src/asset/pxl8_save.c
src/game/pxl8_gui.c
src/game/pxl8_replay.c
src/gui/pxl8_gui.c
src/core/pxl8_replay.c
src/net/pxl8_net.c
src/net/pxl8_protocol.c
"
@ -477,7 +492,7 @@ case "$COMMAND" in
RUN_SERVER=false
for arg in "$@"; do
if [[ "$arg" == "--release" ]]; then
continue
MODE="release"
elif [[ "$arg" == "--repl" ]]; then
EXTRA_ARGS="$EXTRA_ARGS --repl"
elif [[ "$arg" == "--server" ]]; then