From 0dbe45ae37a7aea1bf86787a638ddb68df97a50c Mon Sep 17 00:00:00 2001 From: riperiperi Date: Sun, 16 Oct 2022 23:38:58 +0100 Subject: Fix various issues caused by Vertex/Index buffer conversions (#3762) * Fix various issues caused by #3679 - The arguments for the 0th dummy vertex buffer were incorrect - it was given an offset of 16 rather than a size of 16. - The wrong size was used when doing `autoBuffer.Get` on a converted vertex buffer. - The possibility of a vertex buffer being disposed and then rebound can rebindings to find a different buffer where the current range is out of bounds. Avoid binding when out of range to prevent validation errors. - The above also affects generation of converted buffers, which was a bit more fatal. Conversion functions now attempt to bound input offset/size. * Fix offset for converted buffer --- Ryujinx.Graphics.Vulkan/PipelineBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Ryujinx.Graphics.Vulkan/PipelineBase.cs') diff --git a/Ryujinx.Graphics.Vulkan/PipelineBase.cs b/Ryujinx.Graphics.Vulkan/PipelineBase.cs index 0eb61123..23abde41 100644 --- a/Ryujinx.Graphics.Vulkan/PipelineBase.cs +++ b/Ryujinx.Graphics.Vulkan/PipelineBase.cs @@ -95,7 +95,7 @@ namespace Ryujinx.Graphics.Vulkan using var emptyVb = gd.BufferManager.Create(gd, EmptyVbSize); emptyVb.SetData(0, new byte[EmptyVbSize]); - _vertexBuffers[0] = new VertexBufferState(emptyVb.GetBuffer(), 0, EmptyVbSize, 0); + _vertexBuffers[0] = new VertexBufferState(emptyVb.GetBuffer(), 0, 0, EmptyVbSize, 0); _vertexBuffersDirty = ulong.MaxValue >> (64 - _vertexBuffers.Length); ClearScissor = new Rectangle(0, 0, 0xffff, 0xffff); @@ -1243,7 +1243,7 @@ namespace Ryujinx.Graphics.Vulkan _vertexBuffers[i].BindVertexBuffer(Gd, Cbs, (uint)i, ref _newState); - _vertexBuffersDirty &= ~(1u << i); + _vertexBuffersDirty &= ~(1UL << i); } } -- cgit v1.2.3