Shader upade works on windows
This commit is contained in:
parent
cadf10b3a9
commit
f4ee9d8228
|
@ -129,7 +129,7 @@ qq = 'ms';
|
|||
|
||||
profile.report = function(start, msg = "[undefined report]")
|
||||
{
|
||||
console.info(`${msg} in ${profile.best_t(profile.now()-start)}`);
|
||||
say(`${msg} in ${profile.best_t(profile.now()-start)}`);
|
||||
}
|
||||
|
||||
profile.addreport = function(cache, line, start)
|
||||
|
|
|
@ -152,6 +152,8 @@ var shaderlang = {
|
|||
ios: "metal_ios",
|
||||
}
|
||||
|
||||
say(`shaderlang is ${shaderlang[os.sys()]}`);
|
||||
|
||||
var attr_map = {
|
||||
a_pos: 0,
|
||||
a_uv: 1,
|
||||
|
@ -296,7 +298,7 @@ render.make_shader = function(shader)
|
|||
|
||||
io.slurpwrite(out, shader);
|
||||
var backend = shaderlang[os.sys()];
|
||||
var ret = os.system(`sokol-shdc -b -f bare_yaml --slang=${backend} -i ${out} -o ${out}`);
|
||||
var ret = os.system(`sokol-shdc -f bare_yaml --slang=${backend} -i ${out} -o ${out}`);
|
||||
if (ret) {
|
||||
console.info(`error compiling shader`);
|
||||
return;
|
||||
|
|
|
@ -455,8 +455,8 @@ function cmd_args(cmdargs)
|
|||
if (cmds.length === 0)
|
||||
cmds[0] = "play";
|
||||
else if (!Cmdline.orders[cmds[0]]) {
|
||||
console.warn(`Command ${cmds[0]} not found.`);
|
||||
return;
|
||||
console.warn(`Command ${cmds[0]} not found. Playing instead.`);
|
||||
cmds[0] = "play";
|
||||
}
|
||||
|
||||
Cmdline.orders[cmds[0]](cmds.slice(1));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
var inputpanel = {
|
||||
title: "untitled",
|
||||
toString() { return this.title; },
|
||||
|
|
|
@ -64,6 +64,13 @@ const char *js2str(JSValue v) {
|
|||
return JS_ToCString(js, v);
|
||||
}
|
||||
|
||||
char *js2strdup(JSValue v) {
|
||||
char *str = JS_ToCString(js, v);
|
||||
char *ret = strdup(str);
|
||||
JS_FreeCString(js, str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sg_buffer_free(sg_buffer *b)
|
||||
{
|
||||
sg_destroy_buffer(*b);
|
||||
|
@ -747,6 +754,15 @@ sg_shader js2shader(JSValue v)
|
|||
char *fsmain = js2str(js_getpropstr(fs, "entry_point"));
|
||||
desc.vs.entry = vsmain;
|
||||
desc.fs.entry = fsmain;
|
||||
desc.vs.d3d11_target = "vs_4_0";
|
||||
desc.fs.d3d11_target = "ps_4_0";
|
||||
JSValue attrs = js_getpropstr(vs, "inputs");
|
||||
int atin = js_arrlen(attrs);
|
||||
for (int i = 0; i < atin; i++) {
|
||||
JSValue u = js_getpropidx(attrs, i);
|
||||
desc.attrs[i].sem_name = js2strdup(js_getpropstr(u,"sem_name"));
|
||||
desc.attrs[i].sem_index = js2number(js_getpropstr(u, "sem_index"));
|
||||
}
|
||||
JSValue vsu = js_getpropstr(vs, "uniform_blocks");
|
||||
int unin = js_arrlen(vsu);
|
||||
for (int i = 0; i < unin; i++) {
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
#include "script.h"
|
||||
|
||||
#ifdef __WIN32
|
||||
#include "debugapi.h"
|
||||
#endif
|
||||
|
||||
#define ESC "\033["
|
||||
#define BLACK 30
|
||||
#define RED 31
|
||||
|
|
Loading…
Reference in a new issue