Skip to content

Commit

Permalink
minits fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed May 12, 2024
1 parent 0b8a3bb commit dec71a2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion base/Sources/box_preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ function box_preferences_show() {
b[1] = color_get_gb(box_preferences_world_color);
b[2] = color_get_bb(box_preferences_world_color);
b[3] = 255;
context_raw.empty_envmap = image_from_bytes(b.buffer, 1, 1);
context_raw.empty_envmap = image_from_bytes(b, 1, 1);
context_raw.ddirty = 2;
if (!context_raw.show_envmap) {
scene_world._.envmap = context_raw.empty_envmap;
Expand Down
2 changes: 1 addition & 1 deletion base/Sources/import_arm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ function import_arm_make_pink(abs: string) {
b[1] = 0;
b[2] = 255;
b[3] = 255;
let pink: image_t = image_from_bytes(b.buffer, 1, 1);
let pink: image_t = image_from_bytes(b, 1, 1);
map_set(data_cached_images, abs, pink);
}

Expand Down
16 changes: 8 additions & 8 deletions base/Sources/node_shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ function node_shader_get_hlsl(raw: node_shader_t, shared_sampler: string): strin
if (raw.ins.length > 0) {
s += "struct SPIRV_Cross_Input {\n";
index = 0;
array_sort(raw.ins, function (a: string, b: string): i32 {
array_sort(raw.ins, function (stra: string, strb: string): i32 {
// Sort inputs by name
return substring(a, 4, a.length) >= substring(b, 4, b.length) ? 1 : -1;
return substring(stra, 4, stra.length) >= substring(strb, 4, strb.length) ? 1 : -1;
});
for (let i: i32 = 0; i < raw.ins.length; ++i) {
let a: string = raw.ins[i];
Expand All @@ -266,9 +266,9 @@ function node_shader_get_hlsl(raw: node_shader_t, shared_sampler: string): strin
let num: i32 = 0;
if (raw.outs.length > 0 || raw.shader_type == "vert") {
s += "struct SPIRV_Cross_Output {\n";
array_sort(raw.outs, function (a: string, b: string): i32 {
array_sort(raw.outs, function (stra: string, strb: string): i32 {
// Sort outputs by name
return substring(a, 4, a.length) >= substring(b, 4, b.length) ? 1 : -1;
return substring(stra, 4, stra.length) >= substring(strb, 4, strb.length) ? 1 : -1;
});
index = 0;
if (raw.shader_type == "vert") {
Expand Down Expand Up @@ -440,9 +440,9 @@ function node_shader_get_msl(raw: node_shader_t, shared_sampler: string): string
//if (ins.length > 0) {
s += "struct main_in {\n";
index = 0;
array_sort(raw.ins, function (a: string, b: string): i32 {
array_sort(raw.ins, function (stra: string, strb: string): i32 {
// Sort inputs by name
return substring(a, 4, a.length) >= substring(b, 4, b.length) ? 1 : -1;
return substring(stra, 4, stra.length) >= substring(strb, 4, strb.length) ? 1 : -1;
});
if (raw.shader_type == "vert") {
for (let i: i32 = 0; i < raw.ins.length; ++i) {
Expand All @@ -465,9 +465,9 @@ function node_shader_get_msl(raw: node_shader_t, shared_sampler: string): string
let num: i32 = 0;
if (raw.outs.length > 0 || raw.shader_type == "vert") {
s += "struct main_out {\n";
array_sort(raw.outs, function (a: string, b: string): i32 {
array_sort(raw.outs, function (stra: string, strb: string): i32 {
// Sort outputs by name
return substring(a, 4, a.length) >= substring(b, 4, b.length) ? 1 : -1;
return substring(stra, 4, stra.length) >= substring(strb, 4, strb.length) ? 1 : -1;
});
index = 0;
if (raw.shader_type == "vert") {
Expand Down
2 changes: 1 addition & 1 deletion base/Sources/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function project_new(reset_layers: bool = true) {
f32a[i * 4 + 3] = 1.0;
}

let imgmesh: image_t = image_from_bytes(f32a.buffer, config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.RGBA128);
let imgmesh: image_t = image_from_bytes(f32a, config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.RGBA128);
let texpaint: image_t = project_layers[0].texpaint;
g2_begin(texpaint);
g2_set_pipeline(base_pipe_copy128);
Expand Down
2 changes: 1 addition & 1 deletion base/Sources/tab_swatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function tab_swatches_empty_get(): image_t {
b[1] = 255;
b[2] = 255;
b[3] = 255;
_tab_swatches_empty = image_from_bytes(b.buffer, 1, 1);
_tab_swatches_empty = image_from_bytes(b, 1, 1);
}
return _tab_swatches_empty;
}
Expand Down
4 changes: 2 additions & 2 deletions base/Sources/ui_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,15 @@ function ui_base_init() {
b[1] = 8;
b[2] = 8;
b[3] = 255;
context_raw.empty_envmap = image_from_bytes(b.buffer, 1, 1);
context_raw.empty_envmap = image_from_bytes(b, 1, 1);
}
if (context_raw.preview_envmap == null) {
let b: u8_array_t = u8_array_create(4);
b[0] = 0;
b[1] = 0;
b[2] = 0;
b[3] = 255;
context_raw.preview_envmap = image_from_bytes(b.buffer, 1, 1);
context_raw.preview_envmap = image_from_bytes(b, 1, 1);
}

let world: world_data_t = scene_world;
Expand Down
9 changes: 8 additions & 1 deletion base/Sources/ui_menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,14 @@ function ui_menu_render() {
msg += sys_system_id() + " - " + strings_graphics_api();

///if krom_windows
let save: string = (path_is_protected() ? krom_save_path() : path_data()) + path_sep + "tmp.txt";
let save: string;
if (path_is_protected()) {
save = krom_save_path();
}
else {
save = path_data();
}
save += path_sep + "tmp.txt";
krom_sys_command("wmic path win32_VideoController get name > \"" + save + "\"");
let blob: buffer_t = krom_load_blob(save);
let u8: u8_array_t = u8_array_create_from_buffer(blob);
Expand Down

0 comments on commit dec71a2

Please sign in to comment.