Commit 7f81331
authored
Remove explicit checks against kp::Memory::type() (#455)
* algorithm: check DescriptorType when creating pool
The function that was prevously used, `mem->type()`, is not explicitly
the same as the descriptor type, so using `mem->getDescriptorType()` is
more accurate.
It also makes it easier to create new image-like subclasses of
`kp::Memory` because as long as they specify the correct descriptor
type, the correct pools will be created.
Signed-off-by: Anders Hellerup Madsen <anders@hellerup-madsen.dk>
* Algorithm: check type before casting
The if statement used to assume that if `mem->type() ==
memory::Type::eImage` then it was safe to assume that the memory object
is an instance of `kp::Image`. However, any subclass of `kp::Memory`
could implement the virtual `type()` method to return
`memory::Type::eImage`, so this is an invalid assumption.
This commit fixes the issue by only casting if the memory object
actually is an instance of `kp::Memory`
Signed-off-by: Anders Hellerup Madsen <anders@hellerup-madsen.dk>
---------
Signed-off-by: Anders Hellerup Madsen <anders@hellerup-madsen.dk>1 parent 6e5380d commit 7f81331
2 files changed
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
0 commit comments