From 80b8a59afce450a87af7ca4082529d899b639779 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 29 Dec 2024 22:41:55 +1100 Subject: alpha blending --- pipeline.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'pipeline.cpp') diff --git a/pipeline.cpp b/pipeline.cpp index 015a5dd..a3ea553 100644 --- a/pipeline.cpp +++ b/pipeline.cpp @@ -165,6 +165,38 @@ void Pipeline_Builder::depth(bool test, bool write, Depth_Mode mode) { pip->depth_mode = mode; } +void Pipeline_Builder::blend( + Blend_Mode mode, + Blend_Factor src, + Blend_Factor dst +) { + blend( + mode, + src, + dst, + mode, + src, + dst + ); +} + +void Pipeline_Builder::blend( + Blend_Mode mode_col, + Blend_Factor src_col, + Blend_Factor dst_col, + Blend_Mode mode_alpha, + Blend_Factor src_alpha, + Blend_Factor dst_alpha +) { + pip->blend_enable = true; + pip->blend_mode = mode_col; + pip->blend_src = src_col; + pip->blend_dst = dst_col; + pip->blend_mode_alpha = mode_alpha; + pip->blend_src_alpha = src_alpha; + pip->blend_dst_alpha = dst_alpha; +} + void Pipeline_Builder::shader(Shader_Id s) { pip->shader = s; } @@ -226,6 +258,13 @@ Pipeline& Pipeline_Builder::build() { h(pip->pipeline_hash, pip->depth_test); h(pip->pipeline_hash, pip->depth_write); h(pip->pipeline_hash, pip->depth_mode); + h(pip->pipeline_hash, pip->blend_enable); + h(pip->pipeline_hash, pip->blend_mode); + h(pip->pipeline_hash, pip->blend_mode_alpha); + h(pip->pipeline_hash, pip->blend_src); + h(pip->pipeline_hash, pip->blend_dst); + h(pip->pipeline_hash, pip->blend_src_alpha); + h(pip->pipeline_hash, pip->blend_dst_alpha); { int i, e = pip->descriptor_count; pip->descriptor_resource_hash = fnv1a64(0, 0); -- cgit v1.2.3-54-g00ecf