From 414c058ca70f8e2d0a43686aa1644534a628b3ef Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sun, 8 Oct 2017 23:54:53 +0200 Subject: hellovulkantexture: Fix issues with new validation layer Upgrading to a recent Vulkan SDK (e.g. 1.0.61) leads to getting a few previously unseen warnings from the validation layers. Fix these: vkDebug: ParameterValidation: 8: vkCreateSampler(): The samplerAnisotropy feature was not enabled at device-creation time, so the maxAnisotropy member of the VkSamplerCreateInfo structure must be 1.0 but is 0.000000. vkDebug: DS: 461375808: vkCmdPipelineBarrier(): pImageMemBarriers[0].srcAccessMask (0x4000) is not supported by srcStageMask (0x1). The spec valid usage text states 'Any given element of pMemoryBarriers, pBufferMemoryBarriers or pImageMemoryBarriers must not have any access flag included in its srcAccessMask member if that bit is not supported by any of the pipeline stages in srcStageMask, as specified in the table of supported access types.' vkDebug: DS: 6: vkCmdDraw(): Cannot use image 0x7 with specific layout VK_IMAGE_LAYOUT_GENERAL that doesn't match the actual current layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL. vkDebug: DS: 61: Descriptor set 0xc encountered the following validation error at vkCmdDraw() time: Image layout specified at vkUpdateDescriptorSets() time doesn't match actual image layout at time descriptor is used. See previous error callback for specific details. Change-Id: I1a3200221ac725c2fa661eff3ac075262b9355c2 Reviewed-by: Andy Nichols --- examples/vulkan/hellovulkantexture/hellovulkantexture.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/vulkan') diff --git a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp index 086bca781f..543eb7884a 100644 --- a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp +++ b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp @@ -294,7 +294,7 @@ void VulkanRenderer::ensureTexture() barrier.oldLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; barrier.newLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - barrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT; + barrier.srcAccessMask = 0; // VK_ACCESS_HOST_WRITE_BIT ### no, keep validation layer happy (??) barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT; barrier.image = m_texImage; @@ -453,6 +453,7 @@ void VulkanRenderer::initResources() samplerInfo.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerInfo.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samplerInfo.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; + samplerInfo.maxAnisotropy = 1.0f; err = m_devFuncs->vkCreateSampler(dev, &samplerInfo, nullptr, &m_sampler); if (err != VK_SUCCESS) qFatal("Failed to create sampler: %d", err); @@ -528,7 +529,7 @@ void VulkanRenderer::initResources() VkDescriptorImageInfo descImageInfo = { m_sampler, m_texView, - VK_IMAGE_LAYOUT_GENERAL + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL }; descWrite[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; -- cgit v1.2.1