very close to the skeleton of the canvas written. Still haven't tested it but it's looking good. Need to figure out how I'm goign to iterate shader_kernels without borrowing from self

This commit is contained in:
2019-08-08 00:34:37 -07:00
parent 2207c41956
commit a7e79668eb
3 changed files with 161 additions and 58 deletions

View File

@@ -21,7 +21,7 @@ use vulkano::descriptor::descriptor_set::{PersistentDescriptorSetBuf, Persistent
use shaderc::CompileOptions;
use vulkano::framebuffer::{Subpass, RenderPass, RenderPassAbstract, Framebuffer, FramebufferAbstract};
use vulkano::pipeline::shader::{GraphicsShaderType, ShaderModule, GraphicsEntryPoint, SpecializationConstants, SpecializationMapEntry};
use vulkano::swapchain::{Swapchain, PresentMode, SurfaceTransform, Surface, SwapchainCreationError, AcquireError};
use vulkano::swapchain::{Swapchain, PresentMode, SurfaceTransform, Surface, SwapchainCreationError, AcquireError, Capabilities};
use vulkano::swapchain::acquire_next_image;
use vulkano::image::swapchain::SwapchainImage;
use winit::{EventsLoop, WindowBuilder, Window, Event, WindowEvent};
@@ -99,12 +99,16 @@ pub struct VkProcessor<'a> {
swapchain_recreate_needed: bool,
capabilities: Capabilities
}
impl<'a> VkProcessor<'a> {
pub fn new(instance: &'a Arc<Instance>, surface: &'a Arc<Surface<Window>>) -> VkProcessor<'a> {
let physical = PhysicalDevice::enumerate(instance).next().unwrap();
let queue_family = physical.queue_families().find(|&q| {
@@ -138,6 +142,7 @@ impl<'a> VkProcessor<'a> {
swapchain: None,
swapchain_images: None,
swapchain_recreate_needed: false,
capabilities: surface.capabilities(physical).unwrap()
}
}
@@ -149,7 +154,7 @@ impl<'a> VkProcessor<'a> {
pub fn compile_shaders(&mut self, filename: String, surface: &'a Arc<Surface<Window>>) {
self.shader_kernels = Some(
ShaderKernels::new(filename.clone(),
surface, self.queue.clone(),
self.capabilities.clone(), self.queue.clone(),
self.physical,
self.device.clone())
);