Browse Source

Vk: wait, why the whole LayerProperties are not const?

pull/494/head
Vladimír Vondruš 5 years ago
parent
commit
156e7b64bf
  1. 14
      src/Magnum/Vk/LayerProperties.cpp
  2. 14
      src/Magnum/Vk/LayerProperties.h

14
src/Magnum/Vk/LayerProperties.cpp

@ -42,19 +42,19 @@ LayerProperties::~LayerProperties() = default;
LayerProperties& LayerProperties::operator=(LayerProperties&&) noexcept = default;
Containers::ArrayView<const Containers::StringView> LayerProperties::names() {
Containers::ArrayView<const Containers::StringView> LayerProperties::names() const {
return _names;
}
bool LayerProperties::isSupported(const Containers::StringView layer) {
bool LayerProperties::isSupported(const Containers::StringView layer) const {
return std::binary_search(_names.begin(), _names.end(), layer);
}
UnsignedInt LayerProperties::count() {
UnsignedInt LayerProperties::count() const {
return UnsignedInt(_layers.size());
}
Containers::StringView LayerProperties::name(const UnsignedInt id) {
Containers::StringView LayerProperties::name(const UnsignedInt id) const {
CORRADE_ASSERT(id < _layers.size(),
"Vk::LayerProperties::name(): index" << id << "out of range for" << _layers.size() << "entries", {});
/* Not returning the string views at the end because those are in a
@ -62,19 +62,19 @@ Containers::StringView LayerProperties::name(const UnsignedInt id) {
return _layers[id].layerName;
}
UnsignedInt LayerProperties::revision(const UnsignedInt id) {
UnsignedInt LayerProperties::revision(const UnsignedInt id) const {
CORRADE_ASSERT(id < _layers.size(),
"Vk::LayerProperties::revision(): index" << id << "out of range for" << _layers.size() << "entries", {});
return _layers[id].implementationVersion;
}
Version LayerProperties::version(const UnsignedInt id) {
Version LayerProperties::version(const UnsignedInt id) const {
CORRADE_ASSERT(id < _layers.size(),
"Vk::LayerProperties::version(): index" << id << "out of range for" << _layers.size() << "entries", {});
return Version(_layers[id].specVersion);
}
Containers::StringView LayerProperties::description(const UnsignedInt id) {
Containers::StringView LayerProperties::description(const UnsignedInt id) const {
CORRADE_ASSERT(id < _layers.size(),
"Vk::LayerProperties::description(): index" << id << "out of range for" << _layers.size() << "entries", {});
return _layers[id].description;

14
src/Magnum/Vk/LayerProperties.h

@ -95,7 +95,7 @@ class MAGNUM_VK_EXPORT LayerProperties {
* The returned views are owned by the @ref LayerProperties instance
* (i.e., *not* a global memory).
*/
Containers::ArrayView<const Containers::StringView> names();
Containers::ArrayView<const Containers::StringView> names() const;
/**
* @brief Whether given layer is supported
@ -103,10 +103,10 @@ class MAGNUM_VK_EXPORT LayerProperties {
* Search complexity is @f$ \mathcal{O}(\log n) @f$ in the total layer
* count.
*/
bool isSupported(Containers::StringView layer);
bool isSupported(Containers::StringView layer) const;
/** @brief Count of layers reported by the driver */
UnsignedInt count();
UnsignedInt count() const;
/**
* @brief Layer name
@ -115,19 +115,19 @@ class MAGNUM_VK_EXPORT LayerProperties {
* The returned view is owned by the @ref LayerProperties instance
* (i.e., *not* a global memory).
*/
Containers::StringView name(UnsignedInt id);
Containers::StringView name(UnsignedInt id) const;
/**
* @brief Layer revision
* @param id Layer index, expected to be smaller than @ref count()
*/
UnsignedInt revision(UnsignedInt id);
UnsignedInt revision(UnsignedInt id) const;
/**
* @brief Vulkan version the layer is implemented against
* @param id Layer index, expected to be smaller than @ref count()
*/
Version version(UnsignedInt id);
Version version(UnsignedInt id) const;
/**
* @brief Layer description
@ -136,7 +136,7 @@ class MAGNUM_VK_EXPORT LayerProperties {
* The returned view is owned by the @ref LayerProperties instance
* (i.e., *not* a global memory).
*/
Containers::StringView description(UnsignedInt id);
Containers::StringView description(UnsignedInt id) const;
private:
#ifndef DOXYGEN_GENERATING_OUTPUT

Loading…
Cancel
Save