Guest User

Untitled

a guest
Feb 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #![feature(custom_attribute)]
  2. extern crate rlsl_math;
  3. use rlsl_math::{Input, N0, N1, Output, Vec2, Vec4, Vertex};
  4.  
  5. #[spirv(fragment)]
  6. fn color_frag(color: Input<N0, Vec2<f32>>) -> Output<N0, Vec4<f32>> {
  7. let color = color.data.extend2(0.0, 1.0);
  8. Output::new(color)
  9. }
  10.  
  11. #[spirv(fragment)]
  12. fn red_frag(color: Input<N0, Vec2<f32>>) -> Output<N0, Vec4<f32>> {
  13. let color = Vec4::new(1.0, 0.0, 0.0, 1.0);
  14. Output::new(color)
  15. }
  16.  
  17. #[spirv(fragment)]
  18. fn blue_frag(color: Input<N0, Vec2<f32>>) -> Output<N0, Vec4<f32>> {
  19. let color = Vec4::new(0.0, 0.0, 1.0, 1.0);
  20. Output::new(color)
  21. }
  22.  
  23. #[spirv(vertex)]
  24. fn vertex(
  25. vertex: &mut Vertex,
  26. pos: Input<N0, Vec2<f32>>,
  27. color: Input<N1, Vec2<f32>>,
  28. ) -> Output<N0, Vec2<f32>> {
  29. vertex.position = pos.data.extend2(0.0, 1.0);
  30. Output::new(color.data)
  31. }
Add Comment
Please, Sign In to add comment