1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-10-01 12:30:00 +02:00
Ryujinx/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferBind.cs

52 lines
1.6 KiB
C#
Raw Normal View History

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