Skip to content

Commit

Permalink
layers: Cleanup of error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
spencer-lunarg committed Dec 16, 2024
1 parent 00ad32d commit c3c127e
Show file tree
Hide file tree
Showing 31 changed files with 534 additions and 611 deletions.
5 changes: 3 additions & 2 deletions layers/best_practices/bp_render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* limitations under the License.
*/

#include <vulkan/vk_enum_string_helper.h>
#include "best_practices/best_practices_validation.h"
#include "error_message/error_strings.h"
#include "best_practices/bp_state.h"
Expand Down Expand Up @@ -829,11 +830,11 @@ bool BestPractices::ValidateCmdEndRenderPass(VkCommandBuffer commandBuffer, cons
if (untouched_aspects) {
skip |= LogPerformanceWarning(
"BestPractices-vkCmdEndRenderPass-redundant-attachment-on-tile", commandBuffer, loc,
"%s %s: Render pass was ended, but attachment #%u (format: %u, untouched aspects %s) "
"%s %s: Render pass was ended, but attachment #%u (format: %s, untouched aspects %s) "
"was never accessed by a pipeline or clear command. "
"On tile-based architectures, LOAD_OP_LOAD and STORE_OP_STORE consume bandwidth and should not be part of the "
"render pass if the attachments are not intended to be accessed.",
VendorSpecificTag(kBPVendorArm), VendorSpecificTag(kBPVendorIMG), i, attachment.format,
VendorSpecificTag(kBPVendorArm), VendorSpecificTag(kBPVendorIMG), i, string_VkFormat(attachment.format),
string_VkImageAspectFlags(untouched_aspects).c_str());
}
}
Expand Down
17 changes: 7 additions & 10 deletions layers/core_checks/cc_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "state_tracker/image_state.h"
#include "state_tracker/sampler_state.h"
#include "generated/dispatch_functions.h"
#include "error_message/error_strings.h"

#if defined(VK_USE_PLATFORM_ANDROID_KHR)
// Android-specific validation that uses types defined only on Android and only for NDK versions
Expand Down Expand Up @@ -394,9 +395,8 @@ bool CoreChecks::ValidateAllocateMemoryANDROID(const VkMemoryAllocateInfo &alloc
"is %s but allocationSize is 0.", FormatHandle(mem_ded_alloc_info->buffer).c_str());
}
} else if (0 == allocate_info.allocationSize) {
skip |=
LogError("VUID-VkMemoryAllocateInfo-pNext-07900", device, allocate_info_loc,
"pNext chain does not contain an instance of VkMemoryDedicatedAllocateInfo, but allocationSize is 0.");
skip |= LogError("VUID-VkMemoryAllocateInfo-pNext-07900", device, allocate_info_loc.dot(Field::pNext),
"chain does not contain an instance of VkMemoryDedicatedAllocateInfo, but allocationSize is 0.");
}
}
}
Expand Down Expand Up @@ -596,13 +596,10 @@ bool CoreChecks::ValidateCreateImageViewANDROID(const VkImageViewCreateInfo &cre

// Errors in create_info swizzles
if (IsIdentitySwizzle(create_info.components) == false) {
skip |= LogError(
"VUID-VkImageViewCreateInfo-image-02401", create_info.image, create_info_loc.dot(Field::image),
"was chained with a VkExternalFormatANDROID struct, but "
"includes one or more non-identity component swizzles, r swizzle = %s, g swizzle = %s, b swizzle = %s, a swizzle "
"= %s.",
string_VkComponentSwizzle(create_info.components.r), string_VkComponentSwizzle(create_info.components.g),
string_VkComponentSwizzle(create_info.components.b), string_VkComponentSwizzle(create_info.components.a));
skip |= LogError("VUID-VkImageViewCreateInfo-image-02401", create_info.image, create_info_loc.dot(Field::image),
"was chained with a VkExternalFormatANDROID struct, but "
"includes one or more non-identity component swizzles\n%s.",
string_VkComponentMapping(create_info.components).c_str());
}
}

Expand Down
54 changes: 26 additions & 28 deletions layers/core_checks/cc_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,20 +391,19 @@ bool CoreChecks::PreCallValidateCreateBufferView(VkDevice device, const VkBuffer
alignment_requirement = std::min(alignment_requirement, element_size);
}
if (SafeModulo(pCreateInfo->offset, alignment_requirement) != 0) {
skip |= LogError(
"VUID-VkBufferViewCreateInfo-buffer-02750", objlist, create_info_loc,
"If buffer was created with usage containing "
"VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT, "
"VkBufferViewCreateInfo offset (%" PRIuLEAST64
") must be a multiple of the lesser of "
"VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::storageTexelBufferOffsetAlignmentBytes (%" PRIuLEAST64
") or, if VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::storageTexelBufferOffsetSingleTexelAlignment "
"(%" PRId32
") is VK_TRUE, the size of a texel of the requested format. "
"If the size of a texel is a multiple of three bytes, then the size of a "
"single component of format is used instead",
pCreateInfo->offset, phys_dev_props_core13.storageTexelBufferOffsetAlignmentBytes,
phys_dev_props_core13.storageTexelBufferOffsetSingleTexelAlignment);
skip |= LogError("VUID-VkBufferViewCreateInfo-buffer-02750", objlist, create_info_loc,
"If buffer was created with usage containing "
"VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT, "
"VkBufferViewCreateInfo offset (%" PRIuLEAST64
") must be a multiple of the lesser of "
"storageTexelBufferOffsetAlignmentBytes (%" PRIuLEAST64
") or, if storageTexelBufferOffsetSingleTexelAlignment "
"(%" PRId32
") is VK_TRUE, the size of a texel of the requested format. "
"If the size of a texel is a multiple of three bytes, then the size of a "
"single component of format is used instead",
pCreateInfo->offset, phys_dev_props_core13.storageTexelBufferOffsetAlignmentBytes,
phys_dev_props_core13.storageTexelBufferOffsetSingleTexelAlignment);
}
}
if (buffer_state.usage & VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT) {
Expand All @@ -413,20 +412,19 @@ bool CoreChecks::PreCallValidateCreateBufferView(VkDevice device, const VkBuffer
alignment_requirement = std::min(alignment_requirement, element_size);
}
if (SafeModulo(pCreateInfo->offset, alignment_requirement) != 0) {
skip |= LogError(
"VUID-VkBufferViewCreateInfo-buffer-02751", objlist, create_info_loc,
"If buffer was created with usage containing "
"VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, "
"VkBufferViewCreateInfo offset (%" PRIuLEAST64
") must be a multiple of the lesser of "
"VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::uniformTexelBufferOffsetAlignmentBytes (%" PRIuLEAST64
") or, if VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT::uniformTexelBufferOffsetSingleTexelAlignment "
"(%" PRId32
") is VK_TRUE, the size of a texel of the requested format. "
"If the size of a texel is a multiple of three bytes, then the size of a "
"single component of format is used instead",
pCreateInfo->offset, phys_dev_props_core13.uniformTexelBufferOffsetAlignmentBytes,
phys_dev_props_core13.uniformTexelBufferOffsetSingleTexelAlignment);
skip |= LogError("VUID-VkBufferViewCreateInfo-buffer-02751", objlist, create_info_loc,
"If buffer was created with usage containing "
"VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT, "
"VkBufferViewCreateInfo offset (%" PRIuLEAST64
") must be a multiple of the lesser of "
"uniformTexelBufferOffsetAlignmentBytes (%" PRIuLEAST64
") or, if uniformTexelBufferOffsetSingleTexelAlignment "
"(%" PRId32
") is VK_TRUE, the size of a texel of the requested format. "
"If the size of a texel is a multiple of three bytes, then the size of a "
"single component of format is used instead",
pCreateInfo->offset, phys_dev_props_core13.uniformTexelBufferOffsetAlignmentBytes,
phys_dev_props_core13.uniformTexelBufferOffsetSingleTexelAlignment);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions layers/core_checks/cc_cmd_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ bool CoreChecks::PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer
}
} else {
if (!p_inherited_rendering_info) {
skip |= LogError("VUID-VkCommandBufferBeginInfo-flags-06002", commandBuffer, inheritance_loc,
"pNext chain of pInheritanceInfo must include a "
"VkCommandBufferInheritanceRenderingInfo structure.");
skip |=
LogError("VUID-VkCommandBufferBeginInfo-flags-06002", commandBuffer, inheritance_loc.dot(Field::pNext),
"chain must include a VkCommandBufferInheritanceRenderingInfo structure.");
}
}
}
Expand Down Expand Up @@ -1724,7 +1724,7 @@ bool CoreChecks::PreCallValidateCmdBindVertexBuffers2(VkCommandBuffer commandBuf
if (!enabled_features.maintenance5) {
skip |= LogError("VUID-vkCmdBindVertexBuffers2-pSizes-03358", objlist, error_obj.location.dot(Field::pSizes, i),
"is VK_WHOLE_SIZE, which is not valid in this context. This can be fixed by enabling the "
"VkPhysicalDeviceMaintenance5FeaturesKHR::maintenance5 feature.");
"maintenance5 feature.");
}
} else if (offset + size > buffer_state->create_info.size) {
skip |= LogError("VUID-vkCmdBindVertexBuffers2-pSizes-03358", objlist, error_obj.location.dot(Field::pOffsets, i),
Expand Down
16 changes: 8 additions & 8 deletions layers/core_checks/cc_cmd_buffer_dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -887,8 +887,8 @@ bool CoreChecks::ValidateGraphicsDynamicStateValue(const LastBound& last_bound_s
((cb_state.dynamic_state_value.write_mask_front != 0) || (cb_state.dynamic_state_value.write_mask_back != 0))) {
skip |= LogError(vuid.dynamic_stencil_write_mask_08716, objlist, vuid.loc(),
"Fragment shader contains OpStencilAttachmentReadEXT, but writeMask parameter in the last "
"call to vkCmdSetStencilWriteMask is not equal to 0 for both front (=%" PRIu32
") and back (=%" PRIu32 ").",
"call to vkCmdSetStencilWriteMask is not equal to 0 for both front (%" PRIu32
") and back (%" PRIu32 ").",
cb_state.dynamic_state_value.write_mask_front, cb_state.dynamic_state_value.write_mask_back);
}
}
Expand Down Expand Up @@ -1811,7 +1811,7 @@ bool CoreChecks::PreCallValidateCmdSetDepthBias(VkCommandBuffer commandBuffer, f
if ((depthBiasClamp != 0.0) && !enabled_features.depthBiasClamp) {
skip |=
LogError("VUID-vkCmdSetDepthBias-depthBiasClamp-00790", commandBuffer, error_obj.location.dot(Field::depthBiasClamp),
"is %f, but the depthBiasClamp device feature was not enabled.", depthBiasClamp);
"is %f (not 0.0f), but the depthBiasClamp feature was not enabled.", depthBiasClamp);
}
return skip;
}
Expand Down Expand Up @@ -1853,7 +1853,7 @@ bool CoreChecks::PreCallValidateCmdSetDepthBias2EXT(VkCommandBuffer commandBuffe
if ((pDepthBiasInfo->depthBiasClamp != 0.0) && !enabled_features.depthBiasClamp) {
skip |= LogError("VUID-VkDepthBiasInfoEXT-depthBiasClamp-08950", commandBuffer,
error_obj.location.dot(Field::pDepthBiasInfo).dot(Field::depthBiasClamp),
"is %f, but the depthBiasClamp device feature was not enabled.", pDepthBiasInfo->depthBiasClamp);
"is %f (not 0.0f), but the depthBiasClamp feature was not enabled.", pDepthBiasInfo->depthBiasClamp);
}

if (const auto *depth_bias_representation = vku::FindStructInPNextChain<VkDepthBiasRepresentationInfoEXT>(pDepthBiasInfo->pNext)) {
Expand Down Expand Up @@ -2438,14 +2438,14 @@ bool CoreChecks::PreCallValidateCmdSetColorBlendEquationEXT(VkCommandBuffer comm
equation.srcColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA) {
skip |= LogError("VUID-VkColorBlendEquationEXT-constantAlphaColorBlendFactors-07362", commandBuffer,
equation_loc.dot(Field::srcColorBlendFactor),
"is %s but the constantAlphaColorBlendFactors feature was not supported.",
"is %s but the constantAlphaColorBlendFactors feature was not enabled.",
string_VkBlendFactor(equation.srcColorBlendFactor));
}
if (equation.dstColorBlendFactor == VK_BLEND_FACTOR_CONSTANT_ALPHA ||
equation.dstColorBlendFactor == VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA) {
skip |= LogError("VUID-VkColorBlendEquationEXT-constantAlphaColorBlendFactors-07363", commandBuffer,
equation_loc.dot(Field::dstColorBlendFactor),
"is %s but the constantAlphaColorBlendFactors feature was not supported.",
"is %s but the constantAlphaColorBlendFactors feature was not enabled.",
string_VkBlendFactor(equation.dstColorBlendFactor));
}
}
Expand Down Expand Up @@ -2492,7 +2492,7 @@ bool CoreChecks::PreCallValidateCmdSetRasterizationStreamEXT(VkCommandBuffer com
error_obj.location.dot(Field::rasterizationStream),
"(%" PRIu32
") is non-zero but "
"the transformFeedbackRasterizationStreamSelect feature was not supported.",
"the transformFeedbackRasterizationStreamSelect feature was not enabled.",
rasterizationStream);
}
return skip;
Expand Down Expand Up @@ -2593,7 +2593,7 @@ bool CoreChecks::PreCallValidateCmdSetColorBlendAdvancedEXT(VkCommandBuffer comm
!phys_dev_ext_props.blend_operation_advanced_props.advancedBlendCorrelatedOverlap) {
skip |= LogError("VUID-VkColorBlendAdvancedEXT-blendOverlap-07507", commandBuffer,
error_obj.location.dot(Field::pColorBlendAdvanced, attachment).dot(Field::blendOverlap),
"is %s, but the advancedBlendCorrelatedOverlap feature was not supported.",
"is %s, but the advancedBlendCorrelatedOverlap feature was not enabled.",
string_VkBlendOverlapEXT(advanced.blendOverlap));
}
}
Expand Down
33 changes: 14 additions & 19 deletions layers/core_checks/cc_descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "drawdispatch/descriptor_validator.h"
#include "drawdispatch/drawdispatch_vuids.h"
#include "utils/vk_struct_compare.h"
#include "error_message/error_strings.h"

using DescriptorSet = vvl::DescriptorSet;
using DescriptorSetLayout = vvl::DescriptorSetLayout;
Expand Down Expand Up @@ -1369,13 +1370,8 @@ bool CoreChecks::ValidateImageUpdate(const vvl::ImageView &view_state, VkImageLa
const VkComponentMapping components = view_state.create_info.components;
if (IsIdentitySwizzle(components) == false) {
skip |= LogError("VUID-VkWriteDescriptorSet-descriptorType-00336", objlist, image_info_loc.dot(Field::imageView),
"has a non-identiy swizzle component, here are the actual swizzle values:\n"
"r swizzle = %s\n"
"g swizzle = %s\n"
"b swizzle = %s\n"
"a swizzle = %s\n",
string_VkComponentSwizzle(components.r), string_VkComponentSwizzle(components.g),
string_VkComponentSwizzle(components.b), string_VkComponentSwizzle(components.a));
"has a non-identiy swizzle component, here are the actual swizzle values:\n%s",
string_VkComponentMapping(components).c_str());
}
}

Expand Down Expand Up @@ -4543,26 +4539,25 @@ bool CoreChecks::ValidateCmdPushConstants(VkCommandBuffer commandBuffer, VkPipel
if (matching_stages != range.stageFlags) {
const char *vuid = is_2 ? "VUID-VkPushConstantsInfo-offset-01796" : "VUID-vkCmdPushConstants-offset-01796";
skip |= LogError(vuid, commandBuffer, loc,
"stageFlags (%s, offset (%" PRIu32 "), and size (%" PRIu32
"), must contain all stages in overlapping VkPushConstantRange stageFlags (%s), offset (%" PRIu32
"), and size (%" PRIu32 ") in %s.",
string_VkShaderStageFlags(stageFlags).c_str(), offset, size,
string_VkShaderStageFlags(range.stageFlags).c_str(), range.offset, range.size,
FormatHandle(layout).c_str());
"is called with\nstageFlags (%s), offset (%" PRIu32 "), size (%" PRIu32
")\nwhich is missing stageFlags from the overlapping VkPushConstantRange in %s\nstageFlags (%s), "
"offset (%" PRIu32 "), size (%" PRIu32 ")",
string_VkShaderStageFlags(stageFlags).c_str(), offset, size, FormatHandle(layout).c_str(),
string_VkShaderStageFlags(range.stageFlags).c_str(), range.offset, range.size);
}

// Accumulate all stages we've found
found_stages = matching_stages | found_stages;
}
}
if (found_stages != stageFlags) {
uint32_t missing_stages = ~found_stages & stageFlags;
const uint32_t missing_stages = ~found_stages & stageFlags;
const char *vuid = is_2 ? "VUID-VkPushConstantsInfo-offset-01795" : "VUID-vkCmdPushConstants-offset-01795";
skip |=
LogError(vuid, commandBuffer, loc,
"%s, VkPushConstantRange in %s overlapping offset = %" PRIu32 " and size = %" PRIu32 ", do not contain %s.",
string_VkShaderStageFlags(stageFlags).c_str(), FormatHandle(layout).c_str(), offset, size,
string_VkShaderStageFlags(missing_stages).c_str());
skip |= LogError(vuid, commandBuffer, loc,
"is called with\nstageFlags (%s), offset (%" PRIu32 "), size (%" PRIu32
")\nbut the %s doesn't have a VkPushConstantRange with %s",
string_VkShaderStageFlags(stageFlags).c_str(), offset, size, FormatHandle(layout).c_str(),
string_VkShaderStageFlags(missing_stages).c_str());
}
return skip;
}
Expand Down
Loading

0 comments on commit c3c127e

Please sign in to comment.