pub struct GpuPipelines {
pub lines: RenderPipeline,
pub tris: RenderPipeline,
pub rects: RenderPipeline,
pub discs: RenderPipeline,
pub bind_layout: BindGroupLayout,
/* private fields */
}Expand description
Pipelines cacheadas. Crear uno por proceso (o por surface format).
Para uso típico via GpuBatch los campos no se tocan directo. La
API pública existe para callers avanzados que quieran montar su propio
buffer persistente (datos que no cambian por frame: starfield Gaia,
particles iniciales, viewport estático) y emitir draw calls
manualmente reusando estas pipelines.
Layouts:
- Vertex buffer triángulos:
[x: f32, y: f32, rgba: u32](12 B/vert). - Instance buffer rects:
[x, y, w, h, rgba](20 B/inst). - Instance buffer líneas:
[x0, y0, x1, y1, rgba](20 B/inst). - Bind group 0 binding 0: uniform
{viewport: vec2<f32>, line_width: f32, _pad: f32}(16 B).
Fields§
§lines: RenderPipeline§tris: RenderPipeline§rects: RenderPipeline§discs: RenderPipelineDiscos/anillos rellenos con AA por SDF en el fragment. Instance
format: [cx, cy, r, stroke, rgba] (20 B/disco). stroke <= 0
→ disco lleno; stroke > 0 → anillo de ese grosor (px). Ver
GpuBatch::add_disc / GpuBatch::add_ring.
bind_layout: BindGroupLayoutImplementations§
Source§impl GpuPipelines
impl GpuPipelines
Sourcepub fn new(device: &Device, color_format: TextureFormat) -> Self
pub fn new(device: &Device, color_format: TextureFormat) -> Self
Compila los 3 pipelines apuntando al color_format del target
que recibirán en flush (el de la intermediate de WinitSurface,
normalmente Rgba8Unorm).
Examples found in repository?
examples/gpu_million_points.rs (line 32)
30fn main() {
31 let hal = pollster::block_on(Hal::new(None)).expect("hal");
32 let pipelines = GpuPipelines::new(&hal.device, FMT);
33
34 let (_tex, view) = make_target(&hal.device);
35
36 println!();
37 println!("gpu_million_points — GpuBatch + 3 pipelines · target {W}×{H} Rgba8Unorm");
38 println!("warmup {WARMUP}, measured {MEASURED}");
39 println!(" {:>10} | {:>14} | {:>14}", "N", "ms / frame", "Mprim/s");
40 println!(" {:->10} + {:->14} + {:->14}", "", "", "");
41
42 for &n in SIZES {
43 let ms = bench(&hal, &pipelines, &view, n);
44 let throughput = (n as f64 / 1_000_000.0) / (ms / 1000.0);
45 println!(" {:>10} | {:>14.3} | {:>14.2}", n, ms, throughput);
46 let _ = std::io::stdout().flush();
47 }
48 println!();
49 println!("(en llvmpipe estos números son CPU-bound — ver Fase 0 del SDD)");
50 println!();
51}Auto Trait Implementations§
impl !RefUnwindSafe for GpuPipelines
impl !UnwindSafe for GpuPipelines
impl Freeze for GpuPipelines
impl Send for GpuPipelines
impl Sync for GpuPipelines
impl Unpin for GpuPipelines
impl UnsafeUnpin for GpuPipelines
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.