Validation errors troubleshooting
Invalid usage flag for Buffer 0x.. used by vkCmdCopyBuffer(). In this case, Buffer
should have VK_BUFFER_USAGE_TRANSFER_DST_BIT set during creation.
Possible causes:
- You forgot to include Buf::TARGET usage flag on some buffer which is then being used as copy target.
- You forgot to include Buf::SOURCE (sic!) on a
gvector
with DEVICE_STATIC
memory, and then called one of load
methods. The problematic buffer in this case is hidden staging buffer that receives the data from the device. VPP uses the following heuristics: if the whole vector can be Buf::SOURCE, then Buf::TARGET is imposed on the intermediate buffer (otherwise it is not).
How to fix:
- Add missing Buf::TARGET or Buf::SOURCE flags.
vkCreatePipelineLayout: value of pCreateInfo->pPushConstantRanges[0].stageFlags
must not be 0. The spec valid usage text states 'stageFlags must not be 0'.
Possible causes:
- An
inPushConstant< ... >
binding point has been declared in a pipeline configuration class, but is not really used in any shader.
How to fix:
- Remove unused push constant binding points.
Shader requires VkPhysicalDeviceFeatures::shaderStorageImageExtendedFormats but
is not enabled on the device.
Possible causes:
- Some image formats require enabling additional feature on the device when used with Img::STORAGE flag.
How to fix:
- Enable the feature while creating the device, like in the example below. Caution: some mobile GPUs do not support this feature. If you target such a device, avoid using particular image format which triggers this warning for storage images.
feat.enableIfSupported ( fShaderStorageImageExtendedFormats );
Cannot use image 0x.. with specific layout VK_IMAGE_LAYOUT_GENERAL that doesn't
match the actual current layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL.
Possible causes:
- A storage image is being used with binding point, but the image is in VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL layout when executing the shader. This is wrong, because storage images must be in VK_IMAGE_LAYOUT_GENERAL layout even if they are only being read.
How to fix:
- Find the place in your code which sets VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL layoput for that particular image and change it to VK_IMAGE_LAYOUT_GENERAL.
SPIR-V module not valid: ID .. defined in block .. does not dominate its use in block ..
Possible causes:
- The first use of image binding point in shader (e.g. through image function) is inside conditional block.
How To fix:
- Add
UseImage
directive before the conditional block, like in the example below. Consider declaring all used images this way (it does not cost any resources).
{
If ( ... condition ... );
}
Shader requires VkPhysicalDeviceFeatures::shaderFloat64 but is not enabled on the device.
Possible causes:
- Shader uses double precision floating point types, but his feature is not enabled on the device.
How to fix:
- Enable the feature while creating the device, like in the example below. Caution: some mobile GPUs do not support this feature. If you target such a device, do not use double precision types, or use emulation (on two 32-bit floats) instead.
feat.enableIfSupported ( fShaderFloat64 );
/**