Validation Layer Details

DrawState

DrawState Overview

The DrawState layer tracks state leading into Draw cmds. This includes the Pipeline state, dynamic state, and descriptor set state. DrawState validates the consistency and correctness between and within these states.

DrawState Details Table

CheckOverviewENUM DRAWSTATE_*Relevant APITestnameNotes/TODO
Valid Pipeline LayoutsValidates that pipeline layout from bound descriptor set matches the current pipeline layoutPIPELINE_LAYOUT_MISMATCHvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTBDNone
Validate DbgMarker exensionsValidates that DbgMarker extensions have been enabled before useINVALID_EXTENSIONvkCmdDbgMarkerBegin vkCmdDbgMarkerEndTBDNone
Valid BeginCommandBuffer level-related parametersPrimary command buffers must specify VK_NULL_HANDLE for RenderPass or Framebuffer parameters, while secondary command buffers must provide non-null parametersBEGIN_CB_INVALID_STATEvkBeginCommandBufferPrimaryCommandBufferFramebufferAndRenderpass SecondaryCommandBufferFramebufferAndRenderpassNone
PSO BoundVerify that a properly created and valid pipeline object is bound to the CommandBuffer specified in these callsNO_PIPELINE_BOUNDvkCmdBindDescriptorSets vkCmdBindVertexBuffersPipelineNotBoundThis check is currently more related to DrawState data structures and less about verifying that PSO is bound at all appropriate points in API. For API purposes, need to make sure this is checked at Draw time and any other relevant calls.
Valid DescriptorPoolVerifies that the descriptor set pool object was properly created and is validINVALID_POOLvkResetDescriptorPool vkAllocateDescriptorSetsNoneThis is just an internal layer data structure check. ParamChecker or ObjectTracker should really catch bad DSPool
Valid DescriptorSetValidate that descriptor set was properly created and is currently validINVALID_SETvkCmdBindDescriptorSetsNoneIs this needed other places (like Update/Clear descriptors)
Valid DescriptorSetLayoutFlag DescriptorSetLayout object that was not properly createdINVALID_LAYOUTvkAllocateDescriptorSetsNoneAnywhere else to check this?
Valid PipelineFlag VkPipeline object that was not properly createdINVALID_PIPELINEvkCmdBindPipelineInvalidPipelineNA
Valid Pipeline Create InfoTests for the following: That compute shaders are not specified for the graphics pipeline, tess evaluation and tess control shaders are included or excluded as a pair, that VK_PRIMITIVE_TOPOLOGY_PATCH is set as IA topology for tessellation pipelines, that VK_PRIMITIVE_TOPOLOGY_PATCH primitive topology is only set for tessellation pipelines, and that Vtx Shader specifiedINVALID_PIPELINE_CREATE_STATEvkCreateGraphicsPipelinesInvalidPipelineCreateStateNA
Valid CommandBufferValidates that the command buffer object was properly created and is currently validINVALID_COMMAND_BUFFERvkQueueSubmit vkBeginCommandBuffer vkEndCommandBuffer vkCmdBindPipeline vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearAttachments vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestamp vkCmdBeginRenderPass vkCmdNextSubpass vkCmdEndRenderPass vkCmdExecuteCommands vkCmdDbgMarkerBegin vkCmdDbgMarkerEnd vkAllocateCommandBuffersNoneNA
Vtx Buffer BoundsCheck if VBO index too large for PSO Vtx binding count, and that at least one vertex buffer is attached to pipeline objectVTX_INDEX_OUT_OF_BOUNDSvkCmdBindDescriptorSets vkCmdBindVertexBuffersVtxBufferBadIndexNA
Idx Buffer AlignmentVerify that offset of Index buffer falls on an alignment boundary as defined by IdxBufferAlignmentError paramVTX_INDEX_ALIGNMENT_ERRORvkCmdBindIndexBufferIdxBufferAlignmentErrorNA
Cmd Buffer EndVerifies that EndCommandBuffer was called for this commandBuffer at QueueSubmit timeNO_END_COMMAND_BUFFERvkQueueSubmitNoEndCommandBufferNA
Cmd Buffer BeginCheck that BeginCommandBuffer was called for this command buffer when binding commands or calling endNO_BEGIN_COMMAND_BUFFERvkEndCommandBuffer vkCmdBindPipeline vkCmdSetViewport vkCmdSetLineWidth vkCmdSetDepthBias vkCmdSetBlendConstants vkCmdSetDepthBounds vkCmdSetStencilCompareMask vkCmdSetStencilWriteMask vkCmdSetStencilReference vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearAttachments vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestampNoBeginCommandBufferNA
Cmd Buffer Submit CountVerify that ONE_TIME submit cmdbuffer is not submitted multiple timesCOMMAND_BUFFER_SINGLE_SUBMIT_VIOLATIONvkBeginCommandBuffer, vkQueueSubmitCommandBufferTwoSubmitsNA
Valid Secondary CommandBufferValidates that no primary command buffers are sent to vkCmdExecuteCommands() areINVALID_SECONDARY_COMMAND_BUFFERvkCmdExecuteCommandsExecuteCommandsPrimaryCBNA
Descriptor TypeVerify Descriptor type in bound descriptor set layout matches descriptor type specified in update. This also includes mismatches in the TYPES of copied descriptors.DESCRIPTOR_TYPE_MISMATCHvkUpdateDescriptorSetsDSTypeMismatch CopyDescriptorUpdateErrorsNA
Descriptor StageFlagsVerify all descriptors within a single write update have the same stageFlagsDESCRIPTOR_STAGEFLAGS_MISMATCHvkUpdateDescriptorSetsNONETest this case
DS Update SizeDS update out of bounds for given layout section.DESCRIPTOR_UPDATE_OUT_OF_BOUNDSvkUpdateDescriptorSetsDSUpdateOutOfBounds CopyDescriptorUpdateErrorsNA
Descriptor Pool emptyAttempt to allocate descriptor type from descriptor pool when no more of that type are available to be allocated.DESCRIPTOR_POOL_EMPTYvkAllocateDescriptorSetsAllocDescriptorFromEmptyPoolNA
Free from NON_FREE PoolIt's invalid to call vkFreeDescriptorSets() on Sets that were allocated from a Pool created with NON_FREE usage.CANT_FREE_FROM_NON_FREE_POOLvkFreeDescriptorSetsNoneNA
DS Update IndexDS update binding too large for layout binding count.INVALID_UPDATE_INDEXvkUpdateDescriptorSetsInvalidDSUpdateIndex CopyDescriptorUpdateErrorsNA
DS Update TypeVerifies that structs in DS Update tree are properly created, currenly valid, and of the right typeINVALID_UPDATE_STRUCTvkUpdateDescriptorSetsInvalidDSUpdateStructNA
MSAA Sample CountVerifies that Pipeline, RenderPass, and Subpass sample counts are consistentNUM_SAMPLES_MISMATCHvkCmdBindPipeline vkCmdBeginRenderPass vkCmdNextSubpassNumSamplesMismatchNA
Dynamic Viewport State BindingVerify that viewport dynamic state bound to Cmd Buffer at Draw timeVIEWPORT_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectViewportStateNotBoundNA
Dynamic Scissor State BindingVerify that scissor dynamic state bound to Cmd Buffer at Draw timeSCISSOR_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectScissorStateNotBoundNA
Dynamic Line Width State BindingVerify that line width dynamic state bound to Cmd Buffer at when required (TODO : Verify when this is)LINE_WIDTH_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTODOVerify this check and Write targeted test
Dynamic Depth Bias State BindingVerify that depth bias dynamic state bound when depth enabledDEPTH_BIAS_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTODOVerify this check and Write targeted test
Dynamic Blend State BindingVerify that blend dynamic state bound when color blend enabledBLEND_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTODOVerify this check and Write targeted test
Dynamic Depth Bounds State BindingVerify that depth bounds dynamic state bound when depth enabledDEPTH_BOUNDS_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTODOVerify this check and Write targeted test
Dynamic Stencil State BindingVerify that stencil dynamic state bound when depth enabledSTENCIL_NOT_BOUNDvkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirectTODOVerify this check and Write targeted test
RenderPass misuseTests for the following: that vkCmdDispatch, vkCmdDispatchIndirect, vkCmdCopyBuffer, vkCmdCopyImage, vkCmdBlitImage, vkCmdCopyBufferToImage, vkCmdCopyImageToBuffer, vkCmdUpdateBuffer, vkCmdFillBuffer, vkCmdClearColorImage, vkCmdClearDepthStencilImage, vkCmdResolveImage, vkCmdSetEvent, vkCmdResetEvent, vkCmdResetQueryPool, vkCmdCopyQueryPoolResults, vkCmdBeginRenderPass are not called during an active Renderpass, and that binding compute descriptor sets or pipelines does not take place during an active RenderpassINVALID_RENDERPASS_CMDvkCmdBindPipeline vkCmdBindDescriptorSets vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdResetQueryPool vkCmdCopyQueryPoolResults vkCmdBeginRenderPassRenderPassWithinRenderPass UpdateBufferWithinRenderPass ClearColorImageWithinRenderPass ClearDepthStencilImageWithinRenderPass FillBufferWithinRenderPassNA
Correct use of RenderPassValidates that the following rendering commands are issued inside an active RenderPass: vkCmdDraw, vkCmdDrawIndexed, vkCmdDrawIndirect, vkCmdDrawIndexedIndirect, vkCmdClearAttachments, vkCmdNextSubpass, vkCmdEndRenderPassNO_ACTIVE_RENDERPASSvkCmdBindPipeline vkCmdBindDescriptorSets vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdClearAttachments vkCmdNextSubpass vkCmdEndRenderPassBindPipelineNoRenderPass ClearAttachmentsOutsideRenderPassNA
Valid RenderPassFlag error if attempt made to Begin/End/Continue a NULL or otherwise invalid RenderPass objectINVALID_RENDERPASSvkCmdBeginRenderPass vkCmdEndRenderPass vkBeginCommandBufferNullRenderPassNA
DescriptorSet UpdatedWarn user if DescriptorSet bound that was never updatedDESCRIPTOR_SET_NOT_UPDATEDvkCmdBindDescriptorSetsDescriptorSetNotUpdatedNA
Correct Clear UseWarn user if CmdClear for Color or DepthStencil issued to Cmd Buffer prior to a Draw Cmd. RenderPass LOAD_OP_CLEAR is preferred in this case.CLEAR_CMD_BEFORE_DRAWvkCmdClearColorImage vkCmdClearDepthStencilImageClearCmdNoDrawNA
Index Buffer BindingVerify that an index buffer is bound at the point when an indexed draw is attempted.INDEX_BUFFER_NOT_BOUNDvkCmdDrawIndexed vkCmdDrawIndexedIndirectTODOImplement validation test
Viewport and Scissors matchIn PSO viewportCount and scissorCount must match. Also for each count that is non-zero, there corresponding data array ptr should be non-NULL.VIEWPORT_SCISSOR_MISMATCHvkCreateGraphicsPipelines vkCmdSetViewport vkCmdSetScissorTODOImplement validation test
Valid Image Aspects for descriptor UpdatesWhen updating ImageView for Descriptor Sets with layout of DEPTH_STENCIL type, the Image Aspect must not have both the DEPTH and STENCIL aspects set, but must have one of the two set. For COLOR_ATTACHMENT, aspect must have COLOR_BIT set.INVALID_IMAGE_ASPECTvkUpdateDescriptorSetsDepthStencilImageViewWithColorAspectBitErrorThis test hits Image layer error, but tough to create case that that skips that error and gets to DrawState error.
Valid sampler descriptor UpdatesAn invalid sampler is used when updating SAMPLER descriptor.SAMPLER_DESCRIPTOR_ERRORvkUpdateDescriptorSetsSampleDescriptorUpdateErrorCurrently only making sure sampler handle is known, can add further validation for sampler parameters
Immutable sampler update consistencyWithin a single write update, all sampler updates must use either immutable samplers or non-immutable samplers, but not a combination of both.INCONSISTENT_IMMUTABLE_SAMPLER_UPDATEvkUpdateDescriptorSetsNoneWrite a test for this case
Valid imageView descriptor UpdatesAn invalid imageView is used when updating *_IMAGE or *_ATTACHMENT descriptor.IMAGEVIEW_DESCRIPTOR_ERRORvkUpdateDescriptorSetsImageViewDescriptorUpdateErrorCurrently only making sure imageView handle is known, can add further validation for imageView and underlying image parameters
Valid bufferView descriptor UpdatesAn invalid bufferView is used when updating *_TEXEL_BUFFER descriptor.BUFFERVIEW_DESCRIPTOR_ERRORvkUpdateDescriptorSetsBufferViewDescriptorUpdateErrorCurrently only making sure bufferView handle is known, can add further validation for bufferView parameters
Valid bufferInfo descriptor UpdatesAn invalid bufferInfo is used when updating _UNIFORM_BUFFER or _STORAGE_BUFFER descriptor.BUFFERINFO_DESCRIPTOR_ERRORvkUpdateDescriptorSetsTODOImplement validation test
Attachment References in SubpassAttachment reference must be present in active subpassMISSING_ATTACHMENT_REFERENCEvkCmdClearAttachmentsBufferInfoDescriptorUpdateErrorCurrently only making sure bufferInfo has buffer whose handle is known, can add further validation for bufferInfo parameters
NAEnum used for informational messagesNONENANone
NAEnum used for errors in the layer itself. This does not indicate an app issue, but instead a bug in the layer.INTERNAL_ERRORNANone
NAEnum used when Drawstate attempts to allocate memory for its own internal use and is unable to.OUT_OF_MEMORYNANone
NAEnum used when Drawstate attempts to allocate memory for its own internal use and is unable to.OUT_OF_MEMORYNANone

DrawState Pending Work

Additional checks to be added to DrawState

  1. dynamicOffsetCount lists how many entries are present in pDynamicOffsets - account for this (not certain of what needs to be done here but we don't have any test cases for dynamicOffsets, so keeping this task around until we do)
  2. Lifetime validation (See bug 13383) 8. XGL_DESCRIPTOR_SET 9. Cannot be deleted until no longer in use on GPU, or referenced in any pending command. 10. Sets in XGL_DESCRIPTOR_REGION_USAGE_NON_FREE regions can never be deleted. Instead the xglClearDescriptorRegion() deletes all sets. 11. Sets in XGL_DESCRIPTOR_REGION_USAGE_DYNAMIC regions can be deleted. 12. XGL_DESCRIPTOR_SET_LAYOUT 13. What do IHVs want here? 14. Option 1 (assuming this one): Must not be deleted until all sets and layout chains referencing the set layout are deleted. 15. Option 2: Can be freely deleted after usage. 19. XGL_DESCRIPTOR_REGION 20. Cannot be deleted until no longer in use on the GPU, or referenced in any pending command. 21. XGL_BUFFER_VIEW, XGL_IMAGE_VIEW, etc 22. Cannot be deleted until the descriptors referencing the objects are deleted. 23. For ClearAttachments function, verify that the index of referenced attachment actually exists
  3. GetRenderAreaGranularity - The pname:renderPass parameter must be the same as the one given in the sname:VkRenderPassBeginInfo structure for which the render area is relevant.
  4. vkFreeDescriptorSets must not be called for sets created on top of one-shot pool
  5. If Cmd Buffer one-time submit flag is set, then verify that cmd buffer is only submitted once
  6. Verify that all relevent dynamic state objects are bound (See https://cvs.khronos.org/bugzilla/show_bug.cgi?id=14323)
  7. Flag an error if CommandBuffer has Begin called while it's being constructed - this is not a reset, this is a violation
  8. At PSO creation time, there is no case when NOT including a FS should flag an error since there exist dynamic state configurations that can be set to cause a FS to not be required. Instead, in the case when no FS is in the PSO, validation should detect at runtime if dynamic state will require a FS, and in those case issue a runtime warning about undefined behavior. (see bug https://cvs.khronos.org/bugzilla/show_bug.cgi?id=14429)
  9. Error if a cmdbuffer is submitted on a queue whose family doesn't match the family of the pool from which it was created.
  10. Update Gfx Pipe Create Info shadowing to remove new/delete and instead use unique_ptrs for auto clean-up

ParamChecker

ParamChecker Overview

The ParamChecker layer validates parameter values and flags errors for any values that are outside of acceptable values for the given parameter.

ParamChecker Details Table

CheckOverviewENUMRelevant APITestnameNotes/TODO
Input ParametersPointers in structures are recursively validated to be non-null. Enumerated types are validated against min and max enum values. Structure Types are verified to be correct.NAvkQueueSubmit vkAllocateMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkQueueBindSparse vkCreateFence vkResetFences vkWaitForFences vkCreateSemaphore vkCreateEvent vkCreateQueryPool vkCreateBuffer vkCreateBufferView vkCreateImage vkGetImageSubresourceLayout vkCreateImageView vkCreateShader vkCreatePipelineCache vkMergePipelineCaches vkCreateGraphicsPipelines vkCreateComputePipelines vkCreatePipelineLayout vkCreateSampler vkCreateDescriptorSetLayout( vkCreateDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkUpdateDescriptorSets vkCreateFramebuffer vkCreateRenderPass vkCreateCommandPool vkAllocateCommandBuffers vkBeginCommandBuffer vkCmdBindDescriptorSets vkCmdBindVertexBuffers vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdWaitEvents vkCmdPipelineBarrier vkCmdPushConstants vkCmdBeginRenderPass vkCmdExecuteCommandsTBDNA
Call results, Output ParametersReturn values are checked for VK_SUCCESS, returned pointers are checked to be NON-NULL, enumerated types of return values are checked to be within the defined range.NAvkEnumeratePhysicalDevices vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceLimits vkGetPhysicalDeviceProperties vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceMemoryProperties vkGetDeviceQueue vkQueueSubmit vkQueueWaitIdle vkDeviceWaitIdle vkAllocateMemory vkFreeMemory vkMapMemory vkUnmapMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkGetDeviceMemoryCommitment vkBindBufferMemory vkBindImageMemory vkGetBufferMemoryRequirements vkGetImageMemoryRequirements vkGetImageSparseMemoryRequirements vkGetPhysicalDeviceSparseImageFormatProperties vkQueueBindSparse vkCreateFence vkDestroyFence vkResetFences vkGetFenceStatus vkWaitForFences vkCreateSemaphore vkDestroySemaphore vkCreateEvent vkDestroyEvent vkGetEventStatus vkSetEvent vkResetEvent vkCreateQueryPool vkDestroyQueryPool vkGetQueryPoolResults vkCreateBuffer vkDestroyBuffer vkCreateBufferView vkDestroyBufferView vkCreateImage vkDestroyImage vkGetImageSubresourceLayout vkCreateImageView vkDestroyImageView vkDestroyShaderModule vkCreateShader vkDestroyShader vkCreatePipelineCache vkDestroyPipelineCache vkGetPipelineCacheData vkMergePipelineCaches vkCreateGraphicsPipelines vkCreateComputePipelines vkDestroyPipeline vkCreatePipelineLayout vkDestroyPipelineLayout vkCreateSampler vkDestroySampler vkCreateDescriptorSetLayout vkDestroyDescriptorSetLayout vkCreateDescriptorPool vkDestroyDescriptorPool vkResetDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkUpdateDescriptorSets vkCreateFramebuffer vkDestroyFramebuffer vkCreateRenderPass vkDestroyRenderPass vkGetRenderAreaGranularity vkCreateCommandPool vkDestroyCommandPool vkResetCommandPool vkAllocateCommandBuffers vkFreeCommandBuffers vkBeginCommandBuffer vkEndCommandBuffer vkResetCommandBuffer vkCmdBindPipeline vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestamp vkCmdCopyQueryPoolResults vkCmdPushConstants vkCmdBeginRenderPass vkCmdNextSubpass vkCmdEndRenderPass vkCmdExecuteCommandsTBDNA
NAEnum used for informational messagesNONENANone

ParamChecker Pending Work

Additional work to be done

  1. Source2 was creating a VK_FORMAT_R8_SRGB texture (and image view) which was not supported by the underlying implementation (rendersystemtest imageformat test). Checking that formats are supported by the implementation is something the validation layer could do using the VK_FORMAT_INFO_TYPE_PROPERTIES query. There are probably a bunch of checks here you could be doing around vkCreateImage formats along with whether image/color/depth attachment views are valid. I’m not sure how much of this is already there.
  2. From AMD: we were using an image view with a swizzle of VK_CHANNEL_FORMAT_A with a BC1_RGB texture, which is not valid because the texture does not have an alpha channel. In general, should validate that the swizzles do not reference components not in the texture format.
  3. When querying VK_PHYSICAL_DEVICE_INFO_TYPE_QUEUE_PROPERTIES must provide enough memory for a all the queues on the device (not just 1 when device has multiple queues).
  4. INT & FLOAT bordercolors. Border color int/float selection must match associated texture format.
  5. Flag error on VkBufferCreateInfo if buffer size is 0
  6. VkImageViewCreateInfo.format must be set
  7. For vkCreateGraphicsPipelines, correctly handle array of pCreateInfos and array of pStages within each element of pCreatInfos
  8. Check for valid VkIndexType in vkCmdBindIndexBuffer() should be in PreCmdBindIndexBuffer() call
  9. Check for valid VkPipelineBindPoint in vkCmdBindPipeline() & vkCmdBindDescriptorSets() should be in PreCmdBindPipeline() & PreCmdBindDescriptorSets() calls respectively.

Image

Image Layer Overview

The Image layer is responsible for validating format-related information and enforcing format restrictions.

Image Layer Details Table

DETAILS TABLE PENDING

CheckOverviewENUM IMAGE_*Relevant APITestnameNotes/TODO
Image FormatVerifies that requested format is a supported Vulkan format on this deviceFORMAT_UNSUPPORTEDvkCreateImage vkCreateRenderPassTBDNA
RenderPass AttachmentsValidates that attachment image layouts, loadOps, and storeOps are valid Vulkan valuesRENDERPASS_INVALID_ATTACHMENTvkCreateRenderPassTBDNA
Subpass DS SettingsVerifies that if there is no depth attachment then the subpass attachment is set to VK_ATTACHMENT_UNUSEDRENDERPASS_INVALID_DS_ATTACHMENTvkCreateRenderPassTBDNA
View CreationVerify that requested Image View Creation parameters are reasonable for the image that the view is being created forVIEW_CREATE_ERRORvkCreateImageViewTBDNA
Image AspectsVerify that Image commands are using valid Image Aspect flagsINVALID_IMAGE_ASPECTvkCreateImageView vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdCopyImage vkCmdCopyImageToBuffer vkCmdCopyBufferToImage vkCmdResolveImage vkCmdBlitImageInvalidImageViewAspectNA
Image Aspect MismatchVerify that Image commands with source and dest images use matching aspect flagsMISMATCHED_IMAGE_ASPECTvkCmdCopyImageTBDNA
Image Type MismatchVerify that Image commands with source and dest images use matching typesMISMATCHED_IMAGE_TYPEvkCmdCopyImage vkCmdResolveImageCopyImageTypeMismatch ResolveImageTypeMismatchNA
Image Format MismatchVerify that Image commands with source and dest images use matching formatsMISMATCHED_IMAGE_FORMATvkCmdCopyImage vkCmdResolveImageCopyImageDepthStencilFormatMismatch ResolveImageFormatMismatchNA
Resolve Sample CountVerifies that source and dest images sample counts are validINVALID_RESOLVE_SAMPLESvkCmdResolveImageResolveImageHighSampleCount ResolveImageLowSampleCountNA
Verify FormatVerifies the formats are valid for this image operationINVALID_FORMATvkCreateImageView vkCmdBlitImageTBDNA
Verify Correct Image FilterVerifies that specified filter is validINVALID_FILTERvkCmdBlitImageTBDNA
NAEnum used for informational messagesNONENANone

Image Pending Work

Additional work to be done

MemTracker

MemTracker Overview

The MemTracker layer tracks memory objects and references and validates that they are managed correctly by the application. This includes tracking object bindings, memory hazards, and memory object lifetimes. MemTracker validates several other hazard-related issues related to command buffers, fences, and memory mapping.

MemTracker Details Table

CheckOverviewENUM MEMTRACK_*Relevant APITestnameNotes/TODO
Valid Command BufferVerifies that the command buffer was properly created and is currently validINVALID_CBvkCmdBindPipeline vkCmdSetViewport vkCmdSetLineWidth vkCmdSetDepthBias vkCmdSetBlendConstants vkCmdSetDepthBounds vkCmdSetStencilCompareMask vkCmdSetStencilWriteMask vkCmdSetStencilReference vkBeginCommandBuffer vkResetCommandBuffer vkDestroyDevice vkFreeMemoryNANA
Valid Memory ObjectVerifies that the memory object was properly created and is currently validINVALID_MEM_OBJvkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImage vkFreeMemory vkBindBufferMemory vkBindImageMemory vkQueueBindSparseNANA
Free Referenced MemoryChecks to see if memory being freed still has current referencesFREED_MEM_REFvmFreeMemoryFreeBoundMemoryNA
Memory Properly BoundValidate that the memory object referenced in the call was properly created, is currently valid, and is properly bound to the objectMISSING_MEM_BINDINGSvkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyQueryPoolResults vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImageNANA
Valid ObjectVerifies that the specified Vulkan object was created properly and is currently validINVALID_OBJECTvkCmdBindPipeline vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImageNANA
Bind Invalid MemoryValidate that memory object was correctly created, that the command buffer object was correctly created, and that both are currently valid objects.MEMORY_BINDING_ERRORvkQueueBindSparse vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdResolveImageNAThe valid Object checks are primarily the responsibilty of ObjectTracker layer, so these checks are more of a backup in case ObjectTracker is not enabled
Objects Not DestroyedVerify all objects destroyed at DestroyDevice timeMEMORY_LEAKvkDestroyDeviceNANA
Memory Mapping StateVerifies that mapped memory is CPU-visibleINVALID_STATEvkMapMemoryMapMemWithoutHostVisibleBitNA
Command Buffer SynchronizationCommand Buffer must be complete before BeginCommandBuffer or ResetCommandBuffer can be calledRESET_CB_WHILE_IN_FLIGHTvkBeginCommandBuffer vkResetCommandBufferCallBeginCommandBufferBeforeCompletion CallBeginCommandBufferBeforeCompletionNA
Submitted Fence StatusVerifies that: The fence is not submitted in an already signaled state, that ResetFences is not called with a fence in an unsignaled state, and that fences being checked have been submittedINVALID_FENCE_STATEvkResetFences vkWaitForFences vkQueueSubmit vkGetFenceStatusSubmitSignaledFence ResetUnsignaledFenceCreate test(s) for case where an unsubmitted fence is having its status checked
Immutable Memory BindingValidates that non-sparse memory bindings are immutable, so objects are not re-boundtREBIND_OBJECTvkBindBufferMemory, vkBindImageMemoryRebindMemoryNA
Image/Buffer Usage bitsVerify correct USAGE bits set based on how Images and Buffers are usedINVALID_USAGE_FLAGvkCreateImage, vkCreateBuffer, vkCreateBufferView, vkCmdCopyBuffer, vkCmdCopyQueryPoolResults, vkCmdCopyImage, vkCmdBlitImage, vkCmdCopyBufferToImage, vkCmdCopyImageToBuffer, vkCmdUpdateBuffer, vkCmdFillBufferInvalidUsageBitsNA
Objects Not Destroyed WarningWarns if any memory objects have not been freed before their objects are destroyedMEM_OBJ_CLEAR_EMPTY_BINDINGSvkDestroyDeviceTBDNA
NAEnum used for informational messagesNONENANone
NAEnum used for errors in the layer itself. This does not indicate an app issue, but instead a bug in the layer.INTERNAL_ERRORNANone

MemTracker Pending Work

MemTracker Enhancements

  1. Flag any memory hazards: Validate that the pipeline barriers for buffers are sufficient to avoid hazards
  2. Make sure that the XGL_IMAGE_VIEW_ATTACH_INFO.layout matches the layout of the image as determined by the last IMAGE_MEMORY_BARRIER
  3. Verify that the XGL_IMAGE_MEMORY_BARRIER.oldLayout matches the actual previous layout (this one was super important for previous work in dealing with out-of-order command buffer generation). Note that these need to be tracked for each subresource.
  4. Update for new Memory Binding Model
  5. Consolidate error messages and make them consistent
  6. Add validation for having mapped objects in a command list - GPU writing to mapped object is warning
  7. Add validation for maximum memory references, maximum object counts, and object leaks
  8. When performing clears on surfaces that have both Depth and Stencil, WARN user if subresource range for depth and stencil are not both set (see blit_tests.cpp VkCmdClearDepthStencilTest test).
  9. Re-enable INFO messages that were disabled during v138 integration
  10. Warn on image/buffer deletion if USAGE bits were set that were not needed
  11. Modify INVALID_FENCE_STATE to be WARNINGs instead of ERROR
  12. Report destroy or modify of resources in use on queues and not cleared by fence or WaitIdle. Could be fence, semaphore, or objects used by submitted CommandBuffers.

ShaderChecker

ShaderChecker Overview

The ShaderChecker layer inspects the SPIR-V shader images and fixed function pipeline stages at PSO creation time. It flags errors when inconsistencies are found across interfaces between shader stages. The exact behavior of the checks depends on the pair of pipeline stages involved.

ShaderChecker Details Table

CheckOverviewENUM SHADER_CHECKER_*Relevant APITestnameNotes/TODO
Not consumedFlag warning if a location is not consumed (useless work)OUTPUT_NOT_CONSUMEDvkCreateGraphicsPipelinesCreatePipeline*NotConsumedNA
Not producedFlag error if a location is not produced (consumer reads garbage)INPUT_NOT_PRODUCEDvkCreateGraphicsPipelinesCreatePipeline*NotProvidedNA
Type mismatchFlag error if a location has inconsistent typesINTERFACE_TYPE_MISMATCHvkCreateGraphicsPipelinesCreatePipeline*TypeMismatchBetween shader stages, an exact structural type match is required. Between VI and VS, or between FS and CB, only the basic component type must match (float for UNORM/SNORM/FLOAT, int for SINT, uint for UINT) as the VI and CB stages perform conversions to the exact format.
Inconsistent shaderFlag error if an inconsistent SPIR-V image is detected. Possible cases include broken type definitions which the layer fails to walk.INCONSISTENT_SPIRVvkCreateGraphicsPipelinesTODOAll current tests use the reference compiler to produce valid SPIRV images from GLSL.
Non-SPIRV shaderFlag warning if a non-SPIR-V shader image is detected. This can occur if early drivers are ingesting GLSL. ShaderChecker cannot analyze non-SPIRV shaders, so this suppresses most other checks.NON_SPIRV_SHADERvkCreateGraphicsPipelinesTODONA
FS mixed broadcastFlag error if the fragment shader writes both the legacy gl_FragCoord (which broadcasts to all CBs) and custom FS outputs.FS_MIXED_BROADCASTvkCreateGraphicsPipelinesTODOReference compiler refuses to compile shaders which do this
VI Binding DescriptionsValidate that there is a single vertex input binding description for each bindingINCONSISTENT_VIvkCreateGraphicsPipelinesCreatePipelineAttribBindingConflictNA
Shader Stage CheckWarns if shader stage is unsupportedUNKNOWN_STAGEvkCreateGraphicsPipelinesTBDNA
Missing DescriptorFlags error if shader attempts to use a descriptor binding not declared in the layoutMISSING_DESCRIPTORvkCreateGraphicsPipelinesCreatePipelineUniformBlockNotProvidedNA
NAEnum used for informational messagesNONENANone

ShaderChecker Pending Work

  • Additional test cases for variously broken SPIRV images
  • Validation of a single SPIRV image in isolation (the spec describes many constraints)
  • Validation of SPIRV use of descriptors against the declared descriptor set layout

ObjectTracker

ObjectTracker Overview

The ObjectTracker layer maintains a record of all Vulkan objects. It flags errors when invalid objects are used and at DestroyInstance time it flags any objects that were not properly destroyed.

ObjectTracker Details Table

CheckOverviewENUM OBJTRACK_*Relevant APITestnameNotes/TODO
Valid ObjectValidates that referenced object was properly created and is currently valid.INVALID_OBJECTvkAcquireNextImageKHR vkAllocateDescriptorSets vkAllocateMemory vkBeginCommandBuffer vkBindBufferMemory vkBindImageMemory vkCmdBeginQuery vkCmdBeginRenderPass vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindPipeline vkCmdBindVertexBuffers vkCmdBlitImage vkCmdClearAttachments vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdCopyBuffer vkCmdCopyBufferToImage vkCmdCopyImage vkCmdCopyImageToBuffer vkCmdCopyQueryPoolResults vkCmdDispatch vkCmdDispatchIndirect vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndexedIndirect vkCmdDrawIndirect vkCmdEndQuery vkCmdEndRenderPass vkCmdExecuteCommands vkCmdFillBuffer vkCmdNextSubpass vkCmdPipelineBarrier vkCmdPushConstants vkCmdResetEvent vkCmdResetQueryPool vkCmdResolveImage vkCmdSetEvent vkCmdUpdateBuffer vkCmdWaitEvents vkCmdWriteTimestamp vkCreateBuffer vkCreateBufferView vkAllocateCommandBuffers vkCreateCommandPool vkCreateComputePipelines vkCreateDescriptorPool vkCreateDescriptorSetLayout vkCreateEvent vkCreateFence vkCreateFramebuffer vkCreateGraphicsPipelines vkCreateImage vkCreateImageView vkCreatePipelineCache vkCreatePipelineLayout vkCreateQueryPool vkCreateRenderPass vkCreateSampler vkCreateSemaphore vkCreateShader vkCreateShaderModule vkCreateSwapchainKHR vkDestroyBuffer vkDestroyBufferView vkFreeCommandBuffers vkDestroyCommandPool vkDestroyDescriptorPool vkDestroyDescriptorSetLayout vkDestroyEvent vkDestroyFence vkDestroyFramebuffer vkDestroyImage vkDestroyImageView vkDestroyPipeline vkDestroyPipelineCache vkDestroyPipelineLayout vkDestroyQueryPool vkDestroyRenderPass vkDestroySampler vkDestroySemaphore vkDestroyShader vkDestroyShaderModule vkDestroySwapchainKHR vkDeviceWaitIdle vkEndCommandBuffer vkEnumeratePhysicalDevices vkFreeDescriptorSets vkFreeMemory vkFreeMemory vkGetBufferMemoryRequirements vkGetDeviceMemoryCommitment vkGetDeviceQueue vkGetEventStatus vkGetFenceStatus vkGetImageMemoryRequirements vkGetImageSparseMemoryRequirements vkGetImageSubresourceLayout vkGetPhysicalDeviceSurfaceSupportKHR vkGetPipelineCacheData vkGetQueryPoolResults vkGetRenderAreaGranularity vkInvalidateMappedMemoryRanges vkMapMemory vkMergePipelineCaches vkQueueBindSparse vkResetCommandBuffer vkResetCommandPool vkResetDescriptorPool vkResetEvent vkResetFences vkSetEvent vkUnmapMemory vkUpdateDescriptorSets vkWaitForFencesBindInvalidMemory BindMemoryToDestroyedObjectEvery VkObject class of parameter will be run through this check. This check may ultimately supersede UNKNOWN_OBJECT
Object CleanupVerify that object properly destroyedDESTROY_OBJECT_FAILEDvkDestroyInstance, vkDestroyDevice, vkFreeMemory?NA
Objects LeakWhen an Instance or Device object is destroyed, validates that all objects belonging to that device/instance have previously been destroyedOBJECT_LEAKvkDestroyDevice vkDestroyInstance?NA
Object CountFlag error if number of objects requested from extenstion functions exceeds max number of actual objectsOBJCOUNT_MAX_EXCEEDEDobjTrackGetObjects objTrackGetObjectsOfType?NA
Valid Destroy ObjectValidates that an object pass into a destroy function was properly created and is currently validNONEvkDestroyInstance vkDestroyDevice vkDestroyFence vkDestroySemaphore vkDestroyEvent vkDestroyQueryPool vkDestroyBuffer vkDestroyBufferView vkDestroyImage vkDestroyImageView vkDestroyShaderModule vkDestroyShader vkDestroyPipelineCache vkDestroyPipeline vkDestroyPipelineLayout vkDestroySampler vkDestroyDescriptorSetLayout vkDestroyDescriptorPool vkDestroyCommandPool vkFreeCommandBuffers vkDestroyFramebuffer vkDestroyRenderPass vkDestroySwapchainKHRTBDThese cases need to be moved to a more appropriate error enum
Unknown objectInternal layer errors when it attempts to update use count for an object that's not in its internal tracking datastructures.UNKNOWN_OBJECTNAThis may be irrelevant due to INVALID_OBJECT error, need to look closely and merge this with that error as appropriate.
NAEnum used for informational messagesNONENANone
NAEnum used for errors in the layer itself. This does not indicate an app issue, but instead a bug in the layer.INTERNAL_ERRORNANone

ObjectTracker Pending Work

  1. Verify images have CmdPipelineBarrier layouts matching new layout parameters to CmdImage functions
  2. For specific object instances that are allowed to be NULL, update object validation to verify that such objects are either NULL or valid
  3. Verify cube array VkImageView objects use subresourceRange.arraySize (or effective arraySize when VK_REMAINING_ARRAY_SLICES is specified) that is a multiple of 6.
  4. Make object maps specific to instance and device. Objects may only be used with matching instance or device.
  5. Use reference counting for non-dispatchable objects. Multiple object creation calls may return identical handles.
  6. Update codegen for destroy_obj & validate_obj to generate all of the correct signatures and use the generated code

Threading

Threading Overview

The Threading layer checks for simultaneous use of objects by calls from multiple threads. Application code is responsible for preventing simultaneous use of the same objects by certain calls that modify objects. See bug 13433 and https://cvs.khronos.org/svn/repos/oglc/trunk/nextgen/vulkan/function_properties.csv for threading rules. Objects that may need a mutex include VkQueue, VkDeviceMemory, VkObject, VkBuffer, VkImage, VkDescriptorSet, VkDescriptorPool, VkCommandBuffer, and VkSemaphore. The most common case is that a VkCommandBuffer passed to VkCmd* calls must be used by only one thread at a time.

In addition to reporting threading rule violations, the layer will enforce a mutex for those calls. That can allow an application to continue running without actually crashing due to the reported threading problem.

The layer can only observe when a mutual exclusion rule is actually violated. It cannot insure that there is no latent race condition needing mutual exclusion.

The layer can also catch reentrant use of the same object by calls from a single thread. That might happen if Vulkan calls are made from a callback function or a signal handler. But the layer cannot prevent such a reentrant use of an object.

The layer can only observe when a mutual exclusion rule is actually violated. It cannot insure that there is no latent race condition.

Threading Details Table

CheckOverviewENUM THREADING_CHECKER_*Relevant APITestnameNotes/TODO
Thread CollisionDetects and notifies user if multiple threads are modifying thes same objectMULTIPLE_THREADSvkQueueSubmit vkFreeMemory vkMapMemory vkUnmapMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkBindBufferMemory vkBindImageMemory vkQueueBindSparse vkDestroySemaphore vkDestroyBuffer vkDestroyImage vkDestroyDescriptorPool vkResetDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkFreeCommandBuffers vkBeginCommandBuffer vkEndCommandBuffer vkResetCommandBuffer vkCmdBindPipeline vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestamp vkCmdCopyQueryPoolResults vkCmdBeginRenderPass vkCmdNextSubpass vkCmdPushConstants vkCmdEndRenderPass vkCmdExecuteCommands???NA
Thread ReentrancyDetects cases of a single thread calling Vulkan reentrantlySINGLE_THREAD_REUSEvkQueueSubmit vkFreeMemory vkMapMemory vkUnmapMemory vkFlushMappedMemoryRanges vkInvalidateMappedMemoryRanges vkBindBufferMemory vkBindImageMemory vkQueueBindSparse vkDestroySemaphore vkDestroyBuffer vkDestroyImage vkDestroyDescriptorPool vkResetDescriptorPool vkAllocateDescriptorSets vkFreeDescriptorSets vkFreeCommandBuffers vkBeginCommandBuffer vkEndCommandBuffer vkResetCommandBuffer vkCmdBindPipeline vkCmdSetViewport vkCmdSetBlendConstants vkCmdSetLineWidth vkCmdSetDepthBias vkCmdSetDepthBounds vkCmdSetStencilCompareMask vkCmdSetStencilWriteMask vkCmdSetStencilReference vkCmdBindDescriptorSets vkCmdBindIndexBuffer vkCmdBindVertexBuffers vkCmdDraw vkCmdDrawIndexed vkCmdDrawIndirect vkCmdDrawIndexedIndirect vkCmdDispatch vkCmdDispatchIndirect vkCmdCopyBuffer vkCmdCopyImage vkCmdBlitImage vkCmdCopyBufferToImage vkCmdCopyImageToBuffer vkCmdUpdateBuffer vkCmdFillBuffer vkCmdClearColorImage vkCmdClearDepthStencilImage vkCmdClearAttachments vkCmdResolveImage vkCmdSetEvent vkCmdResetEvent vkCmdWaitEvents vkCmdPipelineBarrier vkCmdBeginQuery vkCmdEndQuery vkCmdResetQueryPool vkCmdWriteTimestamp vkCmdCopyQueryPoolResults vkCmdBeginRenderPass vkCmdNextSubpass vkCmdPushConstants vkCmdEndRenderPass vkCmdExecuteCommands???NA
NAEnum used for informational messagesNONENANone

Threading Pending Work

Additional work to be done

Device Limitations

Device Limitations Overview

This layer is a work in progress. DeviceLimits layer is intended to capture two broad categories of errors:

  1. Incorrect use of APIs to query device capabilities
  2. Attempt to use API functionality beyond the capability of the underlying device

For the first category, the layer tracks which calls are made and flags errors if calls are excluded that should not be, or if call sequencing is incorrect. An example is an app that assumes attempts to Query and use queues without ever having called vkGetPhysicalDeviceQueueFamilyProperties(). Also, if an app is calling vkGetPhysicalDeviceQueueFamilyProperties() to retrieve properties with some assumed count for array size instead of first calling vkGetPhysicalDeviceQueueFamilyProperties() w/ a NULL pQueueFamilyProperties parameter in order to query the actual count. For the second category of errors, DeviceLimits stores its own internal record of underlying device capabilities and flags errors if requests are made beyond those limits. Most (all?) of the limits are queried via vkGetPhysicalDevice* calls.

Device Limitations Details Table

CheckOverviewENUM DEVLIMITS_*Relevant APITestnameNotes/TODO
Valid instanceIf an invalid instance is used, this error will be flaggedINVALID_INSTANCEvkEnumeratePhysicalDevicesNAObjectTracker should also catch this so if we made sure ObjectTracker was always on top, we could avoid this check
Valid physical deviceEnum used for informational messagesINVALID_PHYSICAL_DEVICEvkEnumeratePhysicalDevicesNAObjectTracker should also catch this so if we made sure ObjectTracker was always on top, we could avoid this check
Querying array countsFor API calls where an array count should be queried with an initial call and a NULL array pointer, verify that such a call was made before making a call with non-null array pointer.MUST_QUERY_COUNTvkEnumeratePhysicalDevices vkGetPhysicalDeviceQueueFamilyPropertiesNACreate focused test
Array count valueFor API calls where an array of details is queried, verify that the size of the requested array matches the size of the array supported by the device.COUNT_MISMATCHvkEnumeratePhysicalDevices vkGetPhysicalDeviceQueueFamilyPropertiesNACreate focused test
Queue CreationWhen creating/requesting queues, make sure that QueueFamilyPropertiesIndex and index/count within that queue family are valid.INVALID_QUEUE_CREATE_REQUESTvkGetDeviceQueue vkCreateDeviceNACreate focused test
Query PropertiesBefore creating an Image, warn if physical device properties have not been queriedMUST_QUERY_PROPERTIESvkCreateImageNAAdd validation test
API Call SequencingThis is a general error indicating that an app did not use vkGetPhysicalDevice* and other such query calls, but rather made an assumption about device capabilities.INVALID_CALL_SEQUENCEvkCreateDeviceNAAdd validation test
Feature RequestAttempting to vkCreateDevice with a feature that is not supported by the underlying physical device.INVALID_FEATURE_REQUESTEDvkCreateDeviceNAAdd validation test
Valid Image ExtentsWhen creating an Image, ensure that image extents are within device limits for the specified formatLIMITS_VIOLATIONvkCreateImageCreateImageLimitsViolationWidthNA
Valid Image Resource SizeWhen creating an image, ensure the the total image resource size is less than the queried device maximum resource sizeLIMITS_VIOLATIONvkCreateImageCreateImageResourceSizeViolationNA
AlignmentWhen updating a buffer, data should be aligned on 4 byte boundariesLIMITS_VIOLATIONvkCmdUpdateBufferUpdateBufferAlignmentNA
AlignmentWhen filling a buffer, data should be aligned on 4 byte boundariesLIMITS_VIOLATIONvkCmdFillBufferUpdateBufferAlignmentNA
NAEnum used for informational messagesNONENANone

Device Limitations Pending Work

  1. For all Formats, call vkGetPhysicalDeviceFormatProperties to pull their properties for the underlying device. After that point, if the app attempts to use any formats in violation of those properties, flag errors (this is done for Images).

Swapchain

Swapchain Overview

This layer is a work in progress. DeviceLimits layer is intended to capture two broad categories of errors:

  1. Incorrect use of APIs to query device capabilities
  2. Attempt to use API functionality beyond the capability of the underlying device

For the first category, the layer tracks which calls are made and flags errors if calls are excluded that should not be, or if call sequencing is incorrect. An example is an app that assumes attempts to Query and use queues without ever having called vkGetPhysicalDeviceQueueFamilyProperties(). Also, if an app is calling vkGetPhysicalDeviceQueueFamilyProperties() to retrieve properties with some assumed count for array size instead of first calling vkGetPhysicalDeviceQueueFamilyProperties() w/ a NULL pQueueFamilyProperties parameter in order to query the actual count. For the second category of errors, DeviceLimits stores its own internal record of underlying device capabilities and flags errors if requests are made beyond those limits. Most (all?) of the limits are queried via vkGetPhysicalDevice* calls.

Swapchain Details Table

CheckOverviewENUM SWAPCHAIN_*Relevant APITestnameNotes/TODO
Valid handleIf an invalid handle is used, this error will be flaggedINVALID_HANDLEvkDestroyInstance vkEnumeratePhysicalDevices vkCreateDevice vkDestroyDevice vkGetPhysicalDeviceSurfaceSupportKHR vkGetSurfacePropertiesKHR vkGetSurfaceFormatsKHR vkGetSurfacePresentModesKHR vkCreateSwapchainKHR vkDestroySwapchainKHR vkGetSwapchainImagesKHR vkAcquireNextImageKHR vkQueuePresentKHRNANone
Extension enabled before useValidates that a WSI extension is enabled before its functions are usedEXT_NOT_ENABLED_BUT_USEDvkGetPhysicalDeviceSurfaceSupportKHR vkGetSurfacePropertiesKHR vkGetSurfaceFormatsKHR vkGetSurfacePresentModesKHR vkCreateSwapchainKHR vkDestroySwapchainKHR vkGetSwapchainImagesKHR vkAcquireNextImageKHR vkQueuePresentKHRNANone
Swapchains destroyed before devicesValidates that vkDestroySwapchainKHR() is called for all swapchains associated with a device before vkDestroyDevice() is calledDEL_DEVICE_BEFORE_SWAPCHAINSvkDestroyDeviceNANone
Queries occur before swapchain creationValidates that vkGetSurfacePropertiesKHR(), vkGetSurfaceFormatsKHR() and vkGetSurfacePresentModesKHR() are called before vkCreateSwapchainKHR()CREATE_SWAP_WITHOUT_QUERYvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->minImageCount)Validates vkCreateSwapchainKHR(pCreateInfo->minImageCount)CREATE_SWAP_BAD_MIN_IMG_COUNTvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageExtent)Validates vkCreateSwapchainKHR(pCreateInfo->imageExtent) when window has no fixed sizeCREATE_SWAP_OUT_OF_BOUNDS_EXTENTSvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageExtent)Validates vkCreateSwapchainKHR(pCreateInfo->imageExtent) when window has a fixed sizeCREATE_SWAP_EXTENTS_NO_MATCH_WINvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->preTransform)Validates vkCreateSwapchainKHR(pCreateInfo->preTransform)CREATE_SWAP_BAD_PRE_TRANSFORMvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageArraySize)Validates vkCreateSwapchainKHR(pCreateInfo->imageArraySize)CREATE_SWAP_BAD_IMG_ARRAY_SIZEvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageUsageFlags)Validates vkCreateSwapchainKHR(pCreateInfo->imageUsageFlags)CREATE_SWAP_BAD_IMG_USAGE_FLAGSvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageColorSpace)Validates vkCreateSwapchainKHR(pCreateInfo->imageColorSpace)CREATE_SWAP_BAD_IMG_COLOR_SPACEvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageFormat)Validates vkCreateSwapchainKHR(pCreateInfo->imageFormat)CREATE_SWAP_BAD_IMG_FORMATvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->imageFormat and pCreateInfo->imageColorSpace)Validates vkCreateSwapchainKHR(pCreateInfo->imageFormat and pCreateInfo->imageColorSpace)CREATE_SWAP_BAD_IMG_FMT_CLR_SPvkCreateSwapchainKHRNANone
vkCreateSwapchainKHR(pCreateInfo->presentMode)Validates vkCreateSwapchainKHR(pCreateInfo->presentMode)CREATE_SWAP_BAD_PRESENT_MODEvkCreateSwapchainKHRNANone
Use same device for swapchainValidates that vkDestroySwapchainKHR() called with the same VkDevice as vkCreateSwapchainKHR()DESTROY_SWAP_DIFF_DEVICEvkDestroySwapchainKHRNANone
Don't use too many imagesValidates that app never tries to own too many swapchain images at a timeAPP_OWNS_TOO_MANY_IMAGESvkAcquireNextImageKHRNANone
Index too largeValidates that an image index is within the number of images in a swapchainINDEX_TOO_LARGEvkQueuePresentKHRNANone
Can't present a non-owned imageValidates that application only presents images that it ownsINDEX_NOT_IN_USEvkQueuePresentKHRNANone

Swapchain Pending Work

Additional checks to be added to Swapchain

  1. Check that the queue used for presenting was checked/valid during vkGetPhysicalDeviceSurfaceSupportKHR.
  2. One issue that has already come up is correct UsageFlags for WSI SwapChains and SurfaceProperties.
  3. Tons of other stuff including semaphore and synchronization validation.

Non-validation Layer Details

APIDump

APIDump layer is used for dumping a stream of all the Vulkan API calls that are made, along with details of the parameters to those calls.

APIDump Pending Work

  1. vkAllocateDescriptorSets does not correctly print out all of the created DescriptorSets (no array printing following main API txt)

General Pending Work

A place to capture general validation work to be done. This includes new checks that don't clearly fit into the above layers.

  1. For Upcoming Dynamic State overhaul (if approved): If dynamic state value that is consumed is never set prior to consumption, flag an error
  2. For Upcoming Dynamic State overhaul (if approved): If dynamic state that was bound as "static" in current PSO is attempted to be set with vkCmdSet* flag an error
  3. Need to check VkShaderCreateInfo.stage is being set properly (Issue reported by Dan Ginsberg)