diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index b08e7f26..1f919d9b 100644 --- a/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -932,6 +932,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed /// </summary> private void UpdateVertexAttribState() { + bool supportsScaledFormats = _context.Capabilities.SupportsScaledVertexFormats; uint vbEnableMask = _vbEnableMask; Span<VertexAttribDescriptor> vertexAttribs = stackalloc VertexAttribDescriptor[Constants.TotalVertexAttribs]; @@ -949,7 +950,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed continue; } - if (!FormatTable.TryGetAttribFormat(vertexAttrib.UnpackFormat(), out Format format)) + uint packedFormat = vertexAttrib.UnpackFormat(); + + if (!supportsScaledFormats) + { + packedFormat = vertexAttrib.UnpackType() switch + { + VertexAttribType.Uscaled => ((uint)VertexAttribType.Uint << 27) | (packedFormat & (0x3f << 21)), + VertexAttribType.Sscaled => ((uint)VertexAttribType.Sint << 27) | (packedFormat & (0x3f << 21)), + _ => packedFormat, + }; + } + + if (!FormatTable.TryGetAttribFormat(packedFormat, out Format format)) { Logger.Debug?.Print(LogClass.Gpu, $"Invalid attribute format 0x{vertexAttrib.UnpackFormat():X}."); |