1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//!
//! A wrapper for the [wgpu](https://docs.rs/wgpu/latest/wgpu/) crate.
//!
//! This library provides wrappers for the [wgpu](https://docs.rs/wgpu/latest/wgpu/) crate
//! that are typesafe and easy to use. For this Builders are provided for most of
//! [wgpu](https://docs.rs/wgpu/latest/wgpu/)'s structs as well as wrappers with generics for structs of [wgpu](https://docs.rs/wgpu/latest/wgpu/)
//! that hold data to prevent unintended casting.
//! This crate also provides macros for creating vertices and a Framework that enables easy
//! initialisation.
//!
//! An example of how to render to a image:
//!```rust
//! use ewgpu::*;
//! use ewgpu::mesh::*;
//!
//! #[repr(C)]
//! #[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
//! struct Consts{
//! pub color: [f32; 4],
//! }
//! use winit::{window::WindowBuilder, event_loop::EventLoop};
//!
//! env_logger::init();
//!
//! let event_loop = EventLoop::new();
//!
//! let mut gpu = GPUContextBuilder::new()
//! .set_features_util()
//! .set_limits(wgpu::Limits{
//! max_push_constant_size: 128,
//! ..Default::default()
//! })
//! .build();
//!
//! let mesh = Mesh::<Vert2>::new(&gpu.device, &Vert2::QUAD_VERTS,
//! &Vert2::QUAD_IDXS).unwrap();
//!
//! let vshader = VertexShader::from_src(&gpu.device, "
//! #version 460
//! #if VERTEX_SHADER
//!
//! layout(location = 0) in vec2 i_pos;
//! layout(location = 1) in vec2 i_uv;
//!
//! layout(location = 0) out vec2 f_pos;
//! layout(location = 1) out vec2 f_uv;
//!
//! void main(){
//! f_pos = i_pos;
//! f_uv = i_uv;
//!
//! gl_Position = vec4(i_pos, 0.0, 1.0);
//! }
//!
//! #endif
//! ", None).unwrap();
//!
//! let fshader = FragmentShader::from_src(&gpu.device, "
//! #version 460
//! #if FRAGMENT_SHADER
//!
//! layout(location = 0) in vec2 f_pos;
//! layout(location = 1) in vec2 f_uv;
//!
//! layout(location = 0) out vec4 o_color;
//!
//! layout(push_constant) uniform PushConstants{
//! vec4 color;
//! } constants;
//!
//! void main(){
//! o_color = vec4(1.0, 0., 0., 1.);
//! }
//!
//! #endif
//! ", None).unwrap();
//!
//! let layout = pipeline_layout!(&gpu.device,
//! bind_groups: {},
//! push_constants: {
//! Consts,
//! }
//! );
//!
//! let pipeline = RenderPipelineBuilder::new(&vshader, &fshader)
//! .push_drawable_layouts::<Mesh<Vert2>>()
//! .push_target_replace(wgpu::TextureFormat::Rgba8Unorm)
//! .set_layout(&layout)
//! .build(&gpu.device);
//!
//! gpu.encode_img([1920, 1080], |gpu, dst, encoder|{
//! let mut rpass = RenderPassBuilder::new()
//! .push_color_attachment(dst.color_attachment_clear())
//! .begin(encoder, None);
//!
//! let mut rpass_ppl = rpass.set_pipeline(&pipeline);
//!
//! let consts = Consts{
//! color: [1.0, 0.0, 0.0, 1.0]
//! };
//!
//! rpass_ppl.set_push_const(0, &consts);
//!
//! mesh.draw(&mut rpass_ppl);
//! });
//!
//!```
//!
extern crate more_asserts;
pub extern crate ewgpu_macros;
//extern crate nalgebra_glm as glm;
pub use *;
pub use *;
pub use *;
//pub use self::mesh::*;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use crate*;
pub use *;
pub use crate*;