Fix 16/32bit layer paint
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user