diff options
author | quou <quou@disroot.org> | 2024-12-29 22:41:55 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-29 22:41:55 +1100 |
commit | 80b8a59afce450a87af7ca4082529d899b639779 (patch) | |
tree | 2204e24aff7665ca53b1f4ffca82ce7e0493a771 /video.hpp | |
parent | 4123d42aee69537f6fcede748a5d7b88277ef4af (diff) |
alpha blending
Diffstat (limited to 'video.hpp')
-rw-r--r-- | video.hpp | 45 |
1 files changed, 44 insertions, 1 deletions
@@ -83,13 +83,40 @@ enum class Depth_Mode { never }; +enum class Blend_Factor { + zero, + one, + src_colour, + inv_src_colour, + dst_colour, + inv_dst_colour, + src_alpha, + inv_src_alpha, + dst_alpha, + inv_dst_alpha +}; + +enum class Blend_Mode { + add, + subtract, + reverse_subtract, + min, + max +}; + + struct Pipeline { uint64_t pipeline_hash; uint64_t descriptor_resource_hash; int viewport[4]; int scissor[4]; bool depth_test, depth_write; + bool blend_enable; Depth_Mode depth_mode; + Blend_Factor blend_src, blend_dst; + Blend_Mode blend_mode; + Blend_Factor blend_src_alpha, blend_dst_alpha; + Blend_Mode blend_mode_alpha; Vertex_Format_Id vertex_format; Shader_Id shader; Descriptor descriptors[pipeline_max_descriptors]; @@ -109,7 +136,14 @@ struct Pipeline { scissor[3] == other.scissor[3] && depth_test == other.depth_test && depth_write == other.depth_write && - depth_mode == other.depth_mode; + depth_mode == other.depth_mode && + blend_enable == other.blend_enable && + blend_src == other.blend_src && + blend_dst == other.blend_dst && + blend_src_alpha == other.blend_src_alpha && + blend_dst_alpha == other.blend_dst_alpha && + blend_mode == other.blend_mode && + blend_mode_alpha == other.blend_mode_alpha; } bool desc_layout_eq(const Pipeline& other) const { @@ -257,6 +291,15 @@ struct Pipeline_Builder { void viewport(float x, float y, float w, float h); void scissor(float x, float y, float w, float h); void depth(bool test, bool write, Depth_Mode mode); + void blend(Blend_Mode mode, Blend_Factor src, Blend_Factor dst); + void 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 + ); void shader(Shader_Id s); void vertex_format(Vertex_Format_Id vf); void texture(int binding, Texture_Id t, Sampler_Id s); |