diff options
author | Mary <mary@mary.zone> | 2023-02-13 21:32:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-13 20:32:20 +0000 |
commit | 052b23c83c3a58afdd63c3d5a7655be482f1c739 (patch) | |
tree | dd9a02c1936596099dcef3fe5952364f8047be76 /Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs | |
parent | e4f68592c3a6e51414e5f78eef096f21bf735eb1 (diff) |
vulkan: Do not call vkCmdSetViewport when viewportCount is 0 (#4406)1.1.618
This fix validation error "VUID-vkCmdSetViewport-viewportCount-arraylength".
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs index b4d6e95c..42ea022a 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineDynamicState.cs @@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Vulkan private Array4<float> _blendConstants; - public int ViewportsCount; + public uint ViewportsCount; public Array16<Viewport> Viewports; private enum DirtyFlags @@ -88,9 +88,15 @@ namespace Ryujinx.Graphics.Vulkan _dirty |= DirtyFlags.Viewport; } - public void SetViewportsDirty() + public void SetViewports(ref Array16<Viewport> viewports, uint viewportsCount) { - _dirty |= DirtyFlags.Viewport; + Viewports = viewports; + ViewportsCount = viewportsCount; + + if (ViewportsCount != 0) + { + _dirty |= DirtyFlags.Viewport; + } } public void ForceAllDirty() @@ -155,7 +161,10 @@ namespace Ryujinx.Graphics.Vulkan private void RecordViewport(Vk api, CommandBuffer commandBuffer) { - api.CmdSetViewport(commandBuffer, 0, (uint)ViewportsCount, Viewports.AsSpan()); + if (ViewportsCount != 0) + { + api.CmdSetViewport(commandBuffer, 0, ViewportsCount, Viewports.AsSpan()); + } } } } |