Standardize design pattern for enumerations of Vulkan struct pNext chains.

Consistently use for-loops, VkBaseInStructure and VkBaseOutStructure.
Remove redundant MVKVkAPIStructHeader structure.
Remove unnecessary null tests on incoming Vulkan struct pointers.
This commit is contained in:
Bill Hollings 2020-05-06 11:15:50 -04:00
parent efde388cbd
commit 2b3cf6f395
7 changed files with 166 additions and 207 deletions

View File

@ -261,18 +261,17 @@ VkResult MVKCmdPushDescriptorSet::setContent(MVKCommandBuffer* cmdBuff,
} }
if (mvkDvc->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) { if (mvkDvc->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) {
const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr; const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr;
for (auto* next = (VkWriteDescriptorSetInlineUniformBlockEXT*)descWrite.pNext; next; next = (VkWriteDescriptorSetInlineUniformBlockEXT*)next->pNext) for (const auto* next = (VkBaseInStructure*)descWrite.pNext; next; next = next->pNext) {
{
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: {
pInlineUniformBlock = next; pInlineUniformBlock = (VkWriteDescriptorSetInlineUniformBlockEXT*)next;
break; break;
} }
default: default:
break; break;
} }
} }
if (pInlineUniformBlock != nullptr) { if (pInlineUniformBlock) {
auto *pNewInlineUniformBlock = new VkWriteDescriptorSetInlineUniformBlockEXT(*pInlineUniformBlock); auto *pNewInlineUniformBlock = new VkWriteDescriptorSetInlineUniformBlockEXT(*pInlineUniformBlock);
pNewInlineUniformBlock->pNext = nullptr; // clear pNext just in case, no other extensions are supported at this time pNewInlineUniformBlock->pNext = nullptr; // clear pNext just in case, no other extensions are supported at this time
descWrite.pNext = pNewInlineUniformBlock; descWrite.pNext = pNewInlineUniformBlock;
@ -300,11 +299,10 @@ void MVKCmdPushDescriptorSet::clearDescriptorWrites() {
if (descWrite.pTexelBufferView) { delete[] descWrite.pTexelBufferView; } if (descWrite.pTexelBufferView) { delete[] descWrite.pTexelBufferView; }
const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr; const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr;
for (auto* next = (VkWriteDescriptorSetInlineUniformBlockEXT*)descWrite.pNext; next; next = (VkWriteDescriptorSetInlineUniformBlockEXT*)next->pNext) for (const auto* next = (VkBaseInStructure*)descWrite.pNext; next; next = next->pNext) {
{
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: {
pInlineUniformBlock = next; pInlineUniformBlock = (VkWriteDescriptorSetInlineUniformBlockEXT*)next;
break; break;
} }
default: default:

View File

@ -109,11 +109,10 @@ void MVKDescriptorSetLayout::pushDescriptorSet(MVKCommandEncoder* cmdEncoder,
const VkBufferView* pTexelBufferView = descWrite.pTexelBufferView; const VkBufferView* pTexelBufferView = descWrite.pTexelBufferView;
const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr; const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr;
if (_device->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) { if (_device->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) {
for (auto* next = (VkWriteDescriptorSetInlineUniformBlockEXT*)descWrite.pNext; next; next = (VkWriteDescriptorSetInlineUniformBlockEXT*)next->pNext) for (const auto* next = (VkBaseInStructure*)descWrite.pNext; next; next = next->pNext) {
{
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: {
pInlineUniformBlock = next; pInlineUniformBlock = (VkWriteDescriptorSetInlineUniformBlockEXT*)next;
break; break;
} }
default: default:
@ -689,11 +688,10 @@ void mvkUpdateDescriptorSets(uint32_t writeCount,
const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr; const VkWriteDescriptorSetInlineUniformBlockEXT* pInlineUniformBlock = nullptr;
if (dstSet->getDevice()->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) { if (dstSet->getDevice()->_enabledExtensions.vk_EXT_inline_uniform_block.enabled) {
for (auto* next = (VkWriteDescriptorSetInlineUniformBlockEXT*)pDescWrite->pNext; next; next = (VkWriteDescriptorSetInlineUniformBlockEXT*)next->pNext) for (const auto* next = (VkBaseInStructure*)pDescWrite->pNext; next; next = next->pNext) {
{
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: { case VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT: {
pInlineUniformBlock = next; pInlineUniformBlock = (VkWriteDescriptorSetInlineUniformBlockEXT*)next;
break; break;
} }
default: default:

View File

@ -62,11 +62,10 @@ VkResult MVKPhysicalDevice::getExtensionProperties(const char* pLayerName, uint3
} }
void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures* features) { void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures* features) {
if (features) { *features = _features; } *features = _features;
} }
void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) { void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
if (features) {
features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; features->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
features->features = _features; features->features = _features;
for (auto* next = (VkBaseOutStructure*)features->pNext; next; next = next->pNext) { for (auto* next = (VkBaseOutStructure*)features->pNext; next; next = next->pNext) {
@ -156,17 +155,15 @@ void MVKPhysicalDevice::getFeatures(VkPhysicalDeviceFeatures2* features) {
} }
} }
} }
}
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties* properties) { void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties* properties) {
if (properties) { *properties = _properties; } *properties = _properties;
} }
void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) { void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
if (properties) {
properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; properties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
properties->properties = _properties; properties->properties = _properties;
for (auto* next = (VkBaseOutStructure*)properties; next; next = next->pNext) { for (auto* next = (VkBaseOutStructure*)properties->pNext; next; next = next->pNext) {
switch ((uint32_t)next->sType) { switch ((uint32_t)next->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES: {
auto* pointClipProps = (VkPhysicalDevicePointClippingProperties*)next; auto* pointClipProps = (VkPhysicalDevicePointClippingProperties*)next;
@ -212,7 +209,6 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
} }
} }
} }
}
// Populates the device ID properties structure // Populates the device ID properties structure
void MVKPhysicalDevice::populate(VkPhysicalDeviceIDProperties* pDevIdProps) { void MVKPhysicalDevice::populate(VkPhysicalDeviceIDProperties* pDevIdProps) {
@ -270,18 +266,13 @@ void MVKPhysicalDevice::populate(VkPhysicalDeviceIDProperties* pDevIdProps) {
} }
void MVKPhysicalDevice::getFormatProperties(VkFormat format, VkFormatProperties* pFormatProperties) { void MVKPhysicalDevice::getFormatProperties(VkFormat format, VkFormatProperties* pFormatProperties) {
if (pFormatProperties) {
*pFormatProperties = _pixelFormats.getVkFormatProperties(format); *pFormatProperties = _pixelFormats.getVkFormatProperties(format);
} }
}
void MVKPhysicalDevice::getFormatProperties(VkFormat format, void MVKPhysicalDevice::getFormatProperties(VkFormat format, VkFormatProperties2KHR* pFormatProperties) {
VkFormatProperties2KHR* pFormatProperties) {
if (pFormatProperties) {
pFormatProperties->sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR; pFormatProperties->sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR;
pFormatProperties->formatProperties = _pixelFormats.getVkFormatProperties(format); pFormatProperties->formatProperties = _pixelFormats.getVkFormatProperties(format);
} }
}
VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format, VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
VkImageType type, VkImageType type,
@ -419,13 +410,13 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(VkFormat format,
VkResult MVKPhysicalDevice::getImageFormatProperties(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkResult MVKPhysicalDevice::getImageFormatProperties(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
VkImageFormatProperties2* pImageFormatProperties) { VkImageFormatProperties2* pImageFormatProperties) {
for (const auto* nextInfo = (VkBaseInStructure*)pImageFormatInfo; nextInfo; nextInfo = nextInfo->pNext) { for (const auto* nextInfo = (VkBaseInStructure*)pImageFormatInfo->pNext; nextInfo; nextInfo = nextInfo->pNext) {
switch ((uint32_t)nextInfo->sType) { switch (nextInfo->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO: {
// Return information about external memory support for MTLTexture. // Return information about external memory support for MTLTexture.
// Search VkImageFormatProperties2 for the corresponding VkExternalImageFormatProperties and populate it. // Search VkImageFormatProperties2 for the corresponding VkExternalImageFormatProperties and populate it.
auto* pExtImgFmtInfo = (VkPhysicalDeviceExternalImageFormatInfo*)nextInfo; auto* pExtImgFmtInfo = (VkPhysicalDeviceExternalImageFormatInfo*)nextInfo;
for (auto* nextProps = (VkBaseOutStructure*)pImageFormatProperties; nextProps; nextProps = nextProps->pNext) { for (auto* nextProps = (VkBaseOutStructure*)pImageFormatProperties->pNext; nextProps; nextProps = nextProps->pNext) {
if (nextProps->sType == VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES) { if (nextProps->sType == VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES) {
auto* pExtImgFmtProps = (VkExternalImageFormatProperties*)nextProps; auto* pExtImgFmtProps = (VkExternalImageFormatProperties*)nextProps;
@ -453,8 +444,7 @@ VkResult MVKPhysicalDevice::getImageFormatProperties(const VkPhysicalDeviceImage
// If the image format info links portability image view info, test if an image view of that configuration is supported // If the image format info links portability image view info, test if an image view of that configuration is supported
bool MVKPhysicalDevice::getImageViewIsSupported(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo) { bool MVKPhysicalDevice::getImageViewIsSupported(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo) {
auto* next = (MVKVkAPIStructHeader*)pImageFormatInfo->pNext; for (const auto* next = (VkBaseInStructure*)pImageFormatInfo->pNext; next; next = next->pNext) {
while (next) {
switch ((uint32_t)next->sType) { switch ((uint32_t)next->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_SUPPORT_EXTX: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_SUPPORT_EXTX: {
auto* portImgViewInfo = (VkPhysicalDeviceImageViewSupportEXTX*)next; auto* portImgViewInfo = (VkPhysicalDeviceImageViewSupportEXTX*)next;
@ -462,7 +452,7 @@ bool MVKPhysicalDevice::getImageViewIsSupported(const VkPhysicalDeviceImageForma
// Create an image view and test whether it could be configured // Create an image view and test whether it could be configured
VkImageViewCreateInfo viewInfo = { VkImageViewCreateInfo viewInfo = {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.pNext = (VkStructureType*)portImgViewInfo->pNext, .pNext = portImgViewInfo->pNext,
.flags = portImgViewInfo->flags, .flags = portImgViewInfo->flags,
.image = nullptr, .image = nullptr,
.viewType = portImgViewInfo->viewType, .viewType = portImgViewInfo->viewType,
@ -483,7 +473,6 @@ bool MVKPhysicalDevice::getImageViewIsSupported(const VkPhysicalDeviceImageForma
mtlPixFmt, useSwizzle) == VK_SUCCESS); mtlPixFmt, useSwizzle) == VK_SUCCESS);
} }
default: default:
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
} }
@ -823,7 +812,6 @@ VkResult MVKPhysicalDevice::getMemoryProperties(VkPhysicalDeviceMemoryProperties
} }
VkResult MVKPhysicalDevice::getMemoryProperties(VkPhysicalDeviceMemoryProperties2* pMemoryProperties) { VkResult MVKPhysicalDevice::getMemoryProperties(VkPhysicalDeviceMemoryProperties2* pMemoryProperties) {
if (pMemoryProperties) {
pMemoryProperties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2; pMemoryProperties->sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
pMemoryProperties->memoryProperties = _memoryProperties; pMemoryProperties->memoryProperties = _memoryProperties;
for (auto* next = (VkBaseOutStructure*)pMemoryProperties->pNext; next; next = next->pNext) { for (auto* next = (VkBaseOutStructure*)pMemoryProperties->pNext; next; next = next->pNext) {
@ -844,7 +832,6 @@ VkResult MVKPhysicalDevice::getMemoryProperties(VkPhysicalDeviceMemoryProperties
break; break;
} }
} }
}
return VK_SUCCESS; return VK_SUCCESS;
} }
@ -2909,8 +2896,7 @@ void MVKDevice::enableFeatures(const VkDeviceCreateInfo* pCreateInfo) {
&pdFeats2.features.robustBufferAccess, 55); &pdFeats2.features.robustBufferAccess, 55);
} }
auto* next = (MVKVkAPIStructHeader*)pCreateInfo->pNext; for (const auto* next = (VkBaseInStructure*)pCreateInfo->pNext; next; next = next->pNext) {
while (next) {
switch ((uint32_t)next->sType) { switch ((uint32_t)next->sType) {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2: {
auto* requestedFeatures = (VkPhysicalDeviceFeatures2*)next; auto* requestedFeatures = (VkPhysicalDeviceFeatures2*)next;
@ -2999,7 +2985,6 @@ void MVKDevice::enableFeatures(const VkDeviceCreateInfo* pCreateInfo) {
default: default:
break; break;
} }
next = (MVKVkAPIStructHeader*)next->pNext;
} }
} }

View File

@ -1002,11 +1002,9 @@ VkResult MVKPeerSwapchainImage::bindDeviceMemory2(const void* pBindInfo) {
default: default:
break; break;
} }
if (swapchainInfo) { break; }
}
if (!swapchainInfo) {
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
} }
if (!swapchainInfo) { return VK_ERROR_OUT_OF_DEVICE_MEMORY; }
_swapchainIndex = swapchainInfo->imageIndex; _swapchainIndex = swapchainInfo->imageIndex;
return VK_SUCCESS; return VK_SUCCESS;
} }
@ -1114,17 +1112,14 @@ MVKImageView::MVKImageView(MVKDevice* device,
_image = (MVKImage*)pCreateInfo->image; _image = (MVKImage*)pCreateInfo->image;
_usage = _image->_usage; _usage = _image->_usage;
auto* next = (MVKVkAPIStructHeader*)pCreateInfo->pNext; for (const auto* next = (VkBaseInStructure*)pCreateInfo->pNext; next; next = next->pNext) {
while (next) { switch (next->sType) {
switch ((uint32_t)next->sType) {
case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO: { case VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO: {
auto* pViewUsageInfo = (VkImageViewUsageCreateInfo*)next; auto* pViewUsageInfo = (VkImageViewUsageCreateInfo*)next;
if (!(pViewUsageInfo->usage & ~_usage)) { _usage = pViewUsageInfo->usage; } if (!(pViewUsageInfo->usage & ~_usage)) { _usage = pViewUsageInfo->usage; }
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
default: default:
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
} }

View File

@ -383,8 +383,7 @@ void MVKInstance::initDebugCallbacks(const VkInstanceCreateInfo* pCreateInfo) {
_hasDebugUtilsMessengers = false; _hasDebugUtilsMessengers = false;
_debugReportCallbackLayerPrefix = getDriverLayer()->getName(); _debugReportCallbackLayerPrefix = getDriverLayer()->getName();
MVKVkAPIStructHeader* next = (MVKVkAPIStructHeader*)pCreateInfo->pNext; for (const auto* next = (VkBaseInStructure*)pCreateInfo->pNext; next; next = next->pNext) {
while (next) {
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT: case VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT:
createDebugReportCallback((VkDebugReportCallbackCreateInfoEXT*)next, nullptr); createDebugReportCallback((VkDebugReportCallbackCreateInfoEXT*)next, nullptr);
@ -395,7 +394,6 @@ void MVKInstance::initDebugCallbacks(const VkInstanceCreateInfo* pCreateInfo) {
default: default:
break; break;
} }
next = (MVKVkAPIStructHeader*)next->pNext;
} }
} }

View File

@ -944,15 +944,12 @@ bool MVKGraphicsPipeline::addVertexInputToPipeline(MTLRenderPipelineDescriptor*
const SPIRVToMSLConversionConfiguration& shaderContext) { const SPIRVToMSLConversionConfiguration& shaderContext) {
// Collect extension structures // Collect extension structures
VkPipelineVertexInputDivisorStateCreateInfoEXT* pVertexInputDivisorState = nullptr; VkPipelineVertexInputDivisorStateCreateInfoEXT* pVertexInputDivisorState = nullptr;
auto* next = (MVKVkAPIStructHeader*)pVI->pNext; for (const auto* next = (VkBaseInStructure*)pVI->pNext; next; next = next->pNext) {
while (next) {
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT: case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT:
pVertexInputDivisorState = (VkPipelineVertexInputDivisorStateCreateInfoEXT*)next; pVertexInputDivisorState = (VkPipelineVertexInputDivisorStateCreateInfoEXT*)next;
next = (MVKVkAPIStructHeader*)pVertexInputDivisorState->pNext;
break; break;
default: default:
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
} }
@ -1032,15 +1029,12 @@ void MVKGraphicsPipeline::addTessellationToPipeline(MTLRenderPipelineDescriptor*
VkPipelineTessellationDomainOriginStateCreateInfo* pTessDomainOriginState = nullptr; VkPipelineTessellationDomainOriginStateCreateInfo* pTessDomainOriginState = nullptr;
if (reflectData.patchKind == spv::ExecutionModeTriangles) { if (reflectData.patchKind == spv::ExecutionModeTriangles) {
auto* next = (MVKVkAPIStructHeader*)pTS->pNext; for (const auto* next = (VkBaseInStructure*)pTS->pNext; next; next = next->pNext) {
while (next) {
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO: case VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO:
pTessDomainOriginState = (VkPipelineTessellationDomainOriginStateCreateInfo*)next; pTessDomainOriginState = (VkPipelineTessellationDomainOriginStateCreateInfo*)next;
next = (MVKVkAPIStructHeader*)pTessDomainOriginState->pNext;
break; break;
default: default:
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
} }
@ -1131,15 +1125,12 @@ void MVKGraphicsPipeline::initMVKShaderConverterContext(SPIRVToMSLConversionConf
VkPipelineTessellationDomainOriginStateCreateInfo* pTessDomainOriginState = nullptr; VkPipelineTessellationDomainOriginStateCreateInfo* pTessDomainOriginState = nullptr;
if (pCreateInfo->pTessellationState) { if (pCreateInfo->pTessellationState) {
auto* next = (MVKVkAPIStructHeader*)pCreateInfo->pTessellationState->pNext; for (const auto* next = (VkBaseInStructure*)pCreateInfo->pTessellationState->pNext; next; next = next->pNext) {
while (next) {
switch (next->sType) { switch (next->sType) {
case VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO: case VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO:
pTessDomainOriginState = (VkPipelineTessellationDomainOriginStateCreateInfo*)next; pTessDomainOriginState = (VkPipelineTessellationDomainOriginStateCreateInfo*)next;
next = (MVKVkAPIStructHeader*)pTessDomainOriginState->pNext;
break; break;
default: default:
next = (MVKVkAPIStructHeader*)next->pNext;
break; break;
} }
} }

View File

@ -55,12 +55,6 @@ typedef uint16_t MVKHalfFloat;
/** A representation of the value of 1.0 as a 16-bit half-float. */ /** A representation of the value of 1.0 as a 16-bit half-float. */
#define kHalfFloat1 0x3C00 #define kHalfFloat1 0x3C00
/** Common header for many standard Vulkan API structures. */
typedef struct {
VkStructureType sType;
const void* pNext;
} MVKVkAPIStructHeader;
#pragma mark - #pragma mark -
#pragma mark Vertex content structures #pragma mark Vertex content structures