mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
rusticl/mesa: catch invalid use of resource_assign_vma in debug builds
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35174>
This commit is contained in:
parent
a482ec7f05
commit
006eca8b3c
1 changed files with 8 additions and 0 deletions
|
|
@ -107,6 +107,14 @@ impl PipeScreen {
|
||||||
|
|
||||||
pub fn resource_assign_vma(&self, res: &PipeResource, address: u64) -> bool {
|
pub fn resource_assign_vma(&self, res: &PipeResource, address: u64) -> bool {
|
||||||
if let Some(resource_assign_vma) = self.screen().resource_assign_vma {
|
if let Some(resource_assign_vma) = self.screen().resource_assign_vma {
|
||||||
|
// Validate that we already acquired the vm range
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
|
if let Some(address) = NonZeroU64::new(address) {
|
||||||
|
debug_assert!(self
|
||||||
|
.alloc_vm(address, NonZeroU64::new(1).unwrap())
|
||||||
|
.is_none());
|
||||||
|
}
|
||||||
|
}
|
||||||
unsafe { resource_assign_vma(self.screen.as_ptr(), res.pipe(), address) }
|
unsafe { resource_assign_vma(self.screen.as_ptr(), res.pipe(), address) }
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue