From 5d5a21dec0c865c35297cad03b7b5c61043ca8c3 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 9 Feb 2025 19:29:28 +1100 Subject: make the pipeline builder a bit cleaner to use --- video.hpp | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'video.hpp') diff --git a/video.hpp b/video.hpp index ccc1f11..b8293fa 100644 --- a/video.hpp +++ b/video.hpp @@ -298,21 +298,23 @@ struct Pipeline_Builder { Pipeline_Builder(Arena* arena, Device* dev); - void begin_rp(); - void rp_target(Texture_Id id, Colour clear_colour); - void rp_target(Texture_Id id, Clear_Mode mode); - void rp_depth_target(Texture_Id id, float clear_depth); - void rp_depth_target(Texture_Id id, Clear_Mode mode); + using PB = Pipeline_Builder&; + + PB& begin_rp(); + PB& rp_target(Texture_Id id, Colour clear_colour); + PB& rp_target(Texture_Id id, Clear_Mode mode); + PB& rp_depth_target(Texture_Id id, float clear_depth); + PB& rp_depth_target(Texture_Id id, Clear_Mode mode); Render_Pass& build_rp(); void validate_rp(); - void begin(); - void viewport(int x, int y, int w, int h); - void scissor(int x, int y, int w, int h); - void depth(bool test, bool write, Depth_Mode mode); - void geo(Geo_Type type); - void blend(Blend_Mode mode, Blend_Factor src, Blend_Factor dst); - void blend( + PB& begin(const Render_Pass* p = 0); + PB& viewport(int x, int y, int w, int h); + PB& scissor(int x, int y, int w, int h); + PB& depth(bool test, bool write, Depth_Mode mode); + PB& geo(Geo_Type type); + PB& blend(Blend_Mode mode, Blend_Factor src, Blend_Factor dst); + PB& blend( Blend_Mode mode_col, Blend_Factor src_col, Blend_Factor dst_col, @@ -320,17 +322,17 @@ struct Pipeline_Builder { Blend_Factor src_alpha, Blend_Factor dst_alpha ); - void cull(Cull_Mode mode); - void shader(Shader_Id s); - void vertex_format(Vertex_Format_Id vf); - void texture(int binding, Texture_Id t, Sampler_Id s); - void cbuffer( + PB& cull(Cull_Mode mode); + PB& shader(Shader_Id s); + PB& vertex_format(Vertex_Format_Id vf); + PB& texture(int binding, Texture_Id t, Sampler_Id s); + PB& cbuffer( int binding, Buffer_Id id, int offset = 0, int size = 0 ); - void sbuffer( + PB& sbuffer( int binding, Buffer_Id id, int offset = 0, -- cgit v1.2.3-54-g00ecf