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,10 +78,6 @@ CPPFLAGS += -DCONFIG_VERSION=\"2024-02-14\" -DCONFIG_BIGNUM #for quickjs
# ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER # ENABLE_SINC_[BEST|FAST|MEDIUM]_CONVERTER
# default, fast and medium available in game at runtime; best available in editor # 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) INFO := $(INFO)_$(ARCH)
ifeq ($(OS), Windows_NT) # then WINDOWS ifeq ($(OS), Windows_NT) # then WINDOWS
@ -91,9 +87,6 @@ ifeq ($(OS), Windows_NT) # then WINDOWS
LDFLAGS += -mwin32 -static LDFLAGS += -mwin32 -static
CPPFLAGS += -mwin32 CPPFLAGS += -mwin32
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread 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 INFO :=$(INFO)_win
EXT = .exe EXT = .exe
else ifeq ($(OS), IOS) else ifeq ($(OS), IOS)
@ -161,9 +154,11 @@ includeflag := $(addprefix -I, $(includeflag))
WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types WARNING_FLAGS = -Wno-incompatible-function-pointer-types -Wno-incompatible-pointer-types
# For vanilla compilation, remove _
ifeq ($(INFO),_) ifeq ($(INFO),_)
INFO := INFO :=
endif endif
APP = prosperon APP = prosperon
NAME = $(APP)$(INFO)$(EXT) NAME = $(APP)$(INFO)$(EXT)
SEM != git describe --tags --abbrev=0 SEM != git describe --tags --abbrev=0
@ -183,17 +178,12 @@ all: $(NAME)
prereqs: source/engine/core.cdb.h prereqs: source/engine/core.cdb.h
DESTDIR ?= ~/.bin
install: $(NAME)
@echo Copying to destination
cp -f $(NAME) $(DESTDIR)/$(APP)
$(NAME): $(OBJS) $(DEPS) $(NAME): $(OBJS) $(DEPS)
@echo Linking $(NAME) @echo Linking $(NAME)
$(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@ $(CROSS)$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
@echo Finished build @echo Finished build
%$(INFO).o: %.c %$(INFO).o: %.c prereqs
@echo Making C object $@ @echo Making C object $@
$(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(CROSS)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
@ -257,7 +247,7 @@ crossmac: Prosperon.icns
cp Prosperon.icns Prosperon.app/Contents/Resources cp Prosperon.icns Prosperon.app/Contents/Resources
crosswin: crosswin:
make CROSS=x86_64-w64-mingw32- OS=Windows_NT CC=gcc make CROSS=x86_64-w64-mingw32ucrt- OS=Windows_NT CC=gcc
crossweb: crossweb:
make CC=emcc OS=wasm make CC=emcc OS=wasm

View file

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

View file

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

View file

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

View file

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

View file

@ -29,7 +29,7 @@
#define CYAN 36 #define CYAN 36
#define WHITE 37 #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 *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) }; 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")) { if (!fexists(".prosperon")) {
logout = tmpfile(); logout = tmpfile();
dump = tmpfile(); dump = tmpfile();
writeout = stdout;
} }
else { else {
logout = fopen(".prosperon/log.txt", "w"); 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"); printf("\n");
} }
if (priority >= LOG_PANIC) { if (priority >= LOG_ERROR) {
js_stacktrace(); js_stacktrace();
#ifdef __WIN32 #ifdef __WIN32
DebugBreak(); DebugBreak();