Skip to content

Commit afabc05

Browse files
authored
feat(lambda-rs): Add support for indexed draw commands
2 parents 1317c1c + 96f6649 commit afabc05

21 files changed

+1383
-30
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,6 @@ bin
147147
# End of https://www.gitignore.io/api/linux,cpp,c,cmake,macos,opengl
148148

149149
imgui.ini
150+
151+
# Planning
152+
docs/plans/

crates/lambda-rs-platform/src/wgpu/gpu.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ impl std::ops::BitOr for Features {
6666
pub struct GpuLimits {
6767
pub max_uniform_buffer_binding_size: u64,
6868
pub max_bind_groups: u32,
69+
pub max_vertex_buffers: u32,
70+
pub max_vertex_attributes: u32,
6971
pub min_uniform_buffer_offset_alignment: u32,
7072
}
7173

@@ -250,6 +252,8 @@ impl Gpu {
250252
.max_uniform_buffer_binding_size
251253
.into(),
252254
max_bind_groups: self.limits.max_bind_groups,
255+
max_vertex_buffers: self.limits.max_vertex_buffers,
256+
max_vertex_attributes: self.limits.max_vertex_attributes,
253257
min_uniform_buffer_offset_alignment: self
254258
.limits
255259
.min_uniform_buffer_offset_alignment,

crates/lambda-rs-platform/src/wgpu/render_pass.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,22 @@ impl<'a> RenderPass<'a> {
187187
}
188188

189189
/// Issue a non-indexed draw over a vertex range.
190-
pub fn draw(&mut self, vertices: std::ops::Range<u32>) {
191-
self.raw.draw(vertices, 0..1);
190+
pub fn draw(
191+
&mut self,
192+
vertices: std::ops::Range<u32>,
193+
instances: std::ops::Range<u32>,
194+
) {
195+
self.raw.draw(vertices, instances);
192196
}
193197

194198
/// Issue an indexed draw with a base vertex applied.
195199
pub fn draw_indexed(
196200
&mut self,
197201
indices: std::ops::Range<u32>,
198202
base_vertex: i32,
203+
instances: std::ops::Range<u32>,
199204
) {
200-
self.raw.draw_indexed(indices, base_vertex, 0..1);
205+
self.raw.draw_indexed(indices, base_vertex, instances);
201206
}
202207
}
203208

0 commit comments

Comments
 (0)