Support the VK_KHR_variable_pointers extension.

This commit is contained in:
Chip Davis 2019-01-15 14:56:08 -06:00
parent ba3ece417d
commit acefcca1ff
4 changed files with 17 additions and 7 deletions

View File

@ -242,6 +242,7 @@ In addition to the core *Vulkan* API, **MoltenVK** also supports the following
- `VK_KHR_surface`
- `VK_KHR_swapchain`
- `VK_KHR_swapchain_mutable_format`
- `VK_KHR_variable_pointers`
- `VK_EXT_shader_viewport_index_layer`
- `VK_EXT_vertex_attribute_divisor`
- `VK_MVK_macos_surface` (macOS)

View File

@ -30,6 +30,7 @@ Released 2019/01/15
- Update `VK_MVK_MOLTENVK_SPEC_VERSION` to 16.
- Update copyright to 2019.
- Advertise the `VK_AMD_gpu_shader_half_float` extension.
- Support the `VK_KHR_variable_pointers` extension.
- Update to latest SPIRV-Cross version:
- MSL: Support SPV_KHR_variable_pointers.
- MSL: Workaround missing gradient2d() on macOS for typical cascaded shadow mapping.

View File

@ -63,16 +63,16 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
if (features) {
features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
features->features = _features;
auto* next = (VkStructureType*)features->pNext;
auto* next = (MVKVkAPIStructHeader*)features->pNext;
while (next) {
switch (*next) {
switch (next->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
auto* storageFeatures = (VkPhysicalDevice16BitStorageFeatures*)next;
storageFeatures->storageBuffer16BitAccess = true;
storageFeatures->uniformAndStorageBuffer16BitAccess = true;
storageFeatures->storagePushConstant16 = true;
storageFeatures->storageInputOutput16 = true;
next = (VkStructureType*)storageFeatures->pNext;
next = (MVKVkAPIStructHeader*)storageFeatures->pNext;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR: {
@ -80,25 +80,32 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
storageFeatures->storageBuffer8BitAccess = true;
storageFeatures->uniformAndStorageBuffer8BitAccess = true;
storageFeatures->storagePushConstant8 = true;
next = (VkStructureType*)storageFeatures->pNext;
next = (MVKVkAPIStructHeader*)storageFeatures->pNext;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR: {
auto* f16Features = (VkPhysicalDeviceFloat16Int8FeaturesKHR*)next;
f16Features->shaderFloat16 = true;
f16Features->shaderInt8 = false; // FIXME Needs SPIRV-Cross update
next = (VkStructureType*)f16Features->pNext;
next = (MVKVkAPIStructHeader*)f16Features->pNext;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES: {
auto* varPtrFeatures = (VkPhysicalDeviceVariablePointerFeatures*)next;
varPtrFeatures->variablePointersStorageBuffer = true;
varPtrFeatures->variablePointers = true;
next = (MVKVkAPIStructHeader*)varPtrFeatures->pNext;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: {
auto* divisorFeatures = (VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT*)next;
divisorFeatures->vertexAttributeInstanceRateDivisor = true;
divisorFeatures->vertexAttributeInstanceRateZeroDivisor = true;
next = (VkStructureType*)divisorFeatures->pNext;
next = (MVKVkAPIStructHeader*)divisorFeatures->pNext;
break;
}
default:
next = (VkStructureType*)((VkPhysicalDeviceFeatures2*)next)->pNext;
next = (MVKVkAPIStructHeader*)next->pNext;
break;
}
}

View File

@ -50,6 +50,7 @@ MVK_EXTENSION(KHR_storage_buffer_storage_class, KHR_STORAGE_BUFFER_STORAGE_CLASS
MVK_EXTENSION(KHR_surface, KHR_SURFACE)
MVK_EXTENSION(KHR_swapchain, KHR_SWAPCHAIN)
MVK_EXTENSION(KHR_swapchain_mutable_format, KHR_SWAPCHAIN_MUTABLE_FORMAT)
MVK_EXTENSION(KHR_variable_pointers, KHR_VARIABLE_POINTERS)
MVK_EXTENSION(EXT_shader_viewport_index_layer, EXT_SHADER_VIEWPORT_INDEX_LAYER)
MVK_EXTENSION(EXT_vertex_attribute_divisor, EXT_VERTEX_ATTRIBUTE_DIVISOR)
MVK_EXTENSION(MVK_ios_surface, MVK_IOS_SURFACE)