mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 13:59:56 -04:00
The translator declares every float storage image without a format and turns a load of it into OpImageRead, which SPIR-V allows only in a module that declares StorageImageReadWithoutFormat; only the write-side capability was declared. Of the 44,206 shader variants a 0.7.1 install stores, 117 compute shaders were invalid SPIR-V for that reason (the contributor's sweep with spirv-val, for NVIDIA's, AMD's and Intel's host options: 117 before, 0 after). The drivers tried accept them, so nothing crashed, but an invalid module is whatever a driver makes of it. The read now declares the capability, once a module. The translator's identity changes, so an updated install translates its shaders again (the carry pass serves the old translations meanwhile). Built here from the local package cache; tools/xlate_smoke.py's new compute case fails with the translator before the patch and passes with it, and both modules validate. Not played with the new translator. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> (cherry picked from commit 62e5c345a2ec3e2cc70be49214997ff76e691309)
37 lines
1.7 KiB
Diff
37 lines
1.7 KiB
Diff
--- a/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs
|
|
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Spirv/Declarations.cs
|
|
@@ -225,6 +225,8 @@
|
|
|
|
private static void DeclareImages(CodeGenContext context, IEnumerable<TextureDefinition> images)
|
|
{
|
|
+ bool writeWithoutFormat = false;
|
|
+
|
|
foreach (TextureDefinition image in images)
|
|
{
|
|
int setIndex = context.TargetApi == TargetApi.Vulkan ? image.Set : 0;
|
|
@@ -240,6 +242,12 @@
|
|
AccessQualifier.ReadWrite,
|
|
GetImageFormat(image.Format));
|
|
|
|
+ // NX2NAVI (2026-10-20): an image declared without a format (QueryHostSupportsImageLoadFormatted) that the
|
|
+ // shader stores to needs StorageImageWriteWithoutFormat; upstream never declares it, so spirv-val rejects
|
|
+ // 22 agl_technique_pfx compute shaders with formatted SUST. Vulkan's shaderStorageImageWriteWithoutFormat
|
|
+ // feature backs it. A read of such an image needs StorageImageReadWithoutFormat, which GenerateImageLoad declares.
|
|
+ writeWithoutFormat |= image.Format == TextureFormat.Unknown && image.Flags.HasFlag(TextureUsageFlags.ImageStore);
|
|
+
|
|
SpvInstruction imagePointerType = context.TypePointer(StorageClass.UniformConstant, imageType);
|
|
SpvInstruction imageArrayPointerType = imagePointerType;
|
|
|
|
@@ -269,6 +277,11 @@
|
|
|
|
context.AddGlobalVariable(imageVariable);
|
|
}
|
|
+
|
|
+ if (writeWithoutFormat)
|
|
+ {
|
|
+ context.AddCapability(Capability.StorageImageWriteWithoutFormat);
|
|
+ }
|
|
}
|
|
|
|
private static Dim GetDim(SamplerType type)
|