summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-03-28 08:04:29 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-03-28 08:09:02 +0100
commitb6c9fba81c0b8e96e59e1c954677dfd3b349fcca (patch)
tree77f670c5304d07ef9aaaa8e24009709af8743996 /src/video_core
parentrenderer_vulkan/wrapper: Add owning handles (diff)
downloadyuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar.gz
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar.bz2
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar.lz
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar.xz
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.tar.zst
yuzu-b6c9fba81c0b8e96e59e1c954677dfd3b349fcca.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/renderer_vulkan/wrapper.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/wrapper.h b/src/video_core/renderer_vulkan/wrapper.h
index 14dd792ed..686c2b9a1 100644
--- a/src/video_core/renderer_vulkan/wrapper.h
+++ b/src/video_core/renderer_vulkan/wrapper.h
@@ -28,6 +28,16 @@ namespace Vulkan::vk {
template <typename T>
class Span {
public:
+ using value_type = T;
+ using size_type = u32;
+ using difference_type = std::ptrdiff_t;
+ using reference = const T&;
+ using const_reference = const T&;
+ using pointer = const T*;
+ using const_pointer = const T*;
+ using iterator = const T*;
+ using const_iterator = const T*;
+
/// Construct an empty span.
constexpr Span() noexcept = default;
@@ -50,6 +60,7 @@ public:
}
/// Returns the number of elements in the span.
+ /// @note Returns a 32 bits integer because most Vulkan functions expect this type.
constexpr u32 size() const noexcept {
return static_cast<u32>(num);
}
@@ -75,6 +86,16 @@ public:
return ptr + num;
}
+ /// Returns an iterator to the beginning of the span.
+ constexpr const T* cbegin() const noexcept {
+ return ptr;
+ }
+
+ /// Returns an iterator to the end of the span.
+ constexpr const T* cend() const noexcept {
+ return ptr + num;
+ }
+
private:
const T* ptr = nullptr;
std::size_t num = 0;
@@ -325,7 +346,7 @@ public:
/// Returns the address of the held object.
/// Intended for Vulkan structures that expect a pointer to an array.
const Type* address() const noexcept {
- return &handle;
+ return std::addressof(handle);
}
/// Returns the held Vulkan handle.
@@ -334,7 +355,7 @@ public:
}
/// Returns true when there's a held object.
- operator bool() const noexcept {
+ explicit operator bool() const noexcept {
return handle != nullptr;
}
@@ -396,7 +417,7 @@ public:
/// Returns the address of the held object.
/// Intended for Vulkan structures that expect a pointer to an array.
const Type* address() const noexcept {
- return &handle;
+ return std::addressof(handle);
}
/// Returns the held Vulkan handle.