0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 18:35:47 +00:00
Ryujinx/Ryujinx.Graphics.Gpu/Engine/MethodUniformBufferBind.cs

52 lines
1.6 KiB
C#
Raw Normal View History

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