Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generator: pSampleMask setter should write NULL if slice is empty #432

Merged
merged 1 commit into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ash/src/vk/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5672,8 +5672,17 @@ impl<'a> PipelineMultisampleStateCreateInfoBuilder<'a> {
self.inner.min_sample_shading = min_sample_shading;
self
}
#[doc = r" Sets `p_sample_mask` to `null` if the slice is empty. The mask will"]
#[doc = r" be treated as if it has all bits set to `1`."]
#[doc = r""]
#[doc = r" See <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPipelineMultisampleStateCreateInfo.html#_description>"]
#[doc = r" for more details."]
pub fn sample_mask(mut self, sample_mask: &'a [SampleMask]) -> Self {
self.inner.p_sample_mask = sample_mask.as_ptr() as *const SampleMask;
self.inner.p_sample_mask = if sample_mask.is_empty() {
std::ptr::null()
} else {
sample_mask.as_ptr() as *const SampleMask
};
self
}
pub fn alpha_to_coverage_enable(mut self, alpha_to_coverage_enable: bool) -> Self {
Expand Down
11 changes: 10 additions & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1788,8 +1788,17 @@ pub fn derive_setters(

if name == "pSampleMask" {
return Some(quote!{
/// Sets `p_sample_mask` to `null` if the slice is empty. The mask will
/// be treated as if it has all bits set to `1`.
///
/// See <https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPipelineMultisampleStateCreateInfo.html#_description>
/// for more details.
pub fn sample_mask(mut self, sample_mask: &'a [SampleMask]) -> Self {
self.inner.p_sample_mask = sample_mask.as_ptr() as *const SampleMask;
self.inner.p_sample_mask = if sample_mask.is_empty() {
std::ptr::null()
} else {
sample_mask.as_ptr() as *const SampleMask
};
self
}
});
Expand Down