In the middle of a bit of a versioning hell

master
mitchellhansen 5 years ago
parent 8a699c8f6b
commit 751b7641b2

@ -11,11 +11,13 @@ simple-stopwatch="0.1.4"
nalgebra = "0.18.0" nalgebra = "0.18.0"
image = "0.21.2" image = "0.21.2"
rand = "0.6.5" rand = "0.6.5"
vulkano = "0.13.0" #vulkano = "0.12.0"
vulkano-shaders = "0.12.0" vulkano = {path = "../vulkano/vulkano"}
#vulkano-shaders = "0.12.0"
#vulkano-win = "0.13.0"
time = "0.1.38" time = "0.1.38"
shaderc = "0.5.0" shaderc = "0.5.0"
shade_runner = {version = "0.1.1", git = "https://github.com/MitchellHansen/shade_runner"} #shade_runner = {version = "0.1.1", git = "https://github.com/MitchellHansen/shade_runner"}
#shade_runner = {version = "0.1.1", path = "../shade_runner"} shade_runner = {path = "../shade_runner"}
vulkano-win = "0.13.0"
winit = "0.19.1" winit = "0.19.1"

@ -1,5 +1,4 @@
/*
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(unused_mut)] #![allow(unused_mut)]
@ -39,6 +38,7 @@ use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::device::{Device, DeviceExtensions}; use vulkano::device::{Device, DeviceExtensions};
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice}; use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice};
use vulkano::pipeline::ComputePipeline; use vulkano::pipeline::ComputePipeline;
use vulkano::descriptor::pipeline_layout::PipelineLayoutAbstract;
use vulkano::sync::GpuFuture; use vulkano::sync::GpuFuture;
use shaderc::CompileOptions; use shaderc::CompileOptions;
use shade_runner::CompileError; use shade_runner::CompileError;
@ -114,10 +114,6 @@ fn main() {
let mut workpiece = Workpiece::new(); let mut workpiece = Workpiece::new();
workpiece.render_sprite.set_texture(&mut texture, false); 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); let mut slider = Slider::new(Vector2f::new(40.0, 40.0), None, &font);
@ -210,44 +206,61 @@ fn main() {
window.display(); 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::buffer::{BufferUsage, CpuAccessibleBuffer, DeviceLocalBuffer, ImmutableBuffer, BufferAccess};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState}; use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, StdDescriptorPoolAlloc}; use vulkano::descriptor::descriptor_set::{PersistentDescriptorSet, StdDescriptorPoolAlloc};
use vulkano::device::{Device, DeviceExtensions, QueuesIter, Queue}; use vulkano::device::{Device, DeviceExtensions, QueuesIter, Queue};
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, RenderPassAbstract, Subpass};
use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, QueueFamily}; use vulkano::instance::{Instance, InstanceExtensions, PhysicalDevice, QueueFamily};
use vulkano::pipeline::ComputePipeline; use vulkano::pipeline::{ComputePipeline, GraphicsPipeline};
use vulkano::sync::{GpuFuture, FlushError}; use vulkano::pipeline::viewport::Viewport;
use vulkano::sync::{FlushError, GpuFuture};
use vulkano::sync; use vulkano::sync;
use vulkano::image::SwapchainImage;
use vulkano::swapchain::{AcquireError, PresentMode, SurfaceTransform, Swapchain, SwapchainCreationError};
use vulkano::swapchain;
use std::time::SystemTime; use std::time::SystemTime;
use std::sync::Arc; use std::sync::Arc;
use std::ffi::CStr; use std::ffi::CStr;
use std::path::PathBuf; use std::path::PathBuf;
use shade_runner as sr; use shade_runner as sr;
use image::{DynamicImage, ImageBuffer}; use image::{DynamicImage, GenericImage, GenericImageView, ImageBuffer};
use image::GenericImageView;
use vulkano::descriptor::pipeline_layout::PipelineLayout; use vulkano::descriptor::pipeline_layout::PipelineLayout;
use image::GenericImage;
use shade_runner::{ComputeLayout, CompileError}; use shade_runner::{ComputeLayout, CompileError};
use vulkano::descriptor::descriptor_set::PersistentDescriptorSetBuf; use vulkano::descriptor::descriptor_set::PersistentDescriptorSetBuf;
use shaderc::CompileOptions; use shaderc::CompileOptions;
use vulkano::swapchain::{AcquireError, PresentMode, SurfaceTransform, Swapchain, SwapchainCreationError}; use winit::{Event, EventsLoop, Window, WindowBuilder, WindowEvent};
use vulkano::swapchain;
use vulkano::framebuffer::{Framebuffer, FramebufferAbstract, Subpass, RenderPassAbstract};
use vulkano::image::SwapchainImage;
use vulkano::pipeline::GraphicsPipeline;
use vulkano::pipeline::viewport::Viewport;
use vulkano_win::VkSurfaceBuild; use vulkano_win::VkSurfaceBuild;
use winit::{EventsLoop, Window, WindowBuilder, Event, WindowEvent}; use vulkano::SafeDeref;
use vulkano::command_buffer::synced::SyncCommandBufferBuilder;
fn main() { fn main() {
let instance = { let instance = {
let extensions = vulkano_win::required_extensions(); let extensions = vulkano_win::required_extensions();
Instance::new(None, &extensions, None).unwrap() Instance::new(None, &extensions, None).unwrap()
@ -271,13 +284,13 @@ fn main() {
let window = surface.window(); let window = surface.window();
let queue_family = physical.queue_families().find(|&q| { let queue_family = physical.queue_families().find(|&q| {
// We take the first queue that supports drawing to our window. // We take the first queue that supports drawing to our window.
q.supports_graphics() && q.supports_graphics() &&
surface.is_supported(q).unwrap_or(false) && surface.is_supported(q).unwrap_or(false) &&
q.supports_compute() q.supports_compute()
}).unwrap(); }).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, let (device, mut queues) = Device::new(physical, physical.supported_features(), &device_ext,
[(queue_family, 0.5)].iter().cloned()).unwrap(); [(queue_family, 0.5)].iter().cloned()).unwrap();
@ -323,7 +336,6 @@ fn main() {
Swapchain::new(device.clone(), surface.clone(), capabilities.min_image_count, format, Swapchain::new(device.clone(), surface.clone(), capabilities.min_image_count, format,
initial_dimensions, 1, usage, &queue, SurfaceTransform::Identity, alpha, initial_dimensions, 1, usage, &queue, SurfaceTransform::Identity, alpha,
PresentMode::Fifo, true, None).unwrap() PresentMode::Fifo, true, None).unwrap()
}; };
@ -341,7 +353,7 @@ fn main() {
}; };
mod vs { mod vs {
vulkano_shaders::shader!{ vulkano_shaders::shader! {
ty: "vertex", ty: "vertex",
src: " src: "
#version 450 #version 450
@ -355,7 +367,7 @@ void main() {
} }
mod fs { mod fs {
vulkano_shaders::shader!{ vulkano_shaders::shader! {
ty: "fragment", ty: "fragment",
src: " src: "
#version 450 #version 450
@ -505,7 +517,7 @@ void main() {
Err(AcquireError::OutOfDate) => { Err(AcquireError::OutOfDate) => {
recreate_swapchain = true; recreate_swapchain = true;
continue; continue;
}, }
Err(err) => panic!("{:?}", err) Err(err) => panic!("{:?}", err)
}; };
@ -530,11 +542,11 @@ void main() {
options.add_macro_definition("SETTING_BUCKETS_LEN", Some("2")); options.add_macro_definition("SETTING_BUCKETS_LEN", Some("2"));
let shader = let shader =
sr::load_compute_with_options(compute_path, options) shade_runner::load_compute_with_options(compute_path, options)
.expect("Failed to compile"); .expect("Failed to compile");
let vulkano_entry = let vulkano_entry =
sr::parse_compute(&shader) shade_runner::parse_compute(&shader)
.expect("failed to parse"); .expect("failed to parse");
let x = unsafe { let x = unsafe {
@ -549,7 +561,6 @@ void main() {
).unwrap() ).unwrap()
} }
}); });
} }
// In order to draw, we have to build a *command buffer*. The command buffer object holds // 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( fn window_size_dependent_setup(
images: &[Arc<SwapchainImage<Window>>], images: &[Arc<SwapchainImage<Window>>],
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>, render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
dynamic_state: &mut DynamicState dynamic_state: &mut DynamicState,
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> { ) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
let dimensions = images[0].dimensions(); let dimensions = images[0].dimensions();
let viewport = Viewport { let viewport = Viewport {
origin: [0.0, 0.0], origin: [0.0, 0.0],
dimensions: [dimensions[0] as f32, dimensions[1] as f32], 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)); dynamic_state.viewports = Some(vec!(viewport));
@ -661,3 +672,4 @@ fn window_size_dependent_setup(
} }
*/
Loading…
Cancel
Save