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

52 lines
1.5 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
{
private void UniformBufferBindVertex(int argument)
2019-10-13 06:02:07 +00:00
{
UniformBufferBind(argument, ShaderType.Vertex);
}
private void UniformBufferBindTessControl(int argument)
2019-10-13 06:02:07 +00:00
{
UniformBufferBind(argument, ShaderType.TessellationControl);
}
private void UniformBufferBindTessEvaluation(int argument)
2019-10-13 06:02:07 +00:00
{
UniformBufferBind(argument, ShaderType.TessellationEvaluation);
}
private void UniformBufferBindGeometry(int argument)
2019-10-13 06:02:07 +00:00
{
UniformBufferBind(argument, ShaderType.Geometry);
}
private void UniformBufferBindFragment(int argument)
2019-10-13 06:02:07 +00:00
{
UniformBufferBind(argument, ShaderType.Fragment);
}
private void UniformBufferBind(int argument, ShaderType type)
{
bool enable = (argument & 1) != 0;
int index = (argument >> 4) & 0x1f;
if (enable)
{
var uniformBuffer = _context.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);
}
}
}
}