Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layers: Fix warning for Storage Image #9536

Conversation

spencer-lunarg
Copy link
Contributor

Fixes issue with warning, the user might use Rgba8 in their shader which maps to VK_FORMAT_R8G8B8A8_UNORM but the user can still use VK_FORMAT_B8G8R8A8_UNORM (basically was doing exact format check instead of using vkuFormatCompatibilityClass

@spencer-lunarg spencer-lunarg requested a review from a team as a code owner February 26, 2025 04:21
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 381106.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19202 running.

@spencer-lunarg spencer-lunarg force-pushed the spencer-lunarg-storage-image-warning-hotfix branch from 3b856ee to 62d7a26 Compare February 26, 2025 04:27
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 381138.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19204 running.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19204 failed.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 381385.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19205 running.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19205 failed.

@spencer-lunarg spencer-lunarg force-pushed the spencer-lunarg-storage-image-warning-hotfix branch from 62d7a26 to 11c5a1f Compare February 26, 2025 14:34
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 381478.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19206 running.

<< string_VkFormat(resource_variable.info.image_format) << " which doesn't match the "
<< dev_state.FormatHandle(image_view) << " format (" << string_VkFormat(image_view_ci.format)
<< "). Any loads or stores with the variable will produce undefined values.";
if (vkuFormatCompatibilityClass(image_view_ci.format) ==
Copy link
Contributor Author

@spencer-lunarg spencer-lunarg Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 100% going to trip people up as a "wait I was not allowed to do this?" so the new message tries to help explain more "what to do" here

vkCmdDispatch(): the storage image descriptor [VkDescriptorSet 0xee647e0000000009, Set 0, Binding 0, Index 0, variable "si0"] is accessed by a OpTypeImage that has a Format operand Rgba8 (equivalent to VK_FORMAT_R8G8B8A8_UNORM) which doesn't match the VkImageView 0xf443490000000006 format (VK_FORMAT_B8G8R8A8_UNORM). Any loads or stores with the variable will produce undefined values. While the formats are compatible, Storage Images must exactly match. Two ways to resolve this are

  1. Set your ImageView to VK_FORMAT_R8G8B8A8_UNORM and swizzle the values in the shader to match the desired results.

  2. Use the Unknown format in your shader (will need the widely supported shaderStorageImageWriteWithoutFormat feature)

Spec information at https://docs.vulkan.org/spec/latest/chapters/textures.html#textures-format-validation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice error message

@spencer-lunarg spencer-lunarg force-pushed the spencer-lunarg-storage-image-warning-hotfix branch from 11c5a1f to f63587b Compare February 26, 2025 14:44
@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build queued with queue ID 381533.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19208 running.

@ci-tester-lunarg
Copy link
Collaborator

CI Vulkan-ValidationLayers build # 19208 passed.

@spencer-lunarg spencer-lunarg merged commit aa3c21c into KhronosGroup:main Feb 28, 2025
21 checks passed
@spencer-lunarg spencer-lunarg deleted the spencer-lunarg-storage-image-warning-hotfix branch February 28, 2025 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants