fmt: cargo fmt

This commit is contained in:
chyyran 2024-02-14 19:22:25 -05:00 committed by Ronny Chan
parent 05467c2c78
commit 6fbc4b3075
38 changed files with 124 additions and 70 deletions

View file

@ -6,7 +6,7 @@ pub(crate) mod internal {
use std::error::Error;
use std::path::PathBuf;
use persy::{Config, Persy, ByteVec, ValueMode};
use persy::{ByteVec, Config, Persy, ValueMode};
pub(crate) fn get_cache_dir() -> Result<PathBuf, Box<dyn Error>> {
let cache_dir = if let Some(cache_dir) =
@ -45,11 +45,15 @@ pub(crate) mod internal {
pub(crate) fn get_cache() -> Result<Persy, Box<dyn Error>> {
let cache_dir = get_cache_dir()?;
let conn = Persy::open_or_create_with(&cache_dir.join("librashader.db.1"), Config::new(), |persy| {
let tx = persy.begin()?;
tx.commit()?;
Ok(())
})?;
let conn = Persy::open_or_create_with(
&cache_dir.join("librashader.db.1"),
Config::new(),
|persy| {
let tx = persy.begin()?;
tx.commit()?;
Ok(())
},
)?;
Ok(conn)
}
@ -59,14 +63,19 @@ pub(crate) mod internal {
key: &[u8],
) -> Result<Option<Vec<u8>>, Box<dyn Error>> {
if !conn.exists_index(index)? {
return Ok(None);
return Ok(None);
}
let value = conn.get::<_, ByteVec>(index, &ByteVec::from(key))?.next();
Ok(value.map(|v| v.to_vec()))
}
pub(crate) fn set_blob(conn: &Persy, index: &str, key: &[u8], value: &[u8]) -> Result<(), Box<dyn Error>> {
pub(crate) fn set_blob(
conn: &Persy,
index: &str,
key: &[u8],
value: &[u8],
) -> Result<(), Box<dyn Error>> {
let mut tx = conn.begin()?;
if !tx.exists_index(index)? {
tx.create_index::<ByteVec, ByteVec>(index, ValueMode::Replace)?;

View file

@ -14,7 +14,9 @@ pub struct CachedCompilation<T> {
compilation: T,
}
impl<T: ShaderReflectObject> ShaderReflectObject for CachedCompilation<T> { type Compiler = T::Compiler; }
impl<T: ShaderReflectObject> ShaderReflectObject for CachedCompilation<T> {
type Compiler = T::Compiler;
}
impl<T: ShaderReflectObject + for<'de> serde::Deserialize<'de> + serde::Serialize + Clone>
ShaderInputCompiler<CachedCompilation<T>> for Glslang
@ -39,7 +41,9 @@ where
};
let compilation = 'cached: {
if let Ok(Some(cached)) = crate::cache::internal::get_blob(&cache, "spirv", key.as_bytes()) {
if let Ok(Some(cached)) =
crate::cache::internal::get_blob(&cache, "spirv", key.as_bytes())
{
let decoded =
bincode::serde::decode_from_slice(&cached, bincode::config::standard())
.map(|(compilation, _)| CachedCompilation { compilation })
@ -58,7 +62,9 @@ where
if let Ok(updated) =
bincode::serde::encode_to_vec(&compilation.compilation, bincode::config::standard())
{
let Ok(()) = crate::cache::internal::set_blob(&cache, "spirv", key.as_bytes(), &updated) else {
let Ok(()) =
crate::cache::internal::set_blob(&cache, "spirv", key.as_bytes(), &updated)
else {
return Ok(compilation);
};
}

View file

@ -64,18 +64,30 @@ use librashader::runtime::gl::FilterChain as FilterChainGL;
pub type libra_gl_filter_chain_t = Option<NonNull<FilterChainGL>>;
/// A handle to a Direct3D 11 filter chain.
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d11")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d11")
))]
use librashader::runtime::d3d11::FilterChain as FilterChainD3D11;
/// A handle to a Direct3D 11 filter chain.
#[doc(cfg(all(target_os = "windows", feature = "runtime-d3d11")))]
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d11")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d11")
))]
pub type libra_d3d11_filter_chain_t = Option<NonNull<FilterChainD3D11>>;
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d12")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d12")
))]
use librashader::runtime::d3d12::FilterChain as FilterChainD3D12;
/// A handle to a Direct3D 12 filter chain.
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d12")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d12")
))]
pub type libra_d3d12_filter_chain_t = Option<NonNull<FilterChainD3D12>>;
#[cfg(feature = "runtime-vulkan")]
@ -88,7 +100,14 @@ pub type libra_vk_filter_chain_t = Option<NonNull<FilterChainVulkan>>;
#[cfg(all(target_os = "macos", feature = "runtime-metal"))]
use librashader::runtime::mtl::FilterChain as FilterChainMetal;
#[doc(cfg(all(target_vendor = "apple", feature = "runtime-metal")))]
#[cfg(any(feature = "__cbindgen_internal", all(target_vendor = "apple", feature = "runtime-metal", feature = "__cbindgen_internal_objc")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(
target_vendor = "apple",
feature = "runtime-metal",
feature = "__cbindgen_internal_objc"
)
))]
pub type libra_mtl_filter_chain_t = Option<NonNull<FilterChainMetal>>;
/// Defines the output viewport for a rendered frame.

View file

@ -192,7 +192,7 @@ impl LibrashaderError {
#[cfg(feature = "runtime-vulkan")]
LibrashaderError::VulkanFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,
#[cfg(all(target_vendor = "apple", feature = "runtime-metal"))]
LibrashaderError::MetalFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR
LibrashaderError::MetalFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,
}
}
pub(crate) const fn ok() -> libra_error_t {

View file

@ -8,13 +8,26 @@ pub mod gl;
pub mod vk;
#[doc(cfg(all(target_os = "windows", feature = "runtime-d3d11")))]
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d11")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d11")
))]
pub mod d3d11;
#[doc(cfg(all(target_os = "windows", feature = "runtime-d3d12")))]
#[cfg(any(feature = "__cbindgen_internal", all(target_os = "windows", feature = "runtime-d3d12")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(target_os = "windows", feature = "runtime-d3d12")
))]
pub mod d3d12;
#[doc(cfg(all(target_vendor = "apple", feature = "runtime-metal")))]
#[cfg(any(feature = "__cbindgen_internal", all(target_vendor = "apple", feature = "runtime-metal", feature = "__cbindgen_internal_objc")))]
#[cfg(any(
feature = "__cbindgen_internal",
all(
target_vendor = "apple",
feature = "runtime-metal",
feature = "__cbindgen_internal_objc"
)
))]
pub mod mtl;

View file

@ -1,13 +1,11 @@
use crate::ctypes::{
config_struct, libra_shader_preset_t, libra_viewport_t, libra_mtl_filter_chain_t, FromUninit,
config_struct, libra_mtl_filter_chain_t, libra_shader_preset_t, libra_viewport_t, FromUninit,
};
use crate::error::{assert_non_null, assert_some_ptr, LibrashaderError};
use crate::ffi::extern_fn;
use librashader::runtime::mtl::{
FilterChain, FilterChainOptions, FrameOptions,
};
use librashader::runtime::mtl::{FilterChain, FilterChainOptions, FrameOptions};
use std::ffi::c_char;
use std::ffi::CStr;
use std::ffi::{c_char};
use std::mem::MaybeUninit;
use std::ptr::NonNull;
use std::slice;
@ -29,7 +27,6 @@ pub type PMTLCommandBuffer = *const ProtocolObject<dyn MTLCommandBuffer>;
/// An alias to a `id<MTLTexture>` protocol object pointer.
pub type PMTLTexture = *const ProtocolObject<dyn MTLTexture>;
/// Options for each Metal shader frame.
#[repr(C)]
#[derive(Default, Debug, Clone)]

View file

@ -1,5 +1,5 @@
/// Fast optimized hash map type for small sets.
pub type FastHashMap<K, V> = halfbrown::SizedHashMap<K, V,
core::hash::BuildHasherDefault<rustc_hash::FxHasher>, 32>;
pub type FastHashMap<K, V> =
halfbrown::SizedHashMap<K, V, core::hash::BuildHasherDefault<rustc_hash::FxHasher>, 32>;
pub use halfbrown;
pub use halfbrown;

View file

@ -15,8 +15,8 @@ mod stage;
use crate::include::read_source;
pub use error::*;
use librashader_common::ImageFormat;
use librashader_common::map::FastHashMap;
use librashader_common::ImageFormat;
use std::path::Path;
/// The source file for a single shader pass.

View file

@ -4,13 +4,13 @@
//!
//! Implements wildcard replacement of shader paths specified in
//! [RetroArch#15023](https://github.com/libretro/RetroArch/pull/15023).
use librashader_common::map::FastHashMap;
use once_cell::sync::Lazy;
use regex::bytes::Regex;
use std::collections::VecDeque;
use std::fmt::{Debug, Display, Formatter};
use std::ops::Add;
use std::path::{Component, Path, PathBuf};
use librashader_common::map::FastHashMap;
/// Valid video driver or runtime. This list is non-exhaustive.
#[repr(u32)]

View file

@ -10,12 +10,12 @@ use nom::IResult;
use num_traits::cast::ToPrimitive;
use crate::parse::token::do_lex;
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use librashader_common::map::FastHashMap;
use crate::context::{apply_context, WildcardContext};
use crate::extract_if::MakeExtractIf;

View file

@ -5,9 +5,9 @@ use crate::front::{ShaderInputCompiler, ShaderReflectObject};
use crate::reflect::semantics::{
Semantic, ShaderSemantics, TextureSemantics, UniformSemantic, UniqueSemantics,
};
use librashader_common::map::FastHashMap;
use librashader_preprocess::{PreprocessError, ShaderSource};
use librashader_presets::{ShaderPassConfig, TextureConfig};
use librashader_common::map::FastHashMap;
/// Artifacts of a reflected and compiled shader pass.
///

View file

@ -1,14 +1,14 @@
use crate::texture::{D3D11InputView, InputTexture, LutTexture};
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_common::map::FastHashMap;
use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
use librashader_reflect::back::targets::HLSL;
use librashader_reflect::back::{CompileReflectShader, CompileShader};
use librashader_reflect::front::{SpirvCompilation};
use librashader_reflect::front::SpirvCompilation;
use librashader_reflect::reflect::semantics::ShaderSemantics;
use librashader_reflect::reflect::ReflectShader;
use librashader_runtime::image::{Image, ImageError, UVDirection};
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
use std::path::Path;

View file

@ -2,6 +2,7 @@ use crate::filter_chain::FilterCommon;
use crate::options::FrameOptionsD3D11;
use crate::texture::InputTexture;
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -9,7 +10,6 @@ use librashader_reflect::reflect::semantics::{
BindingStage, MemberOffset, TextureBinding, UniformBinding,
};
use librashader_reflect::reflect::ShaderReflection;
use librashader_common::map::FastHashMap;
use librashader_runtime::binding::{BindSemantics, TextureInput, UniformInputs};
use librashader_runtime::filter_pass::FilterPassMeta;

View file

@ -1,6 +1,6 @@
use crate::error::{assume_d3d11_init, Result};
use librashader_common::{FilterMode, WrapMode};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use windows::Win32::Graphics::Direct3D11::{
ID3D11Device, ID3D11SamplerState, D3D11_COMPARISON_NEVER, D3D11_FLOAT32_MAX,
D3D11_SAMPLER_DESC, D3D11_TEXTURE_ADDRESS_MODE,

View file

@ -14,11 +14,12 @@ use crate::options::{FilterChainOptionsD3D12, FrameOptionsD3D12};
use crate::samplers::SamplerSet;
use crate::texture::{D3D12InputImage, D3D12OutputView, InputTexture, OutputDescriptor};
use crate::{error, util};
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
use librashader_reflect::back::targets::{DXIL, HLSL};
use librashader_reflect::back::{CompileReflectShader, CompileShader};
use librashader_reflect::front::{SpirvCompilation};
use librashader_reflect::front::SpirvCompilation;
use librashader_reflect::reflect::presets::{CompilePresetTarget, ShaderPassArtifact};
use librashader_reflect::reflect::semantics::{ShaderSemantics, MAX_BINDINGS_COUNT};
use librashader_reflect::reflect::ReflectShader;
@ -26,7 +27,6 @@ use librashader_runtime::binding::{BindingUtil, TextureInput};
use librashader_runtime::image::{Image, ImageError, UVDirection};
use librashader_runtime::quad::QuadType;
use librashader_runtime::uniforms::UniformStorage;
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
use std::mem::ManuallyDrop;
use std::path::Path;

View file

@ -6,6 +6,7 @@ use crate::graphics_pipeline::D3D12GraphicsPipeline;
use crate::options::FrameOptionsD3D12;
use crate::samplers::SamplerSet;
use crate::texture::{D3D12OutputView, InputTexture};
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -16,7 +17,6 @@ use librashader_runtime::filter_pass::FilterPassMeta;
use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage};
use librashader_common::map::FastHashMap;
use std::ops::Deref;
use windows::core::ComInterface;
use windows::Win32::Foundation::RECT;

View file

@ -1,7 +1,7 @@
use crate::descriptor_heap::{D3D12DescriptorHeap, D3D12DescriptorHeapSlot, SamplerPaletteHeap};
use crate::error;
use librashader_common::{FilterMode, WrapMode};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use std::ops::Deref;
use windows::Win32::Graphics::Direct3D12::{
ID3D12Device, D3D12_COMPARISON_FUNC_NEVER, D3D12_FLOAT32_MAX, D3D12_SAMPLER_DESC,

View file

@ -16,10 +16,11 @@ use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
use librashader_reflect::back::glsl::GlslVersion;
use librashader_reflect::back::targets::GLSL;
use librashader_reflect::back::{CompileReflectShader, CompileShader};
use librashader_reflect::front::{SpirvCompilation};
use librashader_reflect::front::SpirvCompilation;
use librashader_reflect::reflect::semantics::{ShaderSemantics, UniformMeta};
use librashader_cache::CachedCompilation;
use librashader_common::map::FastHashMap;
use librashader_reflect::reflect::cross::SpirvCross;
use librashader_reflect::reflect::presets::{CompilePresetTarget, ShaderPassArtifact};
use librashader_reflect::reflect::ReflectShader;
@ -27,7 +28,6 @@ use librashader_runtime::binding::BindingUtil;
use librashader_runtime::framebuffer::FramebufferInit;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::scaling::ScaleFramebuffer;
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
#[rustfmt::skip]

View file

@ -1,6 +1,7 @@
use gl::types::{GLint, GLsizei, GLuint};
use librashader_reflect::reflect::ShaderReflection;
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -8,7 +9,6 @@ use librashader_reflect::reflect::semantics::{MemberOffset, TextureBinding, Unif
use librashader_runtime::binding::{BindSemantics, ContextOffset, TextureInput, UniformInputs};
use librashader_runtime::filter_pass::FilterPassMeta;
use librashader_runtime::render_target::RenderTarget;
use librashader_common::map::FastHashMap;
use crate::binding::{GlUniformBinder, GlUniformStorage, UniformLocation, VariableLocation};
use crate::filter_chain::FilterCommon;

View file

@ -1,7 +1,7 @@
use crate::gl::FINAL_VBO_DATA;
use crate::gl::{DrawQuad, OpenGLVertex};
use gl::types::{GLsizei, GLsizeiptr, GLuint};
use bytemuck::offset_of;
use gl::types::{GLsizei, GLsizeiptr, GLuint};
pub struct Gl3DrawQuad {
vbo: GLuint,

View file

@ -3,11 +3,11 @@ use crate::framebuffer::GLImage;
use crate::gl::LoadLut;
use crate::texture::InputTexture;
use gl::types::{GLsizei, GLuint};
use librashader_common::map::FastHashMap;
use librashader_presets::TextureConfig;
use librashader_runtime::image::{Image, ImageError, UVDirection};
use librashader_runtime::scaling::MipmapSize;
use rayon::prelude::*;
use librashader_common::map::FastHashMap;
pub struct Gl3LutLoad;
impl LoadLut for Gl3LutLoad {

View file

@ -1,7 +1,7 @@
use crate::gl::FINAL_VBO_DATA;
use crate::gl::{DrawQuad, OpenGLVertex};
use gl::types::{GLint, GLsizeiptr, GLuint};
use bytemuck::offset_of;
use gl::types::{GLint, GLsizeiptr, GLuint};
pub struct Gl46DrawQuad {
vbo: GLuint,

View file

@ -3,11 +3,11 @@ use crate::framebuffer::GLImage;
use crate::gl::LoadLut;
use crate::texture::InputTexture;
use gl::types::{GLsizei, GLuint};
use librashader_common::map::FastHashMap;
use librashader_presets::TextureConfig;
use librashader_runtime::image::{Image, ImageError, UVDirection};
use librashader_runtime::scaling::MipmapSize;
use rayon::prelude::*;
use librashader_common::map::FastHashMap;
pub struct Gl46LutLoad;
impl LoadLut for Gl46LutLoad {

View file

@ -10,13 +10,13 @@ use crate::texture::InputTexture;
use bytemuck::{Pod, Zeroable};
pub use framebuffer::GLFramebuffer;
use gl::types::{GLenum, GLuint};
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size};
use librashader_presets::{Scale2D, TextureConfig};
use librashader_reflect::back::glsl::CrossGlslContext;
use librashader_reflect::back::ShaderCompilerOutput;
use librashader_reflect::reflect::semantics::{BufferReflection, TextureBinding};
use librashader_runtime::uniforms::UniformStorageAccess;
use librashader_common::map::FastHashMap;
#[repr(C)]
#[derive(Debug, Copy, Clone, Default, Zeroable, Pod)]

View file

@ -1,6 +1,6 @@
use gl::types::{GLenum, GLint, GLuint};
use librashader_common::{FilterMode, WrapMode};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
pub struct SamplerSet {
// todo: may need to deal with differences in mip filter.

View file

@ -14,6 +14,7 @@ use icrate::Metal::{
MTLPixelFormat, MTLPixelFormatRGBA8Unorm, MTLRenderPassDescriptor, MTLResource,
MTLStoreActionDontCare, MTLStoreActionStore, MTLTexture,
};
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_presets::context::VideoDriver;
use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
@ -35,7 +36,6 @@ use librashader_runtime::uniforms::UniformStorage;
use objc2::rc::Id;
use objc2::runtime::ProtocolObject;
use rayon::prelude::*;
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
use std::fmt::{Debug, Formatter};
use std::path::Path;

View file

@ -6,6 +6,7 @@ use crate::options::FrameOptionsMetal;
use crate::samplers::SamplerSet;
use crate::texture::{get_texture_size, InputTexture};
use icrate::Metal::{MTLCommandBuffer, MTLCommandEncoder, MTLRenderCommandEncoder, MTLTexture};
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -17,7 +18,6 @@ use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage};
use objc2::runtime::ProtocolObject;
use librashader_common::map::FastHashMap;
impl TextureInput for InputTexture {
fn size(&self) -> Size<u32> {

View file

@ -1,6 +1,7 @@
use crate::draw_quad::MetalVertex;
use crate::error::{FilterChainError, Result};
use crate::select_optimal_pixel_format;
use bytemuck::offset_of;
use icrate::Foundation::NSString;
use icrate::Metal::{
MTLBlendFactorOneMinusSourceAlpha, MTLBlendFactorSourceAlpha, MTLCommandBuffer,
@ -16,7 +17,6 @@ use librashader_reflect::back::ShaderCompilerOutput;
use librashader_runtime::render_target::RenderTarget;
use objc2::rc::Id;
use objc2::runtime::ProtocolObject;
use bytemuck::offset_of;
/// This is only really plausible for SPIRV-Cross, for Naga we need to supply the next plausible binding.
pub const VERTEX_BUFFER_INDEX: usize = 4;

View file

@ -3,10 +3,10 @@ use icrate::Metal::{
MTLSamplerBorderColorTransparentBlack, MTLSamplerDescriptor, MTLSamplerMinMagFilter,
MTLSamplerState,
};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use objc2::rc::Id;
use objc2::runtime::ProtocolObject;
use librashader_common::map::FastHashMap;
use crate::error::{FilterChainError, Result};

View file

@ -14,10 +14,11 @@ use ash::vk;
use librashader_common::{ImageFormat, Size, Viewport};
use gpu_allocator::vulkan::Allocator;
use librashader_common::map::FastHashMap;
use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
use librashader_reflect::back::targets::SPIRV;
use librashader_reflect::back::{CompileReflectShader, CompileShader};
use librashader_reflect::front::{SpirvCompilation};
use librashader_reflect::front::SpirvCompilation;
use librashader_reflect::reflect::presets::{CompilePresetTarget, ShaderPassArtifact};
use librashader_reflect::reflect::semantics::ShaderSemantics;
use librashader_reflect::reflect::ReflectShader;
@ -26,7 +27,6 @@ use librashader_runtime::image::{Image, ImageError, UVDirection, BGRA8};
use librashader_runtime::quad::QuadType;
use librashader_runtime::uniforms::UniformStorage;
use parking_lot::RwLock;
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
use std::convert::Infallible;
use std::path::Path;

View file

@ -7,6 +7,7 @@ use crate::samplers::SamplerSet;
use crate::texture::InputImage;
use crate::{error, VulkanImage};
use ash::vk;
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -19,7 +20,6 @@ use librashader_runtime::filter_pass::FilterPassMeta;
use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage, UniformStorageAccess};
use librashader_common::map::FastHashMap;
use std::sync::Arc;
pub struct FilterPass {

View file

@ -1,7 +1,7 @@
use crate::error;
use ash::vk;
use librashader_common::{FilterMode, WrapMode};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use std::sync::Arc;
pub struct VulkanSampler {

View file

@ -1,7 +1,8 @@
use librashader_common::map::FastHashMap;
use librashader_presets::{ShaderPassConfig, ShaderPreset, TextureConfig};
use librashader_reflect::back::targets::WGSL;
use librashader_reflect::back::{CompileReflectShader, CompileShader};
use librashader_reflect::front::{SpirvCompilation};
use librashader_reflect::front::SpirvCompilation;
use librashader_reflect::reflect::presets::{CompilePresetTarget, ShaderPassArtifact};
use librashader_reflect::reflect::semantics::ShaderSemantics;
use librashader_reflect::reflect::ReflectShader;
@ -11,7 +12,6 @@ use librashader_runtime::quad::QuadType;
use librashader_runtime::uniforms::UniformStorage;
#[cfg(not(target_arch = "wasm32"))]
use rayon::prelude::*;
use librashader_common::map::FastHashMap;
use std::collections::VecDeque;
use std::path::Path;

View file

@ -6,6 +6,7 @@ use crate::graphics_pipeline::WgpuGraphicsPipeline;
use crate::options::FrameOptionsWgpu;
use crate::samplers::SamplerSet;
use crate::texture::InputImage;
use librashader_common::map::FastHashMap;
use librashader_common::{ImageFormat, Size, Viewport};
use librashader_preprocess::ShaderSource;
use librashader_presets::ShaderPassConfig;
@ -18,7 +19,6 @@ use librashader_runtime::filter_pass::FilterPassMeta;
use librashader_runtime::quad::QuadType;
use librashader_runtime::render_target::RenderTarget;
use librashader_runtime::uniforms::{NoUniformBinder, UniformStorage, UniformStorageAccess};
use librashader_common::map::FastHashMap;
use std::sync::Arc;
use wgpu::{BindGroupDescriptor, BindGroupEntry, BindingResource, BufferBinding, ShaderStages};

View file

@ -1,5 +1,5 @@
use librashader_common::{FilterMode, WrapMode};
use librashader_common::map::FastHashMap;
use librashader_common::{FilterMode, WrapMode};
use std::sync::Arc;
use wgpu::{Sampler, SamplerBorderColor, SamplerDescriptor};

View file

@ -1,4 +1,5 @@
use crate::uniforms::{BindUniform, NoUniformBinder, UniformStorage};
use librashader_common::map::FastHashMap;
use librashader_common::Size;
use librashader_preprocess::ShaderParameter;
use librashader_reflect::reflect::semantics::{
@ -6,7 +7,6 @@ use librashader_reflect::reflect::semantics::{
UniformMeta, UniqueSemantics,
};
use std::ops::{Deref, DerefMut};
use librashader_common::map::FastHashMap;
/// Trait for input textures used during uniform binding,
pub trait TextureInput {

View file

@ -7,7 +7,9 @@ pub trait FilterChainParameters {
fn set_enabled_pass_count(&mut self, count: usize);
/// Enumerates the active parameters as well as their values in the current filter chain.
fn enumerate_parameters<'a>(&'a self) -> ::librashader_common::map::halfbrown::Iter<String, f32>;
fn enumerate_parameters<'a>(
&'a self,
) -> ::librashader_common::map::halfbrown::Iter<String, f32>;
/// Get the value of the given parameter if present.
fn get_parameter(&self, parameter: &str) -> Option<f32>;
@ -30,7 +32,9 @@ macro_rules! impl_filter_chain_parameters {
self.common.config.passes_enabled = count
}
fn enumerate_parameters<'a>(&'a self) -> ::librashader_common::map::halfbrown::Iter<String, f32> {
fn enumerate_parameters<'a>(
&'a self,
) -> ::librashader_common::map::halfbrown::Iter<String, f32> {
self.common.config.parameters.iter()
}

View file

@ -64,9 +64,10 @@ pub mod presets {
let iters: Result<Vec<Vec<ShaderParameter>>, PreprocessError> = preset
.shaders
.iter()
.map(|s| ShaderSource::load(&s.name).map(|s|
s.parameters.into_iter()
.map(|(_,v)| v).collect()))
.map(|s| {
ShaderSource::load(&s.name)
.map(|s| s.parameters.into_iter().map(|(_, v)| v).collect())
})
.collect();
let iters = iters?;
Ok(iters.into_iter().flatten())
@ -297,11 +298,16 @@ pub mod runtime {
#[cfg(feature = "runtime-wgpu")]
#[doc(cfg(feature = "runtime-wgpu"))]
/// Shader runtime for wgpu.
#[cfg_attr(all(feature = "runtime-wgpu", all(target_vendor = "apple", feature = "docsrs")),
#[cfg_attr(
all(
feature = "runtime-wgpu",
all(target_vendor = "apple", feature = "docsrs")
),
doc = "\n\nThe wgpu runtime is available on macOS and iOS, but technical reasons prevent them from rendering on docs.rs.
\n\n This is because wgpu on macOS and iOS link to [metal-rs](https://github.com/gfx-rs/metal-rs), which can not build on docs.rs.
See [SSheldon/rustc-objc-exception#13](https://github.com/SSheldon/rust-objc-exception/issues/13) for more details.
\n\n The wgpu runtime is identical for all supported operating systems, so please refer to documentation from another operating system.")]
\n\n The wgpu runtime is identical for all supported operating systems, so please refer to documentation from another operating system."
)]
pub mod wgpu {
#[cfg(not(all(target_vendor = "apple", feature = "docsrs")))]
pub use librashader_runtime_wgpu::{