more brainstorming on how spriting and computing is going to work
This commit is contained in:
102
src/main.rs
102
src/main.rs
@@ -33,6 +33,98 @@ mod vertex_3d;
|
||||
mod sprite;
|
||||
mod canvas;
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Alright, what the hell do I do next...
|
||||
|
||||
Canvas works, but I want to use CPU accessible buffer instead of immutable buffer
|
||||
I think it would be faster if we reuse fewer oversized buffers than vis versa
|
||||
|
||||
Texturing is broken
|
||||
|
||||
Compute is running in the background, but don't have a way to draw it.
|
||||
Would like to draw it to a sprite???
|
||||
|
||||
|
||||
|
||||
8/13 :
|
||||
Okay. So I've decided to keep compute image and compute kernel in their own 'canvas'
|
||||
Canvas still needs to be cleaned up. I would like a contract type of thing going on
|
||||
with the loaded textures. Where you need to request a texture_handle from vkprocessor
|
||||
to attach to a Sprite. The problem is kinda what I do with the swap image. I only need
|
||||
a reference to it and the general buffer coming back from the compute kernel. I could
|
||||
continue to hold the image in the Canvas, and just give out an ID when a Sprite wants it.
|
||||
|
||||
The issue here is that kinda muddles the API a bit. I would need to do something like
|
||||
|
||||
|
||||
|
||||
|
||||
Canvas.load_textures()
|
||||
|
||||
Compute.create_compute(data) -> compute_buffer_id
|
||||
Canvas.load_image(compute_buffer_id, Compute)
|
||||
|
||||
Sprite::with_image(compute_buffer_id)
|
||||
|
||||
|
||||
|
||||
Canvas::swap_into(compute_buffer, swap_image);
|
||||
|
||||
|
||||
|
||||
I want to be able to chain computes using the same data
|
||||
So that would be a different pipeline using the same or similar descriptor set
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sprite = Sprite::with_texture(Canvas.get_texture_from_file())
|
||||
|
||||
(compute, sprite2) = Compute::with_swap_image(Canvas.get_new_image())
|
||||
|
||||
|
||||
|
||||
compute load shader -> shader object
|
||||
|
||||
compute load buffers -> buffer object
|
||||
|
||||
shader object + buffer object + maybe the swap buffer
|
||||
-> command queue
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let mut canvas = CanvasFrame::new();
|
||||
canvas.draw(&sprite);
|
||||
canvas.draw(&sprite2);
|
||||
|
||||
|
||||
(frame_future) = processor.run(&surface, frame_future, canvas);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
fn main() {
|
||||
|
||||
let instance = {
|
||||
@@ -80,6 +172,8 @@ fn main() {
|
||||
accumulator_time -= step_size;
|
||||
}
|
||||
|
||||
println!("{}", delta_time);
|
||||
|
||||
let mut exit = false;
|
||||
events_loop.poll_events(|event| {
|
||||
match event {
|
||||
@@ -112,10 +206,18 @@ fn main() {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
let mut canvas = CanvasFrame::new();
|
||||
canvas.draw(&sprite);
|
||||
canvas.draw(&sprite2);
|
||||
|
||||
|
||||
(frame_future) = processor.run(&surface, frame_future, canvas);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user