paint: fix mask apply
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
empty: float4;
|
||||
mask_opacity: float;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
@@ -33,6 +33,7 @@ fun mask_apply_vert(input: vert_in): vert_out {
|
||||
fun mask_apply_frag(input: vert_out): float4 {
|
||||
var col0: float4 = sample_lod(tex0, sampler_linear, input.tex, 0.0);
|
||||
var mask: float = sample_lod(texa, sampler_linear, input.tex, 0.0).r;
|
||||
mask = lerp(1.0, mask, constants.mask_opacity);
|
||||
return float4(col0.rgb, col0.a * mask);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ i32 pipes_blending;
|
||||
i32 pipes_tex1w;
|
||||
i32 pipes_tex0_mask;
|
||||
i32 pipes_texa_mask;
|
||||
i32 pipes_opac_apply_mask;
|
||||
i32 pipes_tex0_merge_mask;
|
||||
i32 pipes_texa_merge_mask;
|
||||
i32 pipes_tex_colorid;
|
||||
|
||||
@@ -142,6 +142,8 @@ void pipes_init() {
|
||||
gpu_pipeline_compile(pipes_apply_mask);
|
||||
pipes_tex0_mask = 0;
|
||||
pipes_texa_mask = 1;
|
||||
pipes_offset = 0;
|
||||
pipes_opac_apply_mask = pipes_get_constant_location("float");
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -273,6 +273,7 @@ void layers_apply_mask(slot_layer_t *l, slot_layer_t *m) {
|
||||
gpu_set_pipeline(pipes_apply_mask);
|
||||
gpu_set_texture(pipes_tex0_mask, layers_temp_image);
|
||||
gpu_set_texture(pipes_texa_mask, m->texpaint);
|
||||
gpu_set_float(pipes_opac_apply_mask, m->mask_opacity);
|
||||
gpu_set_vertex_buffer(const_data_screen_aligned_vb);
|
||||
gpu_set_index_buffer(const_data_screen_aligned_ib);
|
||||
gpu_draw();
|
||||
|
||||
Reference in New Issue
Block a user