|
|
|
@ -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()
|
|
|
|
@ -277,7 +290,7 @@ fn main() {
|
|
|
|
|
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<SwapchainImage<Window>>],
|
|
|
|
|
render_pass: Arc<dyn RenderPassAbstract + Send + Sync>,
|
|
|
|
|
dynamic_state: &mut DynamicState
|
|
|
|
|
dynamic_state: &mut DynamicState,
|
|
|
|
|
) -> Vec<Arc<dyn FramebufferAbstract + Send + Sync>> {
|
|
|
|
|
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(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|