Browse Source

Vk: support 8-bit index types.

pull/371/head
Vladimír Vondruš 6 years ago
parent
commit
02d1eda03a
  1. 2
      src/Magnum/Vk/Enums.cpp
  2. 10
      src/Magnum/Vk/Enums.h
  3. 4
      src/Magnum/Vk/Test/EnumsTest.cpp
  4. 1
      src/MagnumExternal/Vulkan/extensions.txt
  5. 14
      src/MagnumExternal/Vulkan/flextVk.h

2
src/Magnum/Vk/Enums.cpp

@ -46,7 +46,7 @@ constexpr VkPrimitiveTopology PrimitiveTopologyMapping[]{
};
constexpr VkIndexType IndexTypeMapping[]{
VkIndexType(~UnsignedInt{}),
VK_INDEX_TYPE_UINT8_EXT,
VK_INDEX_TYPE_UINT16,
VK_INDEX_TYPE_UINT32
};

10
src/Magnum/Vk/Enums.h

@ -58,10 +58,14 @@ MAGNUM_VK_EXPORT VkPrimitiveTopology vkPrimitiveTopology(Magnum::MeshPrimitive p
/**
@brief Check availability of a generic index type
In particular, Vulkan doesn't support the @ref MeshIndexType::UnsignedByte
type. Returns @cpp false @ce if Vulkan doesn't support such type, @cpp true @ce
Returns @cpp false @ce if Vulkan doesn't support such type, @cpp true @ce
otherwise. The @p type value is expected to be valid.
@see @ref vkIndexType()
@note Support of some types depends on presence of a particular Vulkan
extension. Such check is outside of the scope of this function and you are
expected to verify extension availability before using such type.
@see @ref vkIndexType(), @vk_extension{EXT,index_type_uint8}
*/
MAGNUM_VK_EXPORT bool hasVkIndexType(Magnum::MeshIndexType type);

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

@ -152,6 +152,9 @@ void EnumsTest::mapVkIndexType() {
}
void EnumsTest::mapVkIndexTypeUnsupported() {
#if 1
CORRADE_SKIP("All index formats are supported.");
#else
CORRADE_VERIFY(!hasVkIndexType(Magnum::MeshIndexType::UnsignedByte));
std::ostringstream out;
{
@ -160,6 +163,7 @@ void EnumsTest::mapVkIndexTypeUnsupported() {
}
CORRADE_COMPARE(out.str(),
"Vk::vkIndexType(): unsupported type MeshIndexType::UnsignedByte\n");
#endif
}
void EnumsTest::mapVkIndexTypeInvalid() {

1
src/MagnumExternal/Vulkan/extensions.txt vendored

@ -25,6 +25,7 @@ extension KHR_storage_buffer_storage_class optional
extension KHR_variable_pointers optional
extension EXT_texture_compression_astc_hdr optional
extension EXT_index_type_uint8 optional
extension IMG_format_pvrtc optional

14
src/MagnumExternal/Vulkan/flextVk.h vendored

@ -246,6 +246,11 @@ extern "C" {
#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1
#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr"
/* VK_EXT_index_type_uint8 */
#define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1
#define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8"
/* VK_IMG_format_pvrtc */
#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1
@ -1404,7 +1409,8 @@ typedef enum {
VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = 1000066000
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = 1000066000,
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT = 1000265000
} VkStructureType;
typedef enum {
@ -3795,6 +3801,12 @@ typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT {
VkBool32 textureCompressionASTC_HDR;
} VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT;
typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT {
VkStructureType sType;
void* pNext;
VkBool32 indexTypeUint8;
} VkPhysicalDeviceIndexTypeUint8FeaturesEXT;
typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures {
VkStructureType sType;
void* pNext;

Loading…
Cancel
Save