File tree Expand file tree Collapse file tree
crates/lambda-platform/src/gfx Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ use gfx_hal::{
55
66use super :: gpu;
77
8+ /// The type of shader that a shader module represents. Different shader types
9+ /// are used for different operations in the rendering pipeline.
810pub enum ShaderModuleType {
911 Vertex ,
1012 Fragment ,
@@ -94,6 +96,33 @@ impl<RenderBackend: gfx_hal::Backend> ShaderModule<RenderBackend> {
9496 }
9597}
9698
99+ #[ cfg( test) ]
100+ mod tests {
101+
102+ /// Test that we can create a shader module builder and it has the correct
103+ /// defaults.
104+ #[ test]
105+ fn shader_builder_initial_state ( ) {
106+ let shader_builder = super :: ShaderModuleBuilder :: new ( ) ;
107+ assert_eq ! ( shader_builder. entry_name, "main" ) ;
108+ assert_eq ! ( shader_builder. specializations. data. len( ) , 0 ) ;
109+ }
110+
111+ /// Test that we can create a shader module builder with a custom entry point
112+ /// & default specializations.
113+ #[ test]
114+ fn shader_builder_with_properties ( ) {
115+ let shader_builder = super :: ShaderModuleBuilder :: new ( )
116+ . with_entry_name ( "test" )
117+ . with_specializations ( super :: ShaderSpecializations :: default ( ) ) ;
118+ assert_eq ! ( shader_builder. entry_name, "test" ) ;
119+ assert_eq ! (
120+ shader_builder. specializations. data,
121+ super :: ShaderSpecializations :: default ( ) . data
122+ ) ;
123+ }
124+ }
125+
97126/// Internal functions for the shader module. User applications most likely
98127/// should not use these functions directly nor should they need to.
99128pub mod internal {
You can’t perform that action at this time.
0 commit comments