Ryujinx/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferUpdate.cs

41 lines
1.5 KiB
C#
Raw Normal View History

2019-10-13 08:02:07 +02:00
using Ryujinx.Graphics.Gpu.State;
using System;
using System.Runtime.InteropServices;
2019-10-13 08:02:07 +02:00
namespace Ryujinx.Graphics.Gpu.Engine
{
partial class Methods
{
/// <summary>
/// Updates the uniform buffer data with inline data.
/// </summary>
/// <param name="state">Current GPU state</param>
/// <param name="argument">New uniform buffer data word</param>
2019-11-22 03:46:14 +01:00
private void UniformBufferUpdate(GpuState state, int argument)
2019-10-13 08:02:07 +02:00
{
2019-11-22 03:46:14 +01:00
var uniformBuffer = state.Get<UniformBufferState>(MethodOffset.UniformBufferState);
2019-10-13 08:02:07 +02:00
_context.MemoryManager.Write(uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset, argument);
2019-10-13 08:02:07 +02:00
2019-11-22 03:46:14 +01:00
state.SetUniformBufferOffset(uniformBuffer.Offset + 4);
2019-10-13 08:02:07 +02:00
_context.AdvanceSequence();
}
/// <summary>
/// Updates the uniform buffer data with inline data.
/// </summary>
/// <param name="state">Current GPU state</param>
/// <param name="data">Data to be written to the uniform buffer</param>
public void UniformBufferUpdate(GpuState state, ReadOnlySpan<int> data)
{
var uniformBuffer = state.Get<UniformBufferState>(MethodOffset.UniformBufferState);
_context.MemoryManager.Write(uniformBuffer.Address.Pack() + (uint)uniformBuffer.Offset, MemoryMarshal.Cast<int, byte>(data));
state.SetUniformBufferOffset(uniformBuffer.Offset + data.Length * 4);
_context.AdvanceSequence();
}
2019-10-13 08:02:07 +02:00
}
}