AGC: comparison sampling of a 1D T# creates a 1D depth image, which RADV does not support #7923

Closed
opened 2026-10-19 14:11:38 +00:00 by DavidAmsellem · 1 comment
DavidAmsellem commented 2026-10-19 14:11:38 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T14:11:38Z.


What

For comparison sampling, Texture turns an R16_UNORM or R32_SFLOAT T# into a D16_UNORM / D32_SFLOAT image (core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:308-310). It refuses 3D textures, but it does not check 1D ones. ImageTypeFor maps both k1D and k1DArray to VK_IMAGE_TYPE_1D. RADV does not support 1D images with a depth format, so a 1D or 1D-array T# sampled with image_sample_c* creates an image the device reports as unsupported.

lavapipe supports them, so CI never sees it. agc_driver_image_plane_compare_on_line (added in 0851c08b6) takes this path. Its log shows dim=0 … format=7 vk=124: a k1D T# created as VK_FORMAT_D16_UNORM by the vkCreateImage at Texture.cpp:330-343. The test passes on RADV anyway, so this is undefined behaviour that happens to work here. Not checked on AMD's Windows driver or NVIDIA.

Evidence

With VK_LAYER_KHRONOS_validation, the test logs only on RADV:

VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251: vkCreateImage(): format (VK_FORMAT_D16_UNORM) type (VK_IMAGE_TYPE_1D) tiling (VK_IMAGE_TILING_OPTIMAL)
usage (VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT) flags (0) returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2

To rule out the validation layer, I asked the drivers directly with a standalone program, outside AnyPS5. I used the same parameters as Texture.cpp: optimal tiling, TRANSFER_DST | SAMPLED, no flags. vkGetPhysicalDeviceImageFormatProperties and vkGetPhysicalDeviceImageFormatProperties2 give the same answer.

Format RADV NAVI31 1D RADV NAVI31 2D llvmpipe 1D llvmpipe 2D
D16_UNORM not supported supported supported supported
D32_SFLOAT not supported supported supported supported

Possible direction

Back a 1D or 1D-array compare texture with a 2D image of height 1 (and a 2D view) when the device rejects the 1D depth image, as the 3D case already refuses explicitly. Alternatively, refuse it the same way until that exists. I have not changed anything.

Environment

main 85029a00f (code unchanged at c4708fa20). AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8; llvmpipe (LLVM 20.1.2). Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Validation layer 1.3.275.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5925476586 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7923). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T14:11:38Z. --- ### What For comparison sampling, `Texture` turns an `R16_UNORM` or `R32_SFLOAT` T# into a `D16_UNORM` / `D32_SFLOAT` image (`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:308-310`). It refuses 3D textures, but it does not check 1D ones. `ImageTypeFor` maps both `k1D` and `k1DArray` to `VK_IMAGE_TYPE_1D`. RADV does not support 1D images with a depth format, so a 1D or 1D-array T# sampled with `image_sample_c*` creates an image the device reports as unsupported. lavapipe supports them, so CI never sees it. `agc_driver_image_plane_compare_on_line` (added in 0851c08b6) takes this path. Its log shows `dim=0 … format=7 vk=124`: a `k1D` T# created as `VK_FORMAT_D16_UNORM` by the `vkCreateImage` at `Texture.cpp:330-343`. The test passes on RADV anyway, so this is undefined behaviour that happens to work here. Not checked on AMD's Windows driver or NVIDIA. ### Evidence With `VK_LAYER_KHRONOS_validation`, the test logs only on RADV: ``` VUID-VkImageCreateInfo-imageCreateMaxMipLevels-02251: vkCreateImage(): format (VK_FORMAT_D16_UNORM) type (VK_IMAGE_TYPE_1D) tiling (VK_IMAGE_TILING_OPTIMAL) usage (VK_IMAGE_USAGE_TRANSFER_DST_BIT|VK_IMAGE_USAGE_SAMPLED_BIT) flags (0) returned (VK_ERROR_FORMAT_NOT_SUPPORTED) when calling vkGetPhysicalDeviceImageFormatProperties2 ``` To rule out the validation layer, I asked the drivers directly with a standalone program, outside AnyPS5. I used the same parameters as `Texture.cpp`: optimal tiling, `TRANSFER_DST | SAMPLED`, no flags. `vkGetPhysicalDeviceImageFormatProperties` and `vkGetPhysicalDeviceImageFormatProperties2` give the same answer. | Format | RADV NAVI31 1D | RADV NAVI31 2D | llvmpipe 1D | llvmpipe 2D | |---|---|---|---|---| | `D16_UNORM` | **not supported** | supported | supported | supported | | `D32_SFLOAT` | **not supported** | supported | supported | supported | ### Possible direction Back a 1D or 1D-array compare texture with a 2D image of height 1 (and a 2D view) when the device rejects the 1D depth image, as the 3D case already refuses explicitly. Alternatively, refuse it the same way until that exists. I have not changed anything. ### Environment `main` `85029a00f` (code unchanged at `c4708fa20`). AMD Radeon RX 7900 XT (RADV NAVI31, gfx1100), Mesa 25.2.8; llvmpipe (LLVM 20.1.2). Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, GCC 13.3, Release. Validation layer 1.3.275. AI-assisted: yes
oneandonlydean commented 2026-10-21 01:52:33 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T01:52:33Z.


Fixed by #7966 (1faa800f08): 1D and 1D-array depth comparison textures are now backed by 2D images of height 1, so RADV no longer gets a 1D depth image. The focused test passes on RADV with the validation layer and the VUID-02251 errors are gone. Closing.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6306048348 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7923#issuecomment-6306048348). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T01:52:33Z. --- Fixed by #7966 (1faa800f08): 1D and 1D-array depth comparison textures are now backed by 2D images of height 1, so RADV no longer gets a 1D depth image. The focused test passes on RADV with the validation layer and the VUID-02251 errors are gone. Closing.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#7923
No description provided.