Browse Source

Vk: recognize SamplerWrapping::MirrorClampToEdge.

It's a new extension in Vulkan 1.2.
pull/234/head
Vladimír Vondruš 6 years ago
parent
commit
144b6229b2
  1. 5
      doc/changelog.dox
  2. 4
      src/Magnum/Sampler.h
  3. 2
      src/Magnum/Vk/Enums.cpp
  4. 6
      src/Magnum/Vk/Enums.h
  5. 10
      src/Magnum/Vk/Test/EnumsTest.cpp

5
doc/changelog.dox

@ -193,6 +193,11 @@ See also:
- @ref magnum-imageconverter "magnum-imageconverter" has a new `--in-place`
option for converting images in-place
@subsubsection changelog-latest-changes-vk Vk library
- @ref Vk::hasVkSamplerAddressMode() and @ref Vk::vkSamplerAddressMode() now
recognizes @ref SamplerWrapping::MirrorClampToEdge
@subsection changelog-latest-buildsystem Build system
- Fixed compilation of the @ref GL library on macOS with ANGLE --- new code

4
src/Magnum/Sampler.h

@ -169,8 +169,8 @@ enum class SamplerWrapping: UnsignedInt {
* Mirror the texture once in negative coordinates and clamp to
* edge after that.
*
* Corresponds to @ref GL::SamplerWrapping::MirrorClampToEdge. Not
* available on Vulkan.
* Corresponds to @ref GL::SamplerWrapping::MirrorClampToEdge. /
* @val_vk_keyword{SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,SamplerAddressMode}.
*/
MirrorClampToEdge
};

2
src/Magnum/Vk/Enums.cpp

@ -102,7 +102,7 @@ constexpr VkSamplerAddressMode SamplerAddressModeMapping[]{
VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE,
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
VkSamplerAddressMode(~UnsignedInt{}),
VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
};
}

6
src/Magnum/Vk/Enums.h

@ -209,10 +209,8 @@ MAGNUM_VK_EXPORT VkSamplerMipmapMode vkSamplerMipmapMode(Magnum::SamplerMipmap m
/**
@brief Check availability of a generic sampler wrapping mode
Some Vulkan targets don't support all generic sampler wrapping modes (for
example the @ref SamplerWrapping::MirrorClampToEdge). Returns @cpp false @ce if
current target can't support such format, @cpp true @ce otherwise. The
@p wrapping value is expected to be valid.
Returns @cpp false @ce if Vulkan doesn't support such wrapping, @cpp true @ce
otherwise. The @p wrapping value is expected to be valid.
@note Support of some formats depends on presence of a particular Vulkan
extension. Such check is outside of the scope of this function and you are

10
src/Magnum/Vk/Test/EnumsTest.cpp

@ -624,14 +624,16 @@ void EnumsTest::mapVkSamplerAddressModeUnsupported() {
CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions");
#endif
#if 1
CORRADE_SKIP("All sampler address modes are supported.");
#else
CORRADE_VERIFY(!hasVkSamplerAddressMode(Magnum::SamplerWrapping::MirrorClampToEdge));
std::ostringstream out;
{
Error redirectError{&out};
vkSamplerAddressMode(Magnum::SamplerWrapping::MirrorClampToEdge);
}
Error redirectError{&out};
vkSamplerAddressMode(Magnum::SamplerWrapping::MirrorClampToEdge);
CORRADE_COMPARE(out.str(),
"Vk::vkSamplerAddressMode(): unsupported wrapping SamplerWrapping::MirrorClampToEdge\n");
#endif
}
void EnumsTest::mapVkSamplerAddressModeInvalid() {

Loading…
Cancel
Save