From 9cad2b9128b15079e22b4124cb0d103c653ec718 Mon Sep 17 00:00:00 2001 From: chyyran Date: Sun, 27 Nov 2022 23:37:45 -0500 Subject: [PATCH] reflect: make reflect errors non-exhaustive --- README.md | 1 + librashader-reflect/src/error.rs | 2 ++ librashader-runtime-gl/src/binding.rs | 10 +--------- librashader/src/lib.rs | 4 +++- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7373c30..f4b8bba 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Please report an issue if you run into a shader that works in RetroArch, but not * Sampler objects are used rather than `glTexParameter`. * Sampler inputs and outputs are not renamed. This is useful for debugging shaders in RenderDoc. * UBO and Push Constant Buffer sizes are padded to 16-byte boundaries. + * * Direct3D 11 * The staging buffer is not kept around when loading static textures (LUTs). * HDR10 support is not part of the shader runtime and is not supported. diff --git a/librashader-reflect/src/error.rs b/librashader-reflect/src/error.rs index 117abc4..6253329 100644 --- a/librashader-reflect/src/error.rs +++ b/librashader-reflect/src/error.rs @@ -1,6 +1,7 @@ use crate::reflect::semantics::MemberOffset; use thiserror::Error; +#[non_exhaustive] #[derive(Error, Debug)] pub enum ShaderCompileError { #[cfg(feature = "unstable-rust-pipeline")] @@ -32,6 +33,7 @@ pub enum SemanticsErrorKind { InvalidTypeForSemantic(String), } +#[non_exhaustive] #[derive(Error, Debug)] pub enum ShaderReflectError { #[cfg(feature = "unstable-rust-pipeline")] diff --git a/librashader-runtime-gl/src/binding.rs b/librashader-runtime-gl/src/binding.rs index fb88910..eb08aa4 100644 --- a/librashader-runtime-gl/src/binding.rs +++ b/librashader-runtime-gl/src/binding.rs @@ -1,5 +1,5 @@ use gl::types::GLint; -use librashader_reflect::reflect::semantics::{BindingStage, MemberOffset}; +use librashader_reflect::reflect::semantics::BindingStage; #[derive(Debug)] pub enum VariableLocation { @@ -22,14 +22,6 @@ pub struct UniformLocation { } impl UniformLocation { - // pub fn is_fragment_valid(&self) -> bool { - // self.fragment >= 0 - // } - // - // pub fn is_vertex_valid(&self) -> bool { - // self.vertex >= 0 - // } - pub fn is_valid(&self, stage: BindingStage) -> bool { let mut validity = false; if stage.contains(BindingStage::FRAGMENT) { diff --git a/librashader/src/lib.rs b/librashader/src/lib.rs index 72a8b77..74a6665 100644 --- a/librashader/src/lib.rs +++ b/librashader/src/lib.rs @@ -1,4 +1,6 @@ - +//! Re-exports for usage of librashader in consuming libraries. +//! +//! Runtime implementations should depend directly on constituent crates. pub mod presets { pub use librashader_presets::*; }