Skip to content

Commit

Permalink
Correct struct by-ref passing for the change_* methods. Bumped to v0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gwihlidal committed Nov 21, 2018
1 parent c79def0 commit 10bd18b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
14 changes: 9 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spirv-reflect"
version = "0.1.5"
version = "0.1.6"
authors = ["Graham Wihlidal <[email protected]>"]
description = "Reflection API in rust for SPIR-V shader byte code, intended for Vulkan applications."
homepage = "https://github.com/gwihlidal/spirv-reflect-rs"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
48 changes: 24 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,31 @@ impl ShaderModule {
}
}

pub fn enumerate_entry_points(&self) -> Result<Vec<types::ReflectEntryPoint>, &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<types::ReflectEntryPoint> = 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<u32>,
) -> Result<(), &str> {
Expand All @@ -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 {
Expand Down Expand Up @@ -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<Vec<types::ReflectEntryPoint>, &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<types::ReflectEntryPoint> = 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 {
Expand Down

0 comments on commit 10bd18b

Please sign in to comment.