diff --git a/armorforge/project.js b/armorforge/project.js index 1643e718..ca23bc6b 100644 --- a/armorforge/project.js +++ b/armorforge/project.js @@ -11,12 +11,12 @@ project.add_project("../base"); project.add_tsfiles("../armorpaint/sources"); project.add_tsfiles("../armorpaint/sources/nodes"); -project.add_shaders("../armorpaint/shaders/*.glsl"); +project.add_shaders("../armorpaint/shaders/*.kong"); project.add_project("../armorpaint/plugins"); project.add_tsfiles("sources"); project.add_tsfiles("sources/nodes"); -project.add_shaders("shaders/*.glsl"); +project.add_shaders("shaders/*.kong"); project.add_assets("assets/*", { destination: "data/{name}" }); project.add_assets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); project.add_assets("assets/licenses/**", { destination: "data/licenses/{name}" }); diff --git a/armorlab/project.js b/armorlab/project.js index 970b057d..4c0cf25a 100644 --- a/armorlab/project.js +++ b/armorlab/project.js @@ -10,7 +10,7 @@ project.add_project("../base"); project.add_tsfiles("sources"); project.add_tsfiles("sources/nodes"); -project.add_shaders("shaders/*.glsl"); +project.add_shaders("shaders/*.kong"); project.add_assets("assets/*", { destination: "data/{name}" }); project.add_assets("../armorpaint/assets/export_presets/*", { destination: "data/export_presets/{name}" }); project.add_assets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); diff --git a/armorpaint/project.js b/armorpaint/project.js index 6573d074..dd89200f 100644 --- a/armorpaint/project.js +++ b/armorpaint/project.js @@ -9,7 +9,6 @@ project.add_project("../base"); project.add_tsfiles("sources"); project.add_tsfiles("sources/nodes"); -project.add_shaders("shaders/*.glsl"); project.add_shaders("shaders/*.kong"); project.add_assets("assets/*", { destination: "data/{name}" }); project.add_assets("assets/export_presets/*", { destination: "data/export_presets/{name}" }); diff --git a/armorsculpt/project.js b/armorsculpt/project.js index f68bd50f..37d8da0a 100644 --- a/armorsculpt/project.js +++ b/armorsculpt/project.js @@ -9,10 +9,10 @@ project.add_project("../base"); project.add_tsfiles("../armorpaint/sources"); project.add_tsfiles("../armorpaint/sources/nodes"); -project.add_shaders("../armorpaint/shaders/*.glsl"); +project.add_shaders("../armorpaint/shaders/*.kong"); project.add_tsfiles("sources"); project.add_tsfiles("sources/nodes"); -project.add_shaders("shaders/*.glsl"); +project.add_shaders("shaders/*.kong"); project.add_assets("assets/*", { destination: "data/{name}" }); project.add_assets("assets/keymap_presets/*", { destination: "data/keymap_presets/{name}" }); project.add_assets("assets/licenses/**", { destination: "data/licenses/{name}" }); diff --git a/base/assets/Scene.arm b/base/assets/Scene.arm index 2a8d9122..2b81f85d 100644 Binary files a/base/assets/Scene.arm and b/base/assets/Scene.arm differ diff --git a/base/assets/shader_datas.arm b/base/assets/shader_datas.arm index 8eabbe98..d645e6c3 100644 Binary files a/base/assets/shader_datas.arm and b/base/assets/shader_datas.arm differ diff --git a/base/project.js b/base/project.js index eff4ac15..cbb2e2c1 100644 --- a/base/project.js +++ b/base/project.js @@ -53,7 +53,6 @@ if (!flags.lite) { project.add_tsfiles("sources/ts"); project.add_tsfiles("sources/ts/iron"); project.add_tsfiles("sources/ts/nodes"); - project.add_shaders("shaders/*.glsl"); project.add_shaders("shaders/*.kong"); project.add_shaders("shaders/draw/*.kong"); project.add_assets("assets/*", { destination: "data/{name}" }); diff --git a/base/sources/iron_draw.c b/base/sources/iron_draw.c index c371ba47..95797718 100644 --- a/base/sources/iron_draw.c +++ b/base/sources/iron_draw.c @@ -154,8 +154,6 @@ void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_ver image_pipeline.alpha_blend_source = IRON_GPU_BLEND_ONE; image_pipeline.alpha_blend_destination = IRON_GPU_BLEND_INV_SOURCE_ALPHA; - image_pipeline.kong = true; - iron_gpu_pipeline_compile(&image_pipeline); image_tex_unit = iron_gpu_pipeline_get_texture_unit(&image_pipeline, "tex"); @@ -200,8 +198,6 @@ void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_ver colored_pipeline.alpha_blend_source = IRON_GPU_BLEND_ONE; colored_pipeline.alpha_blend_destination = IRON_GPU_BLEND_INV_SOURCE_ALPHA; - colored_pipeline.kong = true; - iron_gpu_pipeline_compile(&colored_pipeline); colored_proj_loc = iron_gpu_pipeline_get_constant_location(&colored_pipeline, "P"); @@ -256,8 +252,6 @@ void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_ver text_pipeline.alpha_blend_source = IRON_GPU_BLEND_SOURCE_ALPHA; text_pipeline.alpha_blend_destination = IRON_GPU_BLEND_INV_SOURCE_ALPHA; - text_pipeline.kong = true; - iron_gpu_pipeline_compile(&text_pipeline); text_tex_unit = iron_gpu_pipeline_get_texture_unit(&text_pipeline, "tex"); @@ -276,8 +270,6 @@ void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_ver text_pipeline_rt.alpha_blend_source = IRON_GPU_BLEND_ONE; text_pipeline_rt.alpha_blend_destination = IRON_GPU_BLEND_INV_SOURCE_ALPHA; - text_pipeline_rt.kong = true; - iron_gpu_pipeline_compile(&text_pipeline_rt); gpu_vertex_buffer_init(&text_vertex_buffer, DRAW_BUFFER_SIZE * 4, &structure, GPU_USAGE_DYNAMIC); diff --git a/base/sources/ts/import_envmap.ts b/base/sources/ts/import_envmap.ts index d48867a6..d4b900c3 100644 --- a/base/sources/ts/import_envmap.ts +++ b/base/sources/ts/import_envmap.ts @@ -21,7 +21,6 @@ function import_envmap_run(path: string, image: iron_gpu_texture_t) { import_envmap_pipeline.color_attachment_count = 1; ARRAY_ACCESS(import_envmap_pipeline.color_attachment, 0) = tex_format_t.RGBA128; - import_envmap_pipeline.kong = true; gpu_compile_pipeline(import_envmap_pipeline); import_envmap_params_loc = gpu_get_constant_location(import_envmap_pipeline, "params"); diff --git a/base/sources/ts/iron/shader_data.ts b/base/sources/ts/iron/shader_data.ts index 7ee4e1a5..772df448 100644 --- a/base/sources/ts/iron/shader_data.ts +++ b/base/sources/ts/iron/shader_data.ts @@ -133,7 +133,6 @@ function shader_context_compile(raw: shader_context_t): shader_context_t { // Shaders if (raw.shader_from_source) { - raw._.pipe_state.kong = true; raw._.pipe_state.vertex_shader = gpu_create_shader_from_source(raw.vertex_shader, shader_type_t.VERTEX); raw._.pipe_state.fragment_shader = gpu_create_shader_from_source(raw.fragment_shader, shader_type_t.FRAGMENT); @@ -143,13 +142,6 @@ function shader_context_compile(raw: shader_context_t): shader_context_t { } } else { - - if (starts_with(raw.fragment_shader, "_")) { - raw.fragment_shader = substring(raw.fragment_shader, 1, raw.fragment_shader.length); - raw.vertex_shader = substring(raw.vertex_shader, 1, raw.vertex_shader.length); - raw._.pipe_state.kong = true; - } - ///if arm_embed raw._.pipe_state.fragment_shader = sys_get_shader(raw.fragment_shader); raw._.pipe_state.vertex_shader = sys_get_shader(raw.vertex_shader); @@ -378,19 +370,19 @@ function shader_context_get_tex_format(s: string): tex_format_t { function shader_context_add_const(raw: shader_context_t, c: shader_const_t, offset: i32) { let cl: iron_gpu_constant_location_t = gpu_get_constant_location(raw._.pipe_state, c.name); - if (raw._.pipe_state.kong) { - let ptr: gpu_constant_location_impl_t = ADDRESS(cl.impl); - ptr.vertexOffset = offset; - ptr.fragmentOffset = offset; - } + + let ptr: gpu_constant_location_impl_t = ADDRESS(cl.impl); + ptr.vertexOffset = offset; + ptr.fragmentOffset = offset; + array_push(raw._.constants, cl); } function shader_context_add_tex(raw: shader_context_t, tu: tex_unit_t, i: i32) { let unit: iron_gpu_texture_unit_t = gpu_get_texture_unit(raw._.pipe_state, tu.name); - if (raw._.pipe_state.kong) { - ARRAY_ACCESS(unit.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = i; - } + + ARRAY_ACCESS(unit.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = i; + array_push(raw._.tex_units, unit); } diff --git a/base/sources/ts/line_draw.ts b/base/sources/ts/line_draw.ts index f286dd46..88118f6d 100644 --- a/base/sources/ts/line_draw.ts +++ b/base/sources/ts/line_draw.ts @@ -54,7 +54,6 @@ function line_draw_init() { ARRAY_ACCESS(line_draw_pipeline.color_attachment, 1) = tex_format_t.RGBA64; ARRAY_ACCESS(line_draw_pipeline.color_attachment, 2) = tex_format_t.RGBA64; line_draw_pipeline.depth_attachment_bits = 24; - line_draw_pipeline.kong = true; gpu_compile_pipeline(line_draw_pipeline); pipes_offset = 0; line_draw_color_loc = pipes_get_constant_location(line_draw_pipeline, "color", "vec3"); @@ -75,7 +74,6 @@ function line_draw_init() { line_draw_overlay_pipeline.cull_mode = cull_mode_t.NONE; line_draw_overlay_pipeline.color_attachment_count = 1; ARRAY_ACCESS(line_draw_overlay_pipeline.color_attachment, 0) = tex_format_t.RGBA64; - line_draw_overlay_pipeline.kong = true; gpu_compile_pipeline(line_draw_overlay_pipeline); } } diff --git a/base/sources/ts/pipes.ts b/base/sources/ts/pipes.ts index 4f2da1f0..527fdc5e 100644 --- a/base/sources/ts/pipes.ts +++ b/base/sources/ts/pipes.ts @@ -63,7 +63,6 @@ function _pipes_make_merge(red: bool, green: bool, blue: bool, alpha: bool): iro ARRAY_ACCESS(pipe.color_write_mask_green, 0) = green; ARRAY_ACCESS(pipe.color_write_mask_blue, 0) = blue; ARRAY_ACCESS(pipe.color_write_mask_alpha, 0) = alpha; - pipe.kong = true; gpu_compile_pipeline(pipe); return pipe; } @@ -97,7 +96,6 @@ function pipes_init() { gpu_vertex_struct_add(vs, "tex", vertex_data_t.F32_2X); gpu_vertex_struct_add(vs, "col", vertex_data_t.U8_4X_NORM); pipes_copy.input_layout = vs; - pipes_copy.kong = true; gpu_compile_pipeline(pipes_copy); } @@ -110,7 +108,6 @@ function pipes_init() { gpu_vertex_struct_add(vs, "tex", vertex_data_t.F32_2X); gpu_vertex_struct_add(vs, "col", vertex_data_t.U8_4X_NORM); pipes_copy_bgra.input_layout = vs; - pipes_copy_bgra.kong = true; gpu_compile_pipeline(pipes_copy_bgra); } @@ -125,7 +122,6 @@ function pipes_init() { pipes_copy8.input_layout = vs; pipes_copy8.color_attachment_count = 1; ARRAY_ACCESS(pipes_copy8.color_attachment, 0) = tex_format_t.R8; - pipes_copy8.kong = true; gpu_compile_pipeline(pipes_copy8); } @@ -140,7 +136,6 @@ function pipes_init() { pipes_copy128.input_layout = vs; pipes_copy128.color_attachment_count = 1; ARRAY_ACCESS(pipes_copy128.color_attachment, 0) = tex_format_t.RGBA128; - pipes_copy128.kong = true; gpu_compile_pipeline(pipes_copy128); } @@ -156,7 +151,6 @@ function pipes_init() { pipes_invert8.input_layout = vs; pipes_invert8.color_attachment_count = 1; ARRAY_ACCESS(pipes_invert8.color_attachment, 0) = tex_format_t.R8; - pipes_invert8.kong = true; gpu_compile_pipeline(pipes_invert8); } @@ -167,7 +161,6 @@ function pipes_init() { let vs: iron_gpu_vertex_structure_t = gpu_vertex_struct_create(); gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_apply_mask.input_layout = vs; - pipes_apply_mask.kong = true; gpu_compile_pipeline(pipes_apply_mask); pipes_tex0_mask = gpu_get_texture_unit(pipes_apply_mask, "tex0"); ARRAY_ACCESS(pipes_tex0_mask.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = 0; @@ -182,7 +175,6 @@ function pipes_init() { let vs: iron_gpu_vertex_structure_t = gpu_vertex_struct_create(); gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_merge_mask.input_layout = vs; - pipes_merge_mask.kong = true; gpu_compile_pipeline(pipes_merge_mask); pipes_tex0_merge_mask = gpu_get_texture_unit(pipes_merge_mask, "tex0"); ARRAY_ACCESS(pipes_tex0_merge_mask.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = 0; @@ -200,7 +192,6 @@ function pipes_init() { let vs: iron_gpu_vertex_structure_t = gpu_vertex_struct_create(); gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_colorid_to_mask.input_layout = vs; - pipes_colorid_to_mask.kong = true; gpu_compile_pipeline(pipes_colorid_to_mask); pipes_texpaint_colorid = gpu_get_texture_unit(pipes_colorid_to_mask, "texpaint_colorid"); ARRAY_ACCESS(pipes_texpaint_colorid.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = 0; @@ -222,7 +213,6 @@ function pipes_init() { ARRAY_ACCESS(pipes_copy_r.color_write_mask_green, 0) = false; ARRAY_ACCESS(pipes_copy_r.color_write_mask_blue, 0) = false; ARRAY_ACCESS(pipes_copy_r.color_write_mask_alpha, 0) = false; - pipes_copy_r.kong = true; gpu_compile_pipeline(pipes_copy_r); } @@ -238,7 +228,6 @@ function pipes_init() { ARRAY_ACCESS(pipes_copy_g.color_write_mask_red, 0) = false; ARRAY_ACCESS(pipes_copy_g.color_write_mask_blue, 0) = false; ARRAY_ACCESS(pipes_copy_g.color_write_mask_alpha, 0) = false; - pipes_copy_g.kong = true; gpu_compile_pipeline(pipes_copy_g); } @@ -249,7 +238,6 @@ function pipes_init() { let vs: iron_gpu_vertex_structure_t = gpu_vertex_struct_create(); gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_inpaint_preview.input_layout = vs; - pipes_inpaint_preview.kong = true; gpu_compile_pipeline(pipes_inpaint_preview); pipes_tex0_inpaint_preview = gpu_get_texture_unit(pipes_inpaint_preview, "tex0"); ARRAY_ACCESS(pipes_tex0_inpaint_preview.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = 0; @@ -267,7 +255,6 @@ function pipes_init() { ARRAY_ACCESS(pipes_copy_a.color_write_mask_red, 0) = false; ARRAY_ACCESS(pipes_copy_a.color_write_mask_green, 0) = false; ARRAY_ACCESS(pipes_copy_a.color_write_mask_blue, 0) = false; - pipes_copy_a.kong = true; gpu_compile_pipeline(pipes_copy_a); pipes_copy_a_tex = gpu_get_texture_unit(pipes_copy_a, "tex"); ARRAY_ACCESS(pipes_copy_a_tex.stages, IRON_GPU_SHADER_TYPE_FRAGMENT) = 0; @@ -284,7 +271,6 @@ function pipes_init() { gpu_vertex_struct_add(vs, "col", vertex_data_t.U8_4X_NORM); pipes_copy_rgb.input_layout = vs; ARRAY_ACCESS(pipes_copy_rgb.color_write_mask_alpha, 0) = false; - pipes_copy_rgb.kong = true; gpu_compile_pipeline(pipes_copy_rgb); } @@ -301,7 +287,6 @@ function pipes_init() { pipes_cursor.blend_destination = blend_factor_t.INV_SOURCE_ALPHA; pipes_cursor.depth_write = false; pipes_cursor.depth_mode = compare_mode_t.ALWAYS; - pipes_cursor.kong = true; gpu_compile_pipeline(pipes_cursor); pipes_offset = 0; pipes_cursor_vp = pipes_get_constant_location(pipes_cursor, "VP", "mat4"); diff --git a/base/sources/ts/ui_view2d.ts b/base/sources/ts/ui_view2d.ts index cd444a37..80d20754 100644 --- a/base/sources/ts/ui_view2d.ts +++ b/base/sources/ts/ui_view2d.ts @@ -43,7 +43,6 @@ function ui_view2d_init() { ui_view2d_pipe.blend_source = blend_factor_t.BLEND_ONE; ui_view2d_pipe.blend_destination = blend_factor_t.BLEND_ZERO; ARRAY_ACCESS(ui_view2d_pipe.color_write_mask_alpha, 0) = false; - ui_view2d_pipe.kong = true; gpu_compile_pipeline(ui_view2d_pipe); pipes_offset = 0; ui_view2d_channel_loc = pipes_get_constant_location(ui_view2d_pipe, "channel", "int"); diff --git a/base/sources/ts/util_uv.ts b/base/sources/ts/util_uv.ts index 0d1d72ce..38f18858 100644 --- a/base/sources/ts/util_uv.ts +++ b/base/sources/ts/util_uv.ts @@ -121,7 +121,6 @@ function util_uv_cache_dilate_map() { util_uv_pipe_dilate.depth_write = false; util_uv_pipe_dilate.depth_mode = compare_mode_t.ALWAYS; ARRAY_ACCESS(util_uv_pipe_dilate.color_attachment, 0) = tex_format_t.R8; - util_uv_pipe_dilate.kong = true; gpu_compile_pipeline(util_uv_pipe_dilate); // dilate_tex_unpack = getConstantLocation(pipeDilate, "tex_unpack"); } diff --git a/base/tools/pad/project.js b/base/tools/pad/project.js index b6ce6339..e44bd3b7 100644 --- a/base/tools/pad/project.js +++ b/base/tools/pad/project.js @@ -9,7 +9,7 @@ flags.lite = true; let project = new Project("ArmorPad"); project.add_tsfiles("sources"); -project.add_shaders("../../shaders/draw/*.glsl",); +project.add_shaders("../../shaders/draw/*.kong",); project.add_assets("../../assets/font_mono.ttf", { destination: "data/{name}" }); project.add_assets("../../assets/text_coloring.json", { destination: "data/{name}" }); project.add_tsfiles("../../sources/ts/iron");