feat(libSceAgcDriver): sample guest 8_24_UNORM images as D24_UNORM_S8_UINT #16294
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16294"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-11-06T06:09:03Z.
What
Maps guest image format 141 (
8_24_UNORMin the AMD GFX10IMG_FMTtable,palFormat.hX8Y24LSB-first =S8in the top byte overD24) toVK_FORMAT_D24_UNORM_S8_UINTwhere the device supports it, whose depth-aspect buffer element (X8_D24_UNORM_PACK32) is byte-identical to the guest texel.kFormatLookupgains the row;kFormatInfoTablesamples it as Float;GetFormatInfodescribes the single 24-bit channel (bitfield, element 4 bytes);IrBufferFormat::Format8_24UNorm = 141is new.SampledTextureFormatqueriesoptimalTilingFeaturesforSAMPLED_IMAGE | TRANSFER_DSTper physical device (cached,DepthSurface-style): AMD Vulkan drivers report no features forD24_UNORM_S8_UINT(RX 6700 XT, driver 26.10.1), so there format 141 samples throughVK_FORMAT_R32_SFLOATinstead, and the detiler's repack pass gains adepthToFloatmode that converts each guest word's low 24 bits tofloat(d24) / 16777215in place before the buffer-to-image copy (fma(d * 2^-24, 2^-24, d * 2^-24)for a correctly-rounded, bit-exact round-trip).APS5_NO_D24S8forces the fallback.Texturenow distinguishes copy/view aspect from barrier aspect for a native depth/stencil format: image barriers on the combined D24S8 image coverDEPTH|STENCIL(required withoutseparateDepthStencilLayouts), while thevkCmdCopyBufferToImageregion and the sampled view keepDEPTHalone so the packed stencil byte is dropped rather than written.depthComparealso accepts a native depth/stencil format (D24S8/D32S8) instead of only the R32/R16 numeric depth-plane formats, so a compare sampler on format 141 works without the R-to-D conversion; on the R32F fallback it takes the existing R32→D32 path.8_24_UINT/X24_8_32_UINThave no Vulkan depthUINT, the24_8pair packs stencil first with no host equivalent, andX24_8_32_FLOATkeeps eight-byte elements that need a new repack pass. Recorded in the libSceAgcDriver debt file.Tested
Windows 11, MinGW GCC 15.2, NVIDIA RTX 3070 (driver 617.42),
VK_LAYER_KHRONOS_validationloaded (SDK 1.4.363,VK_LAYER_PATH),ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1:agc_driver_image_depth24(native D24S8) andagc_driver_image_depth24_float(APS5_NO_D24S8=1, the R32F repack):image_loadfetches every8_24texel's 24-bit depth round-trip-exact andimage_sample_lzsamples it; both return G=0 B=0 A=1.texture_format_lookup,agc_driver_image_converted_unorm,agc_driver_image_packed16_*(133/134/136),agc_driver_image_one_dimensional_compare(the depthCompare path), allagc_driver_depth_*,agc_driver_native_depth_*, gathers) passes; noVUID-and no missing-layer line in the logs. The first iteration of this change producedVUID-VkImageMemoryBarrier-image-03320on the upload barrier, which the barrier-aspect split fixes.agc_driver_image_depth24atvkCreateImage(VK_ERROR_FORMAT_NOT_SUPPORTED, zero format features for D24S8) — the datapoint the fallback answers; a re-run of the current head should take the R32F path.No console measurement: channel semantics and the missing-channel default of the sampled result are per Vulkan/GFX10 documentation only (debt entry).
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)