diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-11-16 14:53:04 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-16 14:53:04 -0300 |
commit | f1d1670b0b1b5c08064df95dabd295f3cf5dcf7f (patch) | |
tree | 082139cb80ee9776f3ea9083991fb3ed6618f7f4 /Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs | |
parent | b8de72de8f25f0bb7f994bc07a0387c1c247b6fe (diff) |
Implement HLE macro for DrawElementsIndirect (#3748)1.1.345
* Implement HLE macro for DrawElementsIndirect
* Shader cache version bump
* Use GL_ARB_shader_draw_parameters extension on OpenGL
* Fix DrawIndexedIndirectCount on Vulkan when extension is not supported
* Implement DrawIndex
* Alignment
* Fix some validation errors
* Rename BaseIds to DrawParameters
* Fix incorrect index buffer and vertex buffer size in some cases
* Add HLE macros for DrawArraysInstanced and DrawElementsInstanced
* Perform a regular draw when indirect data is not modified
* Use non-indirect draw methods if indirect buffer was not GPU modified
* Only check if draw parameters match if the shader actually uses them
* Expose Macro HLE setting on GUI
* Reset FirstVertex and FirstInstance after draw
* Update shader cache version again since some people already tested this
* PR feedback
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs b/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs index c5d98848..ab6f54ef 100644 --- a/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs +++ b/Ryujinx.Graphics.Gpu/Engine/MME/MacroHLETable.cs @@ -44,17 +44,29 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME } } - private static readonly TableEntry[] Table = new TableEntry[] + private static readonly TableEntry[] _table = new TableEntry[] { new TableEntry(MacroHLEFunctionName.ClearColor, new Hash128(0xA9FB28D1DC43645A, 0xB177E5D2EAE67FB0), 0x28), new TableEntry(MacroHLEFunctionName.ClearDepthStencil, new Hash128(0x1B96CB77D4879F4F, 0x8557032FE0C965FB), 0x24), + new TableEntry(MacroHLEFunctionName.DrawArraysInstanced, new Hash128(0x197FB416269DBC26, 0x34288C01DDA82202), 0x48), + new TableEntry(MacroHLEFunctionName.DrawElementsInstanced, new Hash128(0x1A501FD3D54EC8E0, 0x6CF570CF79DA74D6), 0x5c), + new TableEntry(MacroHLEFunctionName.DrawElementsIndirect, new Hash128(0x86A3E8E903AF8F45, 0xD35BBA07C23860A4), 0x7c), new TableEntry(MacroHLEFunctionName.MultiDrawElementsIndirectCount, new Hash128(0x890AF57ED3FB1C37, 0x35D0C95C61F5386F), 0x19C) }; + /// <summary> + /// Checks if the host supports all features required by the HLE macro. + /// </summary> + /// <param name="caps">Host capabilities</param> + /// <param name="name">Name of the HLE macro to be checked</param> + /// <returns>True if the host supports the HLE macro, false otherwise</returns> private static bool IsMacroHLESupported(Capabilities caps, MacroHLEFunctionName name) { if (name == MacroHLEFunctionName.ClearColor || - name == MacroHLEFunctionName.ClearDepthStencil) + name == MacroHLEFunctionName.ClearDepthStencil || + name == MacroHLEFunctionName.DrawArraysInstanced || + name == MacroHLEFunctionName.DrawElementsInstanced || + name == MacroHLEFunctionName.DrawElementsIndirect) { return true; } @@ -77,15 +89,20 @@ namespace Ryujinx.Graphics.Gpu.Engine.MME { var mc = MemoryMarshal.Cast<int, byte>(code); - for (int i = 0; i < Table.Length; i++) + for (int i = 0; i < _table.Length; i++) { - ref var entry = ref Table[i]; + ref var entry = ref _table[i]; var hash = XXHash128.ComputeHash(mc.Slice(0, entry.Length)); if (hash == entry.Hash) { - name = entry.Name; - return IsMacroHLESupported(caps, name); + if (IsMacroHLESupported(caps, entry.Name)) + { + name = entry.Name; + return true; + } + + break; } } |