[+] AuMemoryView.ToReadView

This commit is contained in:
Reece Wilson 2024-10-23 13:23:00 +01:00
parent 49c6a25af8
commit a105bdeb31
2 changed files with 10 additions and 1 deletions

View File

@ -100,6 +100,7 @@ private:
template <typename T>
AuMemoryView(T *start, AuUInt length, const AuMemoryViewControlBlock &copyBlock);
friend struct AuMemoryView<false>;
public:
AuMemoryView &operator =(AuMemoryView &&view);
@ -178,6 +179,8 @@ public:
bool HasControlBlock() const;
AuMemoryView<true> ToReadView() const;
/// Creates (alloc) a shader pointer of the view with an optional parent to capture.
/// If the lifetime of the span cannot be extended beyond the *this container, we fail (return default/nullptr).
/// If we cannot allocate the shared pointer, we fail (return default/nullptr).

View File

@ -580,7 +580,7 @@ bool AuMemoryView<Readonly_b>::MemoryIsSupersetOf(const AuMemoryView<true> &in)
template <bool Readonly_b>
bool AuMemoryView<Readonly_b>::MemoryIsSubsetOf(const AuMemoryView<true> &in) const
{
return in.MemoryIsSupersetOf(*this);
return in.MemoryIsSupersetOf(AuMemoryView<true> { this->pBase, this->uLength });
}
template <bool Readonly_b>
@ -881,6 +881,12 @@ constexpr bool AuMemoryView<Readonly_b>::operator!=(const AuMemoryView &view) co
this->uLength != view.uLength;
}
template <bool Readonly_b>
AuMemoryView<true> AuMemoryView<Readonly_b>::ToReadView() const
{
return AuMemoryView<true> { this->pBase, this->uLength, this->controlBlock };
}
template <bool Readonly_b>
constexpr bool AuMemoryViewStream<Readonly_b>::HasMemory() const
{