layers: GH1889, check for CLAMP_TO_EDGE ext enable
Using this addressing mode in CreateSampler should generate an error
if the extension is not enabled.
Also added layer validation test for this check and updated the error
database.
Change-Id: If0a434976aa4bb30ab23ff6babb95df3af7a4efd
diff --git a/layers/parameter_validation.cpp b/layers/parameter_validation.cpp
index e75b736..ee33ef8 100644
--- a/layers/parameter_validation.cpp
+++ b/layers/parameter_validation.cpp
@@ -2471,6 +2471,20 @@
skip |= validate_ranged_enum(report_data, "vkCreateSampler", "pCreateInfo->borderColor", "VkBorderColor",
VK_BORDER_COLOR_BEGIN_RANGE, VK_BORDER_COLOR_END_RANGE, pCreateInfo->borderColor);
}
+
+ // If any of addressModeU, addressModeV or addressModeW are VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, the
+ // VK_KHR_sampler_mirror_clamp_to_edge extension must be enabled
+ if (!device_data->extensions.vk_khr_sampler_mirror_clamp_to_edge &&
+ ((pCreateInfo->addressModeU == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) ||
+ (pCreateInfo->addressModeV == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE) ||
+ (pCreateInfo->addressModeW == VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE))) {
+ skip |=
+ log_msg(report_data, VK_DEBUG_REPORT_ERROR_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0, __LINE__,
+ VALIDATION_ERROR_1260086e, LayerName,
+ "vkCreateSampler(): A VkSamplerAddressMode value is set to VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE "
+ "but the VK_KHR_sampler_mirror_clamp_to_edge extension has not been enabled. %s",
+ validation_error_map[VALIDATION_ERROR_1260086e]);
+ }
}
if (!skip) {