fmt: run cargo fmt

This commit is contained in:
chyyran 2023-01-15 18:21:01 -05:00
parent b0948dd951
commit c059e7c566
4 changed files with 22 additions and 17 deletions

View file

@ -6,8 +6,8 @@ mod stage;
use crate::include::read_source;
pub use error::*;
use librashader_common::ImageFormat;
use std::path::Path;
use rustc_hash::FxHashMap;
use std::path::Path;
/// The source file for a single shader pass.
#[derive(Debug, Clone, PartialEq)]
@ -72,8 +72,7 @@ pub(crate) fn load_shader_source(path: impl AsRef<Path>) -> Result<ShaderSource,
let source = read_source(path)?;
let meta = pragma::parse_pragma_meta(&source)?;
let text = stage::process_stages(&source)?;
let parameters = FxHashMap::from_iter(meta.parameters.into_iter()
.map(|p| (p.id.clone(), p)));
let parameters = FxHashMap::from_iter(meta.parameters.into_iter().map(|p| (p.id.clone(), p)));
Ok(ShaderSource {
vertex: text.vertex,

View file

@ -186,13 +186,17 @@ impl VulkanWindow {
vk::ImageLayout::UNDEFINED,
vk::ImageLayout::COLOR_ATTACHMENT_OPTIMAL,
vk::AccessFlags::MEMORY_READ
| vk::AccessFlags::MEMORY_WRITE | vk::AccessFlags::HOST_READ | vk::AccessFlags::HOST_WRITE
| vk::AccessFlags::COLOR_ATTACHMENT_READ | vk::AccessFlags::COLOR_ATTACHMENT_WRITE | vk::AccessFlags::SHADER_READ,
| vk::AccessFlags::MEMORY_WRITE
| vk::AccessFlags::HOST_READ
| vk::AccessFlags::HOST_WRITE
| vk::AccessFlags::COLOR_ATTACHMENT_READ
| vk::AccessFlags::COLOR_ATTACHMENT_WRITE
| vk::AccessFlags::SHADER_READ,
vk::AccessFlags::COLOR_ATTACHMENT_WRITE | vk::AccessFlags::COLOR_ATTACHMENT_READ,
vk::PipelineStageFlags::ALL_COMMANDS,
vk::PipelineStageFlags::COLOR_ATTACHMENT_OUTPUT,
vk::QUEUE_FAMILY_IGNORED,
vk::QUEUE_FAMILY_IGNORED
vk::QUEUE_FAMILY_IGNORED,
);
Self::record_command_buffer(vulkan, framebuffer, cmd);
@ -205,13 +209,17 @@ impl VulkanWindow {
vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL,
vk::ImageLayout::SHADER_READ_ONLY_OPTIMAL,
vk::AccessFlags::MEMORY_READ
| vk::AccessFlags::MEMORY_WRITE | vk::AccessFlags::HOST_READ | vk::AccessFlags::HOST_WRITE
| vk::AccessFlags::COLOR_ATTACHMENT_READ | vk::AccessFlags::COLOR_ATTACHMENT_WRITE | vk::AccessFlags::SHADER_READ,
| vk::AccessFlags::MEMORY_WRITE
| vk::AccessFlags::HOST_READ
| vk::AccessFlags::HOST_WRITE
| vk::AccessFlags::COLOR_ATTACHMENT_READ
| vk::AccessFlags::COLOR_ATTACHMENT_WRITE
| vk::AccessFlags::SHADER_READ,
vk::AccessFlags::SHADER_READ,
vk::PipelineStageFlags::ALL_COMMANDS,
vk::PipelineStageFlags::FRAGMENT_SHADER,
vk::QUEUE_FAMILY_IGNORED,
vk::QUEUE_FAMILY_IGNORED
vk::QUEUE_FAMILY_IGNORED,
);
//
// util::vulkan_image_layout_transition_levels(

View file

@ -238,12 +238,12 @@ where
{
let id = id.as_str();
let default = parameter_defaults.get(id)
let default = parameter_defaults
.get(id)
.map(|f| f.initial)
.unwrap_or(0f32);
let value = *runtime_parameters.get(id)
.unwrap_or(&default);
let value = *runtime_parameters.get(id).unwrap_or(&default);
uniform_storage.bind_scalar(offset.offset(), value, offset.context());
}

View file

@ -14,8 +14,8 @@
//! called with appropriate input and output parameters to draw a frame with the shader effect applied.
//!
//! ## Runtimes
//! Currently available runtimes are OpenGL 3.3+ and 4.6 (with DSA), and Direct3D 11.
//! Work on the Vulkan and Direct3D 12 runtimes are in progress.
//! Currently available runtimes are Vulkan 1.3+, OpenGL 3.3+ and 4.6 (with DSA), and Direct3D 11.
//! Work on the Direct3D 12 runtimes are in progress. The Vulkan runtime requires [`VK_KHR_dynamic_rendering`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_dynamic_rendering.html).
//!
//! | **API** | **Status** | **`librashader` feature** |
//! |-------------|------------|---------------------------|
@ -47,9 +47,7 @@ pub mod presets {
let iters: Result<Vec<Vec<ShaderParameter>>, PreprocessError> = preset
.shaders
.iter()
.map(|s| ShaderSource::load(&s.name).map(|s|
s.parameters.into_values()
.collect()))
.map(|s| ShaderSource::load(&s.name).map(|s| s.parameters.into_values().collect()))
.into_iter()
.collect();
let iters = iters?;