fix linux opengl render; windows ucrt

This commit is contained in:
John Alanbrook 2024-05-29 20:21:19 -05:00
parent 33fdd97bdd
commit b2a45fcfdd
6 changed files with 30 additions and 40 deletions

View file

@ -78,34 +78,27 @@ CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
# default, fast and medium available in game at runtime; best available in editor
PKGCMD = tar --directory --exclude="./*.a" --exclude="./obj" -czf $(DISTDIR)/$(DIST) .
ZIP = .tar.gz
UNZIP = cp $(DISTDIR)/$(DIST) $(DESTDIR) && tar xzf $(DESTDIR)/$(DIST) -C $(DESTDIR) && rm $(DESTDIR)/$(DIST)
INFO := $(INFO)_$(ARCH)
ifeq ($(OS), Windows_NT) # then WINDOWS
PLATFORM := win64
PLATFORM := win64
DEPS += resource.o
STEAMAPI := steam_api64
LDFLAGS += -mwin32 -static
CPPFLAGS += -mwin32
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread
PKGCMD = zip -q -r $(MAKEDIR)/$(DISTDIR)/$(DIST) . -x \*.a ./obj/\*
ZIP = .zip
UNZIP = unzip -o -q $(DISTDIR)/$(DIST) -d $(DESTDIR)
INFO :=$(INFO)_win
EXT = .exe
INFO :=$(INFO)_win
EXT = .exe
else ifeq ($(OS), IOS)
CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
SDK = iphoneos
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDK).platform/Developer/SDKs/$(SDK).sdk
CFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
LDFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
LDFLAGS += -framework Foundation -framework UIKit -framework AudioToolbox -framework Metal -framework MetalKit -framework AVFoundation
CXXFLAGS += -std=c++11
CFLAGS += -x objective-c -DIOS
INFO :=$(INFO)_ios
SDK = iphoneos
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$(SDK).platform/Developer/SDKs/$(SDK).sdk
CFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
LDFLAGS += -isysroot $(SDK_PATH) -miphoneos-version-min=13.0
LDFLAGS += -framework Foundation -framework UIKit -framework AudioToolbox -framework Metal -framework MetalKit -framework AVFoundation
CXXFLAGS += -std=c++11
CFLAGS += -x objective-c -DIOS
INFO :=$(INFO)_ios
else ifeq ($(OS), wasm) # Then WEB
OS := Web
LDFLAGS += -sUSE_WEBGPU
@ -131,8 +124,8 @@ else
CFLAGS += -x objective-c
CXXFLAGS += -std=c++11
LDFLAGS += -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework Metal -framework MetalKit
INFO :=$(INFO)_macos
STEAMAPI := steam_api
INFO :=$(INFO)_macos
STEAMAPI := steam_api
endif
endif
@ -161,9 +154,11 @@ includeflag := $(addprefix -I, $(includeflag))
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
# For vanilla compilation, remove _
ifeq ($(INFO),_)
INFO :=
INFO :=
endif
APP = prosperon
NAME = $(APP)$(INFO)$(EXT)
SEM != git describe --tags --abbrev=0
@ -183,17 +178,12 @@ all: $(NAME)
prereqs: source/engine/core.cdb.h
DESTDIR ?= ~/.bin
install: $(NAME)
@echo Copying to destination
cp -f $(NAME) $(DESTDIR)/$(APP)
$(NAME): $(OBJS) $(DEPS)
@echo Linking $(NAME)
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
@echo Finished build
%$(INFO).o: %.c
%$(INFO).o: %.c prereqs
@echo Making C object $@
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@ -257,7 +247,7 @@ crossmac: Prosperon.icns
cp Prosperon.icns Prosperon.app/Contents/Resources
crosswin:
make CROSS=x86_64-w64-mingw32- OS=Windows_NT CC=gcc
make CROSS=x86_64-w64-mingw32ucrt- OS=Windows_NT CC=gcc
crossweb:
make CC=emcc OS=wasm

View file

@ -269,7 +269,6 @@ global.mixin("scripts/render");
global.mixin("scripts/debug");
var frame_t = profile.secs(profile.now());
var phys_step = 1/240;
var sim = {};
sim.mode = "play";
@ -344,11 +343,11 @@ function process()
physlag += dt;
while (physlag > phys_step) {
physlag -= phys_step;
while (physlag > physics.delta) {
physlag -= physics.delta;
var st = profile.now();
prosperon.phys2d_step(phys_step*game.timescale);
prosperon.physupdate(phys_step*game.timescale);
prosperon.phys2d_step(physics.delta*game.timescale);
prosperon.physupdate(physics.delta*game.timescale);
profile.addreport(profcache, "physics step", st);
}
}

View file

@ -53,6 +53,8 @@ physics.gravity.strength = 500;
physics.damp = physics.make_damp();
physics.damp.mask = ~1;
physics.delta = 1/240;
return {
physics
}

View file

@ -6,7 +6,7 @@ render.doc = {
var shaderlang = {
macos: "metal_macos",
windows: "hlsl4",
windows: "hlsl5",
linux: "glsl430",
web: "wgsl",
ios: "metal_ios",

View file

@ -793,9 +793,9 @@ sg_shader js2shader(JSValue v)
int atin = js_arrlen(attrs);
for (int i = 0; i < atin; i++) {
JSValue u = js_getpropidx(attrs, i);
desc.attrs[i].name = js2strdup(js_getpropstr(u, "name"));
desc.attrs[i].sem_name = js2strdup(js_getpropstr(u,"sem_name"));
desc.attrs[i].sem_index = js2number(js_getpropstr(u, "sem_index"));
int slot = js2number(js_getpropstr(u, "slot"));
desc.attrs[slot].sem_name = js2strdup(js_getpropstr(u,"sem_name"));
desc.attrs[slot].sem_index = js2number(js_getpropstr(u, "sem_index"));
}
JSValue vsu = js_getpropstr(vs, "uniform_blocks");

View file

@ -29,7 +29,7 @@
#define CYAN 36
#define WHITE 37
#define COLOR(TXT, _C) ESC #_C "m" #TXT ESC "0m"
#define COLOR(TXT, _C) ESC "22;" #_C "m" #TXT ESC "0m"
char *logstr[] = { "spam", "debug", "info", "warn", "error", "panic"};
char *logcolor[] = { COLOR(spam,37), COLOR(debug,32), COLOR(info,36), COLOR(warn,33), COLOR(error,31), COLOR(panic,45) };
@ -47,7 +47,6 @@ void log_init()
if (!fexists(".prosperon")) {
logout = tmpfile();
dump = tmpfile();
writeout = stdout;
}
else {
logout = fopen(".prosperon/log.txt", "w");
@ -93,7 +92,7 @@ void mYughLog(int category, int priority, int line, const char *file, const char
printf("\n");
}
if (priority >= LOG_PANIC) {
if (priority >= LOG_ERROR) {
js_stacktrace();
#ifdef __WIN32
DebugBreak();