diff options
Diffstat (limited to 'glow/src/quad')
-rw-r--r-- | glow/src/quad/compatibility.rs | 25 | ||||
-rw-r--r-- | glow/src/quad/core.rs | 25 |
2 files changed, 44 insertions, 6 deletions
diff --git a/glow/src/quad/compatibility.rs b/glow/src/quad/compatibility.rs index e083dcf1..28ad214d 100644 --- a/glow/src/quad/compatibility.rs +++ b/glow/src/quad/compatibility.rs @@ -25,20 +25,39 @@ pub struct Pipeline { } impl Pipeline { - pub fn new(gl: &glow::Context) -> Pipeline { + pub fn new( + gl: &glow::Context, + (vertex_version, fragment_version): &(String, String), + ) -> Pipeline { let program = unsafe { program::create( gl, &[ ( glow::VERTEX_SHADER, - include_str!("../shader/compatibility/quad.vert"), + &format!( + "{}\n{}", + vertex_version, + include_str!("../shader/compatibility/quad.vert") + ), ), ( glow::FRAGMENT_SHADER, - include_str!("../shader/compatibility/quad.frag"), + &format!( + "{}\n{}", + fragment_version, + include_str!("../shader/compatibility/quad.frag") + ), ), ], + &[ + (0, "i_Pos"), + (1, "i_Scale"), + (2, "i_Color"), + (3, "i_BorderColor"), + (4, "i_BorderRadius"), + (5, "i_BorderWidth"), + ], ) }; diff --git a/glow/src/quad/core.rs b/glow/src/quad/core.rs index c843e8c7..274ade67 100644 --- a/glow/src/quad/core.rs +++ b/glow/src/quad/core.rs @@ -20,20 +20,39 @@ pub struct Pipeline { } impl Pipeline { - pub fn new(gl: &glow::Context) -> Pipeline { + pub fn new( + gl: &glow::Context, + (vertex_version, fragment_version): &(String, String), + ) -> Pipeline { let program = unsafe { program::create( gl, &[ ( glow::VERTEX_SHADER, - include_str!("../shader/core/quad.vert"), + &format!( + "{}\n{}", + vertex_version, + include_str!("../shader/core/quad.vert") + ), ), ( glow::FRAGMENT_SHADER, - include_str!("../shader/core/quad.frag"), + &format!( + "{}\n{}", + fragment_version, + include_str!("../shader/core/quad.frag") + ), ), ], + &[ + (0, "i_Pos"), + (1, "i_Scale"), + (2, "i_Color"), + (3, "i_BorderColor"), + (4, "i_BorderRadius"), + (5, "i_BorderWidth"), + ], ) }; |