Browse Source

Address review comments

pull/4/head
Ian Chamberlain 2 years ago
parent
commit
3a2b3f4ffe
No known key found for this signature in database
GPG Key ID: AE5484D09405AA60
  1. 7
      citro3d/examples/triangle.rs
  2. 1
      citro3d/src/render.rs

7
citro3d/examples/triangle.rs

@ -80,7 +80,7 @@ fn main() {
let mut program = shader::Program::new(vertex_shader).unwrap(); let mut program = shader::Program::new(vertex_shader).unwrap();
let mut vbo_data = Vec::with_capacity_in(VERTICES.len(), ctru::linear::LinearAllocator); let mut vbo_data = Vec::with_capacity_in(VERTICES.len(), ctru::linear::LinearAllocator);
vbo_data.extend(VERTICES); vbo_data.extend_from_slice(VERTICES);
let (uloc_projection, projection) = scene_init(&mut program, &vbo_data); let (uloc_projection, projection) = scene_init(&mut program, &vbo_data);
@ -106,11 +106,6 @@ fn main() {
render_to(&mut top_target); render_to(&mut top_target);
render_to(&mut bottom_target); render_to(&mut bottom_target);
} }
// explicit drop to ensure the vbo_data lives long enough for the render code
// to reference it. This hopefully won't be necessary anymore if we can use
// lifetimes to manage the buffers instead of passing raw ptrs
drop(vbo_data);
} }
fn scene_init(program: &mut shader::Program, vbo_data: &[Vertex]) -> (i8, C3D_Mtx) { fn scene_init(program: &mut shader::Program, vbo_data: &[Vertex]) -> (i8, C3D_Mtx) {

1
citro3d/src/render.rs

@ -41,7 +41,6 @@ impl<'screen> Target<'screen> {
pub fn new( pub fn new(
width: u16, width: u16,
height: u16, height: u16,
// TODO: is there a use case for a render target that isn't associated with a Screen?
screen: RefMut<'screen, dyn Screen>, screen: RefMut<'screen, dyn Screen>,
depth_format: Option<DepthFormat>, depth_format: Option<DepthFormat>,
) -> Result<Self> { ) -> Result<Self> {

Loading…
Cancel
Save