diff --git a/CHANGES.md b/CHANGES.md index 09a645f..d297e06 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,25 +1,29 @@ # Changes +## 0.1.6 (2018-11-21) + +Correct struct by-ref passing for the change_* methods. + ## 0.1.5 (2018-11-21) -* Added PartialEq to all types +* Added PartialEq to all types. ## 0.1.4 (2018-11-21) -* Fixed some name mangling issues on Windows when bindings are generated on macOS +* Fixed some name mangling issues on Windows when bindings are generated on macOS. ## 0.1.3 (2018-11-21) -* Improved bindgen tooling, and also the generated bindings.rs file +* Improved bindgen tooling, and also the generated bindings.rs file. ## 0.1.2 (2018-11-20) -* Added `load_u8_data` and `load_u32_data` helpers to `ShaderModule` for convenience +* Added `load_u8_data` and `load_u32_data` helpers to `ShaderModule` for convenience. ## 0.1.1 (2018-11-20) * Log all reflection data as human-readable text. -* Cleaned up some code in the demo example. +* Cleaned up some code in the demo example. ## 0.1.0 (2018-11-20) diff --git a/Cargo.toml b/Cargo.toml index 981e87d..f9de18f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "spirv-reflect" -version = "0.1.5" +version = "0.1.6" authors = ["Graham Wihlidal "] description = "Reflection API in rust for SPIR-V shader byte code, intended for Vulkan applications." homepage = "https://github.com/gwihlidal/spirv-reflect-rs" diff --git a/README.md b/README.md index 054f791..1093fdd 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -spirv-reflect = "0.1.5" +spirv-reflect = "0.1.6" ``` and add this to your crate root: diff --git a/src/lib.rs b/src/lib.rs index 243bd78..300373b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -441,9 +441,31 @@ impl ShaderModule { } } + pub fn enumerate_entry_points(&self) -> Result, &str> { + if let Some(ref module) = self.module { + let ffi_entry_points = unsafe { + std::slice::from_raw_parts(module.entry_points, module.entry_point_count as usize) + }; + let entry_points: Vec = ffi_entry_points + .iter() + .map(|&entry_point| convert::ffi_to_entry_point(&entry_point)) + .collect(); + Ok(entry_points) + } else { + Ok(Vec::new()) + } + } + + pub fn get_entry_point_name(&self) -> String { + match self.module { + Some(module) => ffi_to_string(module.entry_point_name), + None => String::new(), + } + } + pub fn change_descriptor_binding_numbers( &mut self, - binding: types::descriptor::ReflectDescriptorBinding, + binding: &types::descriptor::ReflectDescriptorBinding, new_binding: u32, new_set: Option, ) -> Result<(), &str> { @@ -469,7 +491,7 @@ impl ShaderModule { pub fn change_descriptor_set_number( &mut self, - set: types::descriptor::ReflectDescriptorSet, + set: &types::descriptor::ReflectDescriptorSet, new_set: u32, ) -> Result<(), &str> { match self.module { @@ -535,28 +557,6 @@ impl ShaderModule { None => Ok(()), } } - - pub fn get_entry_point_name(&self) -> String { - match self.module { - Some(module) => ffi_to_string(module.entry_point_name), - None => String::new(), - } - } - - pub fn enumerate_entry_points(&self) -> Result, &str> { - if let Some(ref module) = self.module { - let ffi_entry_points = unsafe { - std::slice::from_raw_parts(module.entry_points, module.entry_point_count as usize) - }; - let entry_points: Vec = ffi_entry_points - .iter() - .map(|&entry_point| convert::ffi_to_entry_point(&entry_point)) - .collect(); - Ok(entry_points) - } else { - Ok(Vec::new()) - } - } } impl Drop for ShaderModule {