generator: pSampleMask setter should write NULL if slice is empty (#432)
As per [1] no explicit length field is available for `pSampleMask`, this is based on `ceil(rasterizationSamples/32)` instead. It is valid to not set an array for `pSampleMask` (under normal circumestances this is signaled by setting the length to zero, and the array pointer is ignored) but this has to happen by setting the pointer to `NULL`. [1]: https://github.com/MaikKlein/ash/issues/256
This commit is contained in:
parent
95f748fc3d
commit
4ba8637d01
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue