From 4837b3c7d71e530b232ba96ae17c762a855e9af0 Mon Sep 17 00:00:00 2001 From: chyyran Date: Sat, 4 Feb 2023 19:27:41 -0500 Subject: [PATCH] rs: mark enums as copy/clone/debug --- Cargo.lock | 2 +- spirv-to-dxil/Cargo.toml | 2 +- spirv-to-dxil/src/enums.rs | 3 +++ spirv-to-dxil/src/lib.rs | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2c14ccc..9f12ccb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -207,7 +207,7 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "spirv-to-dxil" -version = "0.2.1" +version = "0.2.2" dependencies = [ "bitflags", "bytemuck", diff --git a/spirv-to-dxil/Cargo.toml b/spirv-to-dxil/Cargo.toml index d2c452b..0c864ec 100644 --- a/spirv-to-dxil/Cargo.toml +++ b/spirv-to-dxil/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spirv-to-dxil" -version = "0.2.2" +version = "0.2.3" edition = "2021" description = "Rust bindings to spirv-to-dxil" license = "MIT" diff --git a/spirv-to-dxil/src/enums.rs b/spirv-to-dxil/src/enums.rs index 1a6df0d..483ea1d 100644 --- a/spirv-to-dxil/src/enums.rs +++ b/spirv-to-dxil/src/enums.rs @@ -1,5 +1,6 @@ use bitflags::bitflags; +#[derive(Copy, Clone, Debug)] pub enum ShaderStage { None, Vertex, @@ -40,6 +41,7 @@ impl From for spirv_to_dxil_sys::dxil_spirv_shader_stage { } } +#[derive(Copy, Clone, Debug)] #[non_exhaustive] pub enum ShaderModel { ShaderModel6_0, @@ -67,6 +69,7 @@ impl From for spirv_to_dxil_sys::dxil_shader_model { } } +#[derive(Copy, Clone, Debug)] #[non_exhaustive] pub enum ValidatorVersion { None, diff --git a/spirv-to-dxil/src/lib.rs b/spirv-to-dxil/src/lib.rs index 5b4a511..d1c7af4 100644 --- a/spirv-to-dxil/src/lib.rs +++ b/spirv-to-dxil/src/lib.rs @@ -161,4 +161,18 @@ mod tests { RuntimeConfig::default()) .expect("failed to compile"); } + + #[test] + fn test_validate() { + let fragment: &[u8] = include_bytes!("../test/vertex.spv"); + let fragment = Vec::from(fragment); + let fragment = bytemuck::cast_slice(&fragment); + + super::spirv_to_dxil(&fragment, + None, "main", + ShaderStage::Vertex, + ShaderModel::ShaderModel6_0, ValidatorVersion::None, + RuntimeConfig::default()) + .expect("failed to compile"); + } }