MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / ValidateFlags

Method ValidateFlags

layers/stateless/sl_utils.cpp:387–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387bool Context::ValidateFlags(const Location& loc, vvl::FlagBitmask flag_bitmask, VkFlags all_flags, VkFlags value,
388 const FlagType flag_type, const char* vuid, const char* flags_zero_vuid, bool instance_function) const {
389 bool skip = false;
390 skip |= ValidateFlagsImplementation<VkFlags>(loc, flag_bitmask, all_flags, value, flag_type, vuid, flags_zero_vuid);
391
392 if (ignore_unknown_enums) {
393 return skip;
394 }
395
396 if ((value & ~all_flags) != 0) {
397 skip |=
398 log.LogError(vuid, error_obj.handle, loc, "contains flag bits (0x%" PRIx32 ") which are not recognized members of %s.",
399 value, String(flag_bitmask));
400 }
401
402 if (!skip && value != 0) {
403 vvl::Extensions required = IsValidFlagValue(flag_bitmask, value, instance_function);
404 if (!required.empty()) {
405 // From https://gitlab.khronos.org/vulkan/vulkan/-/issues/4586
406 // Swapchain is only place we have |imageUsage| and it is easy to blindly map it to the supported queried flags
407 // This is a quick fix, without adding yet another ValidateFlags overload, to give better info around WSI
408 const bool image_usage_hint = loc.field == Field::imageUsage;
409 skip |=
410 log.LogError(vuid, error_obj.handle, loc, "has %s values (%s) that requires the extensions %s.%s",
411 String(flag_bitmask), DescribeFlagBitmaskValue(flag_bitmask, value).c_str(), String(required).c_str(),
412 image_usage_hint ? "\nHint: Make sure to filter the supportedUsageFlags from "
413 "vkGetPhysicalDeviceSurfaceCapabilitiesKHR to only use what is desired."
414 : "");
415 }
416 }
417 return skip;
418}
419
420bool Context::ValidateFlags(const Location& loc, vvl::FlagBitmask flag_bitmask, VkFlags64 all_flags, VkFlags64 value,
421 const FlagType flag_type, const char* vuid, const char* flags_zero_vuid, bool instance_function) const {

Calls 4

StringFunction · 0.85
LogErrorMethod · 0.80
c_strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected