diff --git a/armorpaint/sources/make_paint.ts b/armorpaint/sources/make_paint.ts index 592ca1fa..a6049261 100644 --- a/armorpaint/sources/make_paint.ts +++ b/armorpaint/sources/make_paint.ts @@ -22,6 +22,21 @@ function make_paint_color_attachments(): string[] { let res: string[] = ["RGBA64", "RGBA64"]; return res; } + + let format: tex_format_t = + base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : + base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : + tex_format_t.RGBA128; + + if (format == tex_format_t.RGBA64) { + let res: string[] = ["RGBA64", "RGBA64", "RGBA64", "R8"]; + return res; + } + if (format == tex_format_t.RGBA128) { + let res: string[] = ["RGBA128", "RGBA128", "RGBA128", "R8"]; + return res; + } + let res: string[] = ["RGBA32", "RGBA32", "RGBA32", "R8"]; return res; } diff --git a/armorpaint/sources/render_path_paint.ts b/armorpaint/sources/render_path_paint.ts index d1476c48..aa7022bd 100644 --- a/armorpaint/sources/render_path_paint.ts +++ b/armorpaint/sources/render_path_paint.ts @@ -96,6 +96,7 @@ function render_path_paint_init() { render_path_load_shader("shader_datas/copy_mrt3_pass/copy_mrt3_pass"); render_path_load_shader("shader_datas/copy_mrt3_pass/copy_mrt3RGBA64_pass"); + render_path_load_shader("shader_datas/copy_mrt3_pass/copy_mrt3RGBA128_pass"); render_path_load_shader("shader_datas/dilate_pass/dilate_pass"); } diff --git a/base/assets/shader_datas.arm b/base/assets/shader_datas.arm index 52840907..0edf6d3b 100644 Binary files a/base/assets/shader_datas.arm and b/base/assets/shader_datas.arm differ diff --git a/base/sources/ts/history.ts b/base/sources/ts/history.ts index 608cdb8a..06e671d9 100644 --- a/base/sources/ts/history.ts +++ b/base/sources/ts/history.ts @@ -686,7 +686,17 @@ function history_copy_to_undo(from_id: i32, to_id: i32, is_mask: bool) { render_path_bind_target("texpaint" + from_id, "tex0"); render_path_bind_target("texpaint_nor" + from_id, "tex1"); render_path_bind_target("texpaint_pack" + from_id, "tex2"); - render_path_draw_shader("shader_datas/copy_mrt3_pass/copy_mrt3_pass"); + + let format: tex_format_t = + base_bits_handle.position == texture_bits_t.BITS8 ? tex_format_t.RGBA32 : + base_bits_handle.position == texture_bits_t.BITS16 ? tex_format_t.RGBA64 : + tex_format_t.RGBA128; + + let pipe: string = format == tex_format_t.RGBA32 ? "copy_mrt3_pass" : + format == tex_format_t.RGBA64 ? "copy_mrt3RGBA64_pass" : + "copy_mrt3RGBA128_pass"; + + render_path_draw_shader("shader_datas/copy_mrt3_pass/" + pipe); } history_undo_i = (history_undo_i + 1) % config_raw.undo_steps; } diff --git a/base/sources/ts/pipes.ts b/base/sources/ts/pipes.ts index f627e6ac..3286a2ac 100644 --- a/base/sources/ts/pipes.ts +++ b/base/sources/ts/pipes.ts @@ -1,6 +1,7 @@ let pipes_copy: gpu_pipeline_t; let pipes_copy8: gpu_pipeline_t; +let pipes_copy64: gpu_pipeline_t; let pipes_copy128: gpu_pipeline_t; let pipes_copy_bgra: gpu_pipeline_t; let pipes_copy_rgb: gpu_pipeline_t = null; @@ -115,6 +116,18 @@ function pipes_init() { gpu_pipeline_compile(pipes_copy8); } + { + pipes_copy64 = gpu_create_pipeline(); + pipes_copy64.vertex_shader = sys_get_shader("layer_copy.vert"); + pipes_copy64.fragment_shader = sys_get_shader("layer_copy.frag"); + let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); + pipes_copy64.input_layout = vs; + pipes_copy64.color_attachment_count = 1; + ARRAY_ACCESS(pipes_copy64.color_attachment, 0) = tex_format_t.RGBA64; + gpu_pipeline_compile(pipes_copy64); + } + { pipes_copy128 = gpu_create_pipeline(); pipes_copy128.vertex_shader = sys_get_shader("layer_copy.vert"); diff --git a/base/sources/ts/slot_layer.ts b/base/sources/ts/slot_layer.ts index 59ca9fd8..3ee0eb7f 100644 --- a/base/sources/ts/slot_layer.ts +++ b/base/sources/ts/slot_layer.ts @@ -372,10 +372,14 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { format = tex_format_t.RGBA128; ///end + let pipe: gpu_pipeline_t = format == tex_format_t.RGBA32 ? pipes_copy : + format == tex_format_t.RGBA64 ? pipes_copy64 : + pipes_copy128; + let _texpaint: gpu_texture_t = raw.texpaint; raw.texpaint = gpu_create_render_target(res_x, res_y, format); draw_begin(raw.texpaint); - draw_set_pipeline(pipes_copy); + draw_set_pipeline(pipe); draw_scaled_image(_texpaint, 0, 0, res_x, res_y); draw_set_pipeline(null); draw_end(); @@ -385,7 +389,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { raw.texpaint_nor = gpu_create_render_target(res_x, res_y, format); draw_begin(raw.texpaint_nor); - draw_set_pipeline(pipes_copy); + draw_set_pipeline(pipe); draw_scaled_image(_texpaint_nor, 0, 0, res_x, res_y); draw_set_pipeline(null); draw_end(); @@ -396,7 +400,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { raw.texpaint_pack = gpu_create_render_target(res_x, res_y, format); draw_begin(raw.texpaint_pack); - draw_set_pipeline(pipes_copy); + draw_set_pipeline(pipe); draw_scaled_image(_texpaint_pack, 0, 0, res_x, res_y); draw_set_pipeline(null); draw_end(); diff --git a/base/sources/ts/tab_layers.ts b/base/sources/ts/tab_layers.ts index 0060bb29..45187adf 100644 --- a/base/sources/ts/tab_layers.ts +++ b/base/sources/ts/tab_layers.ts @@ -896,6 +896,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ///end if (base_bits_handle.changed) { sys_notify_on_init(layers_set_bits); + make_material_parse_paint_material(); ui_menu_keep_open = true; } }