mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-20 17:51:13 +02:00
Revert fix buffer destroy before submit changes (VertexBufferState.cs & VertexBufferUpdater.cs) from 'Fix Vulkan validation errors'
This commit is contained in:
@@ -67,7 +67,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
int stride = (_stride + (alignment - 1)) & -alignment;
|
int stride = (_stride + (alignment - 1)) & -alignment;
|
||||||
int newSize = (_size / _stride) * stride;
|
int newSize = (_size / _stride) * stride;
|
||||||
|
|
||||||
updater.BindVertexBuffer(cbs, binding, autoBuffer, 0, newSize, (ulong)stride);
|
var buffer = autoBuffer.Get(cbs, 0, newSize).Value;
|
||||||
|
|
||||||
|
updater.BindVertexBuffer(cbs, binding, buffer, 0, (ulong)newSize, (ulong)stride);
|
||||||
|
|
||||||
_buffer = autoBuffer;
|
_buffer = autoBuffer;
|
||||||
|
|
||||||
@@ -90,7 +92,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
if (autoBuffer != null)
|
if (autoBuffer != null)
|
||||||
{
|
{
|
||||||
updater.BindVertexBuffer(cbs, binding, autoBuffer, _offset, _size, (ulong)_stride);
|
int offset = _offset;
|
||||||
|
bool mirrorable = _size <= VertexBufferMaxMirrorable;
|
||||||
|
var buffer = mirrorable ? autoBuffer.GetMirrorable(cbs, ref offset, _size, out _).Value : autoBuffer.Get(cbs, offset, _size).Value;
|
||||||
|
|
||||||
|
updater.BindVertexBuffer(cbs, binding, buffer, (ulong)offset, (ulong)_size, (ulong)_stride);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
private readonly NativeArray<ulong> _sizes;
|
private readonly NativeArray<ulong> _sizes;
|
||||||
private readonly NativeArray<ulong> _strides;
|
private readonly NativeArray<ulong> _strides;
|
||||||
|
|
||||||
private readonly Auto<DisposableBuffer>[] _bufferAutos;
|
|
||||||
private readonly int[] _bufferOffsetsForGet;
|
|
||||||
private readonly int[] _bufferSizesForGet;
|
|
||||||
|
|
||||||
public VertexBufferUpdater(VulkanRenderer gd)
|
public VertexBufferUpdater(VulkanRenderer gd)
|
||||||
{
|
{
|
||||||
_gd = gd;
|
_gd = gd;
|
||||||
@@ -27,13 +23,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
_offsets = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
_offsets = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
||||||
_sizes = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
_sizes = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
||||||
_strides = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
_strides = new NativeArray<ulong>(Constants.MaxVertexBuffers);
|
||||||
|
|
||||||
_bufferAutos = new Auto<DisposableBuffer>[Constants.MaxVertexBuffers];
|
|
||||||
_bufferOffsetsForGet = new int[Constants.MaxVertexBuffers];
|
|
||||||
_bufferSizesForGet = new int[Constants.MaxVertexBuffers];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindVertexBuffer(CommandBufferScoped cbs, uint binding, Auto<DisposableBuffer> autoBuffer, int offset, int size, ulong stride)
|
public void BindVertexBuffer(CommandBufferScoped cbs, uint binding, VkBuffer buffer, ulong offset, ulong size, ulong stride)
|
||||||
{
|
{
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
{
|
{
|
||||||
@@ -47,11 +39,9 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
|
|
||||||
int index = (int)_count;
|
int index = (int)_count;
|
||||||
|
|
||||||
_bufferAutos[index] = autoBuffer;
|
_buffers[index] = buffer;
|
||||||
_bufferOffsetsForGet[index] = offset;
|
_offsets[index] = offset;
|
||||||
_bufferSizesForGet[index] = size;
|
_sizes[index] = size;
|
||||||
_offsets[index] = (ulong)offset;
|
|
||||||
_sizes[index] = (ulong)size;
|
|
||||||
_strides[index] = stride;
|
_strides[index] = stride;
|
||||||
|
|
||||||
_count++;
|
_count++;
|
||||||
@@ -61,12 +51,6 @@ namespace Ryujinx.Graphics.Vulkan
|
|||||||
{
|
{
|
||||||
if (_count != 0)
|
if (_count != 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _count; i++)
|
|
||||||
{
|
|
||||||
_buffers[i] = _bufferAutos[i].Get(cbs, _bufferOffsetsForGet[i], _bufferSizesForGet[i]).Value;
|
|
||||||
_bufferAutos[i] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_gd.Capabilities.SupportsExtendedDynamicState)
|
if (_gd.Capabilities.SupportsExtendedDynamicState)
|
||||||
{
|
{
|
||||||
_gd.ExtendedDynamicStateApi.CmdBindVertexBuffers2(
|
_gd.ExtendedDynamicStateApi.CmdBindVertexBuffers2(
|
||||||
|
|||||||
Reference in New Issue
Block a user