mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-11 18:06:38 +00:00
a10b2c5ff2
* Ground work for separate GPU channels * Rename TextureManager to TextureCache * Decouple texture bindings management from the texture cache * Rename BufferManager to BufferCache * Decouple buffer bindings management from the buffer cache * More comments and proper disposal * PR feedback * Force host state update on channel switch * Typo * PR feedback * Missing using
85 lines
No EOL
3.1 KiB
C#
85 lines
No EOL
3.1 KiB
C#
using Ryujinx.Graphics.Gpu.State;
|
|
|
|
namespace Ryujinx.Graphics.Gpu.Engine
|
|
{
|
|
partial class Methods
|
|
{
|
|
/// <summary>
|
|
/// Binds a uniform buffer for the vertex shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
private void UniformBufferBindVertex(GpuState state, int argument)
|
|
{
|
|
UniformBufferBind(state, argument, ShaderType.Vertex);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Binds a uniform buffer for the tessellation control shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
private void UniformBufferBindTessControl(GpuState state, int argument)
|
|
{
|
|
UniformBufferBind(state, argument, ShaderType.TessellationControl);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Binds a uniform buffer for the tessellation evaluation shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
private void UniformBufferBindTessEvaluation(GpuState state, int argument)
|
|
{
|
|
UniformBufferBind(state, argument, ShaderType.TessellationEvaluation);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Binds a uniform buffer for the geometry shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
private void UniformBufferBindGeometry(GpuState state, int argument)
|
|
{
|
|
UniformBufferBind(state, argument, ShaderType.Geometry);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Binds a uniform buffer for the fragment shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
private void UniformBufferBindFragment(GpuState state, int argument)
|
|
{
|
|
UniformBufferBind(state, argument, ShaderType.Fragment);
|
|
}
|
|
|
|
/// <summary>
|
|
///Binds a uniform buffer for the specified shader stage.
|
|
/// </summary>
|
|
/// <param name="state">Current GPU state</param>
|
|
/// <param name="argument">Method call argument</param>
|
|
/// <param name="type">Shader stage that will access the uniform buffer</param>
|
|
private void UniformBufferBind(GpuState state, int argument, ShaderType type)
|
|
{
|
|
bool enable = (argument & 1) != 0;
|
|
|
|
int index = (argument >> 4) & 0x1f;
|
|
|
|
FlushUboDirty();
|
|
|
|
if (enable)
|
|
{
|
|
var uniformBuffer = state.Get<UniformBufferState>(MethodOffset.UniformBufferState);
|
|
|
|
ulong address = uniformBuffer.Address.Pack();
|
|
|
|
state.Channel.BufferManager.SetGraphicsUniformBuffer((int)type, index, address, (uint)uniformBuffer.Size);
|
|
}
|
|
else
|
|
{
|
|
state.Channel.BufferManager.SetGraphicsUniformBuffer((int)type, index, 0, 0);
|
|
}
|
|
}
|
|
}
|
|
} |