Skip to content

Commit 78161e5

Browse files
layers: More usage of vvl::Image getter
1 parent 3e34817 commit 78161e5

12 files changed

Lines changed: 115 additions & 120 deletions

layers/best_practices/bp_copy_blit_resolve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ bool BestPractices::PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuf
339339
VendorSpecificTag(kBPVendorAMD));
340340
}
341341
if (VendorCheckEnabled(kBPVendorNVIDIA)) {
342-
skip |= ValidateClearColor(commandBuffer, dst_image->create_info.format, *pColor, error_obj.location);
342+
skip |= ValidateClearColor(commandBuffer, dst_image->GetFormat(), *pColor, error_obj.location);
343343
}
344344

345345
return skip;

layers/best_practices/bp_state.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ void CommandBufferSubState::RecordClearColorImage(vvl::Image& image_state, VkIma
501501
}
502502

503503
if (validator.VendorCheckEnabled(kBPVendorNVIDIA)) {
504-
validator.RecordClearColor(image_state.create_info.format, *color_values);
504+
validator.RecordClearColor(image_state.GetFormat(), *color_values);
505505
}
506506
}
507507

layers/core_checks/cc_copy_blit_resolve.cpp

Lines changed: 65 additions & 68 deletions
Large diffs are not rendered by default.

layers/core_checks/cc_descriptor.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,19 +1274,19 @@ bool CoreChecks::ValidateImageUpdate(const vvl::ImageView& view_state, VkImageLa
12741274
}
12751275
}
12761276

1277-
if (vkuFormatIsDepthOrStencil(image_state->create_info.format)) {
1277+
if (vkuFormatIsDepthOrStencil(image_state->GetFormat())) {
12781278
if (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) {
12791279
if (aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) {
12801280
skip |= LogError(
12811281
"VUID-VkDescriptorImageInfo-imageView-01976", objlist, image_info_loc.dot(Field::imageView),
12821282
"was created with an image format %s, but the image aspectMask (%s) has both STENCIL and DEPTH aspects set ",
1283-
string_VkFormat(image_state->create_info.format), string_VkImageAspectFlags(aspect_mask).c_str());
1283+
string_VkFormat(image_state->GetFormat()), string_VkImageAspectFlags(aspect_mask).c_str());
12841284
}
12851285
} else if ((aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) == 0) {
12861286
skip |=
12871287
LogError("VUID-VkDescriptorImageInfo-imageView-01976", objlist, image_info_loc.dot(Field::imageView),
12881288
"was created with an image format %s, but the image aspectMask (%s) is missing a STENCIL or DEPTH aspects",
1289-
string_VkFormat(image_state->create_info.format), string_VkImageAspectFlags(aspect_mask).c_str());
1289+
string_VkFormat(image_state->GetFormat()), string_VkImageAspectFlags(aspect_mask).c_str());
12901290
}
12911291
}
12921292

@@ -2196,9 +2196,9 @@ bool CoreChecks::VerifyWriteUpdateContents(const vvl::DescriptorSet& dst_set, co
21962196

21972197
if (auto sampler_state = Get<vvl::Sampler>(sampler)) {
21982198
// If there is an immutable sampler then |sampler| isn't used, so the following VU does not apply.
2199-
if (vkuFormatIsMultiplane(image_state->create_info.format)) {
2199+
if (vkuFormatIsMultiplane(image_state->GetFormat())) {
22002200
// multiplane formats must be created with mutable format bit
2201-
const VkFormat image_format = image_state->create_info.format;
2201+
const VkFormat image_format = image_state->GetFormat();
22022202
if (0 == (image_state->create_info.flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)) {
22032203
const LogObjectList objlist(update.dstSet, image_state->Handle());
22042204
skip |= LogError("VUID-VkDescriptorImageInfo-sampler-01564", objlist, write_loc,
@@ -5407,15 +5407,15 @@ bool CoreChecks::PreCallValidateWriteResourceDescriptorsEXT(VkDevice device, uin
54075407
}
54085408
}
54095409

5410-
if (vkuFormatIsDepthOrStencil(image_state->create_info.format)) {
5410+
if (vkuFormatIsDepthOrStencil(image_state->GetFormat())) {
54115411
const VkImageAspectFlags aspect_mask = image_view_ci.subresourceRange.aspectMask;
54125412
if (aspect_mask & VK_IMAGE_ASPECT_DEPTH_BIT) {
54135413
if (aspect_mask & VK_IMAGE_ASPECT_STENCIL_BIT) {
54145414
skip |= LogError("VUID-VkImageDescriptorInfoEXT-pView-11430", image_view_ci.image,
54155415
data_loc.dot(Field::pImage).dot(Field::pView).dot(Field::image),
54165416
"is a depth/stencil image (%s), but aspectMask (%s) has both STENCIL and DEPTH aspect "
54175417
"set\npResources[%" PRIu32 "].type = %s",
5418-
string_VkFormat(image_state->create_info.format),
5418+
string_VkFormat(image_state->GetFormat()),
54195419
string_VkImageAspectFlags(image_view_ci.subresourceRange.aspectMask).c_str(), i,
54205420
string_VkDescriptorType(resource.type));
54215421
}
@@ -5424,7 +5424,7 @@ bool CoreChecks::PreCallValidateWriteResourceDescriptorsEXT(VkDevice device, uin
54245424
data_loc.dot(Field::pImage).dot(Field::pView).dot(Field::image),
54255425
"is a depth/stencil image (%s), but aspectMask (%s) is missing a STENCIL or DEPTH "
54265426
"aspects\npResources[%" PRIu32 "].type = %s",
5427-
string_VkFormat(image_state->create_info.format),
5427+
string_VkFormat(image_state->GetFormat()),
54285428
string_VkImageAspectFlags(image_view_ci.subresourceRange.aspectMask).c_str(), i,
54295429
string_VkDescriptorType(resource.type));
54305430
}

layers/core_checks/cc_device_memory.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -311,19 +311,19 @@ bool CoreChecks::HasExternalMemoryImportSupport(const vvl::Image& image, VkExter
311311
// TODO - Want to use vvl::PnextChainExtract, but would need to cleanup (and test) rest of how we add the other pNext here
312312
// Note - some pNext structs that can be found in VkImageCreateInfo::pNext are not allowed in VkPhysicalDeviceImageFormatInfo2
313313
VkImageFormatListCreateInfo format_list = vku::InitStructHelper();
314-
if (auto original_format_list = vku::FindStructInPNextChain<VkImageFormatListCreateInfo>(image.create_info.pNext)) {
314+
if (auto original_format_list = vku::FindStructInPNextChain<VkImageFormatListCreateInfo>(image.GetPNext())) {
315315
format_list.pViewFormats = original_format_list->pViewFormats;
316316
format_list.viewFormatCount = original_format_list->viewFormatCount;
317317
vvl::PnextChainAdd(&external_info, &format_list);
318318
}
319319
VkImageStencilUsageCreateInfo stencil_usage = vku::InitStructHelper();
320-
if (auto original_stencil_usage = vku::FindStructInPNextChain<VkImageStencilUsageCreateInfo>(image.create_info.pNext)) {
320+
if (auto original_stencil_usage = vku::FindStructInPNextChain<VkImageStencilUsageCreateInfo>(image.GetPNext())) {
321321
stencil_usage.stencilUsage = original_stencil_usage->stencilUsage;
322322
vvl::PnextChainAdd(&external_info, &stencil_usage);
323323
}
324324
VkPhysicalDeviceImageViewImageFormatInfoEXT image_view_format = vku::InitStructHelper();
325325
if (auto original_image_view_format =
326-
vku::FindStructInPNextChain<VkPhysicalDeviceImageViewImageFormatInfoEXT>(image.create_info.pNext)) {
326+
vku::FindStructInPNextChain<VkPhysicalDeviceImageViewImageFormatInfoEXT>(image.GetPNext())) {
327327
image_view_format.imageViewType = original_image_view_format->imageViewType;
328328
vvl::PnextChainAdd(&external_info, &image_view_format);
329329
}
@@ -1187,7 +1187,7 @@ bool CoreChecks::PreCallValidateGetImageMemoryRequirements2(VkDevice device, con
11871187

11881188
auto image_state = Get<vvl::Image>(pInfo->image);
11891189
ASSERT_AND_RETURN_SKIP(image_state);
1190-
const VkFormat image_format = image_state->create_info.format;
1190+
const VkFormat image_format = image_state->GetFormat();
11911191
const VkImageTiling image_tiling = image_state->GetTiling();
11921192
const auto* image_plane_info = vku::FindStructInPNextChain<VkImagePlaneMemoryRequirementsInfo>(pInfo->pNext);
11931193
if (!image_plane_info && image_state->disjoint) {
@@ -1956,7 +1956,7 @@ bool CoreChecks::ValidateBindImageMemory(uint32_t bindInfoCount, const VkBindIma
19561956
if (!image_state || !image_state->disjoint) {
19571957
continue;
19581958
}
1959-
const uint32_t total_planes = vkuFormatPlaneCount(image_state->create_info.format);
1959+
const uint32_t total_planes = vkuFormatPlaneCount(image_state->GetFormat());
19601960
for (uint32_t i = 0; i < total_planes; i++) {
19611961
if (resource.second[i] == vvl::kNoIndex32) {
19621962
skip |= LogError("VUID-vkBindImageMemory2-pBindInfos-02858", resource.first, error_obj.location,
@@ -2086,20 +2086,19 @@ bool CoreChecks::ValidateBindImageMemoryResource(const VkBindImageMemoryInfo& bi
20862086
// TODO - Want to use vvl::PnextChainExtract, but would need to cleanup (and test) rest of how we add the other
20872087
// pNext here
20882088
VkImageFormatListCreateInfo format_list = vku::InitStructHelper();
2089-
if (auto original_format_list = vku::FindStructInPNextChain<VkImageFormatListCreateInfo>(image_state.create_info.pNext)) {
2089+
if (auto original_format_list = vku::FindStructInPNextChain<VkImageFormatListCreateInfo>(image_state.GetPNext())) {
20902090
format_list.pViewFormats = original_format_list->pViewFormats;
20912091
format_list.viewFormatCount = original_format_list->viewFormatCount;
20922092
vvl::PnextChainAdd(&image_format_info, &format_list);
20932093
}
20942094
VkImageStencilUsageCreateInfo stencil_usage = vku::InitStructHelper();
2095-
if (auto original_stencil_usage =
2096-
vku::FindStructInPNextChain<VkImageStencilUsageCreateInfo>(image_state.create_info.pNext)) {
2095+
if (auto original_stencil_usage = vku::FindStructInPNextChain<VkImageStencilUsageCreateInfo>(image_state.GetPNext())) {
20972096
stencil_usage.stencilUsage = original_stencil_usage->stencilUsage;
20982097
vvl::PnextChainAdd(&image_format_info, &stencil_usage);
20992098
}
21002099
VkPhysicalDeviceImageViewImageFormatInfoEXT image_view_format = vku::InitStructHelper();
21012100
if (auto original_image_view_format =
2102-
vku::FindStructInPNextChain<VkPhysicalDeviceImageViewImageFormatInfoEXT>(image_state.create_info.pNext)) {
2101+
vku::FindStructInPNextChain<VkPhysicalDeviceImageViewImageFormatInfoEXT>(image_state.GetPNext())) {
21032102
image_view_format.imageViewType = original_image_view_format->imageViewType;
21042103
vvl::PnextChainAdd(&image_format_info, &image_view_format);
21052104
}
@@ -2592,8 +2591,8 @@ bool CoreChecks::ValidateSparseMemoryBind(const VkSparseMemoryBind& bind, const
25922591
bool CoreChecks::ValidateImageSubresourceSparseImageMemoryBind(vvl::Image const& image_state, VkImageSubresource const& subresource,
25932592
const Location& bind_loc, const Location& subresource_loc) const {
25942593
bool skip = false;
2595-
skip |= ValidateImageAspectMask(image_state.VkHandle(), image_state.create_info.format, subresource.aspectMask,
2596-
image_state.disjoint, bind_loc, "VUID-VkSparseImageMemoryBindInfo-subresource-01106");
2594+
skip |= ValidateImageAspectMask(image_state.VkHandle(), image_state.GetFormat(), subresource.aspectMask, image_state.disjoint,
2595+
bind_loc, "VUID-VkSparseImageMemoryBindInfo-subresource-01106");
25972596

25982597
if (subresource.mipLevel >= image_state.GetMipLevels()) {
25992598
skip |=

layers/core_checks/cc_external_object.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ bool CoreChecks::PreCallValidateExportMetalObjectsEXT(VkDevice device, VkExportM
396396
"VkImageCreateInfo structure",
397397
FormatHandle(metal_texture_ptr->image).c_str());
398398
}
399-
auto format_plane_count = vkuFormatPlaneCount(image_info->create_info.format);
399+
auto format_plane_count = vkuFormatPlaneCount(image_info->GetFormat());
400400
auto image_plane = metal_texture_ptr->plane;
401401
if (!(format_plane_count > 1) && (image_plane != VK_IMAGE_ASPECT_PLANE_0_BIT)) {
402402
skip |= LogError(
@@ -405,7 +405,7 @@ bool CoreChecks::PreCallValidateExportMetalObjectsEXT(VkDevice device, VkExportM
405405
"%s, and plane = %s, but image was created with format %s, which is not multiplaner and plane is "
406406
"required to be VK_IMAGE_ASPECT_PLANE_0_BIT",
407407
FormatHandle(metal_texture_ptr->image).c_str(), string_VkImageAspectFlags(image_plane).c_str(),
408-
string_VkFormat(image_info->create_info.format));
408+
string_VkFormat(image_info->GetFormat()));
409409
}
410410
if ((format_plane_count == 2) && (image_plane == VK_IMAGE_ASPECT_PLANE_2_BIT)) {
411411
skip |= LogError(
@@ -415,7 +415,7 @@ bool CoreChecks::PreCallValidateExportMetalObjectsEXT(VkDevice device, VkExportM
415415
"cannot"
416416
"be VK_IMAGE_ASPECT_PLANE_2_BIT",
417417
FormatHandle(metal_texture_ptr->image).c_str(), string_VkImageAspectFlags(image_plane).c_str(),
418-
string_VkFormat(image_info->create_info.format));
418+
string_VkFormat(image_info->GetFormat()));
419419
}
420420
}
421421
}
@@ -623,7 +623,7 @@ bool CoreChecks::ValidateAllocateMemoryMetal(const VkMemoryAllocateInfo& allocat
623623

624624
// We can only validate images since we lack information to do the buffer call for the properties
625625
auto image_state_ptr = Get<vvl::Image>(dedicated_allocation_info->image);
626-
VkFormat image_format = image_state_ptr->create_info.format;
626+
VkFormat image_format = image_state_ptr->GetFormat();
627627
VkPhysicalDeviceExternalImageFormatInfo external_info = vku::InitStructHelper();
628628
external_info.handleType = VK_EXTERNAL_MEMORY_HANDLE_TYPE_MTLTEXTURE_BIT_EXT;
629629
VkPhysicalDeviceImageFormatInfo2 format_info = image_state_ptr->GetImageFormatInfo2(&external_info);

0 commit comments

Comments
 (0)