Provide actual bounds to Shader primitives

... and allow for proper translation and scissoring.
This commit is contained in:
Héctor Ramón Jiménez 2023-11-28 23:13:38 +01:00
parent 100d15f306
commit ab7dae554c
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 54 additions and 40 deletions

View file

@ -1,6 +1,5 @@
//! Draw primitives using custom pipelines.
use crate::core::{Rectangle, Size};
use crate::graphics::Transformation;
use std::any::{Any, TypeId};
use std::collections::HashMap;
@ -41,9 +40,9 @@ pub trait Primitive: Debug + Send + Sync + 'static {
format: wgpu::TextureFormat,
device: &wgpu::Device,
queue: &wgpu::Queue,
bounds: Rectangle,
target_size: Size<u32>,
scale_factor: f32,
transform: Transformation,
storage: &mut Storage,
);
@ -51,9 +50,9 @@ pub trait Primitive: Debug + Send + Sync + 'static {
fn render(
&self,
storage: &Storage,
bounds: Rectangle<u32>,
target: &wgpu::TextureView,
target_size: Size<u32>,
viewport: Rectangle<u32>,
encoder: &mut wgpu::CommandEncoder,
);
}