diff options
author | riperiperi <rhy3756547@hotmail.com> | 2022-06-17 17:09:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-17 13:09:14 -0300 |
commit | 99ffc061d30c92f224c6b839290e181b6179893d (patch) | |
tree | f25bd915077d9ce1844c4efcb38e59c96ee5f70e /Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs | |
parent | d987cacfb720f2f4bc18958fc26ac0893903c090 (diff) |
Optimize Texture Binding and Shader Specialization Checks (#3399)1.1.149
* Changes 1
* Changes 2
* Better ModifiedSequence handling
This should handle PreciseEvents properly, and simplifies a few things.
* Minor changes, remove debug log
* Handle stage.Info being null
Hopefully fixes Catherine crash
* Fix shader specialization fast texture lookup
* Fix some things.
* Address Feedback Part 1
* Make method static.
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs index f648479b..c64c760a 100644 --- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs +++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs @@ -201,7 +201,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed // of the shader for the new state. if (_shaderSpecState != null) { - if (!_shaderSpecState.MatchesGraphics(_channel, GetPoolState(), GetGraphicsState())) + if (!_shaderSpecState.MatchesGraphics(_channel, GetPoolState(), GetGraphicsState(), false)) { ForceShaderUpdate(); } @@ -275,7 +275,12 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed { UpdateStorageBuffers(); - _channel.TextureManager.CommitGraphicsBindings(); + if (!_channel.TextureManager.CommitGraphicsBindings(_shaderSpecState)) + { + // Shader must be reloaded. + UpdateShaderState(); + } + _channel.BufferManager.CommitGraphicsBindings(); } @@ -1150,6 +1155,9 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed return; } + int maxTextureBinding = -1; + int maxImageBinding = -1; + Span<TextureBindingInfo> textureBindings = _channel.TextureManager.RentGraphicsTextureBindings(stage, info.Textures.Count); if (info.UsesRtLayer) @@ -1169,6 +1177,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed descriptor.CbufSlot, descriptor.HandleIndex, descriptor.Flags); + + if (descriptor.Binding > maxTextureBinding) + { + maxTextureBinding = descriptor.Binding; + } } TextureBindingInfo[] imageBindings = _channel.TextureManager.RentGraphicsImageBindings(stage, info.Images.Count); @@ -1187,8 +1200,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed descriptor.CbufSlot, descriptor.HandleIndex, descriptor.Flags); + + if (descriptor.Binding > maxImageBinding) + { + maxImageBinding = descriptor.Binding; + } } + _channel.TextureManager.SetGraphicsMaxBindings(maxTextureBinding, maxImageBinding); + _channel.BufferManager.SetGraphicsStorageBufferBindings(stage, info.SBuffers); _channel.BufferManager.SetGraphicsUniformBufferBindings(stage, info.CBuffers); } |