Ryujinx/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferBind.cs

52 lines
1.6 KiB
C#
Raw Normal View History

2019-10-12 23:02:07 -07:00
using Ryujinx.Graphics.Gpu.State;
namespace Ryujinx.Graphics.Gpu.Engine
{
partial class Methods
{
2019-11-21 18:46:14 -08:00
private void UniformBufferBindVertex(GpuState state, int argument)
2019-10-12 23:02:07 -07:00
{
2019-11-21 18:46:14 -08:00
UniformBufferBind(state, argument, ShaderType.Vertex);
2019-10-12 23:02:07 -07:00
}
2019-11-21 18:46:14 -08:00
private void UniformBufferBindTessControl(GpuState state, int argument)
2019-10-12 23:02:07 -07:00
{
2019-11-21 18:46:14 -08:00
UniformBufferBind(state, argument, ShaderType.TessellationControl);
2019-10-12 23:02:07 -07:00
}
2019-11-21 18:46:14 -08:00
private void UniformBufferBindTessEvaluation(GpuState state, int argument)
2019-10-12 23:02:07 -07:00
{
2019-11-21 18:46:14 -08:00
UniformBufferBind(state, argument, ShaderType.TessellationEvaluation);
2019-10-12 23:02:07 -07:00
}
2019-11-21 18:46:14 -08:00
private void UniformBufferBindGeometry(GpuState state, int argument)
2019-10-12 23:02:07 -07:00
{
2019-11-21 18:46:14 -08:00
UniformBufferBind(state, argument, ShaderType.Geometry);
2019-10-12 23:02:07 -07:00
}
2019-11-21 18:46:14 -08:00
private void UniformBufferBindFragment(GpuState state, int argument)
2019-10-12 23:02:07 -07:00
{
2019-11-21 18:46:14 -08:00
UniformBufferBind(state, argument, ShaderType.Fragment);
2019-10-12 23:02:07 -07:00
}
2019-11-21 18:46:14 -08:00
private void UniformBufferBind(GpuState state, int argument, ShaderType type)
2019-10-12 23:02:07 -07:00
{
bool enable = (argument & 1) != 0;
int index = (argument >> 4) & 0x1f;
if (enable)
{
2019-11-21 18:46:14 -08:00
var uniformBuffer = state.Get<UniformBufferState>(MethodOffset.UniformBufferState);
2019-10-12 23:02:07 -07:00
ulong address = uniformBuffer.Address.Pack();
2019-12-29 09:41:50 -08:00
BufferManager.SetGraphicsUniformBuffer((int)type, index, address, (uint)uniformBuffer.Size);
2019-10-12 23:02:07 -07:00
}
else
{
2019-12-29 09:41:50 -08:00
BufferManager.SetGraphicsUniformBuffer((int)type, index, 0, 0);
2019-10-12 23:02:07 -07:00
}
}
}
}