rs: mark enums as copy/clone/debug

This commit is contained in:
chyyran 2023-02-04 19:27:41 -05:00
parent 1a5625d57a
commit 4837b3c7d7
4 changed files with 19 additions and 2 deletions

2
Cargo.lock generated
View file

@ -207,7 +207,7 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
[[package]]
name = "spirv-to-dxil"
version = "0.2.1"
version = "0.2.2"
dependencies = [
"bitflags",
"bytemuck",

View file

@ -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"

View file

@ -1,5 +1,6 @@
use bitflags::bitflags;
#[derive(Copy, Clone, Debug)]
pub enum ShaderStage {
None,
Vertex,
@ -40,6 +41,7 @@ impl From<ShaderStage> 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<ShaderModel> for spirv_to_dxil_sys::dxil_shader_model {
}
}
#[derive(Copy, Clone, Debug)]
#[non_exhaustive]
pub enum ValidatorVersion {
None,

View file

@ -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");
}
}