From 751b7641b2150d62cffc616fc8bc994ae90df26a Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Tue, 9 Jul 2019 22:34:14 -0700 Subject: [PATCH] In the middle of a bit of a versioning hell --- Cargo.toml | 12 ++++---- src/main.rs | 84 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 55 insertions(+), 41 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0d23c3d1..7f158ddf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,13 @@ simple-stopwatch="0.1.4" nalgebra = "0.18.0" image = "0.21.2" rand = "0.6.5" -vulkano = "0.13.0" -vulkano-shaders = "0.12.0" +#vulkano = "0.12.0" +vulkano = {path = "../vulkano/vulkano"} +#vulkano-shaders = "0.12.0" +#vulkano-win = "0.13.0" time = "0.1.38" shaderc = "0.5.0" -shade_runner = {version = "0.1.1", git = "https://github.com/MitchellHansen/shade_runner"} -#shade_runner = {version = "0.1.1", path = "../shade_runner"} -vulkano-win = "0.13.0" +#shade_runner = {version = "0.1.1", git = "https://github.com/MitchellHansen/shade_runner"} +shade_runner = {path = "../shade_runner"} + winit = "0.19.1" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 88582f8d..c7ea55a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ -/* #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_mut)] @@ -39,6 +38,7 @@ use vulkano::descriptor::descriptor_set::PersistentDescriptorSet; use vulkano::device::{Device, DeviceExtensions}; use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice}; use vulkano::pipeline::ComputePipeline; +use vulkano::descriptor::pipeline_layout::PipelineLayoutAbstract; use vulkano::sync::GpuFuture; use shaderc::CompileOptions; use shade_runner::CompileError; @@ -114,10 +114,6 @@ fn main() { let mut workpiece = Workpiece::new(); workpiece.render_sprite.set_texture(&mut texture, false); - workpiece.render_sprite.texture().unwrap().update_from_pixesl(); - texture.set_smooth(false); - - workpieceloader.first_stage_texture.set_smooth(true); let mut slider = Slider::new(Vector2f::new(40.0, 40.0), None, &font); @@ -210,44 +206,61 @@ fn main() { window.display(); } } -*/ + + + + + +/* + +//use vulkano::buffer::{BufferAccess, BufferUsage, CpuAccessibleBuffer, DeviceLocalBuffer, ImmutableBuffer}; +//use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState}; +//use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, PersistentDescriptorSetBuf, StdDescriptorPoolAlloc}; +//use vulkano::descriptor::pipeline_layout::PipelineLayout; +//use vulkano::device::{Device, DeviceExtensions, Queue, QueuesIter}; +//use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass}; +//use vulkano::image::SwapchainImage; +//use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, QueueFamily}; +//use vulkano::pipeline::{ComputePipeline, GraphicsPipeline}; +//use vulkano::pipeline::viewport::Viewport; +//use vulkano::swapchain::{AcquireError, PresentMode, SurfaceTransform, Swapchain, SwapchainCreationError}; +//use vulkano::swapchain; +//use vulkano::sync::{FlushError, GpuFuture}; +//use vulkano::sync; +//use vulkano_win::VkSurfaceBuild; +//use winit::{Event, EventsLoop, Window, WindowBuilder, WindowEvent}; +//use shade_runner::{ComputeLayout, CompileError}; +//use shaderc::CompileOptions; + use vulkano::buffer::{BufferUsage, CpuAccessibleBuffer, DeviceLocalBuffer, ImmutableBuffer, BufferAccess}; use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState}; use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, StdDescriptorPoolAlloc}; use vulkano::device::{Device, DeviceExtensions, QueuesIter, Queue}; +use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass}; use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, QueueFamily}; -use vulkano::pipeline::ComputePipeline; -use vulkano::sync::{GpuFuture, FlushError}; +use vulkano::pipeline::{ComputePipeline, GraphicsPipeline}; +use vulkano::pipeline::viewport::Viewport; +use vulkano::sync::{FlushError, GpuFuture}; use vulkano::sync; +use vulkano::image::SwapchainImage; +use vulkano::swapchain::{AcquireError, PresentMode, SurfaceTransform, Swapchain, SwapchainCreationError}; +use vulkano::swapchain; use std::time::SystemTime; use std::sync::Arc; use std::ffi::CStr; use std::path::PathBuf; use shade_runner as sr; -use image::{DynamicImage, ImageBuffer}; -use image::GenericImageView; +use image::{DynamicImage, GenericImage, GenericImageView, ImageBuffer}; use vulkano::descriptor::pipeline_layout::PipelineLayout; -use image::GenericImage; use shade_runner::{ComputeLayout, CompileError}; use vulkano::descriptor::descriptor_set::PersistentDescriptorSetBuf; use shaderc::CompileOptions; -use vulkano::swapchain::{AcquireError, PresentMode, SurfaceTransform, Swapchain, SwapchainCreationError}; -use vulkano::swapchain; -use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, Subpass, RenderPassAbstract}; -use vulkano::image::SwapchainImage; -use vulkano::pipeline::GraphicsPipeline; -use vulkano::pipeline::viewport::Viewport; - - +use winit::{Event, EventsLoop, Window, WindowBuilder, WindowEvent}; use vulkano_win::VkSurfaceBuild; -use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; - -use vulkano::command_buffer::synced::SyncCommandBufferBuilder; - +use vulkano::SafeDeref; fn main() { - let instance = { let extensions = vulkano_win::required_extensions(); Instance::new(None, &extensions, None).unwrap() @@ -271,13 +284,13 @@ fn main() { let window = surface.window(); let queue_family = physical.queue_families().find(|&q| { - // We take the first queue that supports drawing to our window. - q.supports_graphics() && + // We take the first queue that supports drawing to our window. + q.supports_graphics() && surface.is_supported(q).unwrap_or(false) && q.supports_compute() }).unwrap(); - let device_ext = DeviceExtensions { khr_swapchain: true, .. DeviceExtensions::none() }; + let device_ext = DeviceExtensions { khr_swapchain: true, ..DeviceExtensions::none() }; let (device, mut queues) = Device::new(physical, physical.supported_features(), &device_ext, [(queue_family, 0.5)].iter().cloned()).unwrap(); @@ -323,7 +336,6 @@ fn main() { Swapchain::new(device.clone(), surface.clone(), capabilities.min_image_count, format, initial_dimensions, 1, usage, &queue, SurfaceTransform::Identity, alpha, PresentMode::Fifo, true, None).unwrap() - }; @@ -341,7 +353,7 @@ fn main() { }; mod vs { - vulkano_shaders::shader!{ + vulkano_shaders::shader! { ty: "vertex", src: " #version 450 @@ -355,7 +367,7 @@ void main() { } mod fs { - vulkano_shaders::shader!{ + vulkano_shaders::shader! { ty: "fragment", src: " #version 450 @@ -505,7 +517,7 @@ void main() { Err(AcquireError::OutOfDate) => { recreate_swapchain = true; continue; - }, + } Err(err) => panic!("{:?}", err) }; @@ -530,11 +542,11 @@ void main() { options.add_macro_definition("SETTING_BUCKETS_LEN", Some("2")); let shader = - sr::load_compute_with_options(compute_path, options) + shade_runner::load_compute_with_options(compute_path, options) .expect("Failed to compile"); let vulkano_entry = - sr::parse_compute(&shader) + shade_runner::parse_compute(&shader) .expect("failed to parse"); let x = unsafe { @@ -549,7 +561,6 @@ void main() { ).unwrap() } }); - } // In order to draw, we have to build a *command buffer*. The command buffer object holds @@ -640,14 +651,14 @@ void main() { fn window_size_dependent_setup( images: &[Arc>], render_pass: Arc, - dynamic_state: &mut DynamicState + dynamic_state: &mut DynamicState, ) -> Vec> { let dimensions = images[0].dimensions(); let viewport = Viewport { origin: [0.0, 0.0], dimensions: [dimensions[0] as f32, dimensions[1] as f32], - depth_range: 0.0 .. 1.0, + depth_range: 0.0..1.0, }; dynamic_state.viewports = Some(vec!(viewport)); @@ -661,3 +672,4 @@ fn window_size_dependent_setup( } +*/ \ No newline at end of file