|
|
@ -61,16 +61,93 @@ The issue here is that kinda muddles the API a bit. I would need to do something
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Canvas.load_textures()
|
|
|
|
8/27 :
|
|
|
|
|
|
|
|
|
|
|
|
Compute.create_compute(data) -> compute_buffer_id
|
|
|
|
But I dont always want to draw a computable...
|
|
|
|
Canvas.load_image(compute_buffer_id, Compute)
|
|
|
|
Which I guess is fine. I could have another datatype implement computable
|
|
|
|
|
|
|
|
|
|
|
|
Sprite::with_image(compute_buffer_id)
|
|
|
|
CompuSprite
|
|
|
|
|
|
|
|
-> Drawable, Computable
|
|
|
|
|
|
|
|
TxturSprite
|
|
|
|
|
|
|
|
-> Drawable
|
|
|
|
|
|
|
|
ColorSprite
|
|
|
|
|
|
|
|
-> Drawable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Computable
|
|
|
|
|
|
|
|
-> get pipeline id (need to assoc. compiled kernel)
|
|
|
|
|
|
|
|
->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Drawable
|
|
|
|
|
|
|
|
-> get texture id
|
|
|
|
|
|
|
|
-> get image id
|
|
|
|
|
|
|
|
-> get color
|
|
|
|
|
|
|
|
-> get vertices
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Computable
|
|
|
|
|
|
|
|
get data
|
|
|
|
|
|
|
|
set data?
|
|
|
|
|
|
|
|
set settings?
|
|
|
|
|
|
|
|
get swap image id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Drawable:
|
|
|
|
|
|
|
|
get vertices
|
|
|
|
|
|
|
|
get color
|
|
|
|
|
|
|
|
get texture id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get descriptor set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
need some sort of computable interface for the Sprite. It already has drawable
|
|
|
|
|
|
|
|
so why not computable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Pipeline is the compiled kernel/shader
|
|
|
|
|
|
|
|
in the shaders case, it has the vertex definition, constants, and the compiled code
|
|
|
|
|
|
|
|
in kernel, its just constants and compiled code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Descriptor set holds the buffers which we will pass to the pipeline
|
|
|
|
|
|
|
|
rw and settings buffers for the compu
|
|
|
|
|
|
|
|
texture buffer for the textured
|
|
|
|
|
|
|
|
image buffer for the image (swap)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Need to have certain stages in the building of the command buffer.
|
|
|
|
|
|
|
|
(Z level????)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.) computes
|
|
|
|
|
|
|
|
2.) compute swaps
|
|
|
|
|
|
|
|
3.) render images
|
|
|
|
|
|
|
|
4.) render textures
|
|
|
|
|
|
|
|
5.) render solids
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
So to start with we need to know the compute data which we want to run and the kernel we want to run it on. We combine the buffers along with the pipeline generated from the compiled kernel and get
|
|
|
|
|
|
|
|
the descriptor set. We also need the XY for the compute run
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I think I need to keep these kernels in their own Canvas type of structure
|
|
|
|
|
|
|
|
I want to modify their constants and recompile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let comp = Computable::new(device, data, kernel_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I have canvas frame. Perhaps I should do something similar for compute
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ComputeFrame.add(device, data, kernel_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Not sure if I can do this... but inside it could be like
|
|
|
|
|
|
|
|
CompuSprite::new(&mut canvas, kernel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new(&mut canvas) -> CompuSprite {
|
|
|
|
|
|
|
|
let img_id = canvas.new_image();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Canvas {
|
|
|
|
|
|
|
|
img_id.clone()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Canvas::swap_into(compute_buffer, swap_image);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|