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